1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2018 - 2019 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, pip, parent=None): |
|
22 """ |
|
23 Constructor |
|
24 |
|
25 @param pip reference to the pip object |
|
26 @type Pip |
|
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.venvComboBox.addItem(pip.getDefaultEnvironmentString()) |
|
34 projectVenv = pip.getProjectEnvironmentString() |
|
35 if projectVenv: |
|
36 self.venvComboBox.addItem(projectVenv) |
|
37 self.venvComboBox.addItems(pip.getVirtualenvNames()) |
|
38 |
|
39 msh = self.minimumSizeHint() |
|
40 self.resize(max(self.width(), msh.width()), msh.height()) |
|
41 |
|
42 def getData(self): |
|
43 """ |
|
44 Public method to get the entered data. |
|
45 |
|
46 @return tuple with the environment name and a flag indicating to |
|
47 install to the user install directory |
|
48 @rtype tuple of (str, bool) |
|
49 """ |
|
50 return ( |
|
51 self.venvComboBox.currentText(), |
|
52 self.userCheckBox.isChecked(), |
|
53 ) |
|