PluginProjectDjango.py

changeset 161
208fced62e00
parent 159
e08458938716
child 163
1622130167bb
equal deleted inserted replaced
160:e2084f0a28a2 161:208fced62e00
4 # 4 #
5 5
6 """ 6 """
7 Module implementing the Django project plugin. 7 Module implementing the Django project plugin.
8 """ 8 """
9
10 from __future__ import unicode_literals
11 9
12 import os 10 import os
13 import glob 11 import glob
14 import fnmatch 12 import fnmatch
15 13
26 # Start-of-Header 24 # Start-of-Header
27 name = "Django Project Plugin" 25 name = "Django Project Plugin"
28 author = "Detlev Offenbach <detlev@die-offenbachs.de>" 26 author = "Detlev Offenbach <detlev@die-offenbachs.de>"
29 autoactivate = True 27 autoactivate = True
30 deactivateable = True 28 deactivateable = True
31 version = "5.3.3" 29 version = "6.0.0"
32 className = "ProjectDjangoPlugin" 30 className = "ProjectDjangoPlugin"
33 packageName = "ProjectDjango" 31 packageName = "ProjectDjango"
34 shortDescription = "Project support for Django projects." 32 shortDescription = "Project support for Django projects."
35 longDescription = \ 33 longDescription = (
36 """This plugin implements project support for Django projects.""" 34 """This plugin implements project support for Django projects."""
35 )
37 needsRestart = False 36 needsRestart = False
38 pyqtApi = 2 37 pyqtApi = 2
39 python2Compatible = True
40 # End-of-Header 38 # End-of-Header
41 39
42 error = "" 40 error = ""
43 41
44 djangoPluginObject = None 42 djangoPluginObject = None
49 Module function to return the API files made available by this plugin. 47 Module function to return the API files made available by this plugin.
50 48
51 @param language language to get APIs for (string) 49 @param language language to get APIs for (string)
52 @return list of API filenames (list of string) 50 @return list of API filenames (list of string)
53 """ 51 """
54 if language in ["Python3", "Python2"]: 52 if language in ["Python3"]:
55 apisDir = \ 53 apisDir = os.path.join(os.path.dirname(__file__),
56 os.path.join(os.path.dirname(__file__), "ProjectDjango", "APIs") 54 "ProjectDjango", "APIs")
57 apis = glob.glob(os.path.join(apisDir, '*.api')) 55 apis = glob.glob(os.path.join(apisDir, '*.api'))
58 else: 56 else:
59 apis = [] 57 apis = []
60 return apis 58 return apis
61 59
129 QObject.__init__(self, ui) 127 QObject.__init__(self, ui)
130 self.__ui = ui 128 self.__ui = ui
131 self.__initialize() 129 self.__initialize()
132 130
133 self.__defaults = { 131 self.__defaults = {
134 "VirtualEnvironmentNamePy2": "",
135 "VirtualEnvironmentNamePy3": "", 132 "VirtualEnvironmentNamePy3": "",
136 133
137 # these are obsolete and kept for use with eric <18.07 134 # these are obsolete and kept for use with eric <18.07
138 "VirtualEnvironmentPy2": "",
139 "VirtualEnvironmentPy3": "", 135 "VirtualEnvironmentPy3": "",
140 136
141 "Python2ConsoleType": "ipython",
142 "Python3ConsoleType": "ipython", 137 "Python3ConsoleType": "ipython",
143 138
144 "ServerAddress": "", 139 "ServerAddress": "",
145 140
146 "RecentNumberApps": 10, 141 "RecentNumberApps": 10,
221 self.fileTypesCallback, 216 self.fileTypesCallback,
222 lexerAssociationCallback=self.lexerAssociationCallback, 217 lexerAssociationCallback=self.lexerAssociationCallback,
223 binaryTranslationsCallback=self.binaryTranslationsCallback, 218 binaryTranslationsCallback=self.binaryTranslationsCallback,
224 progLanguages=self.__supportedVariants[:]) 219 progLanguages=self.__supportedVariants[:])
225 220
226 from Project.ProjectBrowser import SourcesBrowserFlag, \ 221 from Project.ProjectBrowser import (
227 FormsBrowserFlag, TranslationsBrowserFlag, OthersBrowserFlag 222 SourcesBrowserFlag, FormsBrowserFlag, TranslationsBrowserFlag,
223 OthersBrowserFlag
224 )
228 Preferences.setProjectBrowserFlagsDefault( 225 Preferences.setProjectBrowserFlagsDefault(
229 "Django", 226 "Django",
230 SourcesBrowserFlag | FormsBrowserFlag | 227 SourcesBrowserFlag | FormsBrowserFlag |
231 TranslationsBrowserFlag | OthersBrowserFlag, 228 TranslationsBrowserFlag | OthersBrowserFlag,
232 ) 229 )
398 @return the requested setting 395 @return the requested setting
399 """ 396 """
400 if key in ["RecentNumberApps", "RecentNumberTestData"]: 397 if key in ["RecentNumberApps", "RecentNumberTestData"]:
401 return int(Preferences.Prefs.settings.value( 398 return int(Preferences.Prefs.settings.value(
402 self.PreferencesKey + "/" + key, self.__defaults[key])) 399 self.PreferencesKey + "/" + key, self.__defaults[key]))
403 elif key in ["UsePlainPythonPy2", "UsePlainPythonPy3", "UseIPv6", 400 elif key in ["UseIPv6", "UseThreading",
404 "UseThreading", "UseExternalBrowser", "CheckDeployMode", 401 "UseExternalBrowser", "CheckDeployMode",
405 "KeepTestDatabase", "FuzzyTranslations", ]: 402 "KeepTestDatabase", "FuzzyTranslations", ]:
406 return Preferences.toBool(Preferences.Prefs.settings.value( 403 return Preferences.toBool(Preferences.Prefs.settings.value(
407 self.PreferencesKey + "/" + key, self.__defaults[key])) 404 self.PreferencesKey + "/" + key, self.__defaults[key]))
408 else: 405 else:
409 return Preferences.Prefs.settings.value( 406 return Preferences.Prefs.settings.value(
417 @param value the value to be set 414 @param value the value to be set
418 """ 415 """
419 Preferences.Prefs.settings.setValue( 416 Preferences.Prefs.settings.setValue(
420 self.PreferencesKey + "/" + key, value) 417 self.PreferencesKey + "/" + key, value)
421 418
422 if key in ["VirtualEnvironmentPy2", "VirtualEnvironmentPy3", 419 if key in ["VirtualEnvironmentPy3", "VirtualEnvironmentNamePy3"]:
423 "VirtualEnvironmentNamePy2", "VirtualEnvironmentNamePy3"]:
424 self.__reregisterProjectType() 420 self.__reregisterProjectType()
425 elif key == "TranslationsEditor": 421 elif key == "TranslationsEditor":
426 if self.__object: 422 if self.__object:
427 self.__object.registerOpenHook() 423 self.__object.registerOpenHook()
428 424

eric ide

mercurial