[GRASS-SVN] r36125 - grass/trunk/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Feb 27 10:44:50 EST 2009


Author: martinl
Date: 2009-02-27 10:44:50 -0500 (Fri, 27 Feb 2009)
New Revision: 36125

Modified:
   grass/trunk/gui/wxpython/gui_modules/gdialogs.py
Log:
wxGUI: load map layers dialog -> invert selection


Modified: grass/trunk/gui/wxpython/gui_modules/gdialogs.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gdialogs.py	2009-02-27 13:27:35 UTC (rev 36124)
+++ grass/trunk/gui/wxpython/gui_modules/gdialogs.py	2009-02-27 15:44:50 UTC (rev 36125)
@@ -13,7 +13,7 @@
  - LayersList (used by MultiImport) 
  - SetOpacityDialog
 
-(C) 2008 by the GRASS Development Team
+(C) 2008-2009 by the GRASS Development Team
 
 This program is free software under the GNU General Public
 License (>=v2). Read the file COPYING that comes with GRASS
@@ -733,14 +733,17 @@
         if not hasattr(self, "popupID1"):
             self.popupDataID1 = wx.NewId()
             self.popupDataID2 = wx.NewId()
+            self.popupDataID3 = wx.NewId()
 
-            self.Bind(wx.EVT_MENU, self.OnSelectAll,   id=self.popupDataID1)
-            self.Bind(wx.EVT_MENU, self.OnDeselectAll, id=self.popupDataID2)
+            self.Bind(wx.EVT_MENU, self.OnSelectAll,    id=self.popupDataID1)
+            self.Bind(wx.EVT_MENU, self.OnSelectInvert, id=self.popupDataID2)
+            self.Bind(wx.EVT_MENU, self.OnDeselectAll,  id=self.popupDataID3)
 
         # generate popup-menu
         menu = wx.Menu()
         menu.Append(self.popupDataID1, _("Select all"))
-        menu.Append(self.popupDataID2, _("Deselect all"))
+        menu.Append(self.popupDataID2, _("Invert selection"))
+        menu.Append(self.popupDataID3, _("Deselect all"))
 
         self.PopupMenu(menu)
         menu.Destroy()
@@ -750,6 +753,14 @@
         for item in range(self.layers.GetCount()):
             self.layers.Check(item, True)
 
+    def OnSelectInvert(self, event):
+        """Invert current selection"""
+        for item in range(self.layers.GetCount()):
+            if self.layers.IsChecked(item):
+                self.layers.Check(item, False)
+            else:
+                self.layers.Check(item, True)
+        
     def OnDeselectAll(self, event):
         """Select all map layer from list"""
         for item in range(self.layers.GetCount()):



More information about the grass-commit mailing list