57 {config2}\ |
57 {config2}\ |
58 def __init__(self, ui): |
58 def __init__(self, ui): |
59 """ |
59 """ |
60 Constructor |
60 Constructor |
61 |
61 |
62 @param ui reference to the user interface object (UI.UserInterface) |
62 @param ui reference to the user interface object |
|
63 @type UI.UserInterface |
63 """ |
64 """ |
64 super({className}, self).__init__(ui) |
65 super({className}, self).__init__(ui) |
65 self.__ui = ui |
66 self.__ui = ui |
66 |
67 |
67 def activate(self): |
68 def activate(self): |
68 """ |
69 """ |
69 Public method to activate this plugin. |
70 Public method to activate this plug-in. |
70 |
71 |
71 @return tuple of None and activation status (boolean) |
72 @return tuple of None and activation status |
|
73 @rtype bool |
72 """ |
74 """ |
73 global error |
75 global error |
74 error = "" # clear previous error |
76 error = "" # clear previous error |
75 |
77 |
76 return None, True |
78 return None, True |
77 |
79 |
78 def deactivate(self): |
80 def deactivate(self): |
79 """ |
81 """ |
80 Public method to deactivate this plugin. |
82 Public method to deactivate this plug-in. |
81 """ |
83 """ |
82 pass |
84 pass |
83 {config3}''' |
85 {config3}''' |
84 |
86 |
85 configTemplate0 = '''import Preferences |
87 configTemplate0 = '''import Preferences |
89 configTemplate1 = '''def getConfigData(): |
91 configTemplate1 = '''def getConfigData(): |
90 """ |
92 """ |
91 Module function returning data as required by the configuration dialog. |
93 Module function returning data as required by the configuration dialog. |
92 |
94 |
93 @return dictionary containing the relevant data |
95 @return dictionary containing the relevant data |
|
96 @rtype dict |
94 """ |
97 """ |
95 return {{ |
98 return {{ |
96 "<unique key>": ["<display string>", "<pixmap filename>", |
99 "<unique key>": ["<display string>", "<pixmap filename>", |
97 pageCreationFunction, None, None], |
100 pageCreationFunction, None, None], |
98 }} |
101 }} |
99 |
102 |
100 |
103 |
101 def prepareUninstall(): |
104 def prepareUninstall(): |
102 """ |
105 """ |
103 Module function to prepare for an uninstallation. |
106 Module function to prepare for an un-installation. |
104 """ |
107 """ |
105 Preferences.Prefs.settings.remove({className}.PreferencesKey) |
108 Preferences.Prefs.settings.remove({className}.PreferencesKey) |
106 |
109 |
107 |
110 |
108 ''' |
111 ''' |
113 |
116 |
114 configTemplate3 = '''\ |
117 configTemplate3 = '''\ |
115 |
118 |
116 def getPreferences(self, key): |
119 def getPreferences(self, key): |
117 """ |
120 """ |
118 Public method to retrieve the various refactoring settings. |
121 Public method to retrieve the various settings values. |
119 |
122 |
120 @param key the key of the value to get |
123 @param key the key of the value to get |
121 @return the requested refactoring setting |
124 @type str |
|
125 @return the requested setting value |
|
126 @rtype any |
122 """ |
127 """ |
123 return None |
128 return None |
124 |
129 |
125 def setPreferences(self, key, value): |
130 def setPreferences(self, key, value): |
126 """ |
131 """ |
127 Public method to store the various refactoring settings. |
132 Public method to store the various settings values. |
128 |
133 |
129 @param key the key of the setting to be set (string) |
134 @param key the key of the setting to be set |
|
135 @type str |
130 @param value the value to be set |
136 @param value the value to be set |
|
137 @type any |
131 """ |
138 """ |
132 pass |
139 pass |
133 ''' |
140 ''' |
134 |
141 |
135 onDemandTemplate = '''pluginType = "{pluginType}" |
142 onDemandTemplate = '''pluginType = "{pluginType}" |
138 |
145 |
139 previewPixmapTemplate = '''def previewPix(): |
146 previewPixmapTemplate = '''def previewPix(): |
140 """ |
147 """ |
141 Module function to return a preview pixmap. |
148 Module function to return a preview pixmap. |
142 |
149 |
143 @return preview pixmap (QPixmap) |
150 @return preview pixmap |
|
151 @rtype QPixmap |
144 """ |
152 """ |
145 from PyQt5.QtGui import QPixmap |
153 from PyQt5.QtGui import QPixmap |
146 |
154 |
147 fname = "preview.png" |
155 fname = "preview.png" |
148 return QPixmap(fname) |
156 return QPixmap(fname) |
154 """ |
162 """ |
155 Module function to support the display of some executable info. |
163 Module function to support the display of some executable info. |
156 |
164 |
157 @return list of dictionaries containing the data to query the presence of |
165 @return list of dictionaries containing the data to query the presence of |
158 the executable |
166 the executable |
|
167 @rtype list of dict |
159 """ |
168 """ |
160 dataList = [] |
169 dataList = [] |
161 data = { |
170 data = { |
162 "programEntry": True, |
171 "programEntry": True, |
163 "header": "<translated header string>", |
172 "header": "<translated header string>", |
164 "exe": "dummyExe", |
173 "exe": "dummyExe", |
165 "versionCommand": "--version", |
174 "versionCommand": "--version", |
166 "versionStartsWith": "dummyExe", |
175 "versionStartsWith": "dummyExe", |
|
176 "versionRe": "", |
167 "versionPosition": -1, |
177 "versionPosition": -1, |
168 "version": "", |
178 "version": "", |
169 "versionCleanup": None, |
179 "versionCleanup": None, |
170 } |
180 } |
171 for exePath in ["exe1", "exe2"]: |
181 for exePath in ["exe1", "exe2"]: |
181 """ |
191 """ |
182 Module function to support the display of some executable info. |
192 Module function to support the display of some executable info. |
183 |
193 |
184 @return dictionary containing the data to query the presence of |
194 @return dictionary containing the data to query the presence of |
185 the executable |
195 the executable |
|
196 @rtype dict |
186 """ |
197 """ |
187 data = { |
198 data = { |
188 "programEntry": True, |
199 "programEntry": True, |
189 "header": "<translated header string>", |
200 "header": "<translated header string>", |
190 "exe": exe, |
201 "exe": exe, |
191 "versionCommand": "--version", |
202 "versionCommand": "--version", |
192 "versionStartsWith": "<identifier>", |
203 "versionStartsWith": "<identifier>", |
|
204 "versionRe": "", |
193 "versionPosition": -1, |
205 "versionPosition": -1, |
194 "version": "", |
206 "version": "", |
195 "versionCleanup": None, |
207 "versionCleanup": None, |
196 } |
208 } |
197 |
209 |
209 |
221 |
210 ''' |
222 ''' |
211 |
223 |
212 apiFilesTemplate = '''def apiFiles(language): |
224 apiFilesTemplate = '''def apiFiles(language): |
213 """ |
225 """ |
214 Module function to return the API files made available by this plugin. |
226 Module function to return the API files made available by this plug-in. |
215 |
227 |
216 @param language language to get APIs for (string) |
228 @param language language to get APIs for |
217 @return list of API filenames (list of string) |
229 @type str |
|
230 @return list of API filenames |
|
231 @rtype list of str |
218 """ |
232 """ |
219 if language in ["Python3", "Python2", "Python"]: |
233 if language in ["Python3", "Python2", "Python"]: |
220 apisDir = \\ |
234 apisDir = \\ |
221 os.path.join(os.path.dirname(__file__), "APIs", "Python") |
235 os.path.join(os.path.dirname(__file__), "APIs", "Python") |
222 apis = glob.glob(os.path.join(apisDir, '*.api')) |
236 apis = glob.glob(os.path.join(apisDir, '*.api')) |