PluginProjectDjango.py

changeset 169
b8f263e05c39
parent 168
c6182aab51e9
child 172
ea7980ded4f3
diff -r c6182aab51e9 -r b8f263e05c39 PluginProjectDjango.py
--- a/PluginProjectDjango.py	Wed Dec 30 11:02:06 2020 +0100
+++ b/PluginProjectDjango.py	Sat Apr 24 11:25:03 2021 +0200
@@ -26,7 +26,7 @@
 author = "Detlev Offenbach <detlev@die-offenbachs.de>"
 autoactivate = True
 deactivateable = True
-version = "6.1.0"
+version = "6.2.0"
 className = "ProjectDjangoPlugin"
 packageName = "ProjectDjango"
 shortDescription = "Project support for Django projects."
@@ -84,10 +84,7 @@
         palette = e5App().palette()
         lightness = palette.color(QPalette.Window).lightness()
         usesDarkPalette = lightness <= 128
-    if usesDarkPalette:
-        iconSuffix = "dark"
-    else:
-        iconSuffix = "light"
+    iconSuffix = "dark" if usesDarkPalette else "light"
     
     return {
         "djangoPage": [
@@ -197,10 +194,7 @@
             palette = e5App().palette()
             lightness = palette.color(QPalette.Window).lightness()
             usesDarkPalette = lightness <= 128
-        if usesDarkPalette:
-            iconSuffix = "dark"
-        else:
-            iconSuffix = "light"
+        iconSuffix = "dark" if usesDarkPalette else "light"
         
         self.__object = Project(self, iconSuffix, self.__ui)
         self.__object.initActions()
@@ -346,8 +340,8 @@
         
         @return dictionary with file type associations
         """
-        if self.__e5project.getProjectType() == "Django":
-            fileTypes = {
+        fileTypes = (
+            {
                 "*.html": "FORMS",
                 "*.htm": "FORMS",
                 "*.js": "SOURCES",
@@ -356,8 +350,9 @@
                 "*.mo": "TRANSLATIONS",
                 "*.py": "SOURCES",
             }
-        else:
-            fileTypes = {}
+            if self.__e5project.getProjectType() == "Django" else
+            {}
+        )
         return fileTypes
     
     def lexerAssociationCallback(self, filename):
@@ -418,9 +413,8 @@
         
         if key in ["VirtualEnvironmentPy3", "VirtualEnvironmentNamePy3"]:
             self.__reregisterProjectType()
-        elif key == "TranslationsEditor":
-            if self.__object:
-                self.__object.registerOpenHook()
+        elif key == "TranslationsEditor" and self.__object:
+            self.__object.registerOpenHook()
     
     def __reregisterProjectType(self):
         """

eric ide

mercurial