24 # Start-of-Header |
24 # Start-of-Header |
25 name = "Django Project Plugin" |
25 name = "Django Project Plugin" |
26 author = "Detlev Offenbach <detlev@die-offenbachs.de>" |
26 author = "Detlev Offenbach <detlev@die-offenbachs.de>" |
27 autoactivate = True |
27 autoactivate = True |
28 deactivateable = True |
28 deactivateable = True |
29 version = "6.1.0" |
29 version = "6.2.0" |
30 className = "ProjectDjangoPlugin" |
30 className = "ProjectDjangoPlugin" |
31 packageName = "ProjectDjango" |
31 packageName = "ProjectDjango" |
32 shortDescription = "Project support for Django projects." |
32 shortDescription = "Project support for Django projects." |
33 longDescription = ( |
33 longDescription = ( |
34 """This plugin implements project support for Django projects.""" |
34 """This plugin implements project support for Django projects.""" |
82 except AttributeError: |
82 except AttributeError: |
83 from PyQt5.QtGui import QPalette |
83 from PyQt5.QtGui import QPalette |
84 palette = e5App().palette() |
84 palette = e5App().palette() |
85 lightness = palette.color(QPalette.Window).lightness() |
85 lightness = palette.color(QPalette.Window).lightness() |
86 usesDarkPalette = lightness <= 128 |
86 usesDarkPalette = lightness <= 128 |
87 if usesDarkPalette: |
87 iconSuffix = "dark" if usesDarkPalette else "light" |
88 iconSuffix = "dark" |
|
89 else: |
|
90 iconSuffix = "light" |
|
91 |
88 |
92 return { |
89 return { |
93 "djangoPage": [ |
90 "djangoPage": [ |
94 QCoreApplication.translate("ProjectDjangoPlugin", "Django"), |
91 QCoreApplication.translate("ProjectDjangoPlugin", "Django"), |
95 os.path.join("ProjectDjango", "icons", |
92 os.path.join("ProjectDjango", "icons", |
195 except AttributeError: |
192 except AttributeError: |
196 from PyQt5.QtGui import QPalette |
193 from PyQt5.QtGui import QPalette |
197 palette = e5App().palette() |
194 palette = e5App().palette() |
198 lightness = palette.color(QPalette.Window).lightness() |
195 lightness = palette.color(QPalette.Window).lightness() |
199 usesDarkPalette = lightness <= 128 |
196 usesDarkPalette = lightness <= 128 |
200 if usesDarkPalette: |
197 iconSuffix = "dark" if usesDarkPalette else "light" |
201 iconSuffix = "dark" |
|
202 else: |
|
203 iconSuffix = "light" |
|
204 |
198 |
205 self.__object = Project(self, iconSuffix, self.__ui) |
199 self.__object = Project(self, iconSuffix, self.__ui) |
206 self.__object.initActions() |
200 self.__object.initActions() |
207 e5App().registerPluginObject("ProjectDjango", self.__object) |
201 e5App().registerPluginObject("ProjectDjango", self.__object) |
208 |
202 |
344 """ |
338 """ |
345 Public method get the filetype associations of the Django project type. |
339 Public method get the filetype associations of the Django project type. |
346 |
340 |
347 @return dictionary with file type associations |
341 @return dictionary with file type associations |
348 """ |
342 """ |
349 if self.__e5project.getProjectType() == "Django": |
343 fileTypes = ( |
350 fileTypes = { |
344 { |
351 "*.html": "FORMS", |
345 "*.html": "FORMS", |
352 "*.htm": "FORMS", |
346 "*.htm": "FORMS", |
353 "*.js": "SOURCES", |
347 "*.js": "SOURCES", |
354 "*.pot": "TRANSLATIONS", |
348 "*.pot": "TRANSLATIONS", |
355 "*.po": "TRANSLATIONS", |
349 "*.po": "TRANSLATIONS", |
356 "*.mo": "TRANSLATIONS", |
350 "*.mo": "TRANSLATIONS", |
357 "*.py": "SOURCES", |
351 "*.py": "SOURCES", |
358 } |
352 } |
359 else: |
353 if self.__e5project.getProjectType() == "Django" else |
360 fileTypes = {} |
354 {} |
|
355 ) |
361 return fileTypes |
356 return fileTypes |
362 |
357 |
363 def lexerAssociationCallback(self, filename): |
358 def lexerAssociationCallback(self, filename): |
364 """ |
359 """ |
365 Public method to get the lexer association of the Django project type |
360 Public method to get the lexer association of the Django project type |
416 Preferences.Prefs.settings.setValue( |
411 Preferences.Prefs.settings.setValue( |
417 self.PreferencesKey + "/" + key, value) |
412 self.PreferencesKey + "/" + key, value) |
418 |
413 |
419 if key in ["VirtualEnvironmentPy3", "VirtualEnvironmentNamePy3"]: |
414 if key in ["VirtualEnvironmentPy3", "VirtualEnvironmentNamePy3"]: |
420 self.__reregisterProjectType() |
415 self.__reregisterProjectType() |
421 elif key == "TranslationsEditor": |
416 elif key == "TranslationsEditor" and self.__object: |
422 if self.__object: |
417 self.__object.registerOpenHook() |
423 self.__object.registerOpenHook() |
|
424 |
418 |
425 def __reregisterProjectType(self): |
419 def __reregisterProjectType(self): |
426 """ |
420 """ |
427 Private method to re-register the project type. |
421 Private method to re-register the project type. |
428 """ |
422 """ |