7532:1358e9d67a1c | 7533:88261c96484b |
---|---|
207 self.__navigationMenu = QMenu(self) | 207 self.__navigationMenu = QMenu(self) |
208 self.__navigationMenu.aboutToShow.connect(self.__showNavigationMenu) | 208 self.__navigationMenu.aboutToShow.connect(self.__showNavigationMenu) |
209 self.__navigationMenu.triggered.connect(self.__navigationMenuTriggered) | 209 self.__navigationMenu.triggered.connect(self.__navigationMenuTriggered) |
210 | 210 |
211 self.navigationButton = QToolButton(self) | 211 self.navigationButton = QToolButton(self) |
212 self.navigationButton.setIcon(UI.PixmapCache.getIcon("1downarrow.png")) | 212 self.navigationButton.setIcon(UI.PixmapCache.getIcon("1downarrow")) |
213 self.navigationButton.setToolTip(self.tr("Show a navigation menu")) | 213 self.navigationButton.setToolTip(self.tr("Show a navigation menu")) |
214 self.navigationButton.setPopupMode(QToolButton.InstantPopup) | 214 self.navigationButton.setPopupMode(QToolButton.InstantPopup) |
215 self.navigationButton.setMenu(self.__navigationMenu) | 215 self.navigationButton.setMenu(self.__navigationMenu) |
216 self.navigationButton.setEnabled(False) | 216 self.navigationButton.setEnabled(False) |
217 self.rightCornerWidgetLayout.addWidget(self.navigationButton) | 217 self.rightCornerWidgetLayout.addWidget(self.navigationButton) |
232 self.emptyLabel = QLabel() | 232 self.emptyLabel = QLabel() |
233 self.emptyLabel.setPixmap(ericPic) | 233 self.emptyLabel.setPixmap(ericPic) |
234 self.emptyLabel.setAlignment(Qt.AlignVCenter | Qt.AlignHCenter) | 234 self.emptyLabel.setAlignment(Qt.AlignVCenter | Qt.AlignHCenter) |
235 super(TabWidget, self).addTab( | 235 super(TabWidget, self).addTab( |
236 self.emptyLabel, | 236 self.emptyLabel, |
237 UI.PixmapCache.getIcon("empty.png"), "") | 237 UI.PixmapCache.getIcon("empty"), "") |
238 | 238 |
239 def __initMenu(self): | 239 def __initMenu(self): |
240 """ | 240 """ |
241 Private method to initialize the tab context menu. | 241 Private method to initialize the tab context menu. |
242 """ | 242 """ |
243 self.__menu = QMenu(self) | 243 self.__menu = QMenu(self) |
244 self.leftMenuAct = self.__menu.addAction( | 244 self.leftMenuAct = self.__menu.addAction( |
245 UI.PixmapCache.getIcon("1leftarrow.png"), | 245 UI.PixmapCache.getIcon("1leftarrow"), |
246 self.tr('Move Left'), self.__contextMenuMoveLeft) | 246 self.tr('Move Left'), self.__contextMenuMoveLeft) |
247 self.rightMenuAct = self.__menu.addAction( | 247 self.rightMenuAct = self.__menu.addAction( |
248 UI.PixmapCache.getIcon("1rightarrow.png"), | 248 UI.PixmapCache.getIcon("1rightarrow"), |
249 self.tr('Move Right'), self.__contextMenuMoveRight) | 249 self.tr('Move Right'), self.__contextMenuMoveRight) |
250 self.firstMenuAct = self.__menu.addAction( | 250 self.firstMenuAct = self.__menu.addAction( |
251 UI.PixmapCache.getIcon("2leftarrow.png"), | 251 UI.PixmapCache.getIcon("2leftarrow"), |
252 self.tr('Move First'), self.__contextMenuMoveFirst) | 252 self.tr('Move First'), self.__contextMenuMoveFirst) |
253 self.lastMenuAct = self.__menu.addAction( | 253 self.lastMenuAct = self.__menu.addAction( |
254 UI.PixmapCache.getIcon("2rightarrow.png"), | 254 UI.PixmapCache.getIcon("2rightarrow"), |
255 self.tr('Move Last'), self.__contextMenuMoveLast) | 255 self.tr('Move Last'), self.__contextMenuMoveLast) |
256 self.__menu.addSeparator() | 256 self.__menu.addSeparator() |
257 self.__menu.addAction( | 257 self.__menu.addAction( |
258 UI.PixmapCache.getIcon("tabClose.png"), | 258 UI.PixmapCache.getIcon("tabClose"), |
259 self.tr('Close'), self.__contextMenuClose) | 259 self.tr('Close'), self.__contextMenuClose) |
260 self.closeOthersMenuAct = self.__menu.addAction( | 260 self.closeOthersMenuAct = self.__menu.addAction( |
261 UI.PixmapCache.getIcon("tabCloseOther.png"), | 261 UI.PixmapCache.getIcon("tabCloseOther"), |
262 self.tr("Close Others"), self.__contextMenuCloseOthers) | 262 self.tr("Close Others"), self.__contextMenuCloseOthers) |
263 self.__menu.addAction( | 263 self.__menu.addAction( |
264 self.tr('Close All'), self.__contextMenuCloseAll) | 264 self.tr('Close All'), self.__contextMenuCloseAll) |
265 self.__menu.addSeparator() | 265 self.__menu.addSeparator() |
266 self.saveMenuAct = self.__menu.addAction( | 266 self.saveMenuAct = self.__menu.addAction( |
267 UI.PixmapCache.getIcon("fileSave.png"), | 267 UI.PixmapCache.getIcon("fileSave"), |
268 self.tr('Save'), self.__contextMenuSave) | 268 self.tr('Save'), self.__contextMenuSave) |
269 self.__menu.addAction( | 269 self.__menu.addAction( |
270 UI.PixmapCache.getIcon("fileSaveAs.png"), | 270 UI.PixmapCache.getIcon("fileSaveAs"), |
271 self.tr('Save As...'), self.__contextMenuSaveAs) | 271 self.tr('Save As...'), self.__contextMenuSaveAs) |
272 self.__menu.addAction( | 272 self.__menu.addAction( |
273 UI.PixmapCache.getIcon("fileSaveAll.png"), | 273 UI.PixmapCache.getIcon("fileSaveAll"), |
274 self.tr('Save All'), self.__contextMenuSaveAll) | 274 self.tr('Save All'), self.__contextMenuSaveAll) |
275 self.__menu.addSeparator() | 275 self.__menu.addSeparator() |
276 self.openRejectionsMenuAct = self.__menu.addAction( | 276 self.openRejectionsMenuAct = self.__menu.addAction( |
277 self.tr("Open 'rejection' file"), | 277 self.tr("Open 'rejection' file"), |
278 self.__contextMenuOpenRejections) | 278 self.__contextMenuOpenRejections) |
279 self.__menu.addSeparator() | 279 self.__menu.addSeparator() |
280 self.__menu.addAction( | 280 self.__menu.addAction( |
281 UI.PixmapCache.getIcon("print.png"), | 281 UI.PixmapCache.getIcon("print"), |
282 self.tr('Print'), self.__contextMenuPrintFile) | 282 self.tr('Print'), self.__contextMenuPrintFile) |
283 self.__menu.addSeparator() | 283 self.__menu.addSeparator() |
284 self.copyPathAct = self.__menu.addAction( | 284 self.copyPathAct = self.__menu.addAction( |
285 self.tr("Copy Path to Clipboard"), | 285 self.tr("Copy Path to Clipboard"), |
286 self.__contextMenuCopyPathToClipboard) | 286 self.__contextMenuCopyPathToClipboard) |
363 @param title title for the new tab | 363 @param title title for the new tab |
364 @type str | 364 @type str |
365 """ | 365 """ |
366 editor = assembly.getEditor() | 366 editor = assembly.getEditor() |
367 super(TabWidget, self).addTab( | 367 super(TabWidget, self).addTab( |
368 assembly, UI.PixmapCache.getIcon("empty.png"), title) | 368 assembly, UI.PixmapCache.getIcon("empty"), title) |
369 self.setTabsClosable(True) | 369 self.setTabsClosable(True) |
370 self.navigationButton.setEnabled(True) | 370 self.navigationButton.setEnabled(True) |
371 | 371 |
372 if editor not in self.editors: | 372 if editor not in self.editors: |
373 self.editors.append(editor) | 373 self.editors.append(editor) |
393 @rtype int | 393 @rtype int |
394 """ | 394 """ |
395 editor = assembly.getEditor() | 395 editor = assembly.getEditor() |
396 newIndex = super(TabWidget, self).insertTab( | 396 newIndex = super(TabWidget, self).insertTab( |
397 index, assembly, | 397 index, assembly, |
398 UI.PixmapCache.getIcon("empty.png"), | 398 UI.PixmapCache.getIcon("empty"), |
399 title) | 399 title) |
400 self.setTabsClosable(True) | 400 self.setTabsClosable(True) |
401 self.navigationButton.setEnabled(True) | 401 self.navigationButton.setEnabled(True) |
402 | 402 |
403 if editor not in self.editors: | 403 if editor not in self.editors: |
474 if index > -1: | 474 if index > -1: |
475 self.removeTab(index) | 475 self.removeTab(index) |
476 | 476 |
477 if not self.editors: | 477 if not self.editors: |
478 super(TabWidget, self).addTab( | 478 super(TabWidget, self).addTab( |
479 self.emptyLabel, UI.PixmapCache.getIcon("empty.png"), "") | 479 self.emptyLabel, UI.PixmapCache.getIcon("empty"), "") |
480 self.emptyLabel.show() | 480 self.emptyLabel.show() |
481 self.setTabsClosable(False) | 481 self.setTabsClosable(False) |
482 self.navigationButton.setEnabled(False) | 482 self.navigationButton.setEnabled(False) |
483 | 483 |
484 def __relocateTab(self, sourceId, sourceIndex, targetIndex): | 484 def __relocateTab(self, sourceId, sourceIndex, targetIndex): |
1107 if tw.hasEditor(editor): | 1107 if tw.hasEditor(editor): |
1108 break | 1108 break |
1109 index = tw.indexOf(editor) | 1109 index = tw.indexOf(editor) |
1110 keys = [] | 1110 keys = [] |
1111 if m: | 1111 if m: |
1112 keys.append("fileModified.png") | 1112 keys.append("fileModified") |
1113 if editor.hasSyntaxErrors(): | 1113 if editor.hasSyntaxErrors(): |
1114 keys.append("syntaxError22.png") | 1114 keys.append("syntaxError22") |
1115 elif editor.hasWarnings(): | 1115 elif editor.hasWarnings(): |
1116 keys.append("warning22.png") | 1116 keys.append("warning22") |
1117 if not keys: | 1117 if not keys: |
1118 keys.append("empty.png") | 1118 keys.append("empty") |
1119 tw.setTabIcon(index, UI.PixmapCache.getCombinedIcon(keys)) | 1119 tw.setTabIcon(index, UI.PixmapCache.getCombinedIcon(keys)) |
1120 self._checkActions(editor) | 1120 self._checkActions(editor) |
1121 | 1121 |
1122 def _syntaxErrorToggled(self, editor): | 1122 def _syntaxErrorToggled(self, editor): |
1123 """ | 1123 """ |
1130 if tw.hasEditor(editor): | 1130 if tw.hasEditor(editor): |
1131 break | 1131 break |
1132 index = tw.indexOf(editor) | 1132 index = tw.indexOf(editor) |
1133 keys = [] | 1133 keys = [] |
1134 if editor.isModified(): | 1134 if editor.isModified(): |
1135 keys.append("fileModified.png") | 1135 keys.append("fileModified") |
1136 if editor.hasSyntaxErrors(): | 1136 if editor.hasSyntaxErrors(): |
1137 keys.append("syntaxError22.png") | 1137 keys.append("syntaxError22") |
1138 elif editor.hasWarnings(): | 1138 elif editor.hasWarnings(): |
1139 keys.append("warning22.png") | 1139 keys.append("warning22") |
1140 if not keys: | 1140 if not keys: |
1141 keys.append("empty.png") | 1141 keys.append("empty") |
1142 tw.setTabIcon(index, UI.PixmapCache.getCombinedIcon(keys)) | 1142 tw.setTabIcon(index, UI.PixmapCache.getCombinedIcon(keys)) |
1143 | 1143 |
1144 ViewManager._syntaxErrorToggled(self, editor) | 1144 ViewManager._syntaxErrorToggled(self, editor) |
1145 | 1145 |
1146 def addSplit(self): | 1146 def addSplit(self): |