diff -r 866adc8c315b -r 0acf98cd089a eric6/Project/Project.py --- a/eric6/Project/Project.py Sun Jan 17 13:53:08 2021 +0100 +++ b/eric6/Project/Project.py Mon Feb 01 10:38:16 2021 +0100 @@ -34,6 +34,7 @@ from Globals import recentNameProject import UI.PixmapCache +from UI.NotificationWidget import NotificationTypes from E5Gui.E5Action import E5Action, createActionGroup @@ -265,24 +266,33 @@ self.__projectTypes = { "PyQt5": self.tr("PyQt5 GUI"), "PyQt5C": self.tr("PyQt5 Console"), + "PyQt6": self.tr("PyQt6 GUI"), + "PyQt6C": self.tr("PyQt6 Console"), "E6Plugin": self.tr("Eric6 Plugin"), "Console": self.tr("Console"), "Other": self.tr("Other"), } self.__projectProgLanguages = { - "Python3": ["PyQt5", "PyQt5C", "E6Plugin", "Console", "Other"], + "Python3": ["PyQt5", "PyQt5C", "PyQt6", "PyQt6C", "E6Plugin", + "Console", "Other"], "MicroPython": ["Console", "Other"], "Ruby": ["Console", "Other"], "JavaScript": ["Other"], } - if Utilities.checkPyside(): + if Utilities.checkPyside(variant=2): self.__projectTypes["PySide2"] = self.tr("PySide2 GUI") self.__projectTypes["PySide2C"] = self.tr("PySide2 Console") self.__projectProgLanguages["Python3"].extend( ["PySide2", "PySide2C"]) + if Utilities.checkPyside(variant=6): + self.__projectTypes["PySide6"] = self.tr("PySide6 GUI") + self.__projectTypes["PySide6C"] = self.tr("PySide6 Console") + self.__projectProgLanguages["Python3"].extend( + ["PySide6", "PySide6C"]) + def getProjectTypes(self, progLanguage=""): """ Public method to get the list of supported project types. @@ -323,15 +333,15 @@ @param type_ internal type designator to be registered (string) @param description more verbose type name (display string) (string) - @keyparam fileTypeCallback reference to a method returning a dictionary + @param fileTypeCallback reference to a method returning a dictionary of filetype associations. - @keyparam binaryTranslationsCallback reference to a method returning + @param binaryTranslationsCallback reference to a method returning the name of the binary translation file given the name of the raw translation file - @keyparam lexerAssociationCallback reference to a method returning the + @param lexerAssociationCallback reference to a method returning the lexer type to be used for syntax highlighting given the name of a file - @keyparam progLanguages programming languages supported by the + @param progLanguages programming languages supported by the project type (list of string) """ if progLanguages: @@ -429,6 +439,8 @@ self.dbgAutoClearShell = True self.dbgTracePython = False self.dbgAutoContinue = True + self.dbgEnableMultiprocess = True + self.dbgMultiprocessNoDebug = "" self.pdata = { "DESCRIPTION": "", @@ -489,6 +501,7 @@ "PathPrefix": "", }, "EOL": -1, + "DOCSTRING": "", } self.__initDebugProperties() @@ -510,6 +523,7 @@ @param key key of the data entry to get (string). @return a copy of the requested data or None """ + # __IGNORE_WARNING_D202__ if ( category in ["PROJECTTYPESPECIFICDATA", "CHECKERSPARMS", "PACKAGERSPARMS", "DOCUMENTATIONPARMS", @@ -531,6 +545,7 @@ @param data data to be stored @return flag indicating success (boolean) """ + # __IGNORE_WARNING_D202__ if category not in ["PROJECTTYPESPECIFICDATA", "CHECKERSPARMS", "PACKAGERSPARMS", "DOCUMENTATIONPARMS", "OTHERTOOLSPARMS"]: @@ -589,19 +604,24 @@ # Forms if self.pdata["PROJECTTYPE"] in ["E6Plugin", "PyQt5", - "PySide2"]: + "PyQt6", + "PySide2", + "PySide6"]: self.pdata["FILETYPES"]["*.ui"] = "FORMS" # Resources if self.pdata["PROJECTTYPE"] in ["E6Plugin", "PyQt5", "PyQt5C", - "PySide2", "PySide2C"]: + "PySide2", "PySide2C", + "PySide6", "PySide6C"]: self.pdata["FILETYPES"]["*.qrc"] = "RESOURCES" # Translations if self.pdata["PROJECTTYPE"] in ["E6Plugin", "PyQt5", "PyQt5C", - "PySide2", "PySide2C"]: + "PyQt6", "PyQt6C", + "PySide2", "PySide2C", + "PySide6", "PySide6C"]: self.pdata["FILETYPES"]["*.ts"] = "TRANSLATIONS" self.pdata["FILETYPES"]["*.qm"] = "TRANSLATIONS" @@ -623,7 +643,9 @@ """ if self.pdata["PROJECTTYPE"] in ["E6Plugin", "PyQt5", "PyQt5C", - "PySide2", "PySide2C"]: + "PyQt6", "PyQt6C", + "PySide2", "PySide2C", + "PySide6", "PySide6C"]: if "*.ts" not in self.pdata["FILETYPES"]: self.pdata["FILETYPES"]["*.ts"] = "TRANSLATIONS" if "*.qm" not in self.pdata["FILETYPES"]: @@ -974,7 +996,7 @@ @param quiet flag indicating quiet operations. If this flag is true, no errors are reported. - @keyparam indicator indicator string (string) + @param indicator indicator string (string) """ if self.pfile is None: if not quiet: @@ -1013,7 +1035,7 @@ @param quiet flag indicating quiet operations. If this flag is true, no errors are reported. - @keyparam indicator indicator string (string) + @param indicator indicator string (string) """ if self.pfile is None: if not quiet: @@ -1303,7 +1325,8 @@ def setDbgInfo(self, venvName, argv, wd, env, excReporting, excList, excIgnoreList, autoClearShell, tracePython=None, - autoContinue=None): + autoContinue=None, enableMultiprocess=None, + multiprocessNoDebug=None): """ Public method to set the debugging information. @@ -1324,12 +1347,18 @@ @param autoClearShell flag indicating, that the interpreter window should be cleared @type bool - @keyparam tracePython flag to indicate if the Python library should be + @param tracePython flag to indicate if the Python library should be traced as well @type bool - @keyparam autoContinue flag indicating, that the debugger should not + @param autoContinue flag indicating, that the debugger should not stop at the first executable line @type bool + @param enableMultiprocess flag indicating, that the debugger should + run in multi process mode + @type bool + @param multiprocessNoDebug list of programs not to be debugged in + multi process mode + @type str """ self.dbgVirtualEnv = venvName self.dbgCmdline = argv @@ -1343,6 +1372,10 @@ self.dbgTracePython = tracePython if autoContinue is not None: self.dbgAutoContinue = autoContinue + if enableMultiprocess is not None: + self.dbgEnableMultiprocess = enableMultiprocess + if multiprocessNoDebug is not None: + self.dbgMultiprocessNoDebug = multiprocessNoDebug def getTranslationPattern(self): """ @@ -1378,7 +1411,8 @@ if dlg.exec() == QDialog.Accepted: lang = dlg.getSelectedLanguage() if self.pdata["PROJECTTYPE"] in [ - "PyQt5", "PyQt5C", "E6Plugin", "PySide2", "PySide2C" + "PyQt5", "PyQt5C", "PyQt6", "PyQt6C", "E6Plugin", + "PySide2", "PySide2C", "PySide6", "PySide6C" ]: langFile = self.pdata["TRANSLATIONPATTERN"].replace( "%language%", lang) @@ -2835,7 +2869,22 @@ dlg.transferData() self.setDirty(True) self.__reorganizeFiles() - + + def getFiletypeAssociations(self, associationType): + """ + Public method to get the list of file type associations for + the given association type. + + @param associationType type of the association (one of FORMS, + INTERFACES, OTHERS, PROTOCOLS, RESOURCES, SOURCES or + TRANSLATIONS) + @type str + @return list of file patterns for the given type + @rtype list of str + """ + return [assoc for assoc in self.pdata["FILETYPES"] + if self.pdata["FILETYPES"][assoc] == associationType] + def __showLexerAssociations(self): """ Private slot to display the lexer association dialog. @@ -2880,7 +2929,7 @@ @param fn optional filename of the project file to be read @param restoreSession flag indicating to restore the project session (boolean) - @keyparam reopen flag indicating a reopening of the project (boolean) + @param reopen flag indicating a reopening of the project (boolean) """ if not self.checkDirty(): return @@ -3161,8 +3210,8 @@ """ Public slot to close the current project. - @keyparam reopen flag indicating a reopening of the project (boolean) - @keyparam noSave flag indicating to not perform save actions (boolean) + @param reopen flag indicating a reopening of the project (boolean) + @param noSave flag indicating to not perform save actions (boolean) @return flag indicating success (boolean) """ # save the list of recently opened projects @@ -3264,7 +3313,7 @@ """ Public method to save all scripts belonging to the project. - @keyparam reportSyntaxErrors flag indicating special reporting + @param reportSyntaxErrors flag indicating special reporting for syntax errors (boolean) @return flag indicating success (boolean) """ @@ -3296,7 +3345,7 @@ Public method to check all scripts belonging to the project for their dirty status. - @keyparam reportSyntaxErrors flag indicating special reporting + @param reportSyntaxErrors flag indicating special reporting for syntax errors (boolean) @return flag indicating success (boolean) """ @@ -4207,11 +4256,11 @@ self.tr('Create &Package List'), 0, 0, self.pluginGrp, 'project_plugin_pkglist') self.pluginPkgListAct.setStatusTip( - self.tr('Create an initial PKGLIST file for an eric6 plugin.')) + self.tr('Create an initial PKGLIST file for an eric plugin.')) self.pluginPkgListAct.setWhatsThis(self.tr( """<b>Create Package List</b>""" """<p>This creates an initial list of files to include in an""" - """ eric6 plugin archive. The list is created from the project""" + """ eric plugin archive. The list is created from the project""" """ file.</p>""" )) self.pluginPkgListAct.triggered.connect(self.__pluginCreatePkgList) @@ -4223,10 +4272,10 @@ self.tr('Create Plugin &Archives'), 0, 0, self.pluginGrp, 'project_plugin_archive') self.pluginArchiveAct.setStatusTip( - self.tr('Create eric6 plugin archive files.')) + self.tr('Create eric plugin archive files.')) self.pluginArchiveAct.setWhatsThis(self.tr( """<b>Create Plugin Archives</b>""" - """<p>This creates eric6 plugin archive files using the list""" + """<p>This creates eric plugin archive files using the list""" """ of files given in a PKGLIST* file. The archive name is""" """ built from the main script name if not designated in""" """ the package list file.</p>""" @@ -4240,10 +4289,10 @@ self.tr('Create Plugin Archives (&Snapshot)'), 0, 0, self.pluginGrp, 'project_plugin_sarchive') self.pluginSArchiveAct.setStatusTip(self.tr( - 'Create eric6 plugin archive files (snapshot releases).')) + 'Create eric plugin archive files (snapshot releases).')) self.pluginSArchiveAct.setWhatsThis(self.tr( """<b>Create Plugin Archives (Snapshot)</b>""" - """<p>This creates eric6 plugin archive files using the list""" + """<p>This creates eric plugin archive files using the list""" """ of files given in the PKGLIST* file. The archive name is""" """ built from the main script name if not designated in""" """ the package list file. The version entry of the main script""" @@ -5296,7 +5345,7 @@ @pyqtSlot() def __pluginCreateArchives(self, snapshot=False): """ - Private slot to create eric6 plugin archives. + Private slot to create eric plugin archives. @param snapshot flag indicating snapshot archives (boolean) """ @@ -5409,7 +5458,7 @@ self.ui, self.tr("Create Plugin Archive"), self.tr( - """<p>The eric6 plugin archive file <b>{0}</b>""" + """<p>The eric plugin archive file <b>{0}</b>""" """ could not be created.</p>""" """<p>Reason: {1}</p>""").format(archive, str(why))) errors += 1 @@ -5460,25 +5509,23 @@ progress.setValue(len(selectedLists)) if errors: - message = self.tr("<p>The eric6 plugin archive files were " - "created with some errors.</p>") - else: - message = self.tr("<p>The eric6 plugin archive files were " - "created successfully.</p>") - if self.ui.notificationsEnabled(): self.ui.showNotification( UI.PixmapCache.getPixmap("pluginArchive48"), self.tr("Create Plugin Archive"), - message) + self.tr("<p>The eric plugin archive files were " + "created with some errors.</p>"), + kind=NotificationTypes.Critical, + timeout=0) else: - E5MessageBox.information( - self.ui, + self.ui.showNotification( + UI.PixmapCache.getPixmap("pluginArchive48"), self.tr("Create Plugin Archive"), - message) + self.tr("<p>The eric plugin archive files were " + "created successfully.</p>")) def __pluginCreateSnapshotArchives(self): """ - Private slot to create eric6 plugin archive snapshot releases. + Private slot to create eric plugin archive snapshot releases. """ self.__pluginCreateArchives(True) @@ -5733,13 +5780,12 @@ """<p>There are changes that require the default""" """ make target to be rebuilt.</p>""") - if self.ui.notificationsEnabled() and not interactive: - self.ui.showNotification( - UI.PixmapCache.getPixmap("makefile48"), - title, - message) - else: - E5MessageBox.information(self.ui, title, message) + self.ui.showNotification( + UI.PixmapCache.getPixmap("makefile48"), + title, + message, + kind=NotificationTypes.Warning, + timeout=0) elif exitCode > 1: E5MessageBox.critical( self.ui, @@ -5837,6 +5883,29 @@ "CompressionDisable": False, "PathPrefix": "", } + + ######################################################################### + ## Below are methods implementing some 'docstring' support functions + ######################################################################### + + def hasDefaultDocstringParameter(self): + """ + Public method to test, if the project contains the default docstring + parameter. + + @return flag indicating default parameter + @rtype bool + """ + return self.pdata["DOCSTRING"] == "" + + def getDocstringType(self): + """ + Public method to get the configured docstring style. + + @return configured docstring style + @rtype str + """ + return self.pdata["DOCSTRING"] # # eflag: noqa = M601