Fixed an issue in the toolbar manager where adding a toolbar a second time caused actions to be listed multiple times. 5_0_x

Fri, 07 Jan 2011 11:53:06 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Fri, 07 Jan 2011 11:53:06 +0100
branch
5_0_x
changeset 823
64fa9ab70ddd
parent 822
6a90548b35b1
child 827
e7f6008ab82b

Fixed an issue in the toolbar manager where adding a toolbar a second time caused actions to be listed multiple times.

E5Gui/E5ToolBarDialog.py file | annotate | diff | comparison | revisions
E5Gui/E5ToolBarManager.py file | annotate | diff | comparison | revisions
diff -r 6a90548b35b1 -r 64fa9ab70ddd E5Gui/E5ToolBarDialog.py
--- a/E5Gui/E5ToolBarDialog.py	Fri Jan 07 10:02:23 2011 +0100
+++ b/E5Gui/E5ToolBarDialog.py	Fri Jan 07 11:53:06 2011 +0100
@@ -54,7 +54,7 @@
         self.__currentToolBarItem = None
         self.__removedToolBarIDs = []   # remember custom toolbars to be deleted
         
-        self.__widgetActionToToolBarItemID = {}   # maps widget action IDs to toolbar item IDs
+        self.__widgetActionToToolBarItemID = {} # maps widget action IDs to toolbar item IDs
         self.__toolBarItemToWidgetActionID = {} # maps toolbar item IDs to widget action IDs
         
         self.upButton.setIcon(UI.PixmapCache.getIcon("1uparrow.png"))
@@ -458,4 +458,4 @@
         tbID = self.__currentToolBarItem.toolBarId
         actions = self.__manager.defaultToolBarActions(tbID)
         self.__restoreCurrentToolbar(actions)
-        self.__currentToolBarItem.isChanged = True
\ No newline at end of file
+        self.__currentToolBarItem.isChanged = True
diff -r 6a90548b35b1 -r 64fa9ab70ddd E5Gui/E5ToolBarManager.py
--- a/E5Gui/E5ToolBarManager.py	Fri Jan 07 10:02:23 2011 +0100
+++ b/E5Gui/E5ToolBarManager.py	Fri Jan 07 11:53:06 2011 +0100
@@ -136,14 +136,16 @@
         newActionsWithSeparators = []
         actions = toolBar.actions()
         for action in actions:
+            actID = id(action)
             self.addAction(action, category)
-            if id(action) in self.__widgetActions:
-                self.__widgetActions[id(action)] = toolBar
+            if actID in self.__widgetActions:
+                self.__widgetActions[actID] = toolBar
             newActionsWithSeparators.append(action)
             if action.isSeparator():
                 action = None
             else:
-                self.__actionToToolBars[id(action)].append(toolBar)
+                if toolBar not in self.__actionToToolBars[actID]:
+                    self.__actionToToolBars[actID].append(toolBar)
             newActions.append(action)
         tbID = id(toolBar)
         self.__defaultToolBars[tbID] = newActions
@@ -383,7 +385,7 @@
             return
         if action.isSeparator():
             return
-        if action in self.__allActions:
+        if id(action) in self.__allActions:
             return
         
         if action.metaObject().className() == "QWidgetAction":
@@ -676,4 +678,4 @@
         """
         if tbID not in self.__defaultToolBars:
             return []
-        return self.__defaultToolBars[tbID][:]
\ No newline at end of file
+        return self.__defaultToolBars[tbID][:]

eric ide

mercurial