11 import glob |
11 import glob |
12 import fnmatch |
12 import fnmatch |
13 |
13 |
14 from PyQt6.QtCore import QObject, QTranslator |
14 from PyQt6.QtCore import QObject, QTranslator |
15 |
15 |
16 from EricWidgets.EricApplication import ericApp |
16 from eric7 import Preferences |
17 |
17 from eric7.EricWidgets.EricApplication import ericApp |
18 import Preferences |
|
19 |
18 |
20 from pygments.lexers._mapping import LEXERS |
19 from pygments.lexers._mapping import LEXERS |
21 |
20 |
22 # Start-of-Header |
21 # Start-of-Header |
23 name = "Kivy Project Plugin" |
22 name = "Kivy Project Plugin" |
24 author = "Detlev Offenbach <detlev@die-offenbachs.de>" |
23 author = "Detlev Offenbach <detlev@die-offenbachs.de>" |
25 autoactivate = True |
24 autoactivate = True |
26 deactivateable = True |
25 deactivateable = True |
27 version = "10.0.0" |
26 version = "10.1.0" |
28 className = "ProjectKivyPlugin" |
27 className = "ProjectKivyPlugin" |
29 packageName = "ProjectKivy" |
28 packageName = "ProjectKivy" |
30 shortDescription = "Project support for Kivy projects." |
29 shortDescription = "Project support for Kivy projects." |
31 longDescription = """This plugin implements project support for Kivy projects.""" |
30 longDescription = """This plugin implements project support for Kivy projects.""" |
32 needsRestart = False |
31 needsRestart = False |
96 Public method to activate this plugin. |
95 Public method to activate this plugin. |
97 |
96 |
98 @return tuple of None and activation status |
97 @return tuple of None and activation status |
99 @rtype bool |
98 @rtype bool |
100 """ |
99 """ |
|
100 from eric7.Project.ProjectBrowser import ( |
|
101 SourcesBrowserFlag, |
|
102 FormsBrowserFlag, |
|
103 TranslationsBrowserFlag, |
|
104 OthersBrowserFlag, |
|
105 ) |
|
106 from eric7.QScintilla import Lexers |
|
107 |
101 self.__ericProject.registerProjectType( |
108 self.__ericProject.registerProjectType( |
102 "Kivy", |
109 "Kivy", |
103 self.tr("Kivy"), |
110 self.tr("Kivy"), |
104 self.fileTypesCallback, |
111 self.fileTypesCallback, |
105 lexerAssociationCallback=self.lexerAssociationCallback, |
112 lexerAssociationCallback=self.lexerAssociationCallback, |
106 progLanguages=["Python3"], |
113 progLanguages=["Python3"], |
107 ) |
114 ) |
108 |
115 |
109 from Project.ProjectBrowser import ( |
|
110 SourcesBrowserFlag, |
|
111 FormsBrowserFlag, |
|
112 TranslationsBrowserFlag, |
|
113 OthersBrowserFlag, |
|
114 ) |
|
115 |
|
116 Preferences.setProjectBrowserFlagsDefault( |
116 Preferences.setProjectBrowserFlagsDefault( |
117 "Kivy", |
117 "Kivy", |
118 SourcesBrowserFlag |
118 SourcesBrowserFlag |
119 | FormsBrowserFlag |
119 | FormsBrowserFlag |
120 | TranslationsBrowserFlag |
120 | TranslationsBrowserFlag |
121 | OthersBrowserFlag, |
121 | OthersBrowserFlag, |
122 ) |
122 ) |
123 |
123 |
124 LEXERS[self.KivyLexerKey] = self.KivyLexerEntry |
124 LEXERS[self.KivyLexerKey] = self.KivyLexerEntry |
125 import QScintilla.Lexers |
125 Lexers.registerLexer( |
126 |
|
127 QScintilla.Lexers.registerLexer( |
|
128 "Pygments|Kivy", |
126 "Pygments|Kivy", |
129 self.tr("Kivy"), |
127 self.tr("Kivy"), |
130 "dummy.kv", |
128 "dummy.kv", |
131 self.getLexer, |
129 self.getLexer, |
132 [self.tr("Kivy Files (*.kv *.kivy)")], |
130 [self.tr("Kivy Files (*.kv *.kivy)")], |
138 |
136 |
139 def deactivate(self): |
137 def deactivate(self): |
140 """ |
138 """ |
141 Public method to deactivate this plugin. |
139 Public method to deactivate this plugin. |
142 """ |
140 """ |
|
141 from eric7.QScintilla import Lexers |
|
142 |
143 self.__ericProject.unregisterProjectType("Kivy") |
143 self.__ericProject.unregisterProjectType("Kivy") |
144 |
144 |
145 import QScintilla.Lexers |
145 Lexers.unregisterLexer("Kivy") |
146 |
|
147 QScintilla.Lexers.unregisterLexer("Kivy") |
|
148 if self.KivyLexerKey in LEXERS: |
146 if self.KivyLexerKey in LEXERS: |
149 del LEXERS[self.KivyLexerKey] |
147 del LEXERS[self.KivyLexerKey] |
150 |
148 |
151 self.__initialize() |
149 self.__initialize() |
152 |
150 |