10 from __future__ import unicode_literals |
10 from __future__ import unicode_literals |
11 |
11 |
12 import os |
12 import os |
13 import platform |
13 import platform |
14 |
14 |
15 from PyQt4.QtCore import QObject, QTranslator, QCoreApplication |
15 from PyQt5.QtCore import QObject, QTranslator, QCoreApplication |
16 from PyQt4.QtGui import QDialog |
16 from PyQt5.QtWidgets import QDialog |
17 |
17 |
18 try: |
18 from E5Gui import E5MessageBox |
19 from E5Gui import E5MessageBox |
19 from E5Gui.E5Action import E5Action |
20 from E5Gui.E5Action import E5Action |
20 from E5Gui.E5Application import e5App |
21 from E5Gui.E5Application import e5App |
21 |
22 error = "" |
|
23 except ImportError: |
|
24 error = QCoreApplication.translate( |
|
25 "CxFreezePlugin", |
|
26 """Your version of Eric5 is not supported.""" |
|
27 """ At least version 5.1.0 of Eric5 is needed.""") |
|
28 |
|
29 |
|
30 import Utilities |
22 import Utilities |
31 |
23 |
32 # Start-of-Header |
24 # Start-of-Header |
33 name = "CxFreeze Plugin" |
25 name = "CxFreeze Plugin" |
34 author = "Detlev Offenbach <detlev@die-offenbachs.de>" |
26 author = "Detlev Offenbach <detlev@die-offenbachs.de>" |
35 autoactivate = True |
27 autoactivate = True |
36 deactivateable = True |
28 deactivateable = True |
37 version = "5.3.3" |
29 version = "6.0.0" |
38 className = "CxFreezePlugin" |
30 className = "CxFreezePlugin" |
39 packageName = "CxFreeze" |
31 packageName = "CxFreeze" |
40 shortDescription = "Show the CxFreeze dialogs." |
32 shortDescription = "Show the CxFreeze dialogs." |
41 longDescription = \ |
33 longDescription = \ |
42 """This plugin implements the CxFreeze dialogs.""" \ |
34 """This plugin implements the CxFreeze dialogs.""" \ |
43 """ CxFreeze is used to generate a distribution package.""" |
35 """ CxFreeze is used to generate a distribution package.""" |
44 needsRestart = False |
36 needsRestart = False |
45 pyqtApi = 2 |
37 pyqtApi = 2 |
46 python2Compatible = True |
38 python2Compatible = True |
47 # End-of-Header |
39 # End-of-Header |
|
40 |
|
41 error = "" |
48 |
42 |
49 exePy2 = [] |
43 exePy2 = [] |
50 exePy3 = [] |
44 exePy3 = [] |
51 |
45 |
52 |
46 |
261 |
255 |
262 project = e5App().getObject("Project") |
256 project = e5App().getObject("Project") |
263 menu = project.getMenu("Packagers") |
257 menu = project.getMenu("Packagers") |
264 if menu: |
258 if menu: |
265 self.__projectAct = E5Action( |
259 self.__projectAct = E5Action( |
266 self.trUtf8('Use cx_freeze'), |
260 self.tr('Use cx_freeze'), |
267 self.trUtf8('Use cx_&freeze'), 0, 0, |
261 self.tr('Use cx_&freeze'), 0, 0, |
268 self, 'packagers_cxfreeze') |
262 self, 'packagers_cxfreeze') |
269 self.__projectAct.setStatusTip( |
263 self.__projectAct.setStatusTip( |
270 self.trUtf8('Generate a distribution package using cx_freeze')) |
264 self.tr('Generate a distribution package using cx_freeze')) |
271 self.__projectAct.setWhatsThis(self.trUtf8( |
265 self.__projectAct.setWhatsThis(self.tr( |
272 """<b>Use cx_freeze</b>""" |
266 """<b>Use cx_freeze</b>""" |
273 """<p>Generate a distribution package using cx_freeze.""" |
267 """<p>Generate a distribution package using cx_freeze.""" |
274 """ The command is executed in the project path. All""" |
268 """ The command is executed in the project path. All""" |
275 """ files and directories must be given absolute or""" |
269 """ files and directories must be given absolute or""" |
276 """ relative to the project directory.</p>""" |
270 """ relative to the project directory.</p>""" |
277 )) |
271 )) |
278 self.__projectAct.triggered[()].connect(self.__cxfreeze) |
272 self.__projectAct.triggered.connect(self.__cxfreeze) |
279 project.addE5Actions([self.__projectAct]) |
273 project.addE5Actions([self.__projectAct]) |
280 menu.addAction(self.__projectAct) |
274 menu.addAction(self.__projectAct) |
281 project.showMenu.connect(self.__projectShowMenu) |
275 project.showMenu.connect(self.__projectShowMenu) |
282 |
276 |
283 error = "" |
277 error = "" |
336 project = e5App().getObject("Project") |
330 project = e5App().getObject("Project") |
337 if len(project.pdata["MAINSCRIPT"]) == 0: |
331 if len(project.pdata["MAINSCRIPT"]) == 0: |
338 # no main script defined |
332 # no main script defined |
339 E5MessageBox.critical( |
333 E5MessageBox.critical( |
340 self.__ui, |
334 self.__ui, |
341 self.trUtf8("cxfreeze"), |
335 self.tr("cxfreeze"), |
342 self.trUtf8( |
336 self.tr( |
343 """There is no main script defined for the current""" |
337 """There is no main script defined for the current""" |
344 """ project."""), |
338 """ project."""), |
345 E5MessageBox.StandardButtons(E5MessageBox.Abort)) |
339 E5MessageBox.StandardButtons(E5MessageBox.Abort)) |
346 return |
340 return |
347 |
341 |
349 exe = {"Python": exePy2, "Python2": exePy2, "Python3": exePy3}\ |
343 exe = {"Python": exePy2, "Python2": exePy2, "Python3": exePy3}\ |
350 .get(majorVersionStr) |
344 .get(majorVersionStr) |
351 if exe == []: |
345 if exe == []: |
352 E5MessageBox.critical( |
346 E5MessageBox.critical( |
353 self.__ui, |
347 self.__ui, |
354 self.trUtf8("cxfreeze"), |
348 self.tr("cxfreeze"), |
355 self.trUtf8("""The cxfreeze executable could not be found.""")) |
349 self.tr("""The cxfreeze executable could not be found.""")) |
356 return |
350 return |
357 |
351 |
358 # check if all files saved and errorfree before continue |
352 # check if all files saved and errorfree before continue |
359 if not project.checkAllScriptsDirty(reportSyntaxErrors=True): |
353 if not project.checkAllScriptsDirty(reportSyntaxErrors=True): |
360 return |
354 return |