src/eric7/Plugins/ViewManagerPlugins/Listspace/Listspace.py

branch
eric7
changeset 9413
80c06d472826
parent 9221
bf71ee032bb4
child 9473
3f23dbf37dbe
equal deleted inserted replaced
9412:45e7bb09c120 9413:80c06d472826
18 QSizePolicy, 18 QSizePolicy,
19 QMenu, 19 QMenu,
20 QApplication, 20 QApplication,
21 ) 21 )
22 22
23 from EricWidgets.EricApplication import ericApp 23 from eric7.EricWidgets.EricApplication import ericApp
24 24
25 from ViewManager.ViewManager import ViewManager 25 from eric7.ViewManager.ViewManager import ViewManager
26 26
27 import QScintilla.Editor 27 from eric7.QScintilla.Editor import Editor
28 from QScintilla.Editor import Editor 28 from eric7.QScintilla.EditorAssembly import EditorAssembly
29 from QScintilla.EditorAssembly import EditorAssembly 29
30 30 from eric7.EricGui import EricPixmapCache
31 import UI.PixmapCache 31 from eric7 import Preferences
32 import Preferences
33 32
34 33
35 class StackedWidget(QStackedWidget): 34 class StackedWidget(QStackedWidget):
36 """ 35 """
37 Class implementing a custimized StackedWidget. 36 Class implementing a custimized StackedWidget.
65 Public method to remove a widget. 64 Public method to remove a widget.
66 65
67 @param widget widget to be removed 66 @param widget widget to be removed
68 @type QWidget 67 @type QWidget
69 """ 68 """
70 if isinstance(widget, QScintilla.Editor.Editor): 69 if isinstance(widget, Editor):
71 self.editors.remove(widget) 70 self.editors.remove(widget)
72 widget = widget.parent() 71 widget = widget.parent()
73 super().removeWidget(widget) 72 super().removeWidget(widget)
74 73
75 def currentWidget(self): 74 def currentWidget(self):
90 89
91 @param widget widget to be made current 90 @param widget widget to be made current
92 @type QWidget 91 @type QWidget
93 """ 92 """
94 if widget is not None: 93 if widget is not None:
95 if isinstance(widget, QScintilla.Editor.Editor): 94 if isinstance(widget, Editor):
96 self.editors.remove(widget) 95 self.editors.remove(widget)
97 self.editors.insert(0, widget) 96 self.editors.insert(0, widget)
98 widget = widget.parent() 97 widget = widget.parent()
99 super().setCurrentWidget(widget) 98 super().setCurrentWidget(widget)
100 99
262 """ 261 """
263 Private method to initialize the viewlist context menu. 262 Private method to initialize the viewlist context menu.
264 """ 263 """
265 self.__startMenu = QMenu(self.tr("Start"), self) 264 self.__startMenu = QMenu(self.tr("Start"), self)
266 self.__startMenu.addAction( 265 self.__startMenu.addAction(
267 UI.PixmapCache.getIcon("runScript"), 266 EricPixmapCache.getIcon("runScript"),
268 self.tr("Run Script..."), 267 self.tr("Run Script..."),
269 self.__contextMenuRunScript, 268 self.__contextMenuRunScript,
270 ) 269 )
271 self.__startMenu.addAction( 270 self.__startMenu.addAction(
272 UI.PixmapCache.getIcon("debugScript"), 271 EricPixmapCache.getIcon("debugScript"),
273 self.tr("Debug Script..."), 272 self.tr("Debug Script..."),
274 self.__contextMenuDebugScript, 273 self.__contextMenuDebugScript,
275 ) 274 )
276 self.__startMenu.addAction( 275 self.__startMenu.addAction(
277 UI.PixmapCache.getIcon("profileScript"), 276 EricPixmapCache.getIcon("profileScript"),
278 self.tr("Profile Script..."), 277 self.tr("Profile Script..."),
279 self.__contextMenuProfileScript, 278 self.__contextMenuProfileScript,
280 ) 279 )
281 self.__startMenu.addAction( 280 self.__startMenu.addAction(
282 UI.PixmapCache.getIcon("coverageScript"), 281 EricPixmapCache.getIcon("coverageScript"),
283 self.tr("Coverage run of Script..."), 282 self.tr("Coverage run of Script..."),
284 self.__contextMenuCoverageScript, 283 self.__contextMenuCoverageScript,
285 ) 284 )
286 285
287 self.__menu = QMenu(self) 286 self.__menu = QMenu(self)
288 self.__menu.addAction( 287 self.__menu.addAction(
289 UI.PixmapCache.getIcon("tabClose"), 288 EricPixmapCache.getIcon("tabClose"),
290 self.tr("Close"), 289 self.tr("Close"),
291 self.__contextMenuClose, 290 self.__contextMenuClose,
292 ) 291 )
293 self.closeOthersMenuAct = self.__menu.addAction( 292 self.closeOthersMenuAct = self.__menu.addAction(
294 UI.PixmapCache.getIcon("tabCloseOther"), 293 EricPixmapCache.getIcon("tabCloseOther"),
295 self.tr("Close Others"), 294 self.tr("Close Others"),
296 self.__contextMenuCloseOthers, 295 self.__contextMenuCloseOthers,
297 ) 296 )
298 self.__menu.addAction(self.tr("Close All"), self.__contextMenuCloseAll) 297 self.__menu.addAction(self.tr("Close All"), self.__contextMenuCloseAll)
299 self.__menu.addSeparator() 298 self.__menu.addSeparator()
300 self.saveMenuAct = self.__menu.addAction( 299 self.saveMenuAct = self.__menu.addAction(
301 UI.PixmapCache.getIcon("fileSave"), self.tr("Save"), self.__contextMenuSave 300 EricPixmapCache.getIcon("fileSave"), self.tr("Save"), self.__contextMenuSave
302 ) 301 )
303 self.__menu.addAction( 302 self.__menu.addAction(
304 UI.PixmapCache.getIcon("fileSaveAs"), 303 EricPixmapCache.getIcon("fileSaveAs"),
305 self.tr("Save As..."), 304 self.tr("Save As..."),
306 self.__contextMenuSaveAs, 305 self.__contextMenuSaveAs,
307 ) 306 )
308 self.__menu.addAction( 307 self.__menu.addAction(
309 UI.PixmapCache.getIcon("fileSaveAll"), 308 EricPixmapCache.getIcon("fileSaveAll"),
310 self.tr("Save All"), 309 self.tr("Save All"),
311 self.__contextMenuSaveAll, 310 self.__contextMenuSaveAll,
312 ) 311 )
313 self.__menu.addSeparator() 312 self.__menu.addSeparator()
314 self.openRejectionsMenuAct = self.__menu.addAction( 313 self.openRejectionsMenuAct = self.__menu.addAction(
316 ) 315 )
317 self.__menu.addSeparator() 316 self.__menu.addSeparator()
318 self.__startAct = self.__menu.addMenu(self.__startMenu) 317 self.__startAct = self.__menu.addMenu(self.__startMenu)
319 self.__menu.addSeparator() 318 self.__menu.addSeparator()
320 self.__menu.addAction( 319 self.__menu.addAction(
321 UI.PixmapCache.getIcon("printPreview"), 320 EricPixmapCache.getIcon("printPreview"),
322 self.tr("Print Preview"), 321 self.tr("Print Preview"),
323 self.__contextMenuPrintPreviewFile, 322 self.__contextMenuPrintPreviewFile,
324 ) 323 )
325 self.__menu.addAction( 324 self.__menu.addAction(
326 UI.PixmapCache.getIcon("print"), 325 EricPixmapCache.getIcon("print"),
327 self.tr("Print"), 326 self.tr("Print"),
328 self.__contextMenuPrintFile, 327 self.__contextMenuPrintFile,
329 ) 328 )
330 self.__menu.addSeparator() 329 self.__menu.addSeparator()
331 self.copyPathAct = self.__menu.addAction( 330 self.copyPathAct = self.__menu.addAction(
656 keys.append("warning22") 655 keys.append("warning22")
657 if not keys: 656 if not keys:
658 keys.append("empty") 657 keys.append("empty")
659 item = self.viewlist.item(index) 658 item = self.viewlist.item(index)
660 if item: 659 if item:
661 item.setIcon(UI.PixmapCache.getCombinedIcon(keys)) 660 item.setIcon(EricPixmapCache.getCombinedIcon(keys))
662 self.viewlist.setCurrentRow(currentRow) 661 self.viewlist.setCurrentRow(currentRow)
663 self._checkActions(editor) 662 self._checkActions(editor)
664 663
665 def _syntaxErrorToggled(self, editor): 664 def _syntaxErrorToggled(self, editor):
666 """ 665 """
680 keys.append("warning22") 679 keys.append("warning22")
681 if not keys: 680 if not keys:
682 keys.append("empty") 681 keys.append("empty")
683 item = self.viewlist.item(index) 682 item = self.viewlist.item(index)
684 if item: 683 if item:
685 item.setIcon(UI.PixmapCache.getCombinedIcon(keys)) 684 item.setIcon(EricPixmapCache.getCombinedIcon(keys))
686 self.viewlist.setCurrentRow(currentRow) 685 self.viewlist.setCurrentRow(currentRow)
687 686
688 ViewManager._syntaxErrorToggled(self, editor) 687 ViewManager._syntaxErrorToggled(self, editor)
689 688
690 def addSplit(self): 689 def addSplit(self):
999 ): 998 ):
1000 switched = True 999 switched = True
1001 if isinstance(watched, QStackedWidget): 1000 if isinstance(watched, QStackedWidget):
1002 switched = watched is not self.currentStack 1001 switched = watched is not self.currentStack
1003 self.currentStack = watched 1002 self.currentStack = watched
1004 elif isinstance(watched, QScintilla.Editor.Editor): 1003 elif isinstance(watched, Editor):
1005 for stack in self.stacks: 1004 for stack in self.stacks:
1006 if stack.hasEditor(watched): 1005 if stack.hasEditor(watched):
1007 switched = stack is not self.currentStack 1006 switched = stack is not self.currentStack
1008 self.currentStack = stack 1007 self.currentStack = stack
1009 break 1008 break

eric ide

mercurial