15 |
15 |
16 class NewPythonPackageDialog(QDialog, Ui_NewPythonPackageDialog): |
16 class NewPythonPackageDialog(QDialog, Ui_NewPythonPackageDialog): |
17 """ |
17 """ |
18 Class implementing a dialog to add a new Python package. |
18 Class implementing a dialog to add a new Python package. |
19 """ |
19 """ |
|
20 |
20 def __init__(self, relPath, parent=None): |
21 def __init__(self, relPath, parent=None): |
21 """ |
22 """ |
22 Constructor |
23 Constructor |
23 |
24 |
24 @param relPath initial package path relative to the project root |
25 @param relPath initial package path relative to the project root |
25 (string) |
26 (string) |
26 @param parent reference to the parent widget (QWidget) |
27 @param parent reference to the parent widget (QWidget) |
27 """ |
28 """ |
28 super().__init__(parent) |
29 super().__init__(parent) |
29 self.setupUi(self) |
30 self.setupUi(self) |
30 |
31 |
31 self.okButton = self.buttonBox.button( |
32 self.okButton = self.buttonBox.button(QDialogButtonBox.StandardButton.Ok) |
32 QDialogButtonBox.StandardButton.Ok) |
|
33 self.okButton.setEnabled(False) |
33 self.okButton.setEnabled(False) |
34 |
34 |
35 rp = relPath.replace("/", ".").replace("\\", ".") |
35 rp = relPath.replace("/", ".").replace("\\", ".") |
36 self.packageEdit.setText(rp) |
36 self.packageEdit.setText(rp) |
37 |
37 |
38 msh = self.minimumSizeHint() |
38 msh = self.minimumSizeHint() |
39 self.resize(max(self.width(), msh.width()), msh.height()) |
39 self.resize(max(self.width(), msh.width()), msh.height()) |
40 |
40 |
41 @pyqtSlot(str) |
41 @pyqtSlot(str) |
42 def on_packageEdit_textChanged(self, txt): |
42 def on_packageEdit_textChanged(self, txt): |
43 """ |
43 """ |
44 Private slot called, when the package name is changed. |
44 Private slot called, when the package name is changed. |
45 |
45 |
46 @param txt new text of the package name edit (string) |
46 @param txt new text of the package name edit (string) |
47 """ |
47 """ |
48 self.okButton.setEnabled(txt != "") |
48 self.okButton.setEnabled(txt != "") |
49 |
49 |
50 def getData(self): |
50 def getData(self): |
51 """ |
51 """ |
52 Public method to retrieve the data entered into the dialog. |
52 Public method to retrieve the data entered into the dialog. |
53 |
53 |
54 @return package name (string) |
54 @return package name (string) |
55 """ |
55 """ |
56 return self.packageEdit.text() |
56 return self.packageEdit.text() |