Plugins/UiExtensionPlugins/PipInterface/PipFileSelectionDialog.py

changeset 6342
c79ecba9cde7
parent 6327
a1716d9210f4
child 6619
1d34365c082c
equal deleted inserted replaced
6341:a00e63f6d766 6342:c79ecba9cde7
24 24
25 class PipFileSelectionDialog(QDialog, Ui_PipFileSelectionDialog): 25 class PipFileSelectionDialog(QDialog, Ui_PipFileSelectionDialog):
26 """ 26 """
27 Class implementing a dialog to enter a file to be processed. 27 Class implementing a dialog to enter a file to be processed.
28 """ 28 """
29 def __init__(self, plugin, mode, install=True, parent=None): 29 def __init__(self, pip, mode, install=True, parent=None):
30 """ 30 """
31 Constructor 31 Constructor
32 32
33 @param plugin reference to the plugin object 33 @param pip reference to the pip object
34 @type PipInterfacePlugin 34 @type Pip
35 @param mode mode of the dialog 35 @param mode mode of the dialog
36 @type str 36 @type str
37 @param install flag indicating an install action 37 @param install flag indicating an install action
38 @type bool 38 @type bool
39 @param parent reference to the parent widget 39 @param parent reference to the parent widget
68 self.filePicker.setFilters(self.tr("All Files (*)")) 68 self.filePicker.setFilters(self.tr("All Files (*)"))
69 self.filePicker.setDefaultDirectory(os.path.expanduser("~")) 69 self.filePicker.setDefaultDirectory(os.path.expanduser("~"))
70 70
71 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) 71 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)
72 72
73 self.__default = self.tr("<Default>") 73 self.venvComboBox.addItem(pip.getDefaultEnvironmentString())
74 pipExecutables = sorted(plugin.getPreferences("PipExecutables")) 74 self.venvComboBox.addItems(pip.getVirtualenvNames())
75 self.pipComboBox.addItem(self.__default)
76 self.pipComboBox.addItems(pipExecutables)
77 75
78 self.userCheckBox.setVisible(install) 76 self.userCheckBox.setVisible(install)
79 77
80 msh = self.minimumSizeHint() 78 msh = self.minimumSizeHint()
81 self.resize(max(self.width(), msh.width()), msh.height()) 79 self.resize(max(self.width(), msh.width()), msh.height())
95 93
96 def getData(self): 94 def getData(self):
97 """ 95 """
98 Public method to get the entered data. 96 Public method to get the entered data.
99 97
100 @return tuple with the pip command, the name of the 98 @return tuple with the environment name, the name of the
101 selected file and a flag indicating to install to the 99 selected file and a flag indicating to install to the
102 user install directory 100 user install directory
103 @rtype tuple of (str, str, bool) 101 @rtype tuple of (str, str, bool)
104 """ 102 """
105 command = self.pipComboBox.currentText() 103 return (
106 if command == self.__default: 104 self.venvComboBox.currentText(),
107 command = "" 105 self.filePicker.text(),
108 106 self.userCheckBox.isChecked()
109 return (command, self.filePicker.text(), 107 )
110 self.userCheckBox.isChecked())

eric ide

mercurial