35 needsRestart = {needsRestart} |
35 needsRestart = {needsRestart} |
36 pyqtApi = 2 |
36 pyqtApi = 2 |
37 # End-Of-Header |
37 # End-Of-Header |
38 |
38 |
39 error = "" |
39 error = "" |
40 |
40 |
41 |
41 |
42 {modulesetup}\ |
42 {modulesetup}\ |
43 {exeData}\ |
43 {exeData}\ |
44 {apiFiles}\ |
44 {apiFiles}\ |
45 {preview}\ |
45 {preview}\ |
46 {config1}\ |
46 {config1}\ |
47 class {className}(QObject): |
47 class {className}(QObject): |
48 """ |
48 """ |
49 Class documentation goes here. |
49 Class documentation goes here. |
50 """ |
50 """ |
|
51 |
51 {config2}\ |
52 {config2}\ |
52 def __init__(self, ui): |
53 def __init__(self, ui): |
53 """ |
54 """ |
54 Constructor |
55 Constructor |
55 |
56 |
56 @param ui reference to the user interface object |
57 @param ui reference to the user interface object |
57 @type UI.UserInterface |
58 @type UI.UserInterface |
58 """ |
59 """ |
59 super({className}, self).__init__(ui) |
60 super({className}, self).__init__(ui) |
60 self.__ui = ui |
61 self.__ui = ui |
61 |
62 |
62 def activate(self): |
63 def activate(self): |
63 """ |
64 """ |
64 Public method to activate this plug-in. |
65 Public method to activate this plug-in. |
65 |
66 |
66 @return tuple of None and activation status |
67 @return tuple of None and activation status |
67 @rtype bool |
68 @rtype bool |
68 """ |
69 """ |
69 global error |
70 global error |
70 error = "" # clear previous error |
71 error = "" # clear previous error |
71 |
72 |
72 return None, True |
73 return None, True |
73 |
74 |
74 def deactivate(self): |
75 def deactivate(self): |
75 """ |
76 """ |
76 Public method to deactivate this plug-in. |
77 Public method to deactivate this plug-in. |
77 """ |
78 """ |
78 pass |
79 pass |
83 """ |
84 """ |
84 |
85 |
85 configTemplate1 = '''def getConfigData(): |
86 configTemplate1 = '''def getConfigData(): |
86 """ |
87 """ |
87 Module function returning data as required by the configuration dialog. |
88 Module function returning data as required by the configuration dialog. |
88 |
89 |
89 @return dictionary containing the relevant data |
90 @return dictionary containing the relevant data |
90 @rtype dict |
91 @rtype dict |
91 """ |
92 """ |
92 return {{ |
93 return {{ |
93 "<unique key>": ["<display string>", "<pixmap filename>", |
94 "<unique key>": [ |
94 pageCreationFunction, None, None], |
95 "<display string>", |
|
96 "<pixmap filename>", |
|
97 pageCreationFunction, |
|
98 None, |
|
99 None, |
|
100 ], |
95 }} |
101 }} |
96 |
102 |
97 |
103 |
98 def prepareUninstall(): |
104 def prepareUninstall(): |
99 """ |
105 """ |
103 |
109 |
104 |
110 |
105 ''' |
111 ''' |
106 |
112 |
107 configTemplate2 = """ PreferencesKey = "{preferencesKey}" |
113 configTemplate2 = """ PreferencesKey = "{preferencesKey}" |
108 |
114 |
109 """ |
115 """ |
110 |
116 |
111 configTemplate3 = '''\ |
117 configTemplate3 = ''' |
112 |
|
113 def getPreferences(self, key): |
118 def getPreferences(self, key): |
114 """ |
119 """ |
115 Public method to retrieve the various settings values. |
120 Public method to retrieve the various settings values. |
116 |
121 |
117 @param key the key of the value to get |
122 @param key the key of the value to get |
118 @type str |
123 @type str |
119 @return the requested setting value |
124 @return the requested setting value |
120 @rtype any |
125 @rtype any |
121 """ |
126 """ |
122 return None |
127 return None |
123 |
128 |
124 def setPreferences(self, key, value): |
129 def setPreferences(self, key, value): |
125 """ |
130 """ |
126 Public method to store the various settings values. |
131 Public method to store the various settings values. |
127 |
132 |
128 @param key the key of the setting to be set |
133 @param key the key of the setting to be set |
129 @type str |
134 @type str |
130 @param value the value to be set |
135 @param value the value to be set |
131 @type any |
136 @type any |
132 """ |
137 """ |
138 """ |
143 """ |
139 |
144 |
140 previewPixmapTemplate = '''def previewPix(): |
145 previewPixmapTemplate = '''def previewPix(): |
141 """ |
146 """ |
142 Module function to return a preview pixmap. |
147 Module function to return a preview pixmap. |
143 |
148 |
144 @return preview pixmap |
149 @return preview pixmap |
145 @rtype QPixmap |
150 @rtype QPixmap |
146 """ |
151 """ |
147 from PyQt6.QtGui import QPixmap |
152 from PyQt6.QtGui import QPixmap |
148 |
153 |
149 fname = "preview.png" |
154 fname = "preview.png" |
150 return QPixmap(fname) |
155 return QPixmap(fname) |
151 |
156 |
152 |
157 |
153 ''' |
158 ''' |
154 |
159 |
155 exeDisplayDataListTemplate = '''def exeDisplayDataList(): |
160 exeDisplayDataListTemplate = '''def exeDisplayDataList(): |
156 """ |
161 """ |
157 Module function to support the display of some executable info. |
162 Module function to support the display of some executable info. |
158 |
163 |
159 @return list of dictionaries containing the data to query the presence of |
164 @return list of dictionaries containing the data to query the presence of |
160 the executable |
165 the executable |
161 @rtype list of dict |
166 @rtype list of dict |
162 """ |
167 """ |
163 dataList = [] |
168 dataList = [] |
200 "versionPosition": -1, |
205 "versionPosition": -1, |
201 "version": "", |
206 "version": "", |
202 "versionCleanup": None, |
207 "versionCleanup": None, |
203 "exeModule": None, |
208 "exeModule": None, |
204 } |
209 } |
205 |
210 |
206 return data |
211 return data |
207 |
212 |
208 |
213 |
209 ''' |
214 ''' |
210 |
215 |
211 exeDisplayDataInfoTemplate = '''def exeDisplayData(): |
216 exeDisplayDataInfoTemplate = '''def exeDisplayData(): |
212 """ |
217 """ |
213 Module function to support the display of some executable info. |
218 Module function to support the display of some executable info. |
214 |
219 |
215 @return dictionary containing the data to be shown |
220 @return dictionary containing the data to be shown |
216 @rtype dict |
221 @rtype dict |
217 """ |
222 """ |
218 data = { |
223 data = { |
219 "programEntry": False, |
224 "programEntry": False, |
220 "header": "<translated header string>", |
225 "header": "<translated header string>", |
221 "text": "<translated entry string>", |
226 "text": "<translated entry string>", |
222 "version": "", |
227 "version": "", |
223 } |
228 } |
224 |
229 |
225 return data |
230 return data |
226 |
231 |
227 |
232 |
228 ''' |
233 ''' |
229 |
234 |
237 ''' |
242 ''' |
238 |
243 |
239 apiFilesTemplate = '''def apiFiles(language): |
244 apiFilesTemplate = '''def apiFiles(language): |
240 """ |
245 """ |
241 Module function to return the API files made available by this plug-in. |
246 Module function to return the API files made available by this plug-in. |
242 |
247 |
243 @param language language to get APIs for |
248 @param language language to get APIs for |
244 @type str |
249 @type str |
245 @return list of API filenames |
250 @return list of API filenames |
246 @rtype list of str |
251 @rtype list of str |
247 """ |
252 """ |
248 if language in ["Python3", "Python"]: |
253 if language in ("Python3", "Python"): |
249 apisDir = os.path.join( |
254 apisDir = os.path.join(os.path.dirname(__file__), "APIs", "Python") |
250 os.path.dirname(__file__), "APIs", "Python") |
255 apis = glob.glob(os.path.join(apisDir, "*.api")) |
251 apis = glob.glob(os.path.join(apisDir, '*.api')) |
256 apisDir = os.path.join(os.path.dirname(__file__), "APIs", "Python3") |
252 apisDir = os.path.join( |
257 apis.extend(glob.glob(os.path.join(apisDir, "*.api"))) |
253 os.path.dirname(__file__), "APIs", "Python3") |
|
254 apis.extend(glob.glob(os.path.join(apisDir, '*.api'))) |
|
255 else: |
258 else: |
256 apis = [] |
259 apis = [] |
257 return apis |
260 return apis |
258 |
261 |
259 |
262 |