eric6/Project/Project.py

branch
maintenance
changeset 8176
31965986ecd1
parent 8142
43248bafe9b2
parent 8164
c8b88e73b56f
child 8273
698ae46f40a4
--- a/eric6/Project/Project.py	Sat Mar 06 10:00:52 2021 +0100
+++ b/eric6/Project/Project.py	Sun Mar 28 15:00:11 2021 +0200
@@ -455,6 +455,10 @@
         self.dbgAutoContinue = True
         self.dbgEnableMultiprocess = True
         self.dbgMultiprocessNoDebug = ""
+        self.dbgGlobalConfigOverride = {
+            "enable": False,
+            "redirect": True,
+        }
         
         self.pdata = {
             "DESCRIPTION": "",
@@ -814,7 +818,7 @@
         else:
             # old XML based format
             f = QFile(fn)
-            if f.open(QIODevice.ReadOnly):
+            if f.open(QIODevice.OpenModeFlag.ReadOnly):
                 from E5XML.ProjectReader import ProjectReader
                 reader = ProjectReader(f, self)
                 reader.readXML()
@@ -825,7 +829,7 @@
                 if reader.version.startswith("5.") and not self.pdata["HASH"]:
                     hashStr = str(QCryptographicHash.hash(
                         QByteArray(self.ppath.encode("utf-8")),
-                        QCryptographicHash.Sha1).toHex(),
+                        QCryptographicHash.Algorithm.Sha1).toHex(),
                         encoding="utf-8")
                     self.pdata["HASH"] = hashStr
                     self.setDirty(True)
@@ -911,7 +915,7 @@
         if not self.pdata["HASH"]:
             hashStr = str(QCryptographicHash.hash(
                 QByteArray(self.ppath.encode("utf-8")),
-                QCryptographicHash.Sha1).toHex(),
+                QCryptographicHash.Algorithm.Sha1).toHex(),
                 encoding="utf-8")
             self.pdata["HASH"] = hashStr
         
@@ -925,7 +929,7 @@
         else:
             # old XML based format
             f = QFile(fn)
-            if f.open(QIODevice.WriteOnly):
+            if f.open(QIODevice.OpenModeFlag.WriteOnly):
                 from E5XML.ProjectWriter import ProjectWriter
                 ProjectWriter(f, os.path.splitext(
                     os.path.basename(fn))[0]).writeXML()
@@ -970,7 +974,7 @@
                               '{0}.e4q'.format(fn1))
             if os.path.exists(fn):
                 f = QFile(fn)
-                if f.open(QIODevice.ReadOnly):
+                if f.open(QIODevice.OpenModeFlag.ReadOnly):
                     from E5XML.UserProjectReader import UserProjectReader
                     reader = UserProjectReader(f, self)
                     reader.readXML()
@@ -1044,7 +1048,7 @@
                               '{0}{1}.e5s'.format(fn1, indicator))
             if os.path.exists(fn):
                 f = QFile(fn)
-                if f.open(QIODevice.ReadOnly):
+                if f.open(QIODevice.OpenModeFlag.ReadOnly):
                     from E5XML.SessionReader import SessionReader
                     reader = SessionReader(f, False)
                     reader.readXML(quiet=quiet)
@@ -1131,7 +1135,7 @@
                               '{0}.e6t'.format(base))
             if os.path.exists(fn):
                 f = QFile(fn)
-                if f.open(QIODevice.ReadOnly):
+                if f.open(QIODevice.OpenModeFlag.ReadOnly):
                     from E5XML.TasksReader import TasksReader
                     reader = TasksReader(f, True)
                     reader.readXML()
@@ -1209,7 +1213,7 @@
                               '{0}.e4d'.format(fn1))
             
             f = QFile(fn)
-            if f.open(QIODevice.ReadOnly):
+            if f.open(QIODevice.OpenModeFlag.ReadOnly):
                 from E5XML.DebuggerPropertiesReader import (
                     DebuggerPropertiesReader
                 )
@@ -1315,7 +1319,7 @@
         """
         from .DebuggerPropertiesDialog import DebuggerPropertiesDialog
         dlg = DebuggerPropertiesDialog(self)
-        if dlg.exec() == QDialog.Accepted:
+        if dlg.exec() == QDialog.DialogCode.Accepted:
             dlg.storeData()
         
     def getDebugProperty(self, key):
@@ -1336,7 +1340,7 @@
     def setDbgInfo(self, venvName, argv, wd, env, excReporting, excList,
                    excIgnoreList, autoClearShell, tracePython=None,
                    autoContinue=None, enableMultiprocess=None,
-                   multiprocessNoDebug=None):
+                   multiprocessNoDebug=None, configOverride=None):
         """
         Public method to set the debugging information.
         
@@ -1369,6 +1373,9 @@
         @param multiprocessNoDebug list of programs not to be debugged in
             multi process mode
         @type str
+        @param configOverride dictionary containing the global config override
+            data
+        @type dict
         """
         self.dbgVirtualEnv = venvName
         self.dbgCmdline = argv
@@ -1386,6 +1393,8 @@
             self.dbgEnableMultiprocess = enableMultiprocess
         if multiprocessNoDebug is not None:
             self.dbgMultiprocessNoDebug = multiprocessNoDebug
+        if configOverride is not None:
+            self.dbgGlobalConfigOverride = copy.deepcopy(configOverride)
     
     def getTranslationPattern(self):
         """
@@ -1418,7 +1427,7 @@
         
         from .AddLanguageDialog import AddLanguageDialog
         dlg = AddLanguageDialog(self.parent())
-        if dlg.exec() == QDialog.Accepted:
+        if dlg.exec() == QDialog.DialogCode.Accepted:
             lang = dlg.getSelectedLanguage()
             if self.pdata["PROJECTTYPE"] in [
                 "PyQt5", "PyQt5C", "PyQt6", "PyQt6C", "E6Plugin",
@@ -1663,7 +1672,7 @@
         from .AddFileDialog import AddFileDialog
         dlg = AddFileDialog(self, self.parent(), fileTypeFilter,
                             startdir=startdir)
-        if dlg.exec() == QDialog.Accepted:
+        if dlg.exec() == QDialog.DialogCode.Accepted:
             fnames, target, isSource = dlg.getData()
             if target != '':
                 for fn in fnames:
@@ -1829,7 +1838,7 @@
         from .AddDirectoryDialog import AddDirectoryDialog
         dlg = AddDirectoryDialog(
             self, fileTypeFilter, self.parent(), startdir=startdir)
-        if dlg.exec() == QDialog.Accepted:
+        if dlg.exec() == QDialog.DialogCode.Accepted:
             filetype, source, target, recursive = dlg.getData()
             if target == '':
                 E5MessageBox.critical(
@@ -2327,7 +2336,7 @@
             
         from .PropertiesDialog import PropertiesDialog
         dlg = PropertiesDialog(self, True)
-        if dlg.exec() == QDialog.Accepted:
+        if dlg.exec() == QDialog.DialogCode.Accepted:
             self.closeProject()
             dlg.storeData()
             self.pdata["VCS"] = 'None'
@@ -2364,7 +2373,7 @@
             
             hashStr = str(QCryptographicHash.hash(
                 QByteArray(self.ppath.encode("utf-8")),
-                QCryptographicHash.Sha1).toHex(),
+                QCryptographicHash.Algorithm.Sha1).toHex(),
                 encoding="utf-8")
             self.pdata["HASH"] = hashStr
             
@@ -2565,7 +2574,7 @@
                                     VcsCommandOptionsDialog
                                 )
                                 codlg = VcsCommandOptionsDialog(self.vcs)
-                                if codlg.exec() == QDialog.Accepted:
+                                if codlg.exec() == QDialog.DialogCode.Accepted:
                                     self.vcs.vcsSetOptions(codlg.getOptions())
                             # add project file to repository
                             if res == 0:
@@ -2617,7 +2626,7 @@
                 self.vcs = self.initVCS()
                 if self.vcs is not None:
                     vcsdlg = self.vcs.vcsOptionsDialog(self, self.name)
-                    if vcsdlg.exec() == QDialog.Accepted:
+                    if vcsdlg.exec() == QDialog.DialogCode.Accepted:
                         vcsDataDict = vcsdlg.getData()
                     else:
                         self.pdata["VCS"] = 'None'
@@ -2639,7 +2648,7 @@
                             VcsCommandOptionsDialog
                         )
                         codlg = VcsCommandOptionsDialog(self.vcs)
-                        if codlg.exec() == QDialog.Accepted:
+                        if codlg.exec() == QDialog.DialogCode.Accepted:
                             self.vcs.vcsSetOptions(codlg.getOptions())
                     
                     # create the project in the VCS
@@ -2714,7 +2723,7 @@
                             "Enter the path pattern for translation files "
                             "(use '%language%' in place of the language"
                             " code):"),
-                        QLineEdit.Normal,
+                        QLineEdit.EchoMode.Normal,
                         tslist[0])
                     if pattern:
                         self.pdata["TRANSLATIONPATTERN"] = pattern
@@ -2755,7 +2764,7 @@
         """
         from .PropertiesDialog import PropertiesDialog
         dlg = PropertiesDialog(self, False)
-        if dlg.exec() == QDialog.Accepted:
+        if dlg.exec() == QDialog.DialogCode.Accepted:
             projectType = self.pdata["PROJECTTYPE"]
             dlg.storeData()
             self.setDirty(True)
@@ -2830,7 +2839,7 @@
         
         from .UserPropertiesDialog import UserPropertiesDialog
         dlg = UserPropertiesDialog(self)
-        if dlg.exec() == QDialog.Accepted:
+        if dlg.exec() == QDialog.DialogCode.Accepted:
             dlg.storeData()
             
             if (
@@ -2875,7 +2884,7 @@
         """
         from .FiletypeAssociationDialog import FiletypeAssociationDialog
         dlg = FiletypeAssociationDialog(self)
-        if dlg.exec() == QDialog.Accepted:
+        if dlg.exec() == QDialog.DialogCode.Accepted:
             dlg.transferData()
             self.setDirty(True)
             self.__reorganizeFiles()
@@ -2901,7 +2910,7 @@
         """
         from .LexerAssociationDialog import LexerAssociationDialog
         dlg = LexerAssociationDialog(self)
-        if dlg.exec() == QDialog.Accepted:
+        if dlg.exec() == QDialog.DialogCode.Accepted:
             dlg.transferData()
             self.setDirty(True)
             self.lexerAssociationsChanged.emit()
@@ -3694,11 +3703,11 @@
             return self.eols[self.pdata["EOL"]]
         else:
             eolMode = Preferences.getEditor("EOLMode")
-            if eolMode == QsciScintilla.EolWindows:
+            if eolMode == QsciScintilla.EolMode.EolWindows:
                 eol = '\r\n'
-            elif eolMode == QsciScintilla.EolUnix:
+            elif eolMode == QsciScintilla.EolMode.EolUnix:
                 eol = '\n'
-            elif eolMode == QsciScintilla.EolMac:
+            elif eolMode == QsciScintilla.EolMode.EolMac:
                 eol = '\r'
             else:
                 eol = os.linesep
@@ -5382,7 +5391,7 @@
                 sorted(pkglists), title=self.tr("Create Plugin Archive"),
                 message=self.tr("Select package lists:"),
                 checkBoxSelection=True)
-            if dlg.exec() == QDialog.Accepted:
+            if dlg.exec() == QDialog.DialogCode.Accepted:
                 selectedLists = [os.path.join(self.ppath, s)
                                  for s in dlg.getSelection()]
             else:
@@ -5774,7 +5783,7 @@
             through a menu action)
         @type bool
         """
-        if exitStatus == QProcess.CrashExit:
+        if exitStatus == QProcess.ExitStatus.CrashExit:
             E5MessageBox.critical(
                 self.ui,
                 self.tr("Execute Make"),

eric ide

mercurial