17 |
17 |
18 try: |
18 try: |
19 from E5Gui import E5MessageBox |
19 from E5Gui import E5MessageBox |
20 from E5Gui.E5Action import E5Action |
20 from E5Gui.E5Action import E5Action |
21 from E5Gui.E5Application import e5App |
21 from E5Gui.E5Application import e5App |
22 suitable = True |
22 error = "" |
23 except ImportError: |
23 except ImportError: |
24 suitable = False |
24 error = QCoreApplication.translate("CxFreezePlugin", |
|
25 """Your version of Eric5 is not supported.""" |
|
26 """ At least version 5.1.0 of Eric5 is needed.""") |
|
27 |
25 |
28 |
26 import Utilities |
29 import Utilities |
27 |
30 |
28 # Start-of-Header |
31 # Start-of-Header |
29 name = "CxFreeze Plugin" |
32 name = "CxFreeze Plugin" |
196 |
198 |
197 @return flag indicating availability (boolean) |
199 @return flag indicating availability (boolean) |
198 """ |
200 """ |
199 global error, exePy2, exePy3 |
201 global error, exePy2, exePy3 |
200 |
202 |
201 if not suitable: |
|
202 error = QCoreApplication.translate("CxFreezePlugin", """Your version of Eric5 is not supported. |
|
203 At least version 5.1.0 of Eric5 is needed.""") |
|
204 return False |
|
205 |
|
206 exePy2 = _findExecutable(2) |
203 exePy2 = _findExecutable(2) |
207 exePy3 = _findExecutable(3) |
204 exePy3 = _findExecutable(3) |
208 if (exePy2+exePy3) == []: |
205 if (exePy2+exePy3) == []: |
209 error = QCoreApplication.translate("CxFreezePlugin", |
206 error = QCoreApplication.translate("CxFreezePlugin", |
210 "The cxfreeze executable could not be found.") |
207 "The cxfreeze executable could not be found.") |
211 return False |
208 return False |
212 else: |
209 else: |
213 return True |
210 return True |
214 _checkProgram() |
|
215 |
211 |
216 class CxFreezePlugin(QObject): |
212 class CxFreezePlugin(QObject): |
217 """ |
213 """ |
218 Class implementing the CxFreeze plugin. |
214 Class implementing the CxFreeze plugin. |
219 """ |
215 """ |
242 Public method to activate this plugin. |
238 Public method to activate this plugin. |
243 |
239 |
244 @return tuple of None and activation status (boolean) |
240 @return tuple of None and activation status (boolean) |
245 """ |
241 """ |
246 global error |
242 global error |
|
243 |
|
244 # There is already an error, don't activate |
|
245 if error: |
|
246 return None, False |
247 |
247 |
248 # cxfreeze is only activated if it is available |
248 # cxfreeze is only activated if it is available |
249 if not _checkProgram(): |
249 if not _checkProgram(): |
250 return None, False |
250 return None, False |
251 |
251 |