15 |
15 |
16 class PipPackagesInputDialog(QDialog, Ui_PipPackagesInputDialog): |
16 class PipPackagesInputDialog(QDialog, Ui_PipPackagesInputDialog): |
17 """ |
17 """ |
18 Class implementing a dialog to enter package specifications. |
18 Class implementing a dialog to enter package specifications. |
19 """ |
19 """ |
|
20 |
20 def __init__(self, pip, title, install=True, parent=None): |
21 def __init__(self, pip, title, install=True, parent=None): |
21 """ |
22 """ |
22 Constructor |
23 Constructor |
23 |
24 |
24 @param pip reference to the pip object |
25 @param pip reference to the pip object |
25 @type Pip |
26 @type Pip |
26 @param title dialog title |
27 @param title dialog title |
27 @type str |
28 @type str |
28 @param install flag indicating an install action |
29 @param install flag indicating an install action |
30 @param parent reference to the parent widget |
31 @param parent reference to the parent widget |
31 @type QWidget |
32 @type QWidget |
32 """ |
33 """ |
33 super().__init__(parent) |
34 super().__init__(parent) |
34 self.setupUi(self) |
35 self.setupUi(self) |
35 |
36 |
36 self.setWindowTitle(title) |
37 self.setWindowTitle(title) |
37 |
38 |
38 self.buttonBox.button( |
39 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(False) |
39 QDialogButtonBox.StandardButton.Ok).setEnabled(False) |
40 |
40 |
|
41 self.userCheckBox.setVisible(install) |
41 self.userCheckBox.setVisible(install) |
42 |
42 |
43 msh = self.minimumSizeHint() |
43 msh = self.minimumSizeHint() |
44 self.resize(max(self.width(), msh.width()), msh.height()) |
44 self.resize(max(self.width(), msh.width()), msh.height()) |
45 |
45 |
46 @pyqtSlot(str) |
46 @pyqtSlot(str) |
47 def on_packagesEdit_textChanged(self, txt): |
47 def on_packagesEdit_textChanged(self, txt): |
48 """ |
48 """ |
49 Private slot handling entering package names. |
49 Private slot handling entering package names. |
50 |
50 |
51 @param txt name of the requirements file |
51 @param txt name of the requirements file |
52 @type str |
52 @type str |
53 """ |
53 """ |
54 self.buttonBox.button( |
54 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(bool(txt)) |
55 QDialogButtonBox.StandardButton.Ok).setEnabled(bool(txt)) |
55 |
56 |
|
57 def getData(self): |
56 def getData(self): |
58 """ |
57 """ |
59 Public method to get the entered data. |
58 Public method to get the entered data. |
60 |
59 |
61 @return tuple with the list of package specifications and a flag |
60 @return tuple with the list of package specifications and a flag |
62 indicating to install to the user install directory |
61 indicating to install to the user install directory |
63 @rtype tuple of (list of str, bool) |
62 @rtype tuple of (list of str, bool) |
64 """ |
63 """ |
65 packages = [p.strip() for p in self.packagesEdit.text().split()] |
64 packages = [p.strip() for p in self.packagesEdit.text().split()] |
66 |
65 |
67 return ( |
66 return (packages, self.userCheckBox.isChecked()) |
68 packages, |
|
69 self.userCheckBox.isChecked() |
|
70 ) |
|