[GRASS-SVN] r49372 - grass/trunk/gui/wxpython/gui_core

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Nov 26 18:25:40 EST 2011


Author: martinl
Date: 2011-11-26 15:25:40 -0800 (Sat, 26 Nov 2011)
New Revision: 49372

Modified:
   grass/trunk/gui/wxpython/gui_core/dialogs.py
Log:
wxGUI: GroupDialog: add support for sub-groups


Modified: grass/trunk/gui/wxpython/gui_core/dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/dialogs.py	2011-11-26 23:19:59 UTC (rev 49371)
+++ grass/trunk/gui/wxpython/gui_core/dialogs.py	2011-11-26 23:25:40 UTC (rev 49372)
@@ -1008,6 +1008,10 @@
         bodySizer.Add(item = self.infoLabel, 
                       flag = wx.ALIGN_CENTER_VERTICAL | wx.TOP | wx.BOTTOM, border = 5)
         
+        self.subGroup = wx.CheckBox(parent = self, id = wx.ID_ANY,
+                                    label = _("Define also sub-group (same name as group)"))
+        bodySizer.Add(item = self.subGroup, flag = wx.BOTTOM | wx.EXPAND, border = 5)
+
         # bindings
         self.groupSelect.GetTextCtrl().Bind(wx.EVT_TEXT, self.OnGroupSelected)
         self.addLayer.Bind(wx.EVT_BUTTON, self.OnAddLayer)
@@ -1093,6 +1097,10 @@
         for layerOld in layersOld:
             if layerOld not in layersNew:
                 remove.append(layerOld)
+                
+        kwargs = {}
+        if self.subGroup.IsChecked():
+            kwargs['subgroup'] = group
         
         ret = None
         if remove:
@@ -1100,26 +1108,32 @@
                              parent = self,
                              group = group,
                              flags = 'r',
-                             input = ','.join(remove))
+                             input = ','.join(remove),
+                             **kwargs)
                         
         if add:
             ret = RunCommand('i.group',
                              parent = self,
                              group = group,
-                             input = ','.join(add))
+                             input = ','.join(add),
+                             **kwargs)
                             
         return ret
         
     def CreateNewGroup(self, group):
         """!Create new group"""
         layers = self.GetLayers()
-        ret = RunCommand('i.group',
-                         parent = self,
-                         group = group,
-                         input = layers)
-        return ret
         
-                        
+        kwargs = {}
+        if self.subGroup.IsChecked():
+            kwargs['subgroup'] = group
+        
+        return RunCommand('i.group',
+                          parent = self,
+                          group = group,
+                          input = layers,
+                          **kwargs)
+    
     def GetExistGroups(self):
         """!Returns existing groups in current mapset"""
         return grass.list_grouped('group')[grass.gisenv()['MAPSET']]



More information about the grass-commit mailing list