PyInstallerInterface/PyInstallerConfigDialog.py

Tue, 25 Oct 2022 08:46:11 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Tue, 25 Oct 2022 08:46:11 +0200
branch
eric7
changeset 47
3b9805bff70c
parent 46
ccd14067e6a2
child 51
37e614c54ea5
permissions
-rw-r--r--

Adapted the import statements to the new structure.

3
eb2d30b4d34e Continued implementing the PyInstaller interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
eb2d30b4d34e Continued implementing the PyInstaller interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
43
01ce3d6f7a07 Updated copyright for 2022.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 38
diff changeset
3 # Copyright (c) 2018 - 2022 Detlev Offenbach <detlev@die-offenbachs.de>
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
4 #
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
5
3
eb2d30b4d34e Continued implementing the PyInstaller interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
eb2d30b4d34e Continued implementing the PyInstaller interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing PyInstallerConfigDialog.
eb2d30b4d34e Continued implementing the PyInstaller interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
eb2d30b4d34e Continued implementing the PyInstaller interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
10 import copy
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
11
38
fc9ef9dcd51a Ported the plug-in to PyQt6 for eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 35
diff changeset
12 from PyQt6.QtCore import pyqtSlot
fc9ef9dcd51a Ported the plug-in to PyQt6 for eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 35
diff changeset
13 from PyQt6.QtWidgets import QDialog, QDialogButtonBox
3
eb2d30b4d34e Continued implementing the PyInstaller interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14
47
3b9805bff70c Adapted the import statements to the new structure.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 46
diff changeset
15 from eric7 import Globals
3b9805bff70c Adapted the import statements to the new structure.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 46
diff changeset
16 from eric7.EricWidgets.EricPathPicker import EricPathPickerModes
3
eb2d30b4d34e Continued implementing the PyInstaller interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17
eb2d30b4d34e Continued implementing the PyInstaller interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 from .Ui_PyInstallerConfigDialog import Ui_PyInstallerConfigDialog
eb2d30b4d34e Continued implementing the PyInstaller interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19
eb2d30b4d34e Continued implementing the PyInstaller interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20
eb2d30b4d34e Continued implementing the PyInstaller interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 class PyInstallerConfigDialog(QDialog, Ui_PyInstallerConfigDialog):
eb2d30b4d34e Continued implementing the PyInstaller interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 """
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
23 Class implementing a dialog to enter the parameters for pyinstaller
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
24 and pyi-makespec.
3
eb2d30b4d34e Continued implementing the PyInstaller interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 """
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
26
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
27 def __init__(
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
28 self, project, executables, params=None, mode="installer", parent=None
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
29 ):
3
eb2d30b4d34e Continued implementing the PyInstaller interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 """
eb2d30b4d34e Continued implementing the PyInstaller interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 Constructor
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
32
3
eb2d30b4d34e Continued implementing the PyInstaller interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 @param project reference to the project object
eb2d30b4d34e Continued implementing the PyInstaller interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 @type Project.Project
eb2d30b4d34e Continued implementing the PyInstaller interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 @param executables names of the pyinstaller executables
eb2d30b4d34e Continued implementing the PyInstaller interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 @type list of str
eb2d30b4d34e Continued implementing the PyInstaller interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 @param params parameters to set in the dialog
eb2d30b4d34e Continued implementing the PyInstaller interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 @type dict
eb2d30b4d34e Continued implementing the PyInstaller interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 @param mode mode of the dialog
eb2d30b4d34e Continued implementing the PyInstaller interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 @type str (one of 'installer' or 'spec')
eb2d30b4d34e Continued implementing the PyInstaller interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 @param parent reference to the parent widget
eb2d30b4d34e Continued implementing the PyInstaller interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 @type QWidget
eb2d30b4d34e Continued implementing the PyInstaller interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 """
35
d9b3cadaf707 Implemented some code simplifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 34
diff changeset
44 super().__init__(parent)
3
eb2d30b4d34e Continued implementing the PyInstaller interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 self.setupUi(self)
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
46
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
47 self.__project = project
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
48 self.__mode = mode
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
49
38
fc9ef9dcd51a Ported the plug-in to PyQt6 for eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 35
diff changeset
50 self.inputFilePicker.setMode(EricPathPickerModes.OPEN_FILE_MODE)
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
51 self.inputFilePicker.setDefaultDirectory(self.__project.getProjectPath())
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
52 if self.__mode == "installer":
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
53 self.inputFilePicker.setFilters(
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
54 self.tr(
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
55 "Python Files (*.py *.py3);;"
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
56 "Python GUI Files (*.pyw *.pyw3);;"
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
57 "Spec Files (*.spec);;"
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
58 "All Files (*)"
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
59 )
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
60 )
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
61 elif self.__mode == "spec":
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
62 self.inputFilePicker.setFilters(
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
63 self.tr(
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
64 "Python Files (*.py *.py3);;"
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
65 "Python GUI Files (*.pyw *.pyw3);;"
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
66 "All Files (*)"
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
67 )
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
68 )
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
69
3
eb2d30b4d34e Continued implementing the PyInstaller interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 self.executableCombo.addItems(executables)
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
71
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
72 if not bool(project.getMainScript()):
3
eb2d30b4d34e Continued implementing the PyInstaller interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 # no main script defined
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
74 self.selectedScriptButton.setChecked(True)
3
eb2d30b4d34e Continued implementing the PyInstaller interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
75 self.mainScriptButton.setEnabled(False)
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
76
38
fc9ef9dcd51a Ported the plug-in to PyQt6 for eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 35
diff changeset
77 self.iconFilePicker.setMode(EricPathPickerModes.OPEN_FILE_MODE)
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
78 self.iconFilePicker.setDefaultDirectory(self.__project.getProjectPath())
3
eb2d30b4d34e Continued implementing the PyInstaller interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
79 if Globals.isMacPlatform():
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
80 self.iconFilePicker.setFilters(
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
81 self.tr("Icon Files (*.icns);;" "All Files (*)")
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
82 )
3
eb2d30b4d34e Continued implementing the PyInstaller interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83 elif Globals.isWindowsPlatform():
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
84 self.iconFilePicker.setFilters(
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
85 self.tr(
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
86 "Icon Files (*.ico);;" "Executable Files (*.exe);;" "All Files (*)"
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
87 )
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
88 )
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
89
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
90 # disable platform specific tabs
3
eb2d30b4d34e Continued implementing the PyInstaller interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91 self.tabWidget.setTabEnabled(
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
92 self.tabWidget.indexOf(self.windowsMacTab),
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
93 Globals.isMacPlatform() or Globals.isWindowsPlatform(),
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
94 )
3
eb2d30b4d34e Continued implementing the PyInstaller interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
95 self.tabWidget.setTabEnabled(
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
96 self.tabWidget.indexOf(self.macTab), Globals.isMacPlatform()
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
97 )
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
98
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
99 self.__initializeDefaults()
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
100
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
101 # get a copy of the defaults to store the user settings
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
102 self.__parameters = copy.deepcopy(self.__defaults)
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
103
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
104 # combine it with the values of params
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
105 if params is not None:
20
a7ac91a1a57e Adjusted the code style checking parameters and fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
106 self.__parameters.update(params)
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
107
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
108 # initialize general tab
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
109 if mode == "installer" and bool(self.__parameters["pyinstaller"]):
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
110 self.executableCombo.setCurrentIndex(
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
111 self.executableCombo.findText(self.__parameters["pyinstaller"])
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
112 )
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
113 elif mode == "spec" and bool(self.__parameters["pyi-makespec"]):
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
114 self.executableCombo.setCurrentIndex(
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
115 self.executableCombo.findText(self.__parameters["pyi-makespec"])
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
116 )
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
117 if self.__parameters["mainscript"]:
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
118 self.mainScriptButton.setChecked(True)
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
119 else:
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
120 self.selectedScriptButton.setChecked(True)
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
121 self.inputFilePicker.setText(self.__parameters["inputFile"])
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
122 if self.__parameters["oneDirectory"]:
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
123 self.oneDirButton.setChecked(True)
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
124 else:
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
125 self.oneFileButton.setChecked(True)
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
126 self.nameEdit.setText(self.__parameters["name"])
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
127 self.keyEdit.setText(self.__parameters["encryptionKey"])
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
128 self.cleanCheckBox.setChecked(self.__parameters["cleanBeforeBuilding"])
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
129
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
130 # initialize Windows and macOS tab
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
131 if self.__parameters["consoleApplication"]:
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
132 self.consoleButton.setChecked(True)
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
133 else:
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
134 self.windowedButton.setChecked(True)
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
135 self.iconFilePicker.setText(self.__parameters["iconFile"])
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
136 self.iconIdEdit.setText(self.__parameters["iconId"])
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
137
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
138 # initialize maxOS specific tab
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
139 self.bundleIdentifierEdit.setText(self.__parameters["bundleIdentifier"])
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
140
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
141 self.__updateOkButton()
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
142
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
143 msh = self.minimumSizeHint()
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
144 self.resize(max(self.width(), msh.width()), msh.height())
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
145
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
146 def __initializeDefaults(self):
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
147 """
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
148 Private method to set the default values.
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
149
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
150 These are needed later on to generate the command line parameters.
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
151 """
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
152 self.__defaults = {
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
153 # general options
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
154 "pyinstaller": "",
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
155 "pyi-makespec": "",
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
156 "mainscript": bool(self.__project.getMainScript()),
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
157 "inputFile": "",
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
158 "oneDirectory": True,
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
159 "name": "",
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
160 "encryptionKey": "",
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
161 "cleanBeforeBuilding": False,
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
162 # Windows and macOS options
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
163 "consoleApplication": True,
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
164 "iconFile": "",
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
165 "iconId": "",
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
166 # macOS specific options
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
167 "bundleIdentifier": "",
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
168 }
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
169
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
170 def generateParameters(self):
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
171 """
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
172 Public method that generates the command line parameters.
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
173
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
174 It generates a list of strings to be used to set the QProcess arguments
5
8c92d66d20e4 Continued implementing the PyInstaller interface (implemented the execution dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
175 for the pyinstaller/pyi-makespec call and a list containing the non
8c92d66d20e4 Continued implementing the PyInstaller interface (implemented the execution dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
176 default parameters. The second list can be passed back upon object
8c92d66d20e4 Continued implementing the PyInstaller interface (implemented the execution dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
177 generation to overwrite the default settings.
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
178
5
8c92d66d20e4 Continued implementing the PyInstaller interface (implemented the execution dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
179 @return a tuple of the command line parameters, non default parameters
8c92d66d20e4 Continued implementing the PyInstaller interface (implemented the execution dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
180 and the script path
8c92d66d20e4 Continued implementing the PyInstaller interface (implemented the execution dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
181 @rtype tuple of (list of str, dict, str)
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
182 """
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
183 parms = {}
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
184 args = []
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
185
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
186 # 1. the program name
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
187 if self.__mode == "installer":
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
188 args.append(self.__parameters["pyinstaller"])
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
189 parms["pyinstaller"] = self.__parameters["pyinstaller"]
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
190 elif self.__mode == "spec":
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
191 args.append(self.__parameters["pyi-makespec"])
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
192 parms["pyi-makespec"] = self.__parameters["pyi-makespec"]
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
193
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
194 # 2. the commandline options
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
195 # 2.1 general options, input
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
196 if not self.__parameters["mainscript"]:
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
197 parms["mainscript"] = False
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
198 parms["inputFile"] = self.__parameters["inputFile"]
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
199
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
200 runWithSpec = self.__parameters["inputFile"].endswith(".spec")
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
201 if not runWithSpec:
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
202 # 2.2 general options, part 1
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
203 if not self.__parameters["oneDirectory"]:
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
204 parms["oneDirectory"] = self.__parameters["oneDirectory"]
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
205 args.append("--onefile")
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
206 if self.__parameters["name"] != self.__defaults["name"]:
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
207 parms["name"] = self.__parameters["name"]
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
208 args.append("--name")
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
209 args.append(self.__parameters["name"])
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
210 if self.__parameters["encryptionKey"] != self.__defaults["encryptionKey"]:
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
211 parms["encryptionKey"] = self.__parameters["encryptionKey"]
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
212 args.append("--key")
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
213 args.append(self.__parameters["encryptionKey"])
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
214
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
215 # 2.3 Windows and macOS options
27
25ff8953e335 Added code to search the executable in virtual environment as well on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 26
diff changeset
216 if (
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
217 self.__parameters["consoleApplication"]
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
218 != self.__defaults["consoleApplication"]
27
25ff8953e335 Added code to search the executable in virtual environment as well on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 26
diff changeset
219 ):
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
220 parms["consoleApplication"] = self.__parameters["consoleApplication"]
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
221 args.append("--windowed")
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
222 if self.__parameters["iconFile"] != self.__defaults["iconFile"]:
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
223 parms["iconFile"] = self.__parameters["iconFile"]
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
224 parms["iconId"] = self.__parameters["iconId"]
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
225 args.append("--icon")
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
226 if self.__parameters["iconFile"].endswith(".exe"):
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
227 if bool(self.__parameters["iconId"]):
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
228 iconId = self.__parameters["iconId"]
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
229 else:
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
230 iconId = "0"
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
231 args.append("{0},{1}".format(self.__parameters["iconFile"], iconId))
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
232 else:
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
233 args.append(self.__parameters["iconFile"])
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
234
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
235 # 2.4 macOS specific options
27
25ff8953e335 Added code to search the executable in virtual environment as well on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 26
diff changeset
236 if (
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
237 self.__parameters["bundleIdentifier"]
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
238 != self.__defaults["bundleIdentifier"]
27
25ff8953e335 Added code to search the executable in virtual environment as well on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 26
diff changeset
239 ):
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
240 parms["bundleIdentifier"] = self.__parameters["bundleIdentifier"]
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
241 args.append("--osx-bundle-identifier")
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
242 args.append(self.__parameters["bundleIdentifier"])
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
243
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
244 # 2.5 general options, part 2
27
25ff8953e335 Added code to search the executable in virtual environment as well on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 26
diff changeset
245 if (
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
246 self.__parameters["cleanBeforeBuilding"]
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
247 != self.__defaults["cleanBeforeBuilding"]
27
25ff8953e335 Added code to search the executable in virtual environment as well on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 26
diff changeset
248 ):
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
249 parms["cleanBeforeBuilding"] = self.__parameters["cleanBeforeBuilding"]
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
250 args.append("--clean")
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
251
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
252 # 3. always add these arguments
6
0f0f1598fc4a Continued implementing the PyInstaller interface (implemented the pyi-makespec function).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5
diff changeset
253 if self.__mode == "installer":
0f0f1598fc4a Continued implementing the PyInstaller interface (implemented the pyi-makespec function).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5
diff changeset
254 args.append("--noconfirm") # don't ask the user
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
255
5
8c92d66d20e4 Continued implementing the PyInstaller interface (implemented the execution dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
256 # determine the script to be processed
35
d9b3cadaf707 Implemented some code simplifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 34
diff changeset
257 script = (
d9b3cadaf707 Implemented some code simplifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 34
diff changeset
258 self.__project.getMainScript()
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
259 if self.__parameters["mainscript"]
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
260 else self.__parameters["inputFile"]
35
d9b3cadaf707 Implemented some code simplifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 34
diff changeset
261 )
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
262
5
8c92d66d20e4 Continued implementing the PyInstaller interface (implemented the execution dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
263 return args, parms, script
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
264
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
265 def accept(self):
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
266 """
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
267 Public method called by the Ok button.
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
268
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
269 It saves the values in the parameters dictionary.
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
270 """
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
271 # get data of general tab
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
272 if self.__mode == "installer":
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
273 self.__parameters["pyinstaller"] = self.executableCombo.currentText()
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
274 elif self.__mode == "spec":
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
275 self.__parameters["pyi-makespec"] = self.executableCombo.currentText()
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
276 self.__parameters["mainscript"] = self.mainScriptButton.isChecked()
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
277 self.__parameters["inputFile"] = self.inputFilePicker.text()
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
278 self.__parameters["oneDirectory"] = self.oneDirButton.isChecked()
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
279 self.__parameters["name"] = self.nameEdit.text()
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
280 self.__parameters["encryptionKey"] = self.keyEdit.text()
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
281 self.__parameters["cleanBeforeBuilding"] = self.cleanCheckBox.isChecked()
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
282
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
283 # get data of Windows and macOS tab
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
284 self.__parameters["consoleApplication"] = self.consoleButton.isChecked()
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
285 self.__parameters["iconFile"] = self.iconFilePicker.text()
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
286 self.__parameters["iconId"] = self.iconIdEdit.text()
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
287
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
288 # get data of macOS specific tab
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
289 self.__parameters["bundleIdentifier"] = self.bundleIdentifierEdit.text()
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
290
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
291 # call the accept slot of the base class
35
d9b3cadaf707 Implemented some code simplifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 34
diff changeset
292 super().accept()
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
293
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
294 def __updateOkButton(self):
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
295 """
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
296 Private method to update the enabled state of the OK button.
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
297 """
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
298 enable = True
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
299
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
300 # If not to be run with the project main script, a script or
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
301 # spec file must be selected.
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
302 if self.selectedScriptButton.isChecked() and not bool(
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
303 self.inputFilePicker.text()
27
25ff8953e335 Added code to search the executable in virtual environment as well on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 26
diff changeset
304 ):
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
305 enable = False
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
306
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
307 # If the icon shall be picked from a .exe file, an icon ID
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
308 # must be entered (Windows only).
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
309 if self.iconFilePicker.text().endswith(".exe") and not bool(
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
310 self.iconIdEdit.text()
27
25ff8953e335 Added code to search the executable in virtual environment as well on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 26
diff changeset
311 ):
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
312 enable = False
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
313
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
314 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(enable)
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
315
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
316 @pyqtSlot(bool)
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
317 def on_selectedScriptButton_toggled(self, checked):
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
318 """
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
319 Private slot to handle changes of the radio button state.
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
320
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
321 @param checked state of the radio button
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
322 @type bool
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
323 """
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
324 self.__updateOkButton()
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
325
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
326 @pyqtSlot(str)
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
327 def on_inputFilePicker_textChanged(self, txt):
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
328 """
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
329 Private slot to handle changes of the input file.
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
330
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
331 @param txt text of the file edit
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
332 @type str
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
333 """
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
334 self.__updateOkButton()
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
335
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
336 @pyqtSlot(str)
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
337 def on_iconFilePicker_textChanged(self, txt):
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
338 """
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
339 Private slot to handle changes of the icon file.
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
340
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
341 @param txt text of the file edit
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
342 @type str
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
343 """
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
344 self.iconIdEdit.setEnabled(txt.endswith(".exe"))
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
345 self.__updateOkButton()
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
346
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
347 @pyqtSlot(str)
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
348 def on_iconIdEdit_textChanged(self, txt):
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
349 """
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
350 Private slot to handle changes of the icon ID.
46
ccd14067e6a2 Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
351
4
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
352 @param txt iconID
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
353 @type str
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
354 """
52f0572b5908 Continued implementing the PyInstaller interface (finished the config dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
355 self.__updateOkButton()

eric ide

mercurial