Przeglądaj źródła

wxGUI: set default position of windows (when .grasswx6 file is not available)
(merge https://trac.osgeo.org/grass/changeset/44180 from devbr6)


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@44182 15284696-431f-4ddb-bdfa-cd5b030d7da7

Martin Landa 14 lat temu
rodzic
commit
04bbf4373c

+ 2 - 1
gui/wxpython/gui_modules/globalvar.py

@@ -114,8 +114,9 @@ DIALOG_TEXTCTRL_SIZE = (400, -1)
 DIALOG_LAYER_SIZE = (100, -1)
 DIALOG_COLOR_SIZE = (30, 30)
 
-MAP_WINDOW_SIZE = (770, 570)
+MAP_WINDOW_SIZE = (700, 500)
 HIST_WINDOW_SIZE = (500, 350)
+GM_WINDOW_SIZE = (575, 500)
 
 MAP_DISPLAY_STATUSBAR_MODE = [_("Coordinates"),
                               _("Extent"),

+ 7 - 2
gui/wxpython/gui_modules/preferences.py

@@ -72,8 +72,13 @@ class Settings:
             'general': {
                 # use default window layout (layer manager, displays, ...)
                 'defWindowPos' : {
-                    'enabled' : False,
-                    'dim' : ''
+                    'enabled' : True,
+                    'dim' : '%d,0,%d,%d,0,0,%d,%d' % \
+                        (globalvar.MAP_WINDOW_SIZE[0],
+                         globalvar.GM_WINDOW_SIZE[0],
+                         globalvar.GM_WINDOW_SIZE[1],
+                         globalvar.MAP_WINDOW_SIZE[0],
+                         globalvar.MAP_WINDOW_SIZE[1])
                     },
                 # expand/collapse element list
                 'elementListExpand' : {

+ 13 - 1
gui/wxpython/wxgui.py

@@ -97,7 +97,7 @@ class GMFrame(wx.Frame):
     """
     def __init__(self, parent, id = wx.ID_ANY, title = _("GRASS GIS Layer Manager"),
                  workspace = None,
-                 size = (600, 450), style = wx.DEFAULT_FRAME_STYLE, **kwargs):
+                 size = globalvar.GM_WINDOW_SIZE, style = wx.DEFAULT_FRAME_STYLE, **kwargs):
         self.parent    = parent
         self.baseTitle = title
         self.iconsize  = (16, 16)
@@ -1488,6 +1488,18 @@ class GMApp(wx.App):
                          milliseconds=2000, parent=None, id=wx.ID_ANY)
         wx.Yield()
         
+        w, h = wx.GetDisplaySize()
+        if globalvar.MAP_WINDOW_SIZE[0] + globalvar.GM_WINDOW_SIZE[0] > w:
+            gmX = w - globalvar.GM_WINDOW_SIZE[0]
+            dim = '%d,0,%d,%d,0,0,%d,%d' % \
+                (gmX,
+                 globalvar.GM_WINDOW_SIZE[0],
+                 globalvar.GM_WINDOW_SIZE[1],
+                 globalvar.MAP_WINDOW_SIZE[0],
+                 globalvar.MAP_WINDOW_SIZE[1])
+            UserSettings.Set(group = 'general', key = 'defWindowPos',
+                             subkey = 'dim', value = dim)
+        
         # create and show main frame
         mainframe = GMFrame(parent=None, id=wx.ID_ANY,
                             workspace = self.workspaceFile)