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) |