Plugins/UiExtensionPlugins/PipInterface/PipFileSelectionDialog.py

changeset 6327
a1716d9210f4
parent 6301
f488d2cc5841
child 6342
c79ecba9cde7
equal deleted inserted replaced
6326:5ef9456a0cbe 6327:a1716d9210f4
20 from .Ui_PipFileSelectionDialog import Ui_PipFileSelectionDialog 20 from .Ui_PipFileSelectionDialog import Ui_PipFileSelectionDialog
21 21
22 import Utilities 22 import Utilities
23 23
24 24
25 # TODO: add checkbox to select an installation into 'user site'
26 class PipFileSelectionDialog(QDialog, Ui_PipFileSelectionDialog): 25 class PipFileSelectionDialog(QDialog, Ui_PipFileSelectionDialog):
27 """ 26 """
28 Class implementing a dialog to enter a file to be processed. 27 Class implementing a dialog to enter a file to be processed.
29 """ 28 """
30 def __init__(self, plugin, mode, parent=None): 29 def __init__(self, plugin, mode, install=True, parent=None):
31 """ 30 """
32 Constructor 31 Constructor
33 32
34 @param plugin reference to the plugin object 33 @param plugin reference to the plugin object
35 @type PipInterfacePlugin 34 @type PipInterfacePlugin
36 @param mode mode of the dialog 35 @param mode mode of the dialog
37 @type str 36 @type str
37 @param install flag indicating an install action
38 @type bool
38 @param parent reference to the parent widget 39 @param parent reference to the parent widget
39 @type QWidget 40 @type QWidget
40 """ 41 """
41 super(PipFileSelectionDialog, self).__init__(parent) 42 super(PipFileSelectionDialog, self).__init__(parent)
42 self.setupUi(self) 43 self.setupUi(self)
72 self.__default = self.tr("<Default>") 73 self.__default = self.tr("<Default>")
73 pipExecutables = sorted(plugin.getPreferences("PipExecutables")) 74 pipExecutables = sorted(plugin.getPreferences("PipExecutables"))
74 self.pipComboBox.addItem(self.__default) 75 self.pipComboBox.addItem(self.__default)
75 self.pipComboBox.addItems(pipExecutables) 76 self.pipComboBox.addItems(pipExecutables)
76 77
78 self.userCheckBox.setVisible(install)
79
77 msh = self.minimumSizeHint() 80 msh = self.minimumSizeHint()
78 self.resize(max(self.width(), msh.width()), msh.height()) 81 self.resize(max(self.width(), msh.width()), msh.height())
79 82
80 @pyqtSlot(str) 83 @pyqtSlot(str)
81 def on_filePicker_textChanged(self, txt): 84 def on_filePicker_textChanged(self, txt):
92 95
93 def getData(self): 96 def getData(self):
94 """ 97 """
95 Public method to get the entered data. 98 Public method to get the entered data.
96 99
97 @return tuple with the pip command and the name of the 100 @return tuple with the pip command, the name of the
98 selected file 101 selected file and a flag indicating to install to the
99 @rtype tuple of (str, str) 102 user install directory
103 @rtype tuple of (str, str, bool)
100 """ 104 """
101 command = self.pipComboBox.currentText() 105 command = self.pipComboBox.currentText()
102 if command == self.__default: 106 if command == self.__default:
103 command = "" 107 command = ""
104 108
105 return command, self.filePicker.text() 109 return (command, self.filePicker.text(),
110 self.userCheckBox.isChecked())

eric ide

mercurial