Plugins/UiExtensionPlugins/PipInterface/PipSelectionDialog.py

Tue, 03 Jul 2018 19:07:13 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Tue, 03 Jul 2018 19:07:13 +0200
changeset 6396
f6d4ab496cfe
parent 6342
c79ecba9cde7
child 6619
1d34365c082c
permissions
-rw-r--r--

PipListDialog: changed code to ensure, that the dialog gets raised when a selected action is completed.

6327
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
3 # Copyright (c) 2018 Detlev Offenbach <detlev@die-offenbachs.de>
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing a dialog to select the pip executable to be used.
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10 from __future__ import unicode_literals
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12 from PyQt5.QtWidgets import QDialog
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14 from .Ui_PipSelectionDialog import Ui_PipSelectionDialog
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17 class PipSelectionDialog(QDialog, Ui_PipSelectionDialog):
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 """
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 Class implementing a dialog to select the pip executable to be used.
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20 """
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6327
diff changeset
21 def __init__(self, pip, parent=None):
6327
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 """
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 Constructor
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6327
diff changeset
25 @param pip reference to the pip object
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6327
diff changeset
26 @type Pip
6327
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 @param parent reference to the parent widget
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 @type QWidget
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 """
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 super(PipSelectionDialog, self).__init__(parent)
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 self.setupUi(self)
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6327
diff changeset
33 self.venvComboBox.addItem(pip.getDefaultEnvironmentString())
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6327
diff changeset
34 self.venvComboBox.addItems(pip.getVirtualenvNames())
6327
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 msh = self.minimumSizeHint()
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 self.resize(max(self.width(), msh.width()), msh.height())
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 def getData(self):
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 """
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 Public method to get the entered data.
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6327
diff changeset
43 @return tuple with the environment name and a flag indicating to
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6327
diff changeset
44 install to the user install directory
6327
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 @rtype tuple of (str, bool)
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 """
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6327
diff changeset
47 return (
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6327
diff changeset
48 self.venvComboBox.currentText(),
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6327
diff changeset
49 self.userCheckBox.isChecked(),
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6327
diff changeset
50 )

eric ide

mercurial