--- a/eric7/Plugins/VcsPlugins/vcsMercurial/hg.py Sat May 22 17:01:51 2021 +0200 +++ b/eric7/Plugins/VcsPlugins/vcsMercurial/hg.py Sat May 22 18:51:46 2021 +0200 @@ -16,8 +16,8 @@ ) from PyQt6.QtWidgets import QApplication, QDialog, QInputDialog -from E5Gui.E5Application import e5App -from E5Gui import E5MessageBox, E5FileDialog +from E5Gui.EricApplication import ericApp +from E5Gui import EricMessageBox, EricFileDialog from QScintilla.MiniEditor import MiniEditor @@ -275,7 +275,7 @@ """ success = self.vcsImport(vcsDataDict, project.ppath, addAll=addAll)[0] if not success: - E5MessageBox.critical( + EricMessageBox.critical( self.__ui, self.tr("Create project repository"), self.tr( @@ -452,7 +452,7 @@ for nam in nameList: # check for commit of the project if os.path.isdir(nam): - project = e5App().getObject("Project") + project = ericApp().getObject("Project") if nam == project.getProjectPath(): ok &= ( project.checkAllScriptsDirty( @@ -462,7 +462,7 @@ continue elif os.path.isfile(nam): editor = ( - e5App().getObject("ViewManager").getOpenEditor(nam) + ericApp().getObject("ViewManager").getOpenEditor(nam) ) if editor: ok &= editor.checkDirty() @@ -470,13 +470,13 @@ break if not ok: - res = E5MessageBox.yesNo( + res = EricMessageBox.yesNo( self.__ui, self.tr("Commit Changes"), self.tr( """The commit affects files, that have unsaved""" """ changes. Shall the commit be continued?"""), - icon=E5MessageBox.Warning) + icon=EricMessageBox.Warning) if not res: return @@ -536,7 +536,7 @@ dia.exec() self.committed.emit() if self.__forgotNames: - model = e5App().getObject("Project").getModel() + model = ericApp().getObject("Project").getModel() for name in self.__forgotNames: model.updateVCSStatus(name) self.__forgotNames = [] @@ -751,11 +751,11 @@ names = name[:] if isinstance(name, list) else [name] for nam in names: if os.path.isfile(nam): - editor = e5App().getObject("ViewManager").getOpenEditor(nam) + editor = ericApp().getObject("ViewManager").getOpenEditor(nam) if editor and not editor.checkDirty(): return else: - project = e5App().getObject("Project") + project = ericApp().getObject("Project") if nam == project.ppath and not project.saveAllScripts(): return if self.diff is None: @@ -868,7 +868,7 @@ args.append(name) names = [name] - project = e5App().getObject("Project") + project = ericApp().getObject("Project") names = [project.getRelativePath(nam) for nam in names] if names[0]: from UI.DeleteFilesConfirmationDialog import ( @@ -883,7 +883,7 @@ names) yes = dlg.exec() == QDialog.DialogCode.Accepted else: - yes = E5MessageBox.yesNo( + yes = EricMessageBox.yesNo( None, self.tr("Revert changes"), self.tr("""Do you really want to revert all changes of""" @@ -954,7 +954,7 @@ args.append(name) names = [name] - project = e5App().getObject("Project") + project = ericApp().getObject("Project") names = [project.getRelativePath(nam) for nam in names] if names[0]: from UI.DeleteFilesConfirmationDialog import ( @@ -969,7 +969,7 @@ names) yes = dlg.exec() == QDialog.DialogCode.Accepted else: - yes = E5MessageBox.yesNo( + yes = EricMessageBox.yesNo( None, self.tr("Re-Merge"), self.tr("""Do you really want to re-merge the project?""")) @@ -1453,11 +1453,11 @@ names = name[:] if isinstance(name, list) else [name] for nam in names: if os.path.isfile(nam): - editor = e5App().getObject("ViewManager").getOpenEditor(nam) + editor = ericApp().getObject("ViewManager").getOpenEditor(nam) if editor and not editor.checkDirty(): return else: - project = e5App().getObject("Project") + project = ericApp().getObject("Project") if nam == project.ppath and not project.saveAllScripts(): return @@ -1523,7 +1523,7 @@ output1, error = self.__hgGetFileForRevision(name, rev=rev1) if error: - E5MessageBox.critical( + EricMessageBox.critical( self.__ui, self.tr("Mercurial Side-by-Side Difference"), error) @@ -1533,7 +1533,7 @@ if rev2: output2, error = self.__hgGetFileForRevision(name, rev=rev2) if error: - E5MessageBox.critical( + EricMessageBox.critical( self.__ui, self.tr("Mercurial Side-by-Side Difference"), error) @@ -1545,7 +1545,7 @@ output2 = f1.read() name2 = "{0} (Work)".format(name) except OSError: - E5MessageBox.critical( + EricMessageBox.critical( self.__ui, self.tr("Mercurial Side-by-Side Difference"), self.tr( @@ -2022,12 +2022,12 @@ ignoreName = os.path.join(name, Hg.IgnoreFileName) res = ( - E5MessageBox.yesNo( + EricMessageBox.yesNo( self.__ui, self.tr("Create .hgignore file"), self.tr("""<p>The file <b>{0}</b> exists already.""" """ Overwrite it?</p>""").format(ignoreName), - icon=E5MessageBox.Warning) + icon=EricMessageBox.Warning) if os.path.exists(ignoreName) else True ) @@ -2043,7 +2043,7 @@ if status and autoAdd: self.vcsAdd(ignoreName, noDialog=True) - project = e5App().getObject("Project") + project = ericApp().getObject("Project") project.appendFile(ignoreName) return status @@ -2074,13 +2074,13 @@ compression = "" bundleAll = bundleData["all"] - fname, selectedFilter = E5FileDialog.getSaveFileNameAndFilter( + fname, selectedFilter = EricFileDialog.getSaveFileNameAndFilter( None, self.tr("Create changegroup"), self.__lastChangeGroupPath, self.tr("Mercurial Changegroup Files (*.hg)"), None, - E5FileDialog.DontConfirmOverwrite) + EricFileDialog.DontConfirmOverwrite) if not fname: return # user aborted @@ -2091,13 +2091,13 @@ if ex: fname += ex if QFileInfo(fname).exists(): - res = E5MessageBox.yesNo( + res = EricMessageBox.yesNo( self.__ui, self.tr("Create changegroup"), self.tr("<p>The Mercurial changegroup file <b>{0}</b> " "already exists. Overwrite it?</p>") .format(fname), - icon=E5MessageBox.Warning) + icon=EricMessageBox.Warning) if not res: return fname = Utilities.toNativeSeparators(fname) @@ -2127,7 +2127,7 @@ Public method used to view the log of incoming changes from a changegroup file. """ - file = E5FileDialog.getOpenFileName( + file = EricFileDialog.getOpenFileName( None, self.tr("Preview changegroup"), self.__lastChangeGroupPath, @@ -2155,7 +2155,7 @@ """ res = False if not files: - files = E5FileDialog.getOpenFileNames( + files = EricFileDialog.getOpenFileNames( None, self.tr("Apply changegroups"), self.__lastChangeGroupPath, @@ -2164,7 +2164,7 @@ if files: self.__lastChangeGroupPath = os.path.dirname(files[0]) - update = E5MessageBox.yesNo( + update = EricMessageBox.yesNo( self.__ui, self.tr("Apply changegroups"), self.tr("""Shall the working directory be updated?"""), @@ -2261,7 +2261,7 @@ if dlg.exec() == QDialog.DialogCode.Accepted: rev, merge, date, user, message = dlg.getParameters() if not rev: - E5MessageBox.warning( + EricMessageBox.warning( self.__ui, self.tr("Backing out changeset"), self.tr("""No revision given. Aborting...""")) @@ -2290,12 +2290,12 @@ """ Public method used to rollback the last transaction. """ - res = E5MessageBox.yesNo( + res = EricMessageBox.yesNo( None, self.tr("Rollback last transaction"), self.tr("""Are you sure you want to rollback the last""" """ transaction?"""), - icon=E5MessageBox.Warning) + icon=EricMessageBox.Warning) if res: dia = HgDialog(self.tr('Rollback last transaction'), self) res = dia.startProcess(["rollback"]) @@ -2577,7 +2577,7 @@ """ backupdir = os.path.join(self.getClient().getRepository(), self.adminDir, "strip-backup") - yes = E5MessageBox.yesNo( + yes = EricMessageBox.yesNo( self.__ui, self.tr("Delete All Backups"), self.tr("""<p>Do you really want to delete all backup bundles""" @@ -2633,7 +2633,7 @@ with open(hgsub, "r") as f: contents = f.readlines() except OSError as err: - E5MessageBox.critical( + EricMessageBox.critical( self.__ui, self.tr("Add Sub-repository"), self.tr( @@ -2643,7 +2643,7 @@ return if entry in contents: - E5MessageBox.critical( + EricMessageBox.critical( self.__ui, self.tr("Add Sub-repository"), self.tr( @@ -2661,7 +2661,7 @@ with open(hgsub, "w") as f: f.writelines(contents) except OSError as err: - E5MessageBox.critical( + EricMessageBox.critical( self.__ui, self.tr("Add Sub-repository"), self.tr( @@ -2682,7 +2682,7 @@ subrepositories = [] if not os.path.isfile(hgsub): - E5MessageBox.critical( + EricMessageBox.critical( self.__ui, self.tr("Remove Sub-repositories"), self.tr("""<p>The sub-repositories file .hgsub does not""" @@ -2693,7 +2693,7 @@ with open(hgsub, "r") as f: subrepositories = [line.strip() for line in f.readlines()] except OSError as err: - E5MessageBox.critical( + EricMessageBox.critical( self.__ui, self.tr("Remove Sub-repositories"), self.tr("""<p>The sub-repositories file .hgsub could not""" @@ -2712,7 +2712,7 @@ with open(hgsub, "w") as f: f.write(contents) except OSError as err: - E5MessageBox.critical( + EricMessageBox.critical( self.__ui, self.tr("Remove Sub-repositories"), self.tr( @@ -2797,7 +2797,7 @@ if self.__client: ok, err = self.__client.restartServer() if not ok: - E5MessageBox.warning( + EricMessageBox.warning( None, self.tr("Mercurial Command Server"), self.tr( @@ -2935,7 +2935,7 @@ self.__client = HgClient(repodir, "utf-8", self) ok, err = self.__client.startServer() if not ok: - E5MessageBox.warning( + EricMessageBox.warning( None, self.tr("Mercurial Command Server"), self.tr(