eric6/Project/MakePropertiesDialog.py

Sat, 27 Feb 2021 12:08:23 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 27 Feb 2021 12:08:23 +0100
changeset 8138
169e65a6787c
parent 7923
91e843545d9a
child 8143
2c730d5fd177
permissions
-rw-r--r--

Shell: added functionality to show a prompt when the main client process has exited (e.g. a script ended).

6248
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
7923
91e843545d9a Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
3 # Copyright (c) 2018 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
6248
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing a dialog to enter the properties for 'make'.
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
6254
88cb0838c90d Finished coding the make support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6248
diff changeset
10 from PyQt5.QtWidgets import QDialog, QDialogButtonBox
6248
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12 from E5Gui.E5PathPicker import E5PathPickerModes
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14 from .Ui_MakePropertiesDialog import Ui_MakePropertiesDialog
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17 class MakePropertiesDialog(QDialog, Ui_MakePropertiesDialog):
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 """
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 Class implementing a dialog to enter the properties for 'make'.
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20 """
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 def __init__(self, project, new, parent=None):
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 """
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 Constructor
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 @param project reference to the project object
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 @type Project
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 @param new flag indicating the generation of a new project
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 @type bool
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 @param parent reference to the parent widget of this dialog
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 @type QWidget
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 """
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 super(MakePropertiesDialog, self).__init__(parent)
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 self.setupUi(self)
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 self.__project = project
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 self.makePicker.setMode(E5PathPickerModes.OpenFileMode)
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 self.makePicker.setFilters(self.tr("All Files (*)"))
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 self.makefilePicker.setMode(E5PathPickerModes.OpenFileMode)
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 self.makefilePicker.setDefaultDirectory(self.__project.ppath)
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 self.makefilePicker.setFilters(self.tr(
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 "Makefiles (*makefile Makefile *.mak);;All Files (*)"))
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44
6254
88cb0838c90d Finished coding the make support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6248
diff changeset
45 self.makeTargetEdit.textChanged.connect(self.__updateOkButton)
88cb0838c90d Finished coding the make support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6248
diff changeset
46
6248
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 self.initDialog()
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 msh = self.minimumSizeHint()
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 self.resize(max(self.width(), msh.width()), msh.height())
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52 def initDialog(self):
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53 """
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 Public method to initialize the dialog's data.
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55 """
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 makeData = self.__project.pdata["MAKEPARAMS"]
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58 if makeData["MakeExecutable"]:
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59 self.makePicker.setText(makeData["MakeExecutable"])
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60 else:
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61 self.makePicker.setText(self.__project.DefaultMake)
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62 if makeData["MakeFile"]:
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
63 self.makefilePicker.setText(makeData["MakeFile"])
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
64 else:
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65 self.makefilePicker.setText(self.__project.DefaultMakefile)
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 self.makeTargetEdit.setText(makeData["MakeTarget"])
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 self.makeParametersEdit.setText(makeData["MakeParameters"])
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 self.testOnlyCheckBox.setChecked(makeData["MakeTestOnly"])
6254
88cb0838c90d Finished coding the make support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6248
diff changeset
69
88cb0838c90d Finished coding the make support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6248
diff changeset
70 self.__updateOkButton()
88cb0838c90d Finished coding the make support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6248
diff changeset
71
88cb0838c90d Finished coding the make support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6248
diff changeset
72 def __updateOkButton(self):
88cb0838c90d Finished coding the make support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6248
diff changeset
73 """
88cb0838c90d Finished coding the make support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6248
diff changeset
74 Private slot to update the enabled state of the OK button.
88cb0838c90d Finished coding the make support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6248
diff changeset
75 """
88cb0838c90d Finished coding the make support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6248
diff changeset
76 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(bool(
88cb0838c90d Finished coding the make support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6248
diff changeset
77 self.makeTargetEdit.text()))
6248
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
79 def storeData(self):
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
80 """
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
81 Public method to store the entered/modified data.
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
82 """
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83 makeData = self.__project.pdata["MAKEPARAMS"]
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
84
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
85 makeExe = self.makePicker.text()
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
86 if makeExe == self.__project.DefaultMake:
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
87 makeExe = ""
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
88 makeData["MakeExecutable"] = makeExe
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
90 makefile = self.__project.getRelativePath(self.makefilePicker.text())
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91 if makefile == self.__project.DefaultMakefile:
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
92 makefile = ""
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
93 makeData["MakeFile"] = makefile
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
95 makeData["MakeTarget"] = self.makeTargetEdit.text()
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
96 makeData["MakeParameters"] = self.makeParametersEdit.text()
9458a3d45f27 Project Make Support: implemented the MakePropertiesDialog class and extended the Project class accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
97 makeData["MakeTestOnly"] = self.testOnlyCheckBox.isChecked()

eric ide

mercurial