[GRASS-SVN] r70243 - in grass/trunk/gui/wxpython: core gui_core lmgr

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Jan 4 05:10:23 PST 2017


Author: martinl
Date: 2017-01-04 05:10:23 -0800 (Wed, 04 Jan 2017)
New Revision: 70243

Modified:
   grass/trunk/gui/wxpython/core/settings.py
   grass/trunk/gui/wxpython/gui_core/preferences.py
   grass/trunk/gui/wxpython/lmgr/layertree.py
Log:
wxGUI: add 'Align region to resolution' option to preferences

Modified: grass/trunk/gui/wxpython/core/settings.py
===================================================================
--- grass/trunk/gui/wxpython/core/settings.py	2017-01-04 12:57:37 UTC (rev 70242)
+++ grass/trunk/gui/wxpython/core/settings.py	2017-01-04 13:10:23 UTC (rev 70243)
@@ -11,7 +11,7 @@
 from core.settings import UserSettings
 @endcode
 
-(C) 2007-2016 by the GRASS Development Team
+(C) 2007-2017 by the GRASS Development Team
 This program is free software under the GNU General Public License
 (>=v2). Read the file COPYING that comes with GRASS for details.
 
@@ -104,6 +104,12 @@
                         'enabled': False
                     },
                 },
+                # region
+                'region': {
+                    'resAlign': {
+                        'enabled' : False
+                    },
+                },
             },
             'manager': {
                 # show opacity level widget

Modified: grass/trunk/gui/wxpython/gui_core/preferences.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/preferences.py	2017-01-04 12:57:37 UTC (rev 70242)
+++ grass/trunk/gui/wxpython/gui_core/preferences.py	2017-01-04 13:10:23 UTC (rev 70243)
@@ -14,7 +14,7 @@
  - preferences::MapsetAccess
  - preferences::CheckListMapset
 
-(C) 2007-2014 by the GRASS Development Team
+(C) 2007-2017 by the GRASS Development Team
 
 This program is free software under the GNU General Public License
 (>=v2). Read the file COPYING that comes with GRASS for details.
@@ -57,7 +57,7 @@
     """Base preferences dialog"""
 
     def __init__(self, parent, giface, settings, title=_("User settings"),
-                 size=(500, 475),
+                 size=(-1, 500),
                  style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER):
         self.parent = parent  # ModelerFrame
         self.title = title
@@ -453,6 +453,41 @@
             border=5)
         border.Add(sizer, proportion=0, flag=wx.ALL | wx.EXPAND, border=3)
 
+        #
+        # region
+        #
+        box = wx.StaticBox(
+            parent=panel,
+            id=wx.ID_ANY,
+            label=" %s " %
+            _("Region settings"))
+        sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
+
+        gridSizer = wx.GridBagSizer(hgap=3, vgap=3)
+
+        row = 0
+        resAlign = wx.CheckBox(parent=panel, id=wx.ID_ANY, label=_(
+            "Align region to resolution"), name='IsChecked')
+        resAlign.SetValue(
+            self.settings.Get(
+                group='general',
+                key='region',
+                subkey=[
+                    'resAlign',
+                    'enabled']))
+        self.winId['general:region:resAlign:enabled'] = resAlign.GetId()
+
+        gridSizer.Add(resAlign,
+                      pos=(row, 0), span=(1, 2))
+
+        gridSizer.AddGrowableCol(0)
+        sizer.Add(
+            gridSizer,
+            proportion=1,
+            flag=wx.ALL | wx.EXPAND,
+            border=5)
+        border.Add(sizer, proportion=0, flag=wx.ALL | wx.EXPAND, border=3)
+
         panel.SetSizer(border)
 
         return panel

Modified: grass/trunk/gui/wxpython/lmgr/layertree.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/layertree.py	2017-01-04 12:57:37 UTC (rev 70242)
+++ grass/trunk/gui/wxpython/lmgr/layertree.py	2017-01-04 13:10:23 UTC (rev 70243)
@@ -928,6 +928,9 @@
 
         # print output to command log area
         if kwargs:
+            if UserSettings.Get(group='general',
+                                key='region', subkey=['resAlign', 'enabled']):
+                kwargs['flags'] = 'a'
             # command must run in main thread otherwise it can be
             # launched after rendering is done (region extent will
             # remain untouched)



More information about the grass-commit mailing list