E5Gui/E5ToolBarDialog.py

changeset 945
8cd4d08fa9f6
parent 791
9ec2ac20e54e
child 1112
8a7d1b9d18db
equal deleted inserted replaced
944:1b59c4ba121e 945:8cd4d08fa9f6
13 from E5Gui import E5MessageBox 13 from E5Gui import E5MessageBox
14 14
15 from .Ui_E5ToolBarDialog import Ui_E5ToolBarDialog 15 from .Ui_E5ToolBarDialog import Ui_E5ToolBarDialog
16 16
17 import UI.PixmapCache 17 import UI.PixmapCache
18
18 19
19 class E5ToolBarItem(object): 20 class E5ToolBarItem(object):
20 """ 21 """
21 Class storing data belonging to a toolbar entry of the toolbar dialog. 22 Class storing data belonging to a toolbar entry of the toolbar dialog.
22 """ 23 """
32 self.actionIDs = actionIDs[:] 33 self.actionIDs = actionIDs[:]
33 self.isDefault = default 34 self.isDefault = default
34 self.title = "" 35 self.title = ""
35 self.isChanged = False 36 self.isChanged = False
36 37
38
37 class E5ToolBarDialog(QDialog, Ui_E5ToolBarDialog): 39 class E5ToolBarDialog(QDialog, Ui_E5ToolBarDialog):
38 """ 40 """
39 Class implementing a toolbar configuration dialog. 41 Class implementing a toolbar configuration dialog.
40 """ 42 """
41 ActionIdRole = Qt.UserRole 43 ActionIdRole = Qt.UserRole
42 WidgetActionRole = Qt.UserRole + 1 44 WidgetActionRole = Qt.UserRole + 1
43 45
44 def __init__(self, toolBarManager, parent = None): 46 def __init__(self, toolBarManager, parent=None):
45 """ 47 """
46 Constructor 48 Constructor
47 49
48 @param toolBarManager reference to a toolbar manager object (E5ToolBarManager) 50 @param toolBarManager reference to a toolbar manager object (E5ToolBarManager)
49 @param parent reference to the parent widget (QWidget) 51 @param parent reference to the parent widget (QWidget)
54 self.__manager = toolBarManager 56 self.__manager = toolBarManager
55 self.__toolbarItems = {} # maps toolbar item IDs to toolbar items 57 self.__toolbarItems = {} # maps toolbar item IDs to toolbar items
56 self.__currentToolBarItem = None 58 self.__currentToolBarItem = None
57 self.__removedToolBarIDs = [] # remember custom toolbars to be deleted 59 self.__removedToolBarIDs = [] # remember custom toolbars to be deleted
58 60
59 self.__widgetActionToToolBarItemID = {} # maps widget action IDs to toolbar item IDs 61 self.__widgetActionToToolBarItemID = {} # maps widget action IDs to toolbar item IDs
60 self.__toolBarItemToWidgetActionID = {} # maps toolbar item IDs to widget action IDs 62 self.__toolBarItemToWidgetActionID = {} # maps toolbar item IDs to widget action IDs
61 63
62 self.upButton.setIcon(UI.PixmapCache.getIcon("1uparrow.png")) 64 self.upButton.setIcon(UI.PixmapCache.getIcon("1uparrow.png"))
63 self.downButton.setIcon(UI.PixmapCache.getIcon("1downarrow.png")) 65 self.downButton.setIcon(UI.PixmapCache.getIcon("1downarrow.png"))
64 self.leftButton.setIcon(UI.PixmapCache.getIcon("1leftarrow.png")) 66 self.leftButton.setIcon(UI.PixmapCache.getIcon("1leftarrow.png"))
65 self.rightButton.setIcon(UI.PixmapCache.getIcon("1rightarrow.png")) 67 self.rightButton.setIcon(UI.PixmapCache.getIcon("1rightarrow.png"))
105 self.__widgetActionToToolBarItemID[aID] = id(tbItem) 107 self.__widgetActionToToolBarItemID[aID] = id(tbItem)
106 self.__toolBarItemToWidgetActionID[id(tbItem)].append(aID) 108 self.__toolBarItemToWidgetActionID[id(tbItem)].append(aID)
107 tbItem.actionIDs = actionIDs 109 tbItem.actionIDs = actionIDs
108 self.toolbarComboBox.addItem(tb.windowTitle(), int(id(tbItem))) 110 self.toolbarComboBox.addItem(tb.windowTitle(), int(id(tbItem)))
109 if default: 111 if default:
110 self.toolbarComboBox.setItemData(self.toolbarComboBox.count() - 1, 112 self.toolbarComboBox.setItemData(self.toolbarComboBox.count() - 1,
111 QColor(Qt.darkGreen), Qt.ForegroundRole) 113 QColor(Qt.darkGreen), Qt.ForegroundRole)
112 self.toolbarComboBox.model().sort(0) 114 self.toolbarComboBox.model().sort(0)
113 115
114 self.toolbarComboBox.currentIndexChanged[int].connect( 116 self.toolbarComboBox.currentIndexChanged[int].connect(
115 self.__toolbarComboBox_currentIndexChanged) 117 self.__toolbarComboBox_currentIndexChanged)

eric ide

mercurial