PluginProjectPyramid.py

changeset 138
72ebb74aa42d
parent 136
5673d6bb4c2a
child 140
a891fb543d28
diff -r be24be92ed0f -r 72ebb74aa42d PluginProjectPyramid.py
--- a/PluginProjectPyramid.py	Thu Apr 09 18:34:09 2020 +0200
+++ b/PluginProjectPyramid.py	Tue Jun 23 18:14:14 2020 +0200
@@ -7,8 +7,6 @@
 Module implementing the Pyramid project plugin.
 """
 
-from __future__ import unicode_literals
-
 import os
 import glob
 import fnmatch
@@ -28,15 +26,15 @@
 author = "Detlev Offenbach <detlev@die-offenbachs.de>"
 autoactivate = True
 deactivateable = True
-version = "2.5.0"
+version = "3.0.0"
 className = "ProjectPyramidPlugin"
 packageName = "ProjectPyramid"
 shortDescription = "Project support for Pyramid projects."
-longDescription = \
+longDescription = (
     """This plugin implements project support for Pyramid projects."""
+)
 needsRestart = False
 pyqtApi = 2
-python2Compatible = True
 # End-of-Header
 
 error = ""
@@ -53,8 +51,7 @@
     """
     global pyramidPluginObject
     from ProjectPyramid.ConfigurationPage.PyramidPage import PyramidPage
-    page = PyramidPage(pyramidPluginObject)
-    return page
+    return PyramidPage(pyramidPluginObject)
     
 
 def getConfigData():
@@ -91,13 +88,12 @@
     @param language language to get APIs for (string)
     @return list of API filenames (list of string)
     """
-    if language in ["Python3", "Python2"]:
-        apisDir = \
-            os.path.join(os.path.dirname(__file__), "ProjectPyramid", "APIs")
-        apis = glob.glob(os.path.join(apisDir, '*.api'))
+    if language == "Python3":
+        apisDir = os.path.join(os.path.dirname(__file__),
+                               "ProjectPyramid", "APIs")
+        return glob.glob(os.path.join(apisDir, '*.api'))
     else:
-        apis = []
-    return apis
+        return []
 
 
 def prepareUninstall():
@@ -133,14 +129,8 @@
         self.__initialize()
         
         self.__defaults = {
-            "VirtualEnvironmentNamePy2": "",
             "VirtualEnvironmentNamePy3": "",
             
-            # these are obsolete and kept for use with eric <18.07
-            "VirtualEnvironmentPy2": "",
-            "VirtualEnvironmentPy3": "",
-            
-            "Python2ConsoleType": "python",
             "Python3ConsoleType": "python",
             
             "PyramidDocUrl": "http://docs.pylonsproject.org/projects/"
@@ -219,8 +209,10 @@
                     lexerAssociationCallback=self.lexerAssociationCallback,
                     binaryTranslationsCallback=self.binaryTranslationsCallback)
         
-        from Project.ProjectBrowser import SourcesBrowserFlag, \
-            FormsBrowserFlag, TranslationsBrowserFlag, OthersBrowserFlag
+        from Project.ProjectBrowser import (
+            SourcesBrowserFlag, FormsBrowserFlag, TranslationsBrowserFlag,
+            OthersBrowserFlag
+        )
         Preferences.setProjectBrowserFlagsDefault(
             "Pyramid",
             SourcesBrowserFlag | FormsBrowserFlag |
@@ -337,7 +329,7 @@
         @return dictionary with file type associations
         """
         if self.__e5project.getProjectType() == "Pyramid":
-            fileTypes = {
+            return {
                 "*.mako": "FORMS",
                 "*.mak": "FORMS",
                 "*.pt": "FORMS",
@@ -349,8 +341,7 @@
                 "*.mo": "TRANSLATIONS",
             }
         else:
-            fileTypes = {}
-        return fileTypes
+            return {}
     
     def lexerAssociationCallback(self, filename):
         """
@@ -376,7 +367,8 @@
         @return name of the binary translation file (string)
         """
         if filename.endswith(".po"):
-            filename = filename.replace(".po", ".mo")
+            return filename.replace(".po", ".mo")
+        
         return filename
     
     def getDefaultPreference(self, key):
@@ -412,8 +404,7 @@
         Preferences.Prefs.settings.setValue(
             self.PreferencesKey + "/" + key, value)
         
-        if key in ["VirtualEnvironmentPy2", "VirtualEnvironmentPy3",
-                   "VirtualEnvironmentNamePy2", "VirtualEnvironmentNamePy3"]:
+        if key in ["VirtualEnvironmentNamePy3"]:
             self.__reregisterProjectType()
         elif key == "TranslationsEditor":
             if self.__object:

eric ide

mercurial