E5Gui/E5ToolBarManager.py

branch
Py2 comp.
changeset 3057
10516539f238
parent 2791
a9577f248f04
parent 2990
583beaf0b4b8
child 3060
5883ce99ee12
equal deleted inserted replaced
3056:9986ec0e559a 3057:10516539f238
33 super(E5ToolBarManager, self).__init__(parent) 33 super(E5ToolBarManager, self).__init__(parent)
34 34
35 self.__mainWindow = None 35 self.__mainWindow = None
36 self.__ui = ui 36 self.__ui = ui
37 37
38 self.__toolBars = {} # maps toolbar IDs to actions 38 self.__toolBars = {}
39 self.__toolBarsWithSeparators = {} # maps toolbar IDs to actions incl. separators 39 # maps toolbar IDs to actions
40 self.__defaultToolBars = {} # maps default toolbar IDs to actions 40 self.__toolBarsWithSeparators = {}
41 self.__customToolBars = [] # list of custom toolbars 41 # maps toolbar IDs to actions incl. separators
42 self.__allToolBars = {} # maps toolbar IDs to toolbars 42 self.__defaultToolBars = {}
43 43 # maps default toolbar IDs to actions
44 self.__categoryToActions = {} # maps categories to actions 44 self.__customToolBars = []
45 self.__actionToCategory = {} # maps action IDs to categories 45 # list of custom toolbars
46 self.__allActions = {} # maps action IDs to actions 46 self.__allToolBars = {}
47 self.__actionToToolBars = {} # maps action IDs to toolbars 47 # maps toolbar IDs to toolbars
48 48
49 self.__widgetActions = {} # maps widget action IDs to toolbars 49 self.__categoryToActions = {}
50 self.__allWidgetActions = {} # maps widget action IDs to widget actions 50 # maps categories to actions
51 self.__actionToCategory = {}
52 # maps action IDs to categories
53 self.__allActions = {}
54 # maps action IDs to actions
55 self.__actionToToolBars = {}
56 # maps action IDs to toolbars
57
58 self.__widgetActions = {}
59 # maps widget action IDs to toolbars
60 self.__allWidgetActions = {}
61 # maps widget action IDs to widget actions
51 62
52 ###################################################### 63 ######################################################
53 ## Private methods 64 ## Private methods
54 ###################################################### 65 ######################################################
55 66
288 def isDefaultToolBar(self, toolBar): 299 def isDefaultToolBar(self, toolBar):
289 """ 300 """
290 Public method to check, if a toolbar was added with addToolBar(). 301 Public method to check, if a toolbar was added with addToolBar().
291 302
292 @param toolBar reference to the toolbar to be checked (QToolBar) 303 @param toolBar reference to the toolbar to be checked (QToolBar)
304 @return flag indicating an added toolbar (boolean)
293 """ 305 """
294 return toolBar is not None and \ 306 return toolBar is not None and \
295 id(toolBar) in self.__defaultToolBars 307 id(toolBar) in self.__defaultToolBars
296 308
297 def createToolBar(self, title, name=""): 309 def createToolBar(self, title, name=""):
590 newActions = self.__toolBars[tbID][:] 602 newActions = self.__toolBars[tbID][:]
591 newActionsWithSeparators = self.__toolBarsWithSeparators[tbID][:] 603 newActionsWithSeparators = self.__toolBarsWithSeparators[tbID][:]
592 604
593 removedActions = [] 605 removedActions = []
594 for action in actions[tbID]: 606 for action in actions[tbID]:
595 if action in newActions and self.toolBarWidgetAction(action) == toolBar: 607 if action in newActions and \
608 self.toolBarWidgetAction(action) == toolBar:
596 newActions.remove(action) 609 newActions.remove(action)
597 newActionsWithSeparators.remove(action) 610 newActionsWithSeparators.remove(action)
598 removedActions.append(action) 611 removedActions.append(action)
599 612
600 self.__toolBars[tbID] = newActions 613 self.__toolBars[tbID] = newActions

eric ide

mercurial