[GRASS-SVN] r31104 - in grass/trunk/gui/wxpython: . gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Apr 24 13:25:13 EDT 2008


Author: martinl
Date: 2008-04-24 13:25:12 -0400 (Thu, 24 Apr 2008)
New Revision: 31104

Modified:
   grass/trunk/gui/wxpython/gui_modules/preferences.py
   grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py
   grass/trunk/gui/wxpython/wxgui.py
Log:
wxGUI (preferences) option to disable 'on remove layer' message (trac #139)
Option 'changeOpacityLevel' moved to 'manager' group.


Modified: grass/trunk/gui/wxpython/gui_modules/preferences.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/preferences.py	2008-04-24 16:55:02 UTC (rev 31103)
+++ grass/trunk/gui/wxpython/gui_modules/preferences.py	2008-04-24 17:25:12 UTC (rev 31104)
@@ -56,10 +56,14 @@
             'general': {
                 # current mapset search path
                 'mapsetPath'  : { 'selection' : 0 }, 
+                # use default window layout (layer manager, displays, ...)
+                'defWindowPos' : { 'enabled' : False, 'dim' : '' },
+                },
+            'manager' : {
                 # show opacity level widget
                 'changeOpacityLevel' : { 'enabled' : False }, 
-                # use default window layout (layer manager, displays, ...)
-                'defWindowPos' : { 'enabled' : False, 'dim' : '' }, 
+                # ask when removing layer from layer tree
+                'askOnRemoveLayer' : { 'enabled' : True },
                 },
             #
             # display
@@ -528,12 +532,25 @@
         changeOpacityLevel = wx.CheckBox(parent=panel, id=wx.ID_ANY,
                                        label=_("Opacity level editable"),
                                        name='IsChecked')
-        changeOpacityLevel.SetValue(self.settings.Get(group='general', key='changeOpacityLevel', subkey='enabled'))
-        self.winId['general:changeOpacityLevel:enabled'] = changeOpacityLevel.GetId()
+        changeOpacityLevel.SetValue(self.settings.Get(group='manager', key='changeOpacityLevel', subkey='enabled'))
+        self.winId['manager:changeOpacityLevel:enabled'] = changeOpacityLevel.GetId()
 
         gridSizer.Add(item=changeOpacityLevel,
                       pos=(row, 0), span=(1, 2))
-        
+
+        #
+        # ask when removing map layer from layer tree
+        #
+        row += 1
+        askOnRemoveLayer = wx.CheckBox(parent=panel, id=wx.ID_ANY,
+                                       label=_("Ask when removing map layer from layer tree"),
+                                       name='IsChecked')
+        askOnRemoveLayer.SetValue(self.settings.Get(group='manager', key='askOnRemoveLayer', subkey='enabled'))
+        self.winId['manager:askOnRemoveLayer:enabled'] = askOnRemoveLayer.GetId()
+
+        gridSizer.Add(item=askOnRemoveLayer,
+                      pos=(row, 0), span=(1, 2))
+
         sizer.Add(item=gridSizer, proportion=1, flag=wx.ALL | wx.EXPAND, border=5)
         border.Add(item=sizer, proportion=0, flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=3)
 

Modified: grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py	2008-04-24 16:55:02 UTC (rev 31103)
+++ grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py	2008-04-24 17:25:12 UTC (rev 31104)
@@ -463,7 +463,7 @@
             self.groupnode += 1
         else:
             # all other items (raster, vector, ...)
-            if UserSettings.Get(group='general', key='changeOpacityLevel', subkey='enabled'):
+            if UserSettings.Get(group='manager', key='changeOpacityLevel', subkey='enabled'):
                 ctrl = wx.SpinCtrl(self, id=wx.ID_ANY, value="",
                                    style=wx.SP_ARROW_KEYS, initial=100, min=0, max=100,
                                    name='spinCtrl')
@@ -558,7 +558,7 @@
         if ltype != 'group':
             if lopacity:
                 opacity = lopacity
-                if UserSettings.Get(group='general', key='changeOpacityLevel', subkey='enabled'):
+                if UserSettings.Get(group='manager', key='changeOpacityLevel', subkey='enabled'):
                     ctrl.SetValue(int(lopacity * 100))
                 else:
                     if opacity < 1.0:

Modified: grass/trunk/gui/wxpython/wxgui.py
===================================================================
--- grass/trunk/gui/wxpython/wxgui.py	2008-04-24 16:55:02 UTC (rev 31103)
+++ grass/trunk/gui/wxpython/wxgui.py	2008-04-24 17:25:12 UTC (rev 31104)
@@ -1436,24 +1436,25 @@
             self.MsgNoLayerSelected()
             return
 
-        layerName = str(self.curr_page.maptree.GetItemText(self.curr_page.maptree.layer_selected))
-        if layerName:
-            message = _("Do you want to remove map layer <%s> "
-                        "from layer tree?") % layerName
-        else:
-            message = _("Do you want to remove selected map layer "
-                        "from layer tree?")
+        if UserSettings.Get(group='manager', key='askOnRemoveLayer', subkey='enabled'):
+            layerName = str(self.curr_page.maptree.GetItemText(self.curr_page.maptree.layer_selected))
+            if layerName:
+                message = _("Do you want to remove map layer <%s> "
+                            "from layer tree?") % layerName
+            else:
+                message = _("Do you want to remove selected map layer "
+                            "from layer tree?")
 
-        dlg = wx.MessageDialog (parent=self, message=message,
-                                caption=_("Remove map layer"),
-                                style=wx.YES_NO | wx.YES_DEFAULT | wx.CANCEL | wx.ICON_QUESTION)
+            dlg = wx.MessageDialog (parent=self, message=message,
+                                    caption=_("Remove map layer"),
+                                    style=wx.YES_NO | wx.YES_DEFAULT | wx.CANCEL | wx.ICON_QUESTION)
 
-        if dlg.ShowModal() in [wx.ID_NO, wx.ID_CANCEL]:
+            if dlg.ShowModal() in [wx.ID_NO, wx.ID_CANCEL]:
+                dlg.Destroy()
+                return
+
             dlg.Destroy()
-            return
 
-        dlg.Destroy()
-
         for layer in self.curr_page.maptree.GetSelections():
             if self.curr_page.maptree.GetPyData(layer)[0]['type'] == 'group':
                 self.curr_page.maptree.DeleteChildren(layer)



More information about the grass-commit mailing list