[GRASS-SVN] r67875 - in grass/trunk/gui/wxpython: datacatalog gui_core

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Feb 18 02:16:03 PST 2016


Author: martinl
Date: 2016-02-18 02:16:03 -0800 (Thu, 18 Feb 2016)
New Revision: 67875

Modified:
   grass/trunk/gui/wxpython/datacatalog/tree.py
   grass/trunk/gui/wxpython/gui_core/treeview.py
Log:
wxGUI/datacatalog: expand/collapse on double click

Modified: grass/trunk/gui/wxpython/datacatalog/tree.py
===================================================================
--- grass/trunk/gui/wxpython/datacatalog/tree.py	2016-02-18 09:26:05 UTC (rev 67874)
+++ grass/trunk/gui/wxpython/datacatalog/tree.py	2016-02-18 10:16:03 UTC (rev 67875)
@@ -120,7 +120,8 @@
         self.showNotification = Signal('Tree.showNotification')
         self.parent = parent
         self.contextMenu.connect(self.OnRightClick)
-
+        self.itemActivated.connect(self.OnDoubleClick)
+        
         self._initVariables()
 
     def _initTreeItems(self, locations=None, mapsets=None):
@@ -261,6 +262,13 @@
         elif self.selected_mapset and not self.selected_type:
             self._popupMenuMapset()
 
+    def OnDoubleClick(self, node):
+        """Expand/Collapse node."""
+        if self.IsNodeExpanded(node):
+            self.CollapseNode(node, recursive=False)
+        else:
+            self.ExpandNode(node, recursive=False)
+        
     def ExpandCurrentLocation(self):
         """Expand current location"""
         location = gscript.gisenv()['LOCATION_NAME']
@@ -309,8 +317,8 @@
             self._emitSignal(evt.GetItem(), self.startEdit, event=evt))
         self.Bind(wx.EVT_TREE_END_LABEL_EDIT, lambda evt:
             self._emitSignal(evt.GetItem(), self.endEdit, event=evt))
-        self.startEdit.connect(self.OnStartEditLabel)
-        self.endEdit.connect(self.OnEditLabel)
+        ###self.startEdit.connect(self.OnStartEditLabel)
+        ###self.endEdit.connect(self.OnEditLabel)
 
     def _initVariablesCatalog(self):
         """Init variables."""

Modified: grass/trunk/gui/wxpython/gui_core/treeview.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/treeview.py	2016-02-18 09:26:05 UTC (rev 67874)
+++ grass/trunk/gui/wxpython/gui_core/treeview.py	2016-02-18 10:16:03 UTC (rev 67875)
@@ -121,6 +121,13 @@
             self.Expand(item)
         self.EnsureVisible(item)
 
+    def IsNodeExpanded(self, node):
+        """Check if node is expanded"""
+        index = self._model.GetIndexOfNode(node)
+        item = self.GetItemByIndex(index)
+
+        return self.IsExpanded(item)
+    
     def CollapseNode(self, node, recursive=True):
         """Collapse items.
 



More information about the grass-commit mailing list