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

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Jul 6 07:24:43 EDT 2008


Author: martinl
Date: 2008-07-06 07:24:43 -0400 (Sun, 06 Jul 2008)
New Revision: 32021

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/gselect.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/preferences.py
Log:
wxGUI: expand/collapse element list option added to GUI preferences, default is 'Collapse all except PERMANENT and current' (merged from trunk, r32020)

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/gselect.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/gselect.py	2008-07-06 11:23:03 UTC (rev 32020)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/gselect.py	2008-07-06 11:24:43 UTC (rev 32021)
@@ -211,8 +211,26 @@
                 continue
 
             if self.seltree.ItemHasChildren(dir_node):
-                self.seltree.Expand(dir_node)
+                sel = UserSettings.Get(group='general', key='elementListExpand',
+                                       subkey='selection')
+                collapse = True
 
+                if sel == 0: # collapse all expect PERMANENT and current
+                    if dir in ('PERMANENT', curr_mapset):
+                        collapse = False
+                elif sel == 1: # collapse all expect PERMANENT
+                    if dir == 'PERMANENT':
+                        collapse = False
+                elif sel == 2: # collapse all
+                    pass
+                elif sel == 3: # expand all
+                    collapse = False
+                
+                if collapse:
+                    self.seltree.Collapse(dir_node)
+                else:
+                    self.seltree.Expand(dir_node)
+                
     # helpers
     def FindItem(self, parentItem, text):
         item, cookie = self.seltree.GetFirstChild(parentItem)

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/preferences.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/preferences.py	2008-07-06 11:23:03 UTC (rev 32020)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/preferences.py	2008-07-06 11:24:43 UTC (rev 32021)
@@ -59,6 +59,8 @@
                 'mapsetPath'  : { 'selection' : 0 }, 
                 # use default window layout (layer manager, displays, ...)
                 'defWindowPos' : { 'enabled' : False, 'dim' : '' },
+                # expand/collapse element list
+                'elementListExpand' : { 'selection' : 0 },
                 },
             'manager' : {
                 # show opacity level widget
@@ -220,24 +222,28 @@
                 self.internalSettings[group][key] = {}
 
         self.internalSettings['general']["mapsetPath"]['value'] = self.GetMapsetPath()
-        self.internalSettings['general']['mapsetPath']['choices'] = [_('Mapset search path'),
-                                                                     _('All available mapsets')]
-        self.internalSettings['atm']['leftDbClick']['choices'] = [_('Edit selected record'),
-                                                                  _('Display selected')]
-        self.internalSettings['advanced']['settingsFile']['choices'] = ['home',
+        self.internalSettings['general']['mapsetPath']['choices'] = (_('Mapset search path'),
+                                                                     _('All available mapsets'))
+        self.internalSettings['general']['elementListExpand']['choices'] = (_("Collapse all except PERMANENT and current"),
+                                                                            _("Collapse all except PERMANENT"),
+                                                                            _("Collapse all"),
+                                                                            _("Expand all"))
+        self.internalSettings['atm']['leftDbClick']['choices'] = (_('Edit selected record'),
+                                                                  _('Display selected'))
+        self.internalSettings['advanced']['settingsFile']['choices'] = ('home',
                                                                         'gisdbase',
                                                                         'location',
-                                                                        'mapset']
-        self.internalSettings['advanced']['iconTheme']['choices'] = ['grass',
-                                                                     'silk']
-        self.internalSettings['advanced']['digitInterface']['choices'] = ['vedit',
-                                                                          'vdigit']
-        self.internalSettings['cmd']['verbosity']['choices'] = ['grassenv',
+                                                                        'mapset')
+        self.internalSettings['advanced']['iconTheme']['choices'] = ('grass',
+                                                                     'silk')
+        self.internalSettings['advanced']['digitInterface']['choices'] = ('vedit',
+                                                                          'vdigit')
+        self.internalSettings['cmd']['verbosity']['choices'] = ('grassenv',
                                                                 'verbose',
-                                                                'quiet']
+                                                                'quiet')
         self.internalSettings['display']['driver']['choices'] = ['default']
         self.internalSettings['display']['statusbarMode']['choices'] = globalvar.MAP_DISPLAY_STATUSBAR_MODE
-        
+
     def GetMapsetPath(self):
         """Store mapset search path"""
         all, access = utils.ListOfMapsets()
@@ -537,7 +543,28 @@
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(row, 1))
         
+        #
+        # expand element list
+        #
+        row +=1
+        gridSizer.Add(item=wx.StaticText(parent=panel, id=wx.ID_ANY,
+                                         label=_("Element list:")),
+                      flag=wx.ALIGN_LEFT |
+                      wx.ALIGN_CENTER_VERTICAL,
+                      pos=(row, 0))
+        elementList = wx.Choice(parent=panel, id=wx.ID_ANY, 
+                                choices=self.settings.Get(group='general', key='elementListExpand',
+                                                          subkey='choices', internal=True),
+                                name="GetSelection")
+        elementList.SetSelection(self.settings.Get(group='general', key='elementListExpand',
+                                                   subkey='selection'))
+        self.winId['general:elementListExpand:selection'] = elementList.GetId()
 
+        gridSizer.Add(item=elementList,
+                      flag=wx.ALIGN_RIGHT |
+                      wx.ALIGN_CENTER_VERTICAL,
+                      pos=(row, 1))
+
         #
         # default window layout
         #



More information about the grass-commit mailing list