Browse Source

wxGUI/iclass: temporary fix for switching tools (needs refactoring)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@54530 15284696-431f-4ddb-bdfa-cd5b030d7da7
Anna Petrášová 12 years ago
parent
commit
f71399210c
1 changed files with 19 additions and 1 deletions
  1. 19 1
      gui/wxpython/iclass/frame.py

+ 19 - 1
gui/wxpython/iclass/frame.py

@@ -1081,10 +1081,28 @@ class IClassMapFrame(DoubleMapFrame):
         @fixme: needs refactoring
         """
         toolbar = self.GetMapToolbar()
-        self.SwitchTool(toolbar, event)
 
         self.GetFirstWindow().mouse['use'] = 'pointer'
 
+    def SwitchTool(self, toolbar, event):
+        """!Calls UpdateTools to manage connected toolbars"""
+        self.UpdateTools(event)
+        super(IClassMapFrame, self).SwitchTool(toolbar, event)
+
+    def UpdateTools(self, event):
+        """!Method deals with relations of toolbars and other
+        elements"""
+        # untoggles button in other toolbars
+        for toolbar in self.toolbars.itervalues():
+            if hasattr(event, 'GetEventObject') == True:
+                if event.GetEventObject() == toolbar:
+                    continue
+                if toolbar.action:
+                    toolbar.ToggleTool(toolbar.action['id'], False)
+                    toolbar.action['id'] = -1
+                    toolbar.OnTool(None)
+
+
 class MapManager:
     """! Class for managing map renderer.