PluginProjectDjango.py

changeset 51
0b60dbff8e9a
parent 47
19da3417eb3d
child 58
1590a48ad5b6
--- a/PluginProjectDjango.py	Sat Apr 26 16:57:10 2014 +0200
+++ b/PluginProjectDjango.py	Sun Jul 06 18:43:50 2014 +0200
@@ -13,7 +13,7 @@
 import glob
 import fnmatch
 
-from PyQt4.QtCore import QCoreApplication, QObject, QTranslator
+from PyQt5.QtCore import QCoreApplication, QObject, QTranslator
 
 from E5Gui.E5Application import e5App
 
@@ -28,7 +28,7 @@
 author = "Detlev Offenbach <detlev@die-offenbachs.de>"
 autoactivate = True
 deactivateable = True
-version = "3.4.0"
+version = "4.0.0"
 className = "ProjectDjangoPlugin"
 packageName = "ProjectDjango"
 shortDescription = "Project support for Django projects."
@@ -51,7 +51,7 @@
     @param language language to get APIs for (string)
     @return list of API filenames (list of string)
     """
-    if language in ["Python3",  "Python2"]:
+    if language in ["Python3", "Python2"]:
         apisDir = \
             os.path.join(os.path.dirname(__file__), "ProjectDjango", "APIs")
         apis = glob.glob(os.path.join(apisDir, '*.api'))
@@ -162,17 +162,17 @@
     
     def __checkVersions(self):
         """
-        Private function to check that the eric5 version is ok.
+        Private function to check that the eric6 version is ok.
         
         @return flag indicating version is ok (boolean)
         """
         global error
         
-        if self.__ui.versionIsNewer('5.0.99', '20120101'):
+        if self.__ui.versionIsNewer('5.99.99', '20140701'):
             error = ""
         else:
-            error = self.trUtf8("eric5 version is too old, {0}, {1} or newer"
-                                " needed.").format("5.1.0", "20120101")
+            error = self.tr("eric6 version is too old, {0}, {1} or newer"
+                            " needed.").format("6.0.0", "20140701")
             return False
         
         return True
@@ -198,20 +198,12 @@
         self.__supportedVariants = self.__object.supportedPythonVariants()
         
         if self.__supportedVariants:
-            try:
-                self.__e5project.registerProjectType(
-                    "Django", self.trUtf8("Django"),
-                    self.fileTypesCallback,
-                    lexerAssociationCallback=self.lexerAssociationCallback,
-                    binaryTranslationsCallback=self.binaryTranslationsCallback,
-                    progLanguages=self.__supportedVariants[:])
-            except TypeError:
-                # for backward compatibility
-                self.__e5project.registerProjectType(
-                    "Django", self.trUtf8("Django"),
-                    self.fileTypesCallback,
-                    lexerAssociationCallback=self.lexerAssociationCallback,
-                    binaryTranslationsCallback=self.binaryTranslationsCallback)
+            self.__e5project.registerProjectType(
+                "Django", self.tr("Django"),
+                self.fileTypesCallback,
+                lexerAssociationCallback=self.lexerAssociationCallback,
+                binaryTranslationsCallback=self.binaryTranslationsCallback,
+                progLanguages=self.__supportedVariants[:])
         
         from Project.ProjectBrowser import SourcesBrowserFlag, \
             FormsBrowserFlag, TranslationsBrowserFlag, OthersBrowserFlag
@@ -406,22 +398,12 @@
             # step 2: register again with new language settings
             self.__supportedVariants = supportedVariants
             if self.__supportedVariants:
-                try:
-                    self.__e5project.registerProjectType(
-                        "Django", self.trUtf8("Django"),
-                        self.fileTypesCallback,
-                        lexerAssociationCallback=self.lexerAssociationCallback,
-                        binaryTranslationsCallback=
-                        self.binaryTranslationsCallback,
-                        progLanguages=self.__supportedVariants[:])
-                except TypeError:
-                    # for backward compatibility
-                    self.__e5project.registerProjectType(
-                        "Django", self.trUtf8("Django"),
-                        self.fileTypesCallback,
-                        lexerAssociationCallback=self.lexerAssociationCallback,
-                        binaryTranslationsCallback=
-                        self.binaryTranslationsCallback)
+                self.__e5project.registerProjectType(
+                    "Django", self.tr("Django"),
+                    self.fileTypesCallback,
+                    lexerAssociationCallback=self.lexerAssociationCallback,
+                    binaryTranslationsCallback=self.binaryTranslationsCallback,
+                    progLanguages=self.__supportedVariants[:])
     
     def getMenu(self, name):
         """
@@ -442,7 +424,7 @@
         
         @return menu names (list of string)
         """
-        if self.__object is not None:        
+        if self.__object is not None:
             return list(self.__menus.keys())
         else:
             return []

eric ide

mercurial