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

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Nov 26 18:34:24 EST 2011


Author: martinl
Date: 2011-11-26 15:34:24 -0800 (Sat, 26 Nov 2011)
New Revision: 49373

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/gdialogs.py
Log:
wxGUI: GroupDialog: add support for sub-groups
       (merge r49372 from trunk)


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/gdialogs.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/gdialogs.py	2011-11-26 23:25:40 UTC (rev 49372)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/gdialogs.py	2011-11-26 23:34:24 UTC (rev 49373)
@@ -953,6 +953,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)
@@ -1039,32 +1043,42 @@
             if layerOld not in layersNew:
                 remove.append(layerOld)
         
+        kwargs = {}
+        if self.subGroup.IsChecked():
+            kwargs['subgroup'] = group
+        
         ret = None
         if remove:
             ret = gcmd.RunCommand('i.group',
                                   parent = self,
                                   group = group,
                                   flags = 'r',
-                                  input = ','.join(remove))
-                        
+                                  input = ','.join(remove),
+                                  **kwargs)
+        
         if add:
             ret = gcmd.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 = gcmd.RunCommand('i.group',
-                              parent = self,
-                              group = group,
-                              input = layers)
-        return ret
         
-                        
+        kwargs = {}
+        if self.subGroup.IsChecked():
+            kwargs['subgroup'] = group
+        
+        return gcmd.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