浏览代码

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 年之前
父节点
当前提交
f71399210c
共有 1 个文件被更改,包括 19 次插入1 次删除
  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.