diff -r f95dde35d0ab -r 0090cfa83159 eric6/UI/PythonDisViewer.py --- a/eric6/UI/PythonDisViewer.py Mon Apr 26 17:33:08 2021 +0200 +++ b/eric6/UI/PythonDisViewer.py Tue Apr 27 17:25:06 2021 +0200 @@ -32,8 +32,8 @@ """ Class implementing the disassembly viewer operation modes. """ - SourceDisassemblyMode = 0 - TracebackMode = 1 + SOURCEDISASSEMBLY = 0 + TRACEBACK = 1 class PythonDisViewer(QWidget, Ui_PythonDisViewer): @@ -46,7 +46,7 @@ CodeInfoRole = Qt.ItemDataRole.UserRole + 2 def __init__(self, viewmanager, - mode=PythonDisViewerModes.SourceDisassemblyMode, + mode=PythonDisViewerModes.SOURCEDISASSEMBLY, parent=None): """ Constructor @@ -78,7 +78,7 @@ [self.tr("Key"), self.tr("Value")]) self.__disMenu = QMenu(self.disWidget) - if self.__mode == PythonDisViewerModes.SourceDisassemblyMode: + if self.__mode == PythonDisViewerModes.SOURCEDISASSEMBLY: self.__codeInfoAct = self.__disMenu.addAction( self.tr("Show Code Info"), self.__showCodeInfo) self.__disMenu.addSeparator() @@ -91,7 +91,7 @@ self.tr('Configure...'), self.__configure) self.__codeInfoMenu = QMenu(self.codeInfoWidget) - if self.__mode == PythonDisViewerModes.SourceDisassemblyMode: + if self.__mode == PythonDisViewerModes.SOURCEDISASSEMBLY: self.__codeInfoMenu.addAction( self.tr("Hide"), self.codeInfoWidget.hide) self.__codeInfoMenu.addAction( @@ -112,7 +112,7 @@ self.__showCodeInfoDetails = Preferences.getPython( "DisViewerExpandCodeInfoDetails") - if self.__mode == PythonDisViewerModes.SourceDisassemblyMode: + if self.__mode == PythonDisViewerModes.SOURCEDISASSEMBLY: self.disWidget.itemClicked.connect(self.__disItemClicked) self.disWidget.itemCollapsed.connect(self.__resizeDisColumns) self.disWidget.itemExpanded.connect(self.__resizeDisColumns) @@ -124,14 +124,14 @@ self.codeInfoWidget.customContextMenuRequested.connect( self.__codeInfoContextMenuRequested) - if self.__mode == PythonDisViewerModes.SourceDisassemblyMode: + if self.__mode == PythonDisViewerModes.SOURCEDISASSEMBLY: self.__vm.disViewerStateChanged.connect( self.__disViewerStateChanged) self.codeInfoWidget.hide() self.hide() - elif self.__mode == PythonDisViewerModes.TracebackMode: + elif self.__mode == PythonDisViewerModes.TRACEBACK: self.__styleLabels() def __disContextMenuRequested(self, coord): @@ -141,7 +141,7 @@ @param coord position of the mouse pointer @type QPoint """ - if self.__mode == PythonDisViewerModes.SourceDisassemblyMode: + if self.__mode == PythonDisViewerModes.SOURCEDISASSEMBLY: itm = self.disWidget.itemAt(coord) self.__codeInfoAct.setEnabled(bool(itm.data(0, self.CodeInfoRole))) self.disWidget.setCurrentItem(itm) @@ -217,7 +217,7 @@ super().show() if ( - self.__mode == PythonDisViewerModes.SourceDisassemblyMode and + self.__mode == PythonDisViewerModes.SOURCEDISASSEMBLY and not self.__vmConnected ): self.__vm.editorChangedEd.connect(self.__editorChanged) @@ -239,7 +239,7 @@ self.__editor.clearAllHighlights() if ( - self.__mode == PythonDisViewerModes.SourceDisassemblyMode and + self.__mode == PythonDisViewerModes.SOURCEDISASSEMBLY and self.__vmConnected ): self.__vm.editorChangedEd.disconnect(self.__editorChanged) @@ -262,7 +262,7 @@ @param on flag indicating to show the Disassembly @type bool """ - if self.__mode == PythonDisViewerModes.SourceDisassemblyMode: + if self.__mode == PythonDisViewerModes.SOURCEDISASSEMBLY: editor = self.__vm.activeWindow() if on: if editor is not self.__editor: @@ -444,7 +444,7 @@ Private method to generate the Disassembly from the source of the current editor and visualize it. """ - if self.__mode != PythonDisViewerModes.SourceDisassemblyMode: + if self.__mode != PythonDisViewerModes.SOURCEDISASSEMBLY: # wrong mode, just return return @@ -501,7 +501,7 @@ @type dict """ if ( - self.__mode == PythonDisViewerModes.TracebackMode and + self.__mode == PythonDisViewerModes.TRACEBACK and disassembly and "instructions" in disassembly and disassembly["instructions"]