PluginCxFreeze.py

Sun, 28 Apr 2013 18:08:54 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 28 Apr 2013 18:08:54 +0200
changeset 44
8b51b5efd1ae
parent 43
122dd6b685f7
child 47
986f27beaad4
permissions
-rw-r--r--

Set version to 5.1.2 due to merge.

25
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
1 # -*- coding: utf-8 -*-
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
2
36
aa766140aff8 Updated copyright for 2013.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 34
diff changeset
3 # Copyright (c) 2010 - 2013 Detlev Offenbach <detlev@die-offenbachs.de>
25
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
4 #
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
5
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
6 """
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
7 Module implementing the CxFreeze plugin.
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
8 """
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
9
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
10 import os
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
11 import sys
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
12
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
13 from PyQt4.QtCore import QObject, QTranslator, QCoreApplication
39
27dcfe29985b Changed usage of QMessageBox and QFileDialog to the eric5 equivalents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 37
diff changeset
14 from PyQt4.QtGui import QDialog
25
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
15
39
27dcfe29985b Changed usage of QMessageBox and QFileDialog to the eric5 equivalents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 37
diff changeset
16 from E5Gui import E5MessageBox
25
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
17 from E5Gui.E5Action import E5Action
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
18 from E5Gui.E5Application import e5App
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
19
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
20 import Utilities
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
21
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
22 # Start-of-Header
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
23 name = "CxFreeze Plugin"
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
24 author = "Detlev Offenbach <detlev@die-offenbachs.de>"
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
25 autoactivate = True
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
26 deactivateable = True
44
8b51b5efd1ae Set version to 5.1.2 due to merge.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
27 version = "5.1.2"
25
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
28 className = "CxFreezePlugin"
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
29 packageName = "CxFreeze"
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
30 shortDescription = "Show the CxFreeze dialogs."
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
31 longDescription = """This plugin implements the CxFreeze dialogs.""" \
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
32 """ CxFreeze is used to generate a distribution package."""
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
33 needsRestart = False
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
34 pyqtApi = 2
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
35 # End-of-Header
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
36
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
37 error = ""
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
38
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
39 def exeDisplayData():
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
40 """
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
41 Public method to support the display of some executable info.
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
42
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
43 @return dictionary containing the data to query the presence of
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
44 the executable
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
45 """
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
46 data = {
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
47 "programEntry" : True,
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
48 "header" : QCoreApplication.translate("CxFreezePlugin",
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
49 "Packagers - cx_freeze"),
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
50 "exe" : 'dummyfreeze',
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
51 "versionCommand" : '--version',
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
52 "versionStartsWith" : 'dummyfreeze',
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
53 "versionPosition" : -1,
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
54 "version" : "",
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
55 "versionCleanup" : None,
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
56 }
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
57
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
58 exe = _findExecutable()
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
59 if exe:
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
60 data["exe"] = exe
30
153f0acb2ebb Corrected some more stuff in the main plug-in file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 28
diff changeset
61 data["versionStartsWith"] = "cxfreeze"
25
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
62
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
63 return data
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
64
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
65 def _findExecutable():
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
66 """
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
67 Restricted function to determine the name of the executable.
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
68
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
69 @return name of the executable (string)
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
70 """
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
71 if Utilities.isWindowsPlatform():
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
72 #
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
73 # Windows
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
74 #
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
75 exe = 'cxfreeze.bat'
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
76 if Utilities.isinpath(exe):
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
77 return exe
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
78 try:
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
79 #only since python 3.2
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
80 import sysconfig
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
81 scripts = sysconfig.get_path('scripts','nt')
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
82 return os.path.join(scripts, exe)
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
83 except ImportError:
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
84 try:
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
85 import winreg
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
86 except ImportError:
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
87 # give up ...
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
88 return None
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
89
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
90 def getExePath(branch):
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
91 version = str(sys.version_info.major) + '.' + \
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
92 str(sys.version_info.minor)
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
93 try:
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
94 software = winreg.OpenKey(branch, 'Software')
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
95 python = winreg.OpenKey(software, 'Python')
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
96 pcore = winreg.OpenKey(python, 'PythonCore')
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
97 version = winreg.OpenKey(pcore, version)
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
98 installpath = winreg.QueryValue(version, 'InstallPath')
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
99 return os.path.join(installpath, 'Scripts', exe)
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
100 except WindowsError: # __IGNORE_WARNING__
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
101 return None
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
102
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
103 exePath = getExePath(winreg.HKEY_CURRENT_USER)
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
104 if not exePath:
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
105 exePath = getExePath(winreg.HKEY_LOCAL_MACHINE)
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
106 return exePath
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
107 else:
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
108 #
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
109 # Linux, Unix ...
28
bbcf4437e32a Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 25
diff changeset
110 cxfreezeScript = 'cxfreeze'
33
2a3b4b7a633f Enhanced the algorithm to determine the cxfreeze executable on non-Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
111 scriptSuffixes = ["",
2a3b4b7a633f Enhanced the algorithm to determine the cxfreeze executable on non-Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
112 "-python{0}".format(sys.version[:1]),
2a3b4b7a633f Enhanced the algorithm to determine the cxfreeze executable on non-Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
113 "-python{0}".format(sys.version[:3])]
30
153f0acb2ebb Corrected some more stuff in the main plug-in file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 28
diff changeset
114 # There could be multiple cxfreeze executables in the path
28
bbcf4437e32a Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 25
diff changeset
115 # e.g. for different python variants
bbcf4437e32a Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 25
diff changeset
116 path = Utilities.getEnvironmentEntry('PATH')
bbcf4437e32a Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 25
diff changeset
117 # environment variable not defined
bbcf4437e32a Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 25
diff changeset
118 if path is None:
bbcf4437e32a Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 25
diff changeset
119 return None
bbcf4437e32a Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 25
diff changeset
120
bbcf4437e32a Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 25
diff changeset
121 # step 1: determine possible candidates
bbcf4437e32a Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 25
diff changeset
122 exes = []
bbcf4437e32a Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 25
diff changeset
123 dirs = path.split(os.pathsep)
bbcf4437e32a Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 25
diff changeset
124 for dir in dirs:
33
2a3b4b7a633f Enhanced the algorithm to determine the cxfreeze executable on non-Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
125 for suffix in scriptSuffixes:
2a3b4b7a633f Enhanced the algorithm to determine the cxfreeze executable on non-Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
126 exe = os.path.join(dir, cxfreezeScript + suffix)
2a3b4b7a633f Enhanced the algorithm to determine the cxfreeze executable on non-Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
127 if os.access(exe, os.X_OK):
2a3b4b7a633f Enhanced the algorithm to determine the cxfreeze executable on non-Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
128 exes.append(exe)
28
bbcf4437e32a Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 25
diff changeset
129
bbcf4437e32a Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 25
diff changeset
130 # step 2: determine the Python 3 variant
bbcf4437e32a Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 25
diff changeset
131 found = False
bbcf4437e32a Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 25
diff changeset
132 if Utilities.isMacPlatform():
41
394efa0e059c Fixed an issue locating the cxfreeze executable on Mac OS X and the list of init-scripts containing a .py extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 37
diff changeset
133 checkStrings = ["Python.framework/Versions/3".lower(),
394efa0e059c Fixed an issue locating the cxfreeze executable on Mac OS X and the list of init-scripts containing a .py extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 37
diff changeset
134 "python3"]
28
bbcf4437e32a Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 25
diff changeset
135 else:
41
394efa0e059c Fixed an issue locating the cxfreeze executable on Mac OS X and the list of init-scripts containing a .py extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 37
diff changeset
136 checkStrings = ["python3"]
28
bbcf4437e32a Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 25
diff changeset
137 for exe in exes:
bbcf4437e32a Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 25
diff changeset
138 try:
bbcf4437e32a Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 25
diff changeset
139 f = open(exe, "r")
bbcf4437e32a Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 25
diff changeset
140 line0 = f.readline()
41
394efa0e059c Fixed an issue locating the cxfreeze executable on Mac OS X and the list of init-scripts containing a .py extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 37
diff changeset
141 for checkStr in checkStrings:
394efa0e059c Fixed an issue locating the cxfreeze executable on Mac OS X and the list of init-scripts containing a .py extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 37
diff changeset
142 if checkStr in line0.lower():
394efa0e059c Fixed an issue locating the cxfreeze executable on Mac OS X and the list of init-scripts containing a .py extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 37
diff changeset
143 found = True
394efa0e059c Fixed an issue locating the cxfreeze executable on Mac OS X and the list of init-scripts containing a .py extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 37
diff changeset
144 break
28
bbcf4437e32a Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 25
diff changeset
145 finally:
bbcf4437e32a Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 25
diff changeset
146 f.close()
bbcf4437e32a Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 25
diff changeset
147 if found:
bbcf4437e32a Fixed the algorithm searching for the right cxfreeze executable in the presence of multiple installations for different Python versions..
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 25
diff changeset
148 return exe
25
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
149
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
150 return None
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
151
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
152 def _checkProgram():
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
153 """
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
154 Restricted function to check the availability of cxfreeze.
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
155
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
156 @return flag indicating availability (boolean)
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
157 """
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
158 global error
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
159
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
160 if _findExecutable() is None:
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
161 error = QCoreApplication.translate("CxFreezePlugin",
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
162 "The cxfreeze executable could not be found.")
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
163 return False
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
164 else:
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
165 return True
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
166 _checkProgram()
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
167
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
168 class CxFreezePlugin(QObject):
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
169 """
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
170 Class implementing the CxFreeze plugin.
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
171 """
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
172 def __init__(self, ui):
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
173 """
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
174 Constructor
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
175
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
176 @param ui reference to the user interface object (UI.UserInterface)
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
177 """
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
178 QObject.__init__(self, ui)
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
179 self.__ui = ui
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
180 self.__initialize()
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
181 _checkProgram()
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
182
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
183 self.__translator = None
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
184 self.__loadTranslator()
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
185
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
186 def __initialize(self):
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
187 """
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
188 Private slot to (re)initialize the plugin.
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
189 """
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
190 self.__projectAct = None
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
191
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
192 def activate(self):
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
193 """
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
194 Public method to activate this plugin.
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
195
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
196 @return tuple of None and activation status (boolean)
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
197 """
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
198 global error
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
199
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
200 # cxfreeze is only activated if it is available
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
201 if not _checkProgram():
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
202 return None, False
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
203
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
204 menu = e5App().getObject("Project").getMenu("Packagers")
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
205 if menu:
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
206 self.__projectAct = E5Action(self.trUtf8('Use cx_freeze'),
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
207 self.trUtf8('Use cx_&freeze'), 0, 0,
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
208 self, 'packagers_cxfreeze')
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
209 self.__projectAct.setStatusTip(
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
210 self.trUtf8('Generate a distribution package using cx_freeze'))
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
211 self.__projectAct.setWhatsThis(self.trUtf8(
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
212 """<b>Use cx_freeze</b>"""
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
213 """<p>Generate a distribution package using cx_freeze."""
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
214 """ The command is executed in the project path. All"""
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
215 """ files and directories must be given absolute or"""
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
216 """ relative to the project directory.</p>"""
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
217 ))
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
218 self.__projectAct.triggered[()].connect(self.__cxfreeze)
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
219 e5App().getObject("Project").addE5Actions([self.__projectAct])
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
220 menu.addAction(self.__projectAct)
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
221
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
222 error = ""
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
223 return None, True
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
224
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
225 def deactivate(self):
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
226 """
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
227 Public method to deactivate this plugin.
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
228 """
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
229 menu = e5App().getObject("Project").getMenu("Packagers")
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
230 if menu:
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
231 if self.__projectAct:
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
232 menu.removeAction(self.__projectAct)
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
233 e5App().getObject("Project").removeE5Actions([self.__projectAct])
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
234 self.__initialize()
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
235
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
236 def __loadTranslator(self):
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
237 """
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
238 Private method to load the translation file.
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
239 """
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
240 if self.__ui is not None:
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
241 loc = self.__ui.getLocale()
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
242 if loc and loc != "C":
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
243 locale_dir = \
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
244 os.path.join(os.path.dirname(__file__), "CxFreeze", "i18n")
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
245 translation = "cxfreeze_{0}".format(loc)
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
246 translator = QTranslator(None)
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
247 loaded = translator.load(translation, locale_dir)
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
248 if loaded:
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
249 self.__translator = translator
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
250 e5App().installTranslator(self.__translator)
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
251 else:
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
252 print("Warning: translation file '{0}' could not be loaded."\
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
253 .format(translation))
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
254 print("Using default.")
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
255
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
256 def __cxfreeze(self):
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
257 """
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
258 Private slot to handle the cxfreeze execution.
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
259 """
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
260 project = e5App().getObject("Project")
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
261 if len(project.pdata["MAINSCRIPT"]) == 0:
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
262 # no main script defined
39
27dcfe29985b Changed usage of QMessageBox and QFileDialog to the eric5 equivalents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 37
diff changeset
263 E5MessageBox.critical(None,
25
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
264 self.trUtf8("cxfreeze"),
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
265 self.trUtf8(
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
266 """There is no main script defined for the current project."""),
39
27dcfe29985b Changed usage of QMessageBox and QFileDialog to the eric5 equivalents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 37
diff changeset
267 E5MessageBox.StandardButtons(E5MessageBox.Abort))
25
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
268 return
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
269
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
270 parms = project.getData('PACKAGERSPARMS', "CXFREEZE")
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
271 exe = _findExecutable()
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
272 if exe is None:
39
27dcfe29985b Changed usage of QMessageBox and QFileDialog to the eric5 equivalents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 37
diff changeset
273 E5MessageBox.critical(None,
25
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
274 self.trUtf8("cxfreeze"),
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
275 self.trUtf8("""The cxfreeze executable could not be found."""))
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
276 return
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
277
37
94949c60ef54 Modified the code to do lazy import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 36
diff changeset
278 from CxFreeze.CxfreezeConfigDialog import CxfreezeConfigDialog
25
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
279 dlg = CxfreezeConfigDialog(project, exe, parms)
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
280 if dlg.exec_() == QDialog.Accepted:
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
281 args, parms = dlg.generateParameters()
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
282 project.setData('PACKAGERSPARMS', "CXFREEZE", parms)
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
283
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
284 # now do the call
37
94949c60ef54 Modified the code to do lazy import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 36
diff changeset
285 from CxFreeze.CxfreezeExecDialog import CxfreezeExecDialog
25
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
286 dia = CxfreezeExecDialog("cxfreeze")
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
287 dia.show()
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
288 res = dia.start(args,
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
289 os.path.join(project.ppath, project.pdata["MAINSCRIPT"][0]))
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
290 if res:
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
291 dia.exec_()
737c623c90df Fixed the cxfreeze search algorithm to check a per user install as well.
detlev@die-offenbachs.de
parents: 24
diff changeset
292

eric ide

mercurial