Plugins/UiExtensionPlugins/PipInterface/PipSelectionDialog.py

changeset 6327
a1716d9210f4
child 6342
c79ecba9cde7
equal deleted inserted replaced
6326:5ef9456a0cbe 6327:a1716d9210f4
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2018 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing a dialog to select the pip executable to be used.
8 """
9
10 from __future__ import unicode_literals
11
12 from PyQt5.QtWidgets import QDialog
13
14 from .Ui_PipSelectionDialog import Ui_PipSelectionDialog
15
16
17 class PipSelectionDialog(QDialog, Ui_PipSelectionDialog):
18 """
19 Class implementing a dialog to select the pip executable to be used.
20 """
21 def __init__(self, plugin, parent=None):
22 """
23 Constructor
24
25 @param plugin reference to the plugin object
26 @type ToolPipPlugin
27 @param parent reference to the parent widget
28 @type QWidget
29 """
30 super(PipSelectionDialog, self).__init__(parent)
31 self.setupUi(self)
32
33 self.__default = self.tr("<Default>")
34 pipExecutables = sorted(plugin.getPreferences("PipExecutables"))
35 self.pipComboBox.addItem(self.__default)
36 self.pipComboBox.addItems(pipExecutables)
37
38 msh = self.minimumSizeHint()
39 self.resize(max(self.width(), msh.width()), msh.height())
40
41 def getData(self):
42 """
43 Public method to get the entered data.
44
45 @return tuple with the pip command and a flag indicating to install
46 to the user install directory
47 @rtype tuple of (str, bool)
48 """
49 command = self.pipComboBox.currentText()
50 if command == self.__default:
51 command = ""
52
53 return command, self.userCheckBox.isChecked()

eric ide

mercurial