24 # Start-of-Header |
24 # Start-of-Header |
25 name = "Flask Project Plugin" |
25 name = "Flask 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 = "1.2.0" |
29 version = "1.3.0" |
30 className = "ProjectFlaskPlugin" |
30 className = "ProjectFlaskPlugin" |
31 packageName = "ProjectFlask" |
31 packageName = "ProjectFlask" |
32 shortDescription = "Project support for Flask projects." |
32 shortDescription = "Project support for Flask projects." |
33 longDescription = ( |
33 longDescription = ( |
34 """This plugin implements project support for Flask projects.""" |
34 """This plugin implements project support for Flask projects.""" |
83 except AttributeError: |
83 except AttributeError: |
84 from PyQt5.QtGui import QPalette |
84 from PyQt5.QtGui import QPalette |
85 palette = e5App().palette() |
85 palette = e5App().palette() |
86 lightness = palette.color(QPalette.Window).lightness() |
86 lightness = palette.color(QPalette.Window).lightness() |
87 usesDarkPalette = lightness <= 128 |
87 usesDarkPalette = lightness <= 128 |
88 if usesDarkPalette: |
88 iconSuffix = "dark" if usesDarkPalette else "light" |
89 iconSuffix = "dark" |
|
90 else: |
|
91 iconSuffix = "light" |
|
92 |
89 |
93 return { |
90 return { |
94 "flaskPage": [ |
91 "flaskPage": [ |
95 QCoreApplication.translate("ProjectFlaskPlugin", "Flask"), |
92 QCoreApplication.translate("ProjectFlaskPlugin", "Flask"), |
96 os.path.join("ProjectFlask", "icons", |
93 os.path.join("ProjectFlask", "icons", |
181 except AttributeError: |
178 except AttributeError: |
182 from PyQt5.QtGui import QPalette |
179 from PyQt5.QtGui import QPalette |
183 palette = e5App().palette() |
180 palette = e5App().palette() |
184 lightness = palette.color(QPalette.Window).lightness() |
181 lightness = palette.color(QPalette.Window).lightness() |
185 usesDarkPalette = lightness <= 128 |
182 usesDarkPalette = lightness <= 128 |
186 if usesDarkPalette: |
183 iconSuffix = "dark" if usesDarkPalette else "light" |
187 iconSuffix = "dark" |
|
188 else: |
|
189 iconSuffix = "light" |
|
190 |
184 |
191 self.__object = Project(self, iconSuffix, self.__ui) |
185 self.__object = Project(self, iconSuffix, self.__ui) |
192 self.__object.initActions() |
186 self.__object.initActions() |
193 e5App().registerPluginObject("ProjectFlask", self.__object) |
187 e5App().registerPluginObject("ProjectFlask", self.__object) |
194 |
188 |
321 Public method get the filetype associations of the Django project type. |
315 Public method get the filetype associations of the Django project type. |
322 |
316 |
323 @return dictionary with file type associations |
317 @return dictionary with file type associations |
324 @rtype dict |
318 @rtype dict |
325 """ |
319 """ |
326 if self.__e5project.getProjectType() == "Flask": |
320 fileTypes = ( |
327 fileTypes = { |
321 {"*.py": "SOURCES", |
328 "*.py": "SOURCES", |
322 "*.js": "SOURCES", |
329 "*.js": "SOURCES", |
323 "*.html": "FORMS", |
330 "*.html": "FORMS", |
324 "*.htm": "FORMS", |
331 "*.htm": "FORMS", |
325 "*.pot": "TRANSLATIONS", |
332 "*.pot": "TRANSLATIONS", |
326 "*.po": "TRANSLATIONS", |
333 "*.po": "TRANSLATIONS", |
327 "*.mo": "TRANSLATIONS", } |
334 "*.mo": "TRANSLATIONS", |
328 if self.__e5project.getProjectType() == "Flask" else |
335 } |
329 {} |
336 else: |
330 ) |
337 fileTypes = {} |
|
338 return fileTypes |
331 return fileTypes |
339 |
332 |
340 def lexerAssociationCallback(self, filename): |
333 def lexerAssociationCallback(self, filename): |
341 """ |
334 """ |
342 Public method to get the lexer association of the Django project type |
335 Public method to get the lexer association of the Django project type |