37 @param parent reference to the parent widget |
38 @param parent reference to the parent widget |
38 @type QWidget |
39 @type QWidget |
39 """ |
40 """ |
40 super().__init__(parent) |
41 super().__init__(parent) |
41 self.setupUi(self) |
42 self.setupUi(self) |
42 |
43 |
43 if mode == "requirements": |
44 if mode == "requirements": |
44 self.fileLabel.setText(self.tr("Enter requirements file:")) |
45 self.fileLabel.setText(self.tr("Enter requirements file:")) |
45 self.filePicker.setMode(EricPathPickerModes.OPEN_FILE_MODE) |
46 self.filePicker.setMode(EricPathPickerModes.OPEN_FILE_MODE) |
46 self.filePicker.setToolTip(self.tr( |
47 self.filePicker.setToolTip( |
47 "Press to select the requirements file through a file" |
48 self.tr( |
48 " selection dialog.")) |
49 "Press to select the requirements file through a file" |
49 self.filePicker.setFilters( |
50 " selection dialog." |
50 self.tr("Text Files (*.txt);;All Files (*)")) |
51 ) |
|
52 ) |
|
53 self.filePicker.setFilters(self.tr("Text Files (*.txt);;All Files (*)")) |
51 elif mode == "package": |
54 elif mode == "package": |
52 self.fileLabel.setText(self.tr("Enter package file:")) |
55 self.fileLabel.setText(self.tr("Enter package file:")) |
53 self.filePicker.setMode(EricPathPickerModes.OPEN_FILE_MODE) |
56 self.filePicker.setMode(EricPathPickerModes.OPEN_FILE_MODE) |
54 self.filePicker.setToolTip(self.tr( |
57 self.filePicker.setToolTip( |
55 "Press to select the package file through a file" |
58 self.tr( |
56 " selection dialog.")) |
59 "Press to select the package file through a file" |
|
60 " selection dialog." |
|
61 ) |
|
62 ) |
57 self.filePicker.setFilters( |
63 self.filePicker.setFilters( |
58 self.tr("Python Wheel (*.whl);;" |
64 self.tr( |
59 "Archive Files (*.tar.gz *.zip);;" |
65 "Python Wheel (*.whl);;" |
60 "All Files (*)")) |
66 "Archive Files (*.tar.gz *.zip);;" |
|
67 "All Files (*)" |
|
68 ) |
|
69 ) |
61 else: |
70 else: |
62 self.fileLabel.setText(self.tr("Enter file name:")) |
71 self.fileLabel.setText(self.tr("Enter file name:")) |
63 self.filePicker.setMode(EricPathPickerModes.OPEN_FILE_MODE) |
72 self.filePicker.setMode(EricPathPickerModes.OPEN_FILE_MODE) |
64 self.filePicker.setToolTip(self.tr( |
73 self.filePicker.setToolTip( |
65 "Press to select a file through a file selection dialog.")) |
74 self.tr("Press to select a file through a file selection dialog.") |
|
75 ) |
66 self.filePicker.setFilters(self.tr("All Files (*)")) |
76 self.filePicker.setFilters(self.tr("All Files (*)")) |
67 self.filePicker.setDefaultDirectory(os.path.expanduser("~")) |
77 self.filePicker.setDefaultDirectory(os.path.expanduser("~")) |
68 |
78 |
69 self.buttonBox.button( |
79 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(False) |
70 QDialogButtonBox.StandardButton.Ok).setEnabled(False) |
80 |
71 |
|
72 self.userCheckBox.setVisible(install) |
81 self.userCheckBox.setVisible(install) |
73 |
82 |
74 msh = self.minimumSizeHint() |
83 msh = self.minimumSizeHint() |
75 self.resize(max(self.width(), msh.width()), msh.height()) |
84 self.resize(max(self.width(), msh.width()), msh.height()) |
76 |
85 |
77 @pyqtSlot(str) |
86 @pyqtSlot(str) |
78 def on_filePicker_textChanged(self, txt): |
87 def on_filePicker_textChanged(self, txt): |
79 """ |
88 """ |
80 Private slot to handle entering the name of a file. |
89 Private slot to handle entering the name of a file. |
81 |
90 |
82 @param txt name of the file |
91 @param txt name of the file |
83 @type str |
92 @type str |
84 """ |
93 """ |
85 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( |
94 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( |
86 bool(txt) and |
95 bool(txt) and os.path.exists(Utilities.toNativeSeparators(txt)) |
87 os.path.exists(Utilities.toNativeSeparators(txt)) |
|
88 ) |
96 ) |
89 |
97 |
90 def getData(self): |
98 def getData(self): |
91 """ |
99 """ |
92 Public method to get the entered data. |
100 Public method to get the entered data. |
93 |
101 |
94 @return tuple with the name of the selected file and a flag indicating |
102 @return tuple with the name of the selected file and a flag indicating |
95 to install to the user install directory |
103 to install to the user install directory |
96 @rtype tuple of (str, bool) |
104 @rtype tuple of (str, bool) |
97 """ |
105 """ |
98 return ( |
106 return (self.filePicker.text(), self.userCheckBox.isChecked()) |
99 self.filePicker.text(), |
|
100 self.userCheckBox.isChecked() |
|
101 ) |
|