Thu, 28 Apr 2011 19:36:25 +0200
Refined the last change and made final plug-in archive.
17
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
1 | # -*- coding: utf-8 -*- |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
2 | |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
3 | # Copyright (c) 2010 - 2011 Detlev Offenbach <detlev@die-offenbachs.de> |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
4 | # |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
5 | |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
6 | """ |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
7 | Module implementing the CxFreeze plugin. |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
8 | """ |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
9 | |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
10 | import os |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
11 | import sys |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
12 | |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
13 | from PyQt4.QtCore import QObject, QTranslator, QCoreApplication |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
14 | from PyQt4.QtGui import QDialog, QMessageBox |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
15 | |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
16 | from E5Gui.E5Action import E5Action |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
17 | from E5Gui.E5Application import e5App |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
18 | |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
19 | from CxFreeze.CxfreezeConfigDialog import CxfreezeConfigDialog |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
20 | from CxFreeze.CxfreezeExecDialog import CxfreezeExecDialog |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
21 | |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
22 | import Utilities |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
23 | |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
24 | # Start-of-Header |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
25 | name = "CxFreeze Plugin" |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
26 | author = "Detlev Offenbach <detlev@die-offenbachs.de>" |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
27 | autoactivate = True |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
28 | deactivateable = True |
21
de49f07bb6bf
Fixed an issue finding the executable on Windows systems (thanks to Tomas Sobota for the patch).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
18
diff
changeset
|
29 | version = "5.0.3" |
17
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
30 | className = "CxFreezePlugin" |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
31 | packageName = "CxFreeze" |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
32 | shortDescription = "Show the CxFreeze dialogs." |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
33 | longDescription = """This plugin implements the CxFreeze dialogs.""" \ |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
34 | """ CxFreeze is used to generate a distribution package.""" |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
35 | needsRestart = False |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
36 | pyqtApi = 2 |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
37 | # End-of-Header |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
38 | |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
39 | error = "" |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
40 | |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
41 | def exeDisplayData(): |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
42 | """ |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
43 | Public method to support the display of some executable info. |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
44 | |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
45 | @return dictionary containing the data to query the presence of |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
46 | the executable |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
47 | """ |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
48 | data = { |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
49 | "programEntry" : True, |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
50 | "header" : QCoreApplication.translate("CxFreezePlugin", |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
51 | "Packagers - cx_freeze"), |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
52 | "exe" : 'dummyfreeze', |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
53 | "versionCommand" : '--version', |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
54 | "versionStartsWith" : 'dummyfreeze', |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
55 | "versionPosition" : -1, |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
56 | "version" : "", |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
57 | "versionCleanup" : None, |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
58 | } |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
59 | |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
60 | exe = _findExecutable() |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
61 | if exe: |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
62 | data["exe"] = exe |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
63 | if exe.startswith("FreezePython"): |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
64 | data["versionStartsWith"] = "FreezePython" |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
65 | elif exe.startswith("cxfreeze"): |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
66 | data["versionStartsWith"] = "cxfreeze" |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
67 | |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
68 | return data |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
69 | |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
70 | def _findExecutable(): |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
71 | """ |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
72 | Restricted function to determine the name of the executable. |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
73 | |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
74 | @return name of the executable (string) |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
75 | """ |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
76 | # step 1: check for version 4.x |
22
b03d3d52f900
Refined the last change and made final plug-in archive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
21
diff
changeset
|
77 | if Utilities.isWindowsPlatform(): |
21
de49f07bb6bf
Fixed an issue finding the executable on Windows systems (thanks to Tomas Sobota for the patch).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
18
diff
changeset
|
78 | # |
de49f07bb6bf
Fixed an issue finding the executable on Windows systems (thanks to Tomas Sobota for the patch).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
18
diff
changeset
|
79 | # Windows |
de49f07bb6bf
Fixed an issue finding the executable on Windows systems (thanks to Tomas Sobota for the patch).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
18
diff
changeset
|
80 | # |
de49f07bb6bf
Fixed an issue finding the executable on Windows systems (thanks to Tomas Sobota for the patch).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
18
diff
changeset
|
81 | exe = 'cxfreeze.bat' |
de49f07bb6bf
Fixed an issue finding the executable on Windows systems (thanks to Tomas Sobota for the patch).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
18
diff
changeset
|
82 | if Utilities.isinpath(exe): |
de49f07bb6bf
Fixed an issue finding the executable on Windows systems (thanks to Tomas Sobota for the patch).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
18
diff
changeset
|
83 | return exe |
de49f07bb6bf
Fixed an issue finding the executable on Windows systems (thanks to Tomas Sobota for the patch).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
18
diff
changeset
|
84 | try: |
de49f07bb6bf
Fixed an issue finding the executable on Windows systems (thanks to Tomas Sobota for the patch).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
18
diff
changeset
|
85 | #only since python 3.2 |
de49f07bb6bf
Fixed an issue finding the executable on Windows systems (thanks to Tomas Sobota for the patch).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
18
diff
changeset
|
86 | import sysconfig |
de49f07bb6bf
Fixed an issue finding the executable on Windows systems (thanks to Tomas Sobota for the patch).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
18
diff
changeset
|
87 | scripts = sysconfig.get_path('scripts','nt') |
de49f07bb6bf
Fixed an issue finding the executable on Windows systems (thanks to Tomas Sobota for the patch).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
18
diff
changeset
|
88 | return os.path.join(scripts, exe) |
de49f07bb6bf
Fixed an issue finding the executable on Windows systems (thanks to Tomas Sobota for the patch).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
18
diff
changeset
|
89 | except ImportError: |
de49f07bb6bf
Fixed an issue finding the executable on Windows systems (thanks to Tomas Sobota for the patch).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
18
diff
changeset
|
90 | try: |
de49f07bb6bf
Fixed an issue finding the executable on Windows systems (thanks to Tomas Sobota for the patch).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
18
diff
changeset
|
91 | import winreg |
de49f07bb6bf
Fixed an issue finding the executable on Windows systems (thanks to Tomas Sobota for the patch).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
18
diff
changeset
|
92 | except ImportError: |
de49f07bb6bf
Fixed an issue finding the executable on Windows systems (thanks to Tomas Sobota for the patch).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
18
diff
changeset
|
93 | # give up ... |
de49f07bb6bf
Fixed an issue finding the executable on Windows systems (thanks to Tomas Sobota for the patch).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
18
diff
changeset
|
94 | return None |
de49f07bb6bf
Fixed an issue finding the executable on Windows systems (thanks to Tomas Sobota for the patch).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
18
diff
changeset
|
95 | |
de49f07bb6bf
Fixed an issue finding the executable on Windows systems (thanks to Tomas Sobota for the patch).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
18
diff
changeset
|
96 | version = str(sys.version_info.major) + '.' + \ |
de49f07bb6bf
Fixed an issue finding the executable on Windows systems (thanks to Tomas Sobota for the patch).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
18
diff
changeset
|
97 | str(sys.version_info.minor) |
de49f07bb6bf
Fixed an issue finding the executable on Windows systems (thanks to Tomas Sobota for the patch).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
18
diff
changeset
|
98 | |
de49f07bb6bf
Fixed an issue finding the executable on Windows systems (thanks to Tomas Sobota for the patch).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
18
diff
changeset
|
99 | try: |
de49f07bb6bf
Fixed an issue finding the executable on Windows systems (thanks to Tomas Sobota for the patch).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
18
diff
changeset
|
100 | software = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, 'Software') |
de49f07bb6bf
Fixed an issue finding the executable on Windows systems (thanks to Tomas Sobota for the patch).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
18
diff
changeset
|
101 | python = winreg.OpenKey(software, 'Python') |
de49f07bb6bf
Fixed an issue finding the executable on Windows systems (thanks to Tomas Sobota for the patch).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
18
diff
changeset
|
102 | pcore = winreg.OpenKey(python, 'PythonCore') |
de49f07bb6bf
Fixed an issue finding the executable on Windows systems (thanks to Tomas Sobota for the patch).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
18
diff
changeset
|
103 | version = winreg.OpenKey(pcore, version) |
de49f07bb6bf
Fixed an issue finding the executable on Windows systems (thanks to Tomas Sobota for the patch).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
18
diff
changeset
|
104 | installpath = winreg.QueryValue(version, 'InstallPath') |
de49f07bb6bf
Fixed an issue finding the executable on Windows systems (thanks to Tomas Sobota for the patch).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
18
diff
changeset
|
105 | return os.path.join(installpath, 'Scripts', exe) |
de49f07bb6bf
Fixed an issue finding the executable on Windows systems (thanks to Tomas Sobota for the patch).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
18
diff
changeset
|
106 | except WindowsError: # __IGNORE_WARNING__ |
de49f07bb6bf
Fixed an issue finding the executable on Windows systems (thanks to Tomas Sobota for the patch).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
18
diff
changeset
|
107 | return None |
de49f07bb6bf
Fixed an issue finding the executable on Windows systems (thanks to Tomas Sobota for the patch).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
18
diff
changeset
|
108 | else: |
de49f07bb6bf
Fixed an issue finding the executable on Windows systems (thanks to Tomas Sobota for the patch).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
18
diff
changeset
|
109 | # |
de49f07bb6bf
Fixed an issue finding the executable on Windows systems (thanks to Tomas Sobota for the patch).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
18
diff
changeset
|
110 | # Linux, Unix ... |
de49f07bb6bf
Fixed an issue finding the executable on Windows systems (thanks to Tomas Sobota for the patch).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
18
diff
changeset
|
111 | exe = 'cxfreeze' |
de49f07bb6bf
Fixed an issue finding the executable on Windows systems (thanks to Tomas Sobota for the patch).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
18
diff
changeset
|
112 | if Utilities.isinpath(exe): |
de49f07bb6bf
Fixed an issue finding the executable on Windows systems (thanks to Tomas Sobota for the patch).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
18
diff
changeset
|
113 | return exe |
17
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
114 | |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
115 | return None |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
116 | |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
117 | def _checkProgram(): |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
118 | """ |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
119 | Restricted function to check the availability of cxfreeze. |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
120 | |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
121 | @return flag indicating availability (boolean) |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
122 | """ |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
123 | global error |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
124 | |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
125 | if _findExecutable() is None: |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
126 | error = QCoreApplication.translate("CxFreezePlugin", |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
127 | "The cxfreeze executable could not be found.") |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
128 | return False |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
129 | else: |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
130 | return True |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
131 | _checkProgram() |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
132 | |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
133 | class CxFreezePlugin(QObject): |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
134 | """ |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
135 | Class implementing the CxFreeze plugin. |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
136 | """ |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
137 | def __init__(self, ui): |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
138 | """ |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
139 | Constructor |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
140 | |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
141 | @param ui reference to the user interface object (UI.UserInterface) |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
142 | """ |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
143 | QObject.__init__(self, ui) |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
144 | self.__ui = ui |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
145 | self.__initialize() |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
146 | _checkProgram() |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
147 | |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
148 | self.__translator = None |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
149 | self.__loadTranslator() |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
150 | |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
151 | def __initialize(self): |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
152 | """ |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
153 | Private slot to (re)initialize the plugin. |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
154 | """ |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
155 | self.__projectAct = None |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
156 | |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
157 | def activate(self): |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
158 | """ |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
159 | Public method to activate this plugin. |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
160 | |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
161 | @return tuple of None and activation status (boolean) |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
162 | """ |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
163 | global error |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
164 | |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
165 | # cxfreeze is only activated if it is available |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
166 | if not _checkProgram(): |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
167 | return None, False |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
168 | |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
169 | menu = e5App().getObject("Project").getMenu("Packagers") |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
170 | if menu: |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
171 | self.__projectAct = E5Action(self.trUtf8('Use cx_freeze'), |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
172 | self.trUtf8('Use cx_&freeze'), 0, 0, |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
173 | self, 'packagers_cxfreeze') |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
174 | self.__projectAct.setStatusTip( |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
175 | self.trUtf8('Generate a distribution package using cx_freeze')) |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
176 | self.__projectAct.setWhatsThis(self.trUtf8( |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
177 | """<b>Use cx_freeze</b>""" |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
178 | """<p>Generate a distribution package using cx_freeze.""" |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
179 | """ The command is executed in the project path. All""" |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
180 | """ files and directories must be given absolute or""" |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
181 | """ relative to the project directory.</p>""" |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
182 | )) |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
183 | self.__projectAct.triggered[()].connect(self.__cxfreeze) |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
184 | e5App().getObject("Project").addE5Actions([self.__projectAct]) |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
185 | menu.addAction(self.__projectAct) |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
186 | |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
187 | error = "" |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
188 | return None, True |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
189 | |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
190 | def deactivate(self): |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
191 | """ |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
192 | Public method to deactivate this plugin. |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
193 | """ |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
194 | menu = e5App().getObject("Project").getMenu("Packagers") |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
195 | if menu: |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
196 | if self.__projectAct: |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
197 | menu.removeAction(self.__projectAct) |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
198 | e5App().getObject("Project").removeE5Actions([self.__projectAct]) |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
199 | self.__initialize() |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
200 | |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
201 | def __loadTranslator(self): |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
202 | """ |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
203 | Private method to load the translation file. |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
204 | """ |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
205 | if self.__ui is not None: |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
206 | loc = self.__ui.getLocale() |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
207 | if loc and loc != "C": |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
208 | locale_dir = \ |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
209 | os.path.join(os.path.dirname(__file__), "CxFreeze", "i18n") |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
210 | translation = "cxfreeze_{0}".format(loc) |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
211 | translator = QTranslator(None) |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
212 | loaded = translator.load(translation, locale_dir) |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
213 | if loaded: |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
214 | self.__translator = translator |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
215 | e5App().installTranslator(self.__translator) |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
216 | else: |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
217 | print("Warning: translation file '{0}' could not be loaded."\ |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
218 | .format(translation)) |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
219 | print("Using default.") |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
220 | |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
221 | def __cxfreeze(self): |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
222 | """ |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
223 | Private slot to handle the cxfreeze execution. |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
224 | """ |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
225 | project = e5App().getObject("Project") |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
226 | if len(project.pdata["MAINSCRIPT"]) == 0: |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
227 | # no main script defined |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
228 | QMessageBox.critical(None, |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
229 | self.trUtf8("cxfreeze"), |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
230 | self.trUtf8( |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
231 | """There is no main script defined for the current project."""), |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
232 | QMessageBox.StandardButtons( |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
233 | QMessageBox.Abort)) |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
234 | return |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
235 | |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
236 | parms = project.getData('PACKAGERSPARMS', "CXFREEZE") |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
237 | exe = _findExecutable() |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
238 | if exe is None: |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
239 | QMessageBox.critical(None, |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
240 | self.trUtf8("cxfreeze"), |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
241 | self.trUtf8("""The cxfreeze executable could not be found.""")) |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
242 | return |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
243 | |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
244 | dlg = CxfreezeConfigDialog(project, exe, parms) |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
245 | if dlg.exec_() == QDialog.Accepted: |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
246 | args, parms = dlg.generateParameters() |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
247 | project.setData('PACKAGERSPARMS', "CXFREEZE", parms) |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
248 | |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
249 | # now do the call |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
250 | dia = CxfreezeExecDialog("cxfreeze") |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
251 | dia.show() |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
252 | res = dia.start(args, |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
253 | os.path.join(project.ppath, project.pdata["MAINSCRIPT"][0])) |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
254 | if res: |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
255 | dia.exec_() |
b5f6e6ca8b1a
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
16
diff
changeset
|
256 |