Plugins/UiExtensionPlugins/PipInterface/PipSelectionDialog.py

changeset 6342
c79ecba9cde7
parent 6327
a1716d9210f4
child 6619
1d34365c082c
equal deleted inserted replaced
6341:a00e63f6d766 6342:c79ecba9cde7
16 16
17 class PipSelectionDialog(QDialog, Ui_PipSelectionDialog): 17 class PipSelectionDialog(QDialog, Ui_PipSelectionDialog):
18 """ 18 """
19 Class implementing a dialog to select the pip executable to be used. 19 Class implementing a dialog to select the pip executable to be used.
20 """ 20 """
21 def __init__(self, plugin, parent=None): 21 def __init__(self, pip, parent=None):
22 """ 22 """
23 Constructor 23 Constructor
24 24
25 @param plugin reference to the plugin object 25 @param pip reference to the pip object
26 @type ToolPipPlugin 26 @type Pip
27 @param parent reference to the parent widget 27 @param parent reference to the parent widget
28 @type QWidget 28 @type QWidget
29 """ 29 """
30 super(PipSelectionDialog, self).__init__(parent) 30 super(PipSelectionDialog, self).__init__(parent)
31 self.setupUi(self) 31 self.setupUi(self)
32 32
33 self.__default = self.tr("<Default>") 33 self.venvComboBox.addItem(pip.getDefaultEnvironmentString())
34 pipExecutables = sorted(plugin.getPreferences("PipExecutables")) 34 self.venvComboBox.addItems(pip.getVirtualenvNames())
35 self.pipComboBox.addItem(self.__default)
36 self.pipComboBox.addItems(pipExecutables)
37 35
38 msh = self.minimumSizeHint() 36 msh = self.minimumSizeHint()
39 self.resize(max(self.width(), msh.width()), msh.height()) 37 self.resize(max(self.width(), msh.width()), msh.height())
40 38
41 def getData(self): 39 def getData(self):
42 """ 40 """
43 Public method to get the entered data. 41 Public method to get the entered data.
44 42
45 @return tuple with the pip command and a flag indicating to install 43 @return tuple with the environment name and a flag indicating to
46 to the user install directory 44 install to the user install directory
47 @rtype tuple of (str, bool) 45 @rtype tuple of (str, bool)
48 """ 46 """
49 command = self.pipComboBox.currentText() 47 return (
50 if command == self.__default: 48 self.venvComboBox.currentText(),
51 command = "" 49 self.userCheckBox.isChecked(),
52 50 )
53 return command, self.userCheckBox.isChecked()

eric ide

mercurial