Sat, 16 Feb 2019 10:27:50 +0100
Created global tag <release-19.02.1>.
6011
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1 | # -*- coding: utf-8 -*- |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2 | |
6645
ad476851d7e0
Updated copyright for 2019.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6619
diff
changeset
|
3 | # Copyright (c) 2015 - 2019 Detlev Offenbach <detlev@die-offenbachs.de> |
6011
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4 | # |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
5 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
6 | """ |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
7 | Module implementing a dialog to list installed packages. |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
8 | """ |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
9 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
10 | from __future__ import unicode_literals |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
11 | try: |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
12 | str = unicode # __IGNORE_EXCEPTION__ |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
13 | except NameError: |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
14 | pass |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
15 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
16 | import json |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
17 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
18 | from PyQt5.QtCore import pyqtSlot, Qt, QProcess, QTimer |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
19 | from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QAbstractButton, \ |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
20 | QApplication, QTreeWidgetItem, QHeaderView |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
21 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
22 | from E5Gui import E5MessageBox |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
23 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
24 | from .Ui_PipListDialog import Ui_PipListDialog |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
25 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
26 | import Preferences |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
27 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
28 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
29 | class PipListDialog(QDialog, Ui_PipListDialog): |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
30 | """ |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
31 | Class implementing a dialog to list installed packages. |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
32 | """ |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
33 | CommandArguments = { |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
34 | "list": ["list", "--format=json"], |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
35 | "uptodate": ["list", "--uptodate", "--format=json"], |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
36 | "outdated": ["list", "--outdated", "--format=json"], |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
37 | } |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
38 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
39 | ShowProcessGeneralMode = 0 |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
40 | ShowProcessClassifiersMode = 1 |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
41 | ShowProcessEntryPointsMode = 2 |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
42 | ShowProcessFilesListMode = 3 |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
43 | |
6342
c79ecba9cde7
pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6327
diff
changeset
|
44 | def __init__(self, pip, mode, indexUrl, title, parent=None): |
6011
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
45 | """ |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
46 | Constructor |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
47 | |
6342
c79ecba9cde7
pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6327
diff
changeset
|
48 | @param pip reference to the master object |
c79ecba9cde7
pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6327
diff
changeset
|
49 | @type Pip |
c79ecba9cde7
pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6327
diff
changeset
|
50 | @param mode list command mode (one of 'list', 'uptodate', 'outdated') |
c79ecba9cde7
pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6327
diff
changeset
|
51 | @type str |
c79ecba9cde7
pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6327
diff
changeset
|
52 | @param indexUrl URL of the pypi index |
c79ecba9cde7
pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6327
diff
changeset
|
53 | @type str |
c79ecba9cde7
pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6327
diff
changeset
|
54 | @param title title of the dialog |
c79ecba9cde7
pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6327
diff
changeset
|
55 | @type str |
c79ecba9cde7
pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6327
diff
changeset
|
56 | @param parent reference to the parent widget |
c79ecba9cde7
pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6327
diff
changeset
|
57 | @type QWidget |
6011
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
58 | """ |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
59 | assert mode in PipListDialog.CommandArguments |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
60 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
61 | super(PipListDialog, self).__init__(parent) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
62 | self.setupUi(self) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
63 | self.setWindowFlags(Qt.Window) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
64 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
65 | self.setWindowTitle(title) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
66 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
67 | self.__refreshButton = self.buttonBox.addButton( |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
68 | self.tr("&Refresh"), QDialogButtonBox.ActionRole) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
69 | self.__refreshButton.setEnabled(False) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
70 | if mode == "outdated": |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
71 | self.__upgradeButton = self.buttonBox.addButton( |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
72 | self.tr("Up&grade"), QDialogButtonBox.ActionRole) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
73 | self.__upgradeButton.setEnabled(False) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
74 | self.__upgradeAllButton = self.buttonBox.addButton( |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
75 | self.tr("Upgrade &All"), QDialogButtonBox.ActionRole) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
76 | self.__upgradeAllButton.setEnabled(False) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
77 | else: |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
78 | self.__upgradeButton = None |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
79 | self.__upgradeAllButton = None |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
80 | self.__uninstallButton = self.buttonBox.addButton( |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
81 | self.tr("&Uninstall"), QDialogButtonBox.ActionRole) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
82 | self.__uninstallButton.setEnabled(False) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
83 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
84 | self.__pip = pip |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
85 | self.__mode = mode |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
86 | self.__ioEncoding = Preferences.getSystem("IOEncoding") |
6342
c79ecba9cde7
pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6327
diff
changeset
|
87 | self.__indexUrl = indexUrl |
6011
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
88 | self.__errors = "" |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
89 | self.__output = [] |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
90 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
91 | self.__nothingStrings = { |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
92 | "list": self.tr("Nothing to show"), |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
93 | "uptodate": self.tr("All packages outdated"), |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
94 | "outdated": self.tr("All packages up-to-date"), |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
95 | } |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
96 | |
6342
c79ecba9cde7
pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6327
diff
changeset
|
97 | self.venvComboBox.addItem(self.__pip.getDefaultEnvironmentString()) |
6619
1d34365c082c
pip Interface: added an entry to select the virtual environment of the current project if it has one defined.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6396
diff
changeset
|
98 | projectVenv = self.__pip.getProjectEnvironmentString() |
1d34365c082c
pip Interface: added an entry to select the virtual environment of the current project if it has one defined.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6396
diff
changeset
|
99 | if projectVenv: |
1d34365c082c
pip Interface: added an entry to select the virtual environment of the current project if it has one defined.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6396
diff
changeset
|
100 | self.venvComboBox.addItem(projectVenv) |
6342
c79ecba9cde7
pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6327
diff
changeset
|
101 | self.venvComboBox.addItems(self.__pip.getVirtualenvNames()) |
6011
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
102 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
103 | if mode == "list": |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
104 | self.infoLabel.setText(self.tr("Installed Packages:")) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
105 | self.packageList.setHeaderLabels([ |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
106 | self.tr("Package"), |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
107 | self.tr("Version"), |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
108 | ]) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
109 | elif mode == "uptodate": |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
110 | self.infoLabel.setText(self.tr("Up-to-date Packages:")) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
111 | self.packageList.setHeaderLabels([ |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
112 | self.tr("Package"), |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
113 | self.tr("Version"), |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
114 | ]) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
115 | elif mode == "outdated": |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
116 | self.infoLabel.setText(self.tr("Outdated Packages:")) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
117 | self.packageList.setHeaderLabels([ |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
118 | self.tr("Package"), |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
119 | self.tr("Current Version"), |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
120 | self.tr("Latest Version"), |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
121 | self.tr("Package Type"), |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
122 | ]) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
123 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
124 | self.packageList.header().setSortIndicator(0, Qt.AscendingOrder) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
125 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
126 | self.__infoLabels = { |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
127 | "name": self.tr("Name:"), |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
128 | "version": self.tr("Version:"), |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
129 | "location": self.tr("Location:"), |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
130 | "requires": self.tr("Requires:"), |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
131 | "summary": self.tr("Summary:"), |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
132 | "home-page": self.tr("Homepage:"), |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
133 | "author": self.tr("Author:"), |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
134 | "author-email": self.tr("Author Email:"), |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
135 | "license": self.tr("License:"), |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
136 | "metadata-version": self.tr("Metadata Version:"), |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
137 | "installer": self.tr("Installer:"), |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
138 | "classifiers": self.tr("Classifiers:"), |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
139 | "entry-points": self.tr("Entry Points:"), |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
140 | "files": self.tr("Files:"), |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
141 | } |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
142 | self.infoWidget.setHeaderLabels(["Key", "Value"]) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
143 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
144 | self.process = QProcess() |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
145 | self.process.finished.connect(self.__procFinished) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
146 | self.process.readyReadStandardOutput.connect(self.__readStdout) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
147 | self.process.readyReadStandardError.connect(self.__readStderr) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
148 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
149 | self.show() |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
150 | QApplication.processEvents() |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
151 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
152 | def __stopProcess(self): |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
153 | """ |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
154 | Private slot to stop the running process. |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
155 | """ |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
156 | if self.process.state() != QProcess.NotRunning: |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
157 | self.process.terminate() |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
158 | QTimer.singleShot(2000, self.process.kill) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
159 | self.process.waitForFinished(3000) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
160 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
161 | QApplication.restoreOverrideCursor() |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
162 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
163 | def closeEvent(self, e): |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
164 | """ |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
165 | Protected slot implementing a close event handler. |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
166 | |
6342
c79ecba9cde7
pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6327
diff
changeset
|
167 | @param e close event |
c79ecba9cde7
pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6327
diff
changeset
|
168 | @type QCloseEvent |
6011
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
169 | """ |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
170 | self.__stopProcess() |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
171 | e.accept() |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
172 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
173 | def __finish(self): |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
174 | """ |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
175 | Private slot called when the process finished or the user pressed |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
176 | the cancel button. |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
177 | """ |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
178 | self.__stopProcess() |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
179 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
180 | self.__processOutput() |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
181 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
182 | self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
183 | self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
184 | self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
185 | self.buttonBox.button(QDialogButtonBox.Close).setFocus( |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
186 | Qt.OtherFocusReason) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
187 | self.__refreshButton.setEnabled(True) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
188 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
189 | if self.packageList.topLevelItemCount() == 0: |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
190 | QTreeWidgetItem(self.packageList, |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
191 | [self.__nothingStrings[self.__mode]]) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
192 | if self.__errors and not self.__errors.startswith("DEPRECATION"): |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
193 | E5MessageBox.critical( |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
194 | self, |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
195 | self.windowTitle(), |
6342
c79ecba9cde7
pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6327
diff
changeset
|
196 | self.tr("""<p>The command failed.</p>""" |
6011
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
197 | """<p>Reason: {0}</p>""").format( |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
198 | self.__errors.replace("\r\n", "<br/>") |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
199 | .replace("\n", "<br/>").replace("\r", "<br/>") |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
200 | .replace(" ", " "))) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
201 | if self.__upgradeAllButton is not None: |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
202 | self.__upgradeAllButton.setEnabled(False) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
203 | else: |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
204 | if self.__upgradeAllButton is not None: |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
205 | self.__upgradeAllButton.setEnabled(True) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
206 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
207 | self.packageList.sortItems( |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
208 | 0, |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
209 | self.packageList.header().sortIndicatorOrder()) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
210 | self.packageList.header().resizeSections( |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
211 | QHeaderView.ResizeToContents) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
212 | self.packageList.header().setStretchLastSection(True) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
213 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
214 | @pyqtSlot(QAbstractButton) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
215 | def on_buttonBox_clicked(self, button): |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
216 | """ |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
217 | Private slot called by a button of the button box clicked. |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
218 | |
6342
c79ecba9cde7
pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6327
diff
changeset
|
219 | @param button button that was clicked |
c79ecba9cde7
pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6327
diff
changeset
|
220 | @type QAbstractButton |
6011
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
221 | """ |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
222 | if button == self.buttonBox.button(QDialogButtonBox.Close): |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
223 | self.close() |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
224 | elif button == self.buttonBox.button(QDialogButtonBox.Cancel): |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
225 | self.__finish() |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
226 | elif button == self.__refreshButton: |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
227 | self.__refresh() |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
228 | elif button == self.__upgradeButton: |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
229 | self.__upgradePackages() |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
230 | elif button == self.__upgradeAllButton: |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
231 | self.__upgradeAllPackages() |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
232 | elif button == self.__uninstallButton: |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
233 | self.__uninstallPackages() |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
234 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
235 | def __procFinished(self, exitCode, exitStatus): |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
236 | """ |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
237 | Private slot connected to the finished signal. |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
238 | |
6342
c79ecba9cde7
pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6327
diff
changeset
|
239 | @param exitCode exit code of the process |
c79ecba9cde7
pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6327
diff
changeset
|
240 | @type int |
c79ecba9cde7
pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6327
diff
changeset
|
241 | @param exitStatus exit status of the process |
c79ecba9cde7
pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6327
diff
changeset
|
242 | @type QProcess.ExitStatus |
6011
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
243 | """ |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
244 | self.__finish() |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
245 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
246 | def __refresh(self): |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
247 | """ |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
248 | Private slot to refresh the displayed list. |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
249 | """ |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
250 | self.__stopProcess() |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
251 | self.start() |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
252 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
253 | def start(self): |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
254 | """ |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
255 | Public method to start the command. |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
256 | """ |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
257 | self.packageList.clear() |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
258 | self.__errors = "" |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
259 | self.__output = [] |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
260 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
261 | self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
262 | self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
263 | self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
264 | self.__refreshButton.setEnabled(False) |
6124
8467f7d4b567
Fixed an issue with the pip list dialog related to correct enabled status of the buttons.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
265 | if self.__upgradeAllButton is not None: |
8467f7d4b567
Fixed an issue with the pip list dialog related to correct enabled status of the buttons.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
266 | self.__upgradeAllButton.setEnabled(False) |
6011
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
267 | QApplication.processEvents() |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
268 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
269 | QApplication.setOverrideCursor(Qt.WaitCursor) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
270 | QApplication.processEvents() |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
271 | |
6342
c79ecba9cde7
pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6327
diff
changeset
|
272 | venvName = self.venvComboBox.currentText() |
c79ecba9cde7
pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6327
diff
changeset
|
273 | interpreter = self.__pip.getVirtualenvInterpreter(venvName) |
c79ecba9cde7
pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6327
diff
changeset
|
274 | if not interpreter: |
c79ecba9cde7
pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6327
diff
changeset
|
275 | return |
6011
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
276 | |
6342
c79ecba9cde7
pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6327
diff
changeset
|
277 | args = ["-m", "pip"] + PipListDialog.CommandArguments[self.__mode] |
6011
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
278 | if self.localCheckBox.isChecked(): |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
279 | args.append("--local") |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
280 | if self.notRequiredCheckBox.isChecked(): |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
281 | args.append("--not-required") |
6327
a1716d9210f4
pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6301
diff
changeset
|
282 | if self.userCheckBox.isChecked(): |
a1716d9210f4
pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6301
diff
changeset
|
283 | args.append("--user") |
6011
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
284 | |
6257
4523c5e6dd43
Added more code to properly override the PyPi index URL used by pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6124
diff
changeset
|
285 | if self.__indexUrl: |
4523c5e6dd43
Added more code to properly override the PyPi index URL used by pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6124
diff
changeset
|
286 | args.append("--index-url") |
4523c5e6dd43
Added more code to properly override the PyPi index URL used by pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6124
diff
changeset
|
287 | args.append(self.__indexUrl + "/simple") |
4523c5e6dd43
Added more code to properly override the PyPi index URL used by pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6124
diff
changeset
|
288 | |
6342
c79ecba9cde7
pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6327
diff
changeset
|
289 | self.process.start(interpreter, args) |
6011
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
290 | procStarted = self.process.waitForStarted(5000) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
291 | if not procStarted: |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
292 | self.buttonBox.setFocus() |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
293 | self.__stopProcess() |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
294 | E5MessageBox.critical( |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
295 | self, |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
296 | self.tr('Process Generation Error'), |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
297 | self.tr( |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
298 | 'The process {0} could not be started.' |
6342
c79ecba9cde7
pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6327
diff
changeset
|
299 | ).format(interpreter)) |
6011
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
300 | self.__finish() |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
301 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
302 | def __processOutput(self): |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
303 | """ |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
304 | Private method to process the captured output. |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
305 | """ |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
306 | if self.__output: |
6257
4523c5e6dd43
Added more code to properly override the PyPi index URL used by pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6124
diff
changeset
|
307 | try: |
4523c5e6dd43
Added more code to properly override the PyPi index URL used by pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6124
diff
changeset
|
308 | packageData = json.loads("\n".join(self.__output)) |
4523c5e6dd43
Added more code to properly override the PyPi index URL used by pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6124
diff
changeset
|
309 | for package in packageData: |
4523c5e6dd43
Added more code to properly override the PyPi index URL used by pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6124
diff
changeset
|
310 | data = [ |
4523c5e6dd43
Added more code to properly override the PyPi index URL used by pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6124
diff
changeset
|
311 | package["name"], |
4523c5e6dd43
Added more code to properly override the PyPi index URL used by pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6124
diff
changeset
|
312 | package["version"], |
4523c5e6dd43
Added more code to properly override the PyPi index URL used by pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6124
diff
changeset
|
313 | ] |
4523c5e6dd43
Added more code to properly override the PyPi index URL used by pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6124
diff
changeset
|
314 | if self.__mode == "outdated": |
4523c5e6dd43
Added more code to properly override the PyPi index URL used by pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6124
diff
changeset
|
315 | data.extend([ |
4523c5e6dd43
Added more code to properly override the PyPi index URL used by pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6124
diff
changeset
|
316 | package["latest_version"], |
4523c5e6dd43
Added more code to properly override the PyPi index URL used by pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6124
diff
changeset
|
317 | package["latest_filetype"], |
4523c5e6dd43
Added more code to properly override the PyPi index URL used by pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6124
diff
changeset
|
318 | ]) |
4523c5e6dd43
Added more code to properly override the PyPi index URL used by pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6124
diff
changeset
|
319 | QTreeWidgetItem(self.packageList, data) |
4523c5e6dd43
Added more code to properly override the PyPi index URL used by pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6124
diff
changeset
|
320 | except ValueError as err: |
4523c5e6dd43
Added more code to properly override the PyPi index URL used by pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6124
diff
changeset
|
321 | self.__errors += str(err) + "\n" |
4523c5e6dd43
Added more code to properly override the PyPi index URL used by pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6124
diff
changeset
|
322 | self.__errors += "received output:\n" |
4523c5e6dd43
Added more code to properly override the PyPi index URL used by pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6124
diff
changeset
|
323 | self.__errors += "\n".join(self.__output) |
6011
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
324 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
325 | def __readStdout(self): |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
326 | """ |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
327 | Private slot to handle the readyReadStandardOutput signal. |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
328 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
329 | It reads the output of the process, formats it and inserts it into |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
330 | the contents pane. |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
331 | """ |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
332 | self.process.setReadChannel(QProcess.StandardOutput) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
333 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
334 | while self.process.canReadLine(): |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
335 | line = str(self.process.readLine(), self.__ioEncoding, |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
336 | 'replace').strip() |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
337 | self.__output.append(line) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
338 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
339 | def __readStderr(self): |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
340 | """ |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
341 | Private slot to handle the readyReadStandardError signal. |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
342 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
343 | It reads the error output of the process and inserts it into the |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
344 | error pane. |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
345 | """ |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
346 | self.__errors += str(self.process.readAllStandardError(), |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
347 | self.__ioEncoding, 'replace') |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
348 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
349 | @pyqtSlot(str) |
6342
c79ecba9cde7
pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6327
diff
changeset
|
350 | def on_venvComboBox_activated(self, txt): |
6011
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
351 | """ |
6342
c79ecba9cde7
pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6327
diff
changeset
|
352 | Private slot handling the selection of a virtual environment. |
6011
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
353 | |
6342
c79ecba9cde7
pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6327
diff
changeset
|
354 | @param txt virtual environment |
c79ecba9cde7
pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6327
diff
changeset
|
355 | @type str |
6011
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
356 | """ |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
357 | self.__refresh() |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
358 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
359 | @pyqtSlot(bool) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
360 | def on_localCheckBox_clicked(self, checked): |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
361 | """ |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
362 | Private slot handling the switching of the local mode. |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
363 | |
6327
a1716d9210f4
pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6301
diff
changeset
|
364 | @param checked state of the local check box |
a1716d9210f4
pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6301
diff
changeset
|
365 | @type bool |
6011
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
366 | """ |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
367 | self.__refresh() |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
368 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
369 | @pyqtSlot(bool) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
370 | def on_notRequiredCheckBox_clicked(self, checked): |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
371 | """ |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
372 | Private slot handling the switching of the 'not required' mode. |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
373 | |
6327
a1716d9210f4
pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6301
diff
changeset
|
374 | @param checked state of the 'not required' check box |
a1716d9210f4
pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6301
diff
changeset
|
375 | @type bool |
a1716d9210f4
pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6301
diff
changeset
|
376 | """ |
a1716d9210f4
pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6301
diff
changeset
|
377 | self.__refresh() |
a1716d9210f4
pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6301
diff
changeset
|
378 | |
a1716d9210f4
pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6301
diff
changeset
|
379 | @pyqtSlot(bool) |
a1716d9210f4
pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6301
diff
changeset
|
380 | def on_userCheckBox_clicked(self, checked): |
a1716d9210f4
pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6301
diff
changeset
|
381 | """ |
a1716d9210f4
pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6301
diff
changeset
|
382 | Private slot handling the switching of the 'user-site' mode. |
a1716d9210f4
pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6301
diff
changeset
|
383 | |
a1716d9210f4
pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6301
diff
changeset
|
384 | @param checked state of the 'user-site' check box |
a1716d9210f4
pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6301
diff
changeset
|
385 | @type bool |
6011
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
386 | """ |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
387 | self.__refresh() |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
388 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
389 | @pyqtSlot() |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
390 | def on_packageList_itemSelectionChanged(self): |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
391 | """ |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
392 | Private slot handling the selection of a package. |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
393 | """ |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
394 | self.infoWidget.clear() |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
395 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
396 | if len(self.packageList.selectedItems()) == 1: |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
397 | itm = self.packageList.selectedItems()[0] |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
398 | |
6342
c79ecba9cde7
pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6327
diff
changeset
|
399 | environment = self.venvComboBox.currentText() |
c79ecba9cde7
pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6327
diff
changeset
|
400 | interpreter = self.__pip.getVirtualenvInterpreter(environment) |
c79ecba9cde7
pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6327
diff
changeset
|
401 | if not interpreter: |
c79ecba9cde7
pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6327
diff
changeset
|
402 | return |
6011
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
403 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
404 | QApplication.setOverrideCursor(Qt.WaitCursor) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
405 | |
6342
c79ecba9cde7
pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6327
diff
changeset
|
406 | args = ["-m", "pip", "show"] |
6011
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
407 | if self.verboseCheckBox.isChecked(): |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
408 | args.append("--verbose") |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
409 | if self.installedFilesCheckBox.isChecked(): |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
410 | args.append("--files") |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
411 | args.append(itm.text(0)) |
6342
c79ecba9cde7
pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6327
diff
changeset
|
412 | success, output = self.__pip.runProcess(args, interpreter) |
6011
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
413 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
414 | if success and output: |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
415 | mode = PipListDialog.ShowProcessGeneralMode |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
416 | for line in output.splitlines(): |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
417 | line = line.rstrip() |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
418 | if line != "---": |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
419 | if mode != PipListDialog.ShowProcessGeneralMode: |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
420 | if line[0] == " ": |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
421 | QTreeWidgetItem( |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
422 | self.infoWidget, |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
423 | [" ", line.strip()]) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
424 | else: |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
425 | mode = PipListDialog.ShowProcessGeneralMode |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
426 | if mode == PipListDialog.ShowProcessGeneralMode: |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
427 | try: |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
428 | label, info = line.split(": ", 1) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
429 | except ValueError: |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
430 | label = line[:-1] |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
431 | info = "" |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
432 | label = label.lower() |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
433 | if label in self.__infoLabels: |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
434 | QTreeWidgetItem( |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
435 | self.infoWidget, |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
436 | [self.__infoLabels[label], info]) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
437 | if label == "files": |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
438 | mode = PipListDialog.ShowProcessFilesListMode |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
439 | elif label == "classifiers": |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
440 | mode = PipListDialog.ShowProcessClassifiersMode |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
441 | elif label == "entry-points": |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
442 | mode = PipListDialog.ShowProcessEntryPointsMode |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
443 | self.infoWidget.scrollToTop() |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
444 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
445 | header = self.infoWidget.header() |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
446 | header.setStretchLastSection(False) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
447 | header.resizeSections(QHeaderView.ResizeToContents) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
448 | if header.sectionSize(0) + header.sectionSize(1) < header.width(): |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
449 | header.setStretchLastSection(True) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
450 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
451 | QApplication.restoreOverrideCursor() |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
452 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
453 | enable = (len(self.packageList.selectedItems()) > 1 or |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
454 | (len(self.packageList.selectedItems()) == 1 and |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
455 | self.packageList.selectedItems()[0].text(0) not in |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
456 | self.__nothingStrings.values())) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
457 | self.__upgradeButton and self.__upgradeButton.setEnabled(enable) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
458 | self.__uninstallButton.setEnabled(enable) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
459 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
460 | @pyqtSlot(bool) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
461 | def on_verboseCheckBox_clicked(self, checked): |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
462 | """ |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
463 | Private slot to handle a change of the verbose package information |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
464 | checkbox. |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
465 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
466 | @param checked state of the checkbox |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
467 | @type bool |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
468 | """ |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
469 | self.on_packageList_itemSelectionChanged() |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
470 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
471 | @pyqtSlot(bool) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
472 | def on_installedFilesCheckBox_clicked(self, checked): |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
473 | """ |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
474 | Private slot to handle a change of the installed files information |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
475 | checkbox. |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
476 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
477 | @param checked state of the checkbox |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
478 | @type bool |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
479 | """ |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
480 | self.on_packageList_itemSelectionChanged() |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
481 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
482 | def __upgradePackages(self): |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
483 | """ |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
484 | Private slot to upgrade the selected packages. |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
485 | """ |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
486 | packages = [] |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
487 | for itm in self.packageList.selectedItems(): |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
488 | packages.append(itm.text(0)) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
489 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
490 | if packages: |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
491 | if "pip" in packages: |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
492 | self.__upgradePip() |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
493 | else: |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
494 | self.__executeUpgradePackages(packages) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
495 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
496 | def __upgradeAllPackages(self): |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
497 | """ |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
498 | Private slot to upgrade all listed packages. |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
499 | """ |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
500 | packages = [] |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
501 | for index in range(self.packageList.topLevelItemCount()): |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
502 | itm = self.packageList.topLevelItem(index) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
503 | packages.append(itm.text(0)) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
504 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
505 | if packages: |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
506 | if "pip" in packages: |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
507 | self.__upgradePip() |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
508 | else: |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
509 | self.__executeUpgradePackages(packages) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
510 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
511 | def __upgradePip(self): |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
512 | """ |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
513 | Private slot to upgrade pip itself. |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
514 | """ |
6327
a1716d9210f4
pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6301
diff
changeset
|
515 | res = self.__pip.upgradePip( |
6342
c79ecba9cde7
pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6327
diff
changeset
|
516 | venvName=self.venvComboBox.currentText(), |
c79ecba9cde7
pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6327
diff
changeset
|
517 | userSite=self.userCheckBox.isChecked()) |
6011
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
518 | if res: |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
519 | self.__refresh() |
6301
f488d2cc5841
pip interface: added TODO markers to support --user
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6257
diff
changeset
|
520 | |
6011
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
521 | def __executeUpgradePackages(self, packages): |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
522 | """ |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
523 | Private method to execute the pip upgrade command. |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
524 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
525 | @param packages list of package names to be upgraded |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
526 | @type list of str |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
527 | """ |
6327
a1716d9210f4
pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6301
diff
changeset
|
528 | res = self.__pip.upgradePackages( |
6342
c79ecba9cde7
pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6327
diff
changeset
|
529 | packages, venvName=self.venvComboBox.currentText(), |
c79ecba9cde7
pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6327
diff
changeset
|
530 | userSite=self.userCheckBox.isChecked()) |
6011
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
531 | if res: |
6396
f6d4ab496cfe
PipListDialog: changed code to ensure, that the dialog gets raised when a selected action is completed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6342
diff
changeset
|
532 | self.activateWindow() |
f6d4ab496cfe
PipListDialog: changed code to ensure, that the dialog gets raised when a selected action is completed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6342
diff
changeset
|
533 | self.raise_() |
6011
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
534 | self.__refresh() |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
535 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
536 | def __uninstallPackages(self): |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
537 | """ |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
538 | Private slot to uninstall the selected packages. |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
539 | """ |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
540 | packages = [] |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
541 | for itm in self.packageList.selectedItems(): |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
542 | packages.append(itm.text(0)) |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
543 | |
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
544 | if packages: |
6342
c79ecba9cde7
pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6327
diff
changeset
|
545 | res = self.__pip.uninstallPackages( |
c79ecba9cde7
pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6327
diff
changeset
|
546 | packages, |
c79ecba9cde7
pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6327
diff
changeset
|
547 | venvName=self.venvComboBox.currentText()) |
6011
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
548 | if res: |
6396
f6d4ab496cfe
PipListDialog: changed code to ensure, that the dialog gets raised when a selected action is completed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6342
diff
changeset
|
549 | self.activateWindow() |
f6d4ab496cfe
PipListDialog: changed code to ensure, that the dialog gets raised when a selected action is completed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6342
diff
changeset
|
550 | self.raise_() |
6011
e6af0dcfbb35
Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
551 | self.__refresh() |