The positioning of the main window of the tryton client does not work correctly 
on startup on windows. With this patch the client is maximized on startup if it
was maximized by the user on last usage. I have tested this under linux and 
windows.
But i could not test it on mac os x.

Please review this at http://codereview.appspot.com/4154044/
Issue: https://bugs.tryton.org/roundup/issue1867

Affected files:
   M tryton/config.py
   M tryton/gui/main.py


Index: tryton/config.py
===================================================================
--- a/tryton/config.py
+++ b/tryton/config.py
@@ -64,6 +64,7 @@
              'client.modepda': False,
              'client.toolbar': 'default',
              'client.form_tab': 'left',
+            'client.maximize': False,
              'client.save_width_height': True,
              'client.spellcheck': False,
              'client.default_path': get_home_dir(),
Index: tryton/gui/main.py
===================================================================
--- a/tryton/gui/main.py
+++ b/tryton/gui/main.py
@@ -52,6 +52,8 @@
          self.window = gtk.Window()
          self._width = int(CONFIG['client.default_width'])
          self._height = int(CONFIG['client.default_height'])
+        if CONFIG['client.maximize']:
+            self.window.maximize()
          self.window.set_default_size(self._width, self._height)
          self.window.set_resizable(True)
          self.window.set_title('Tryton')
@@ -59,6 +61,7 @@
          self.window.connect("destroy", Main.sig_quit)
          self.window.connect("delete_event", self.sig_delete)
          self.window.connect('configure_event', self.sig_configure)
+        self.window.connect('window_state_event', self.sig_window_state)

          self.accel_group = gtk.AccelGroup()
          self.window.add_accel_group(self.accel_group)
@@ -1331,6 +1334,11 @@
              self._width =  int(event.width)
              self._height = int(event.height)
          return False
+
+    def sig_window_state(self, widget, event):
+        CONFIG['client.maximize'] = bool(event.new_window_state ==
+                gtk.gdk.WINDOW_STATE_MAXIMIZED)
+        return False

      def win_add(self, page):
          previous_page_id = self.notebook.get_current_page()



-- 
Korbinian Preisler
____________________________________
virtual things
Preisler & Spallek GbR
Munich - Aix-la-Chapelle

Windeckstr. 77
81375 Munich - Germany
Tel: +49 (89) 710 481 55
Fax: +49 (89) 710 481 56

[email protected]
http://www.virtual-things.biz

-- 
[email protected] mailing list

Reply via email to