--- a/eric6/Project/Project.py Sat Jun 20 17:36:20 2020 +0200 +++ b/eric6/Project/Project.py Sun Jun 21 18:26:12 2020 +0200 @@ -164,7 +164,6 @@ self.ui = parent self.__progLanguages = [ - "Python2", "Python3", "MicroPython", "Ruby", @@ -172,9 +171,6 @@ ] self.__dbgFilters = { - "Python2": self.tr( - "Python2 Files (*.py2);;" - "Python2 GUI Files (*.pyw2);;"), "Python3": self.tr( "Python3 Files (*.py *.py3);;" "Python3 GUI Files (*.pyw *.pyw3);;"), @@ -212,14 +208,7 @@ @param language programming language (string) @return source extensions (list of string) """ - if language == "Python2": - extensions = Preferences.getPython("PythonExtensions") - # *.py and *.pyw should always be associated with source files - for ext in [".py", ".pyw"]: - if ext not in extensions: - extensions.append(ext) - return extensions - elif language == "Python3": + if language == "Python3": extensions = Preferences.getPython("Python3Extensions") # *.py and *.pyw should always be associated with source files for ext in [".py", ".pyw"]: @@ -275,8 +264,6 @@ self.__binaryTranslationsCallbacks = {} self.__projectTypes = { - "Qt4": self.tr("PyQt4 GUI (deprecated)"), - "Qt4C": self.tr("PyQt4 Console (deprecated)"), "PyQt5": self.tr("PyQt5 GUI"), "PyQt5C": self.tr("PyQt5 Console"), "E6Plugin": self.tr("Eric6 Plugin"), @@ -285,36 +272,17 @@ } self.__projectProgLanguages = { - "Python2": ["Qt4", "Qt4C", "PyQt5", "PyQt5C", - "E6Plugin", "Console", "Other"], - "Python3": ["Qt4", "Qt4C", "PyQt5", "PyQt5C", - "E6Plugin", "Console", "Other"], + "Python3": ["PyQt5", "PyQt5C", "E6Plugin", "Console", "Other"], "MicroPython": ["Console", "Other"], - "Ruby": ["Qt4", "Qt4C", "Console", "Other"], + "Ruby": ["Console", "Other"], "JavaScript": ["Other"], } - pyside_py2, pyside_py3 = Utilities.checkPyside("1") - if pyside_py2 or pyside_py3: - self.__projectTypes["PySide"] = self.tr("PySide GUI") - self.__projectTypes["PySideC"] = self.tr("PySide Console") - if pyside_py2: - self.__projectProgLanguages["Python2"].extend( - ["PySide", "PySideC"]) - if pyside_py3: - self.__projectProgLanguages["Python3"].extend( - ["PySide", "PySideC"]) - - pyside2_py2, pyside2_py3 = Utilities.checkPyside("2") - if pyside2_py2 or pyside2_py3: + if Utilities.checkPyside(): self.__projectTypes["PySide2"] = self.tr("PySide2 GUI") self.__projectTypes["PySide2C"] = self.tr("PySide2 Console") - if pyside2_py2: - self.__projectProgLanguages["Python2"].extend( - ["PySide2", "PySide2C"]) - if pyside2_py3: - self.__projectProgLanguages["Python3"].extend( - ["PySide2", "PySide2C"]) + self.__projectProgLanguages["Python3"].extend( + ["PySide2", "PySide2C"]) def getProjectTypes(self, progLanguage=""): """ @@ -369,14 +337,18 @@ """ if progLanguages: for progLanguage in progLanguages: + if progLanguage in ["Python", "Python2"]: + # ignore that silently for Python2 + return + if progLanguage not in self.__projectProgLanguages: E5MessageBox.critical( self.ui, self.tr("Registering Project Type"), self.tr( """<p>The Programming Language <b>{0}</b> is not""" - """ supported.</p>""") - .format(progLanguage) + """ supported (project type: {1}).</p>""") + .format(progLanguage, type_) ) return @@ -616,24 +588,20 @@ self.pdata["FILETYPES"]["*.proto"] = "PROTOCOLS" # Forms - if self.pdata["PROJECTTYPE"] in ["Qt4", "PyQt5", - "E6Plugin", "PySide", + if self.pdata["PROJECTTYPE"] in ["E6Plugin", + "PyQt5", "PySide2"]: self.pdata["FILETYPES"]["*.ui"] = "FORMS" # Resources - if self.pdata["PROJECTTYPE"] in ["Qt4", "Qt4C", - "E6Plugin", + if self.pdata["PROJECTTYPE"] in ["E6Plugin", "PyQt5", "PyQt5C", - "PySide", "PySideC", "PySide2", "PySide2C"]: self.pdata["FILETYPES"]["*.qrc"] = "RESOURCES" # Translations - if self.pdata["PROJECTTYPE"] in ["Qt4", "Qt4C", - "E6Plugin", + if self.pdata["PROJECTTYPE"] in ["E6Plugin", "PyQt5", "PyQt5C", - "PySide", "PySideC", "PySide2", "PySide2C"]: self.pdata["FILETYPES"]["*.ts"] = "TRANSLATIONS" self.pdata["FILETYPES"]["*.qm"] = "TRANSLATIONS" @@ -654,10 +622,8 @@ Public method to update the filetype associations with new default values. """ - if self.pdata["PROJECTTYPE"] in ["Qt4", "Qt4C", - "E6Plugin", + if self.pdata["PROJECTTYPE"] in ["E6Plugin", "PyQt5", "PyQt5C", - "PySide", "PySideC", "PySide2", "PySide2C"]: if "*.ts" not in self.pdata["FILETYPES"]: self.pdata["FILETYPES"]["*.ts"] = "TRANSLATIONS" @@ -1414,8 +1380,7 @@ if dlg.exec_() == QDialog.Accepted: lang = dlg.getSelectedLanguage() if self.pdata["PROJECTTYPE"] in [ - "Qt4", "Qt4C", "PyQt5", "PyQt5C", "E6Plugin", - "PySide", "PySideC", "PySide2", "PySide2C" + "PyQt5", "PyQt5C", "E6Plugin", "PySide2", "PySide2C" ]: langFile = self.pdata["TRANSLATIONPATTERN"].replace( "%language%", lang) @@ -2385,7 +2350,7 @@ # create an empty __init__.py file to make it a Python package # (only for Python and Python3) if self.pdata["PROGLANGUAGE"] in [ - "Python", "Python2", "Python3", "MicroPython" + "Python3", "MicroPython" ]: fn = os.path.join(self.ppath, "__init__.py") f = open(fn, "w", encoding="utf-8") @@ -2499,7 +2464,7 @@ # create an empty __init__.py file to make it a Python package # if none exists (only for Python and Python3) if self.pdata["PROGLANGUAGE"] in [ - "Python", "Python2", "Python3", "MicroPython" + "Python3", "MicroPython" ]: fn = os.path.join(self.ppath, "__init__.py") if not os.path.exists(fn): @@ -2731,7 +2696,7 @@ self.projectLanguageAdded.emit(qm) if not self.pdata["MAINSCRIPT"] and bool(mainscriptname): if self.pdata["PROGLANGUAGE"] in [ - "Python", "Python2", "Python3", "MicroPython" + "Python3", "MicroPython" ]: self.pdata["MAINSCRIPT"] = '{0}.py'.format(mainscriptname) elif self.pdata["PROGLANGUAGE"] == "Ruby": @@ -3444,13 +3409,12 @@ def isPythonProject(self): """ - Public method to check, if this project is a Python2 or Python3 + Public method to check, if this project is a Python3 or MicroPython project. @return flag indicating a Python project (boolean) """ - return self.pdata["PROGLANGUAGE"] in ["Python", "Python2", - "Python3", "MicroPython"] + return self.pdata["PROGLANGUAGE"] in ["Python3", "MicroPython"] def isPy3Project(self): """ @@ -3459,15 +3423,7 @@ @return flag indicating a Python3 project (boolean) """ return self.pdata["PROGLANGUAGE"] == "Python3" - - def isPy2Project(self): - """ - Public method to check, if this project is a Python2 project. - - @return flag indicating a Python2 project (boolean) - """ - return self.pdata["PROGLANGUAGE"] in ["Python", "Python2"] - + def isMicroPythonProject(self): """ Public method to check, if this project is a MicroPython project. @@ -3529,7 +3485,7 @@ if lang == "": lang = "Python3" elif lang == "Python": - lang = "Python2" + lang = "Python3" return self.__sourceExtensions(lang)[0] def getProjectPath(self): @@ -5116,7 +5072,7 @@ os.path.isfile("{0}.profile".format(basename)) or os.path.isfile("{0}.profile".format(tbasename))) self.codeCoverageAct.setEnabled( - (self.isPy3Project() or self.isPy2Project()) and + self.isPy3Project() and (os.path.isfile("{0}.coverage".format(basename)) or os.path.isfile("{0}.coverage".format(tbasename)))) else: