PluginCxFreeze.py

Wed, 27 Apr 2011 18:37:18 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 27 Apr 2011 18:37:18 +0200
changeset 21
de49f07bb6bf
parent 18
7a6fc748930f
child 22
b03d3d52f900
child 23
0ea5e51bc627
permissions
-rw-r--r--

Fixed an issue finding the executable on Windows systems (thanks to Tomas Sobota for the patch).

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
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
77 ## exe = 'cxfreeze'
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
78 if sys.platform == "win32":
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
79 ## exe += '.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
80 ## 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
81 ## 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
82 #
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 # 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
84 #
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 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
86 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
87 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
88 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
89 #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
90 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
91 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
92 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
93 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
94 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
95 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
96 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
97 # 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
98 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
99
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 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
101 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
102
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 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
104 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
105 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
106 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
107 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
108 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
109 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
110 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
111 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
112 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
113 #
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
114 # 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
115 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
116 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
117 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
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 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
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 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
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 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
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 @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
126 """
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 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
128
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 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
130 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
131 "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
132 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
133 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
134 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
135 _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
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 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
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 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
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 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
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 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
144
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 @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
146 """
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 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
148 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
149 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
150 _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
151
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 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
153 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
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 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
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 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
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 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
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 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
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 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
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 @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
166 """
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 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
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 # 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
170 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
171 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
172
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 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
174 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
175 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
176 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
177 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
178 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
179 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
180 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
181 """<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
182 """<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
183 """ 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
184 """ 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
185 """ 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
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 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
188 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
189 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
190
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 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
192 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
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 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
195 """
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 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
197 """
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 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
199 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
200 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
201 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
202 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
203 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
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 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
206 """
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 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
208 """
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 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
210 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
211 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
212 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 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
214 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
215 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
216 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
217 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
218 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
219 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
220 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
221 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
222 .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
223 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
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 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
226 """
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 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
228 """
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 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
230 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
231 # 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
232 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
233 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
234 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
235 """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
236 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
237 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
238 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
239
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 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
241 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
242 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
243 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
244 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
245 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
246 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
247
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 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
249 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
250 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
251 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
252
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 # 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
254 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
255 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
256 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
257 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
258 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
259 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
260

eric ide

mercurial