E5Gui/E5ToolBarManager.py

changeset 945
8cd4d08fa9f6
parent 930
95309225005e
child 1112
8a7d1b9d18db
equal deleted inserted replaced
944:1b59c4ba121e 945:8cd4d08fa9f6
8 """ 8 """
9 9
10 from PyQt4.QtCore import * 10 from PyQt4.QtCore import *
11 from PyQt4.QtGui import * 11 from PyQt4.QtGui import *
12 12
13
13 class E5ToolBarManager(QObject): 14 class E5ToolBarManager(QObject):
14 """ 15 """
15 Class implementing a toolbar manager. 16 Class implementing a toolbar manager.
16 """ 17 """
17 VersionMarker = 0xffff 18 VersionMarker = 0xffff
18 ToolBarMarker = 0xfefe 19 ToolBarMarker = 0xfefe
19 CustomToolBarMarker = 0xfdfd 20 CustomToolBarMarker = 0xfdfd
20 21
21 def __init__(self, ui = None, parent = None): 22 def __init__(self, ui=None, parent=None):
22 """ 23 """
23 Constructor 24 Constructor
24 25
25 @param ui reference to the user interface object (UI.UserInterface) 26 @param ui reference to the user interface object (UI.UserInterface)
26 @param parent reference to the parent object (QObject) 27 @param parent reference to the parent object (QObject)
29 30
30 self.__mainWindow = None 31 self.__mainWindow = None
31 self.__ui = ui 32 self.__ui = ui
32 33
33 self.__toolBars = {} # maps toolbar IDs to actions 34 self.__toolBars = {} # maps toolbar IDs to actions
34 self.__toolBarsWithSeparators = {} # maps toolbar IDs to actions incl. separators 35 self.__toolBarsWithSeparators = {} # maps toolbar IDs to actions incl. separators
35 self.__defaultToolBars = {} # maps default toolbar IDs to actions 36 self.__defaultToolBars = {} # maps default toolbar IDs to actions
36 self.__customToolBars = [] # list of custom toolbars 37 self.__customToolBars = [] # list of custom toolbars
37 self.__allToolBars = {} # maps toolbar IDs to toolbars 38 self.__allToolBars = {} # maps toolbar IDs to toolbars
38 39
39 self.__categoryToActions = {} # maps categories to actions 40 self.__categoryToActions = {} # maps categories to actions
432 433
433 for category in self.__categoryToActions: 434 for category in self.__categoryToActions:
434 if action in self.__categoryToActions[category]: 435 if action in self.__categoryToActions[category]:
435 self.__categoryToActions[category].remove(action) 436 self.__categoryToActions[category].remove(action)
436 437
437 def saveState(self, version = 0): 438 def saveState(self, version=0):
438 """ 439 """
439 Public method to save the state of the toolbar manager. 440 Public method to save the state of the toolbar manager.
440 441
441 @param version version number stored with the data (integer) 442 @param version version number stored with the data (integer)
442 @return saved state as a byte array (QByteArray) 443 @return saved state as a byte array (QByteArray)
483 else: 484 else:
484 stream.writeString("".encode()) 485 stream.writeString("".encode())
485 486
486 return data 487 return data
487 488
488 def restoreState(self, state, version = 0): 489 def restoreState(self, state, version=0):
489 """ 490 """
490 Public method to restore the state of the toolbar manager. 491 Public method to restore the state of the toolbar manager.
491 492
492 @param state byte array containing the saved state (QByteArray) 493 @param state byte array containing the saved state (QByteArray)
493 @param version version number stored with the data (integer) 494 @param version version number stored with the data (integer)

eric ide

mercurial