[GRASS-SVN] r39787 - grass/branches/develbranch_6/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Nov 23 04:30:24 EST 2009


Author: martinl
Date: 2009-11-23 04:30:21 -0500 (Mon, 23 Nov 2009)
New Revision: 39787

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/preferences.py
Log:
wxGUI: set/unset default color table


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py	2009-11-23 09:15:46 UTC (rev 39786)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py	2009-11-23 09:30:21 UTC (rev 39787)
@@ -100,7 +100,8 @@
             time.sleep(.1)
             
             # set default color table for raster data
-            if args[0][0][:2] == 'r.':
+            if UserSettings.Get(group='cmd', key='rasterColorTable', subkey='enabled') and \
+                    args[0][0][:2] == 'r.':
                 moduleInterface = menuform.GUI().ParseCommand(args[0], show = None)
                 outputParam = moduleInterface.get_param(value = 'output', raiseError = False)
                 colorTable = UserSettings.Get(group='cmd', key='rasterColorTable', subkey='selection')

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/preferences.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/preferences.py	2009-11-23 09:15:46 UTC (rev 39786)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/preferences.py	2009-11-23 09:30:21 UTC (rev 39787)
@@ -177,6 +177,7 @@
                     'enabled' : True
                     },
                 'rasterColorTable' : {
+                    'enabled'   : False,
                     'selection' : 'rainbow',
                     },
                 # d.vect
@@ -1241,18 +1242,25 @@
 
         # default color table
         row += 1
-        gridSizer.Add(item=wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                         label=_("Default color table:")),
-                      flag=wx.ALIGN_LEFT |
-                      wx.ALIGN_CENTER_VERTICAL,
+        rasterCTCheck = wx.CheckBox(parent=panel, id=wx.ID_ANY,
+                                    label=_("Default color table"),
+                                    name='IsChecked')
+        rasterCTCheck.SetValue(self.settings.Get(group='cmd', key='rasterColorTable', subkey='enabled'))
+        self.winId['cmd:rasterColorTable:enabled'] = rasterCTCheck.GetId()
+        rasterCTCheck.Bind(wx.EVT_CHECKBOX, self.OnCheckColorTable)
+        
+        gridSizer.Add(item=rasterCTCheck,
                       pos=(row, 0))
-        colorTable = wx.Choice(parent=panel, id=wx.ID_ANY, size=(200, -1),
+        
+        rasterCTName = wx.Choice(parent=panel, id=wx.ID_ANY, size=(200, -1),
                                choices=utils.GetColorTables(),
                                name="GetStringSelection")
-        colorTable.SetStringSelection(self.settings.Get(group='cmd', key='rasterColorTable', subkey='selection'))
-        self.winId['cmd:rasterColorTable:selection'] = colorTable.GetId()
+        rasterCTName.SetStringSelection(self.settings.Get(group='cmd', key='rasterColorTable', subkey='selection'))
+        self.winId['cmd:rasterColorTable:selection'] = rasterCTName.GetId()
+        if not rasterCTCheck.IsChecked():
+            rasterCTName.Enable(False)
         
-        gridSizer.Add(item=colorTable,
+        gridSizer.Add(item=rasterCTName,
                       pos=(row, 1))
         
         sizer.Add(item=gridSizer, proportion=1, flag=wx.ALL | wx.EXPAND, border=5)
@@ -1663,6 +1671,14 @@
         
         return panel
 
+    def OnCheckColorTable(self, event):
+        """!Set/unset default color table"""
+        win = self.FindWindowById(self.winId['cmd:rasterColorTable:selection'])
+        if event.IsChecked():
+            win.Enable()
+        else:
+            win.Enable(False)
+        
     def OnLoadEpsgCodes(self, event):
         """!Load EPSG codes from the file"""
         win = self.FindWindowById(self.winId['projection:statusbar:projFile'])



More information about the grass-commit mailing list