diff -r 8a7677a63c8d -r 68ec9c3d4de5 eric7/HexEdit/HexEditMainWindow.py --- a/eric7/HexEdit/HexEditMainWindow.py Sat May 22 17:01:51 2021 +0200 +++ b/eric7/HexEdit/HexEditMainWindow.py Sat May 22 18:51:46 2021 +0200 @@ -18,10 +18,10 @@ QWhatsThis, QLabel, QWidget, QVBoxLayout, QDialog, QFrame, QMenu ) -from E5Gui.E5Action import E5Action -from E5Gui.E5MainWindow import E5MainWindow -from E5Gui import E5FileDialog, E5MessageBox -from E5Gui.E5ClickableLabel import E5ClickableLabel +from E5Gui.EricAction import EricAction +from E5Gui.EricMainWindow import EricMainWindow +from E5Gui import EricFileDialog, EricMessageBox +from E5Gui.EricClickableLabel import EricClickableLabel from Globals import strGroup, recentNameHexFiles @@ -36,7 +36,7 @@ import Utilities -class HexEditMainWindow(E5MainWindow): +class HexEditMainWindow(EricMainWindow): """ Class implementing the web browser main window. @@ -156,7 +156,7 @@ """ Private method to define the file related user interface actions. """ - self.newWindowAct = E5Action( + self.newWindowAct = EricAction( self.tr('New Window'), UI.PixmapCache.getIcon("newWindow"), self.tr('New &Window'), @@ -172,7 +172,7 @@ self.__actions.append(self.newWindowAct) # correct texts will be set later - self.openAct = E5Action( + self.openAct = EricAction( self.tr('Open'), UI.PixmapCache.getIcon("open"), self.tr('&Open...'), @@ -182,13 +182,13 @@ self.__actions.append(self.openAct) # correct texts will be set later - self.openReadOnlyAct = E5Action( + self.openReadOnlyAct = EricAction( "", "", 0, 0, self, 'hexEditor_file_open_read_only') self.openReadOnlyAct.triggered.connect(self.__openHexFileReadOnly) self.__actions.append(self.openReadOnlyAct) - self.saveAct = E5Action( + self.saveAct = EricAction( self.tr('Save'), UI.PixmapCache.getIcon("fileSave"), self.tr('&Save'), @@ -202,7 +202,7 @@ self.saveAct.triggered.connect(self.__saveHexFile) self.__actions.append(self.saveAct) - self.saveAsAct = E5Action( + self.saveAsAct = EricAction( self.tr('Save As'), UI.PixmapCache.getIcon("fileSaveAs"), self.tr('Save &As...'), @@ -217,7 +217,7 @@ self.saveAsAct.triggered.connect(self.__saveHexFileAs) self.__actions.append(self.saveAsAct) - self.saveReadableAct = E5Action( + self.saveReadableAct = EricAction( self.tr('Save As Readable'), self.tr('Save As &Readable...'), 0, 0, self, 'hexEditor_file_save_readable') @@ -232,7 +232,7 @@ self.saveReadableAct.triggered.connect(self.__saveHexFileReadable) self.__actions.append(self.saveReadableAct) - self.closeAct = E5Action( + self.closeAct = EricAction( self.tr('Close'), UI.PixmapCache.getIcon("close"), self.tr('&Close'), @@ -247,7 +247,7 @@ self.closeAct.triggered.connect(self.close) self.__actions.append(self.closeAct) - self.closeAllAct = E5Action( + self.closeAllAct = EricAction( self.tr('Close All'), self.tr('Close &All'), 0, 0, self, 'hexEditor_file_close_all') @@ -260,7 +260,7 @@ self.closeAllAct.triggered.connect(self.__closeAll) self.__actions.append(self.closeAllAct) - self.closeOthersAct = E5Action( + self.closeOthersAct = EricAction( self.tr('Close Others'), self.tr('Close Others'), 0, 0, self, 'hexEditor_file_close_others') @@ -273,7 +273,7 @@ self.closeOthersAct.triggered.connect(self.__closeOthers) self.__actions.append(self.closeOthersAct) - self.exitAct = E5Action( + self.exitAct = EricAction( self.tr('Quit'), UI.PixmapCache.getIcon("exit"), self.tr('&Quit'), @@ -292,7 +292,7 @@ """ Private method to create the Edit actions. """ - self.undoAct = E5Action( + self.undoAct = EricAction( self.tr('Undo'), UI.PixmapCache.getIcon("editUndo"), self.tr('&Undo'), @@ -307,7 +307,7 @@ self.undoAct.triggered.connect(self.__editor.undo) self.__actions.append(self.undoAct) - self.redoAct = E5Action( + self.redoAct = EricAction( self.tr('Redo'), UI.PixmapCache.getIcon("editRedo"), self.tr('&Redo'), @@ -321,7 +321,7 @@ self.redoAct.triggered.connect(self.__editor.redo) self.__actions.append(self.redoAct) - self.revertAct = E5Action( + self.revertAct = EricAction( self.tr('Revert to last saved state'), self.tr('Re&vert to last saved state'), QKeySequence(self.tr("Ctrl+Y", "Edit|Revert")), @@ -336,7 +336,7 @@ self.revertAct.triggered.connect(self.__editor.revertToUnmodified) self.__actions.append(self.revertAct) - self.cutAct = E5Action( + self.cutAct = EricAction( self.tr('Cut'), UI.PixmapCache.getIcon("editCut"), self.tr('Cu&t'), @@ -351,7 +351,7 @@ self.cutAct.triggered.connect(self.__editor.cut) self.__actions.append(self.cutAct) - self.copyAct = E5Action( + self.copyAct = EricAction( self.tr('Copy'), UI.PixmapCache.getIcon("editCopy"), self.tr('&Copy'), @@ -366,7 +366,7 @@ self.copyAct.triggered.connect(self.__editor.copy) self.__actions.append(self.copyAct) - self.pasteAct = E5Action( + self.pasteAct = EricAction( self.tr('Paste'), UI.PixmapCache.getIcon("editPaste"), self.tr('&Paste'), @@ -381,7 +381,7 @@ self.pasteAct.triggered.connect(self.__editor.paste) self.__actions.append(self.pasteAct) - self.selectAllAct = E5Action( + self.selectAllAct = EricAction( self.tr('Select All'), UI.PixmapCache.getIcon("editSelectAll"), self.tr('&Select All'), @@ -397,7 +397,7 @@ self.selectAllAct.triggered.connect(self.__editor.selectAll) self.__actions.append(self.selectAllAct) - self.deselectAllAct = E5Action( + self.deselectAllAct = EricAction( self.tr('Deselect all'), self.tr('&Deselect all'), QKeySequence(self.tr("Alt+Ctrl+A", "Edit|Deselect all")), @@ -411,7 +411,7 @@ self.deselectAllAct.triggered.connect(self.__editor.deselectAll) self.__actions.append(self.deselectAllAct) - self.saveSelectionReadableAct = E5Action( + self.saveSelectionReadableAct = EricAction( self.tr('Save Selection Readable'), self.tr('Save Selection Readable...'), 0, 0, self, 'hexEditor_edit_selection_save_readable') @@ -427,7 +427,7 @@ self.__saveSelectionReadable) self.__actions.append(self.saveSelectionReadableAct) - self.readonlyAct = E5Action( + self.readonlyAct = EricAction( self.tr('Set Read Only'), self.tr('Set Read Only'), 0, 0, self, 'hexEditor_edit_readonly', True) @@ -443,7 +443,7 @@ self.__editor.readOnlyChanged.connect(self.readonlyAct.setChecked) self.__actions.append(self.readonlyAct) - self.searchAct = E5Action( + self.searchAct = EricAction( self.tr('Search'), UI.PixmapCache.getIcon("find"), self.tr('&Search...'), @@ -459,7 +459,7 @@ self.searchAct.triggered.connect(self.__search) self.__actions.append(self.searchAct) - self.searchNextAct = E5Action( + self.searchNextAct = EricAction( self.tr('Search next'), UI.PixmapCache.getIcon("findNext"), self.tr('Search &next'), @@ -476,7 +476,7 @@ self.searchNextAct.triggered.connect(self.__searchWidget.findPrevNext) self.__actions.append(self.searchNextAct) - self.searchPrevAct = E5Action( + self.searchPrevAct = EricAction( self.tr('Search previous'), UI.PixmapCache.getIcon("findPrev"), self.tr('Search &previous'), @@ -494,7 +494,7 @@ lambda: self.__searchWidget.findPrevNext(True)) self.__actions.append(self.searchPrevAct) - self.replaceAct = E5Action( + self.replaceAct = EricAction( self.tr('Replace'), self.tr('&Replace...'), QKeySequence(self.tr("Ctrl+R", "Search|Replace")), @@ -510,7 +510,7 @@ self.replaceAct.triggered.connect(self.__replace) self.__actions.append(self.replaceAct) - self.gotoAct = E5Action( + self.gotoAct = EricAction( self.tr('Goto Offset'), UI.PixmapCache.getIcon("goto"), self.tr('&Goto Offset...'), @@ -548,7 +548,7 @@ """ Private method to create the Help actions. """ - self.aboutAct = E5Action( + self.aboutAct = EricAction( self.tr('About'), self.tr('&About'), 0, 0, self, 'hexEditor_help_about') @@ -560,7 +560,7 @@ self.aboutAct.triggered.connect(self.__about) self.__actions.append(self.aboutAct) - self.aboutQtAct = E5Action( + self.aboutQtAct = EricAction( self.tr('About Qt'), self.tr('About &Qt'), 0, 0, self, 'hexEditor_help_about_qt') @@ -573,7 +573,7 @@ self.aboutQtAct.triggered.connect(self.__aboutQt) self.__actions.append(self.aboutQtAct) - self.whatsThisAct = E5Action( + self.whatsThisAct = EricAction( self.tr('What\'s This?'), UI.PixmapCache.getIcon("whatsThis"), self.tr('&What\'s This?'), @@ -595,7 +595,7 @@ """ Private method to create the Settings actions. """ - self.prefAct = E5Action( + self.prefAct = EricAction( self.tr('Preferences'), UI.PixmapCache.getIcon("configure"), self.tr('&Preferences...'), @@ -797,7 +797,7 @@ self.__sbSize.setFrameStyle( QFrame.Shape.StyledPanel | QFrame.Shadow.Plain) - self.__sbEditMode = E5ClickableLabel(self.__statusBar) + self.__sbEditMode = EricClickableLabel(self.__statusBar) self.__statusBar.addPermanentWidget(self.__sbEditMode) self.__sbEditMode.setWhatsThis(self.tr( """<p>This part of the status bar displays the edit mode.</p>""" @@ -806,7 +806,7 @@ QFrame.Shape.StyledPanel | QFrame.Shadow.Plain) self.__sbEditMode.clicked.connect(self.__toggleEditMode) - self.__sbReadOnly = E5ClickableLabel(self.__statusBar) + self.__sbReadOnly = EricClickableLabel(self.__statusBar) self.__statusBar.addPermanentWidget(self.__sbReadOnly) self.__sbReadOnly.setWhatsThis(self.tr( """<p>This part of the status bar displays the read""" @@ -946,7 +946,7 @@ ): self.__lastOpenPath = self.__project.getProjectPath() - fileName = E5FileDialog.getOpenFileName( + fileName = EricFileDialog.getOpenFileName( self, self.tr("Open binary file in new window"), self.__lastOpenPath, @@ -967,7 +967,7 @@ @rtype bool """ if self.__editor.isModified(): - ret = E5MessageBox.okToClearData( + ret = EricMessageBox.okToClearData( self, self.tr("eric Hex Editor"), self.tr("""The loaded file has unsaved changes."""), @@ -985,14 +985,14 @@ """ file = QFile(fileName) if not file.exists(): - E5MessageBox.warning( + EricMessageBox.warning( self, self.tr("eric Hex Editor"), self.tr("The file '{0}' does not exist.") .format(fileName)) return if not file.open(QFile.ReadOnly): - E5MessageBox.warning( + EricMessageBox.warning( self, self.tr("eric Hex Editor"), self.tr("Cannot read file '{0}:\n{1}.") .format(fileName, file.errorString())) @@ -1021,7 +1021,7 @@ ): self.__lastOpenPath = self.__project.getProjectPath() - fileName = E5FileDialog.getOpenFileName( + fileName = EricFileDialog.getOpenFileName( self, self.tr("Open binary file"), self.__lastOpenPath, @@ -1072,22 +1072,22 @@ if not self.__lastSavePath and self.__lastOpenPath: self.__lastSavePath = self.__lastOpenPath - fileName = E5FileDialog.getSaveFileName( + fileName = EricFileDialog.getSaveFileName( self, self.tr("Save binary file"), self.__lastSavePath, self.tr("All Files (*)"), - E5FileDialog.DontConfirmOverwrite) + EricFileDialog.DontConfirmOverwrite) if not fileName: return False if QFileInfo(fileName).exists(): - res = E5MessageBox.yesNo( + res = EricMessageBox.yesNo( self, self.tr("Save binary file"), self.tr("<p>The file <b>{0}</b> already exists." " Overwrite it?</p>").format(fileName), - icon=E5MessageBox.Warning) + icon=EricMessageBox.Warning) if not res: return False @@ -1106,7 +1106,7 @@ """ file = QFile(fileName) if not file.open(QFile.WriteOnly): - E5MessageBox.warning( + EricMessageBox.warning( self, self.tr("eric Hex Editor"), self.tr("Cannot write file '{0}:\n{1}.") .format(fileName, file.errorString())) @@ -1119,7 +1119,7 @@ file.close() if not res: - E5MessageBox.warning( + EricMessageBox.warning( self, self.tr("eric Hex Editor"), self.tr("Cannot write file '{0}:\n{1}.") .format(fileName, file.errorString())) @@ -1154,13 +1154,13 @@ if not savePath and self.__lastOpenPath: savePath = self.__lastOpenPath - fileName, selectedFilter = E5FileDialog.getSaveFileNameAndFilter( + fileName, selectedFilter = EricFileDialog.getSaveFileNameAndFilter( self, self.tr("Save to readable file"), savePath, self.tr("Text Files (*.txt);;All Files (*)"), self.tr("Text Files (*.txt)"), - E5FileDialog.DontConfirmOverwrite) + EricFileDialog.DontConfirmOverwrite) if not fileName: return @@ -1170,18 +1170,18 @@ if ex: fileName += ex if QFileInfo(fileName).exists(): - res = E5MessageBox.yesNo( + res = EricMessageBox.yesNo( self, self.tr("Save to readable file"), self.tr("<p>The file <b>{0}</b> already exists." " Overwrite it?</p>").format(fileName), - icon=E5MessageBox.Warning) + icon=EricMessageBox.Warning) if not res: return file = QFile(fileName) if not file.open(QFile.WriteOnly): - E5MessageBox.warning( + EricMessageBox.warning( self, self.tr("eric Hex Editor"), self.tr("Cannot write file '{0}:\n{1}.") .format(fileName, file.errorString())) @@ -1196,7 +1196,7 @@ file.close() if not res: - E5MessageBox.warning( + EricMessageBox.warning( self, self.tr("eric Hex Editor"), self.tr("Cannot write file '{0}:\n{1}.") .format(fileName, file.errorString())) @@ -1300,7 +1300,7 @@ """ Private slot to show a little About message. """ - E5MessageBox.about( + EricMessageBox.about( self, self.tr("About eric Hex Editor"), self.tr("The eric Hex Editor is a simple editor component" " to edit binary files.")) @@ -1309,7 +1309,7 @@ """ Private slot to handle the About Qt dialog. """ - E5MessageBox.aboutQt(self, "eric Hex Editor") + EricMessageBox.aboutQt(self, "eric Hex Editor") def __whatsThis(self): """