eric6/E5Gui/E5ToolBarManager.py

changeset 7252
c5e3705073eb
parent 7229
53054eb5b15a
child 7360
9190402e4505
equal deleted inserted replaced
7251:bc5b1b00560a 7252:c5e3705073eb
225 225
226 # step 1: check list of actions 226 # step 1: check list of actions
227 toRemove = {} 227 toRemove = {}
228 newActions = [] 228 newActions = []
229 for action in actions: 229 for action in actions:
230 if action is None or \ 230 if (
231 (action not in newActions and id(action) in self.__allActions): 231 action is None or
232 (action not in newActions and
233 id(action) in self.__allActions)
234 ):
232 newActions.append(action) 235 newActions.append(action)
233 oldTB = self.toolBarWidgetAction(action) 236 oldTB = self.toolBarWidgetAction(action)
234 if oldTB is not None and oldTB != toolBar: 237 if oldTB is not None and oldTB != toolBar:
235 if id(oldTB) not in toRemove: 238 if id(oldTB) not in toRemove:
236 toRemove[id(oldTB)] = [] 239 toRemove[id(oldTB)] = []
300 Public method to check, if a toolbar was added with addToolBar(). 303 Public method to check, if a toolbar was added with addToolBar().
301 304
302 @param toolBar reference to the toolbar to be checked (QToolBar) 305 @param toolBar reference to the toolbar to be checked (QToolBar)
303 @return flag indicating an added toolbar (boolean) 306 @return flag indicating an added toolbar (boolean)
304 """ 307 """
305 return toolBar is not None and \ 308 return (
309 toolBar is not None and
306 id(toolBar) in self.__defaultToolBars 310 id(toolBar) in self.__defaultToolBars
311 )
307 312
308 def createToolBar(self, title, name=""): 313 def createToolBar(self, title, name=""):
309 """ 314 """
310 Public method to create a custom toolbar. 315 Public method to create a custom toolbar.
311 316
623 newActions = self.__toolBars[tbID][:] 628 newActions = self.__toolBars[tbID][:]
624 newActionsWithSeparators = self.__toolBarsWithSeparators[tbID][:] 629 newActionsWithSeparators = self.__toolBarsWithSeparators[tbID][:]
625 630
626 removedActions = [] 631 removedActions = []
627 for action in actions[tbID]: 632 for action in actions[tbID]:
628 if action in newActions and \ 633 if (
629 self.toolBarWidgetAction(action) == toolBar: 634 action in newActions and
635 self.toolBarWidgetAction(action) == toolBar
636 ):
630 newActions.remove(action) 637 newActions.remove(action)
631 newActionsWithSeparators.remove(action) 638 newActionsWithSeparators.remove(action)
632 removedActions.append(action) 639 removedActions.append(action)
633 640
634 self.__toolBars[tbID] = newActions 641 self.__toolBars[tbID] = newActions

eric ide

mercurial