chiark / gitweb /
Properly handle the unfilled window positions.
authordaid303 <daid303@gmail.com>
Mon, 21 Jan 2013 11:53:43 +0000 (12:53 +0100)
committerdaid303 <daid303@gmail.com>
Mon, 21 Jan 2013 11:53:43 +0000 (12:53 +0100)
Cura/gui/mainWindow.py
Cura/util/profile.py

index 68aea1b427f98f4c0a75a9bc1a3a7d7e71163f2e..f83e47c6bb690a2a2e6d3b7d9af52a1b3812583a 100644 (file)
@@ -219,19 +219,18 @@ class mainWindow(wx.Frame):
                self.Centre()
 
                # Restore the window position, size & state from the preferences file
-               try:
-                       if profile.getPreference('window_maximized') == 'True':
-                               self.Maximize(True)
-                       else:
-                               posx = int(profile.getPreference('window_pos_x'))
-                               posy = int(profile.getPreference('window_pos_y'))
-                               width = int(profile.getPreference('window_width'))
-                               height = int(profile.getPreference('window_height'))
+               if profile.getPreference('window_maximized') == 'True':
+                       self.Maximize(True)
+               else:
+                       posx = int(profile.getPreference('window_pos_x'))
+                       posy = int(profile.getPreference('window_pos_y'))
+                       width = int(profile.getPreference('window_width'))
+                       height = int(profile.getPreference('window_height'))
+                       if posx > 0 or posy > 0:
                                self.SetPosition((posx,posy))
+                       if width > 0 and height > 0:
                                self.SetSize((width,height))
-               except:
-                       pass
-                       
+
                self.Show(True)
 
        def updateSliceMode(self):
index 662ff317353eb7db12f9fa6aca883e0ffc747755..bfd0c0d689f17607af721eda7f7c816a7ae4554c 100644 (file)
@@ -181,6 +181,12 @@ preferencesDefaultSettings = {
        'model_colour2': '#CB3030',
        'model_colour3': '#DDD93C',
        'model_colour4': '#4550D3',
+
+       'window_maximized': 'False',
+       'window_pos_x': '-1',
+       'window_pos_y': '-1',
+       'window_width': '-1',
+       'window_height': '-1',
 }
 
 #########################################################