PipxInterface/PipxWidget.py

Wed, 26 Jun 2024 11:57:04 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 26 Jun 2024 11:57:04 +0200
changeset 8
02b45cd11e64
parent 7
9a98f7260372
child 9
2ab7d3ac8283
permissions
-rw-r--r--

Added the display of the path standalone Python interpreters are installed to.

2
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
3 # Copyright (c) 2024 Detlev Offenbach <detlev@die-offenbachs.de>
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing the pipx management widget.
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10 from PyQt6.QtCore import Qt, pyqtSlot
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11 from PyQt6.QtWidgets import QTreeWidgetItem, QWidget
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13 from eric7.EricGui import EricPixmapCache
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15 from .Pipx import Pipx
4
097a06104774 Implemented two foundational dialogs for executing pipx commands and running applications from the list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
16 from .PipxAppStartDialog import PipxAppStartDialog
097a06104774 Implemented two foundational dialogs for executing pipx commands and running applications from the list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
17
2
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 from .Ui_PipxWidget import Ui_PipxWidget
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 class PipxWidget(QWidget, Ui_PipxWidget):
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 """
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 Class documentation goes here.
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 """
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 PackageColumn = 0
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 VersionColumn = 1
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 PythonVersionColumn = 2
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 AppPathRole = Qt.ItemDataRole.UserRole
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 def __init__(self, plugin, fromEric=True, parent=None):
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 """
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 Constructor
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 @param plugin reference to the plug-in object
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 @type MqttMonitorPlugin
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 @param fromEric flag indicating the eric-ide mode (defaults to True)
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 (True = eric-ide mode, False = application mode)
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 @type bool (optional)
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 @param parent reference to the parent widget (defaults to None)
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 @type QWidget (optional)
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 """
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 super().__init__(parent)
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 self.setupUi(self)
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46
7
9a98f7260372 Modified the application execution dialog to allow the selection of a working directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
47 self.__plugin = plugin
2
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48 self.__pipx = Pipx(self)
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 if fromEric:
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 self.layout().setContentsMargins(0, 3, 0, 0)
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52 else:
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53 self.layout().setContentsMargins(0, 0, 0, 0)
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55 # TODO: set the various icons
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 self.pipxMenuButton.setIcon(EricPixmapCache.getIcon("superMenu"))
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 self.refreshButton.setIcon(EricPixmapCache.getIcon("reload"))
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59 self.packagesList.header().setSortIndicator(
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60 PipxWidget.PackageColumn, Qt.SortOrder.AscendingOrder
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61 )
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
63 self.__showPipxVersion()
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
64
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65 pipxPaths = self.__pipx.getPipxStrPaths()
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 self.venvsPathEdit.setText(pipxPaths["venvsPath"])
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 self.applicationsPathEdit.setText(pipxPaths["appsPath"])
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 self.manPagesPathEdit.setText(pipxPaths["manPath"])
8
02b45cd11e64 Added the display of the path standalone Python interpreters are installed to.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
69 self.interpretersPathEdit.setText(pipxPaths["pythonPath"])
2
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71 self.__populatePackages()
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 def __showPipxVersion(self):
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74 """
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
75 Private method to show the pipx version in the widget header.
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76 """
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77 self.pipxVersionLabel.setText(
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 self.tr("<b>pipx Version {0}</b>").format(self.__pipx.getPipxVersion())
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
79 )
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
80
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
81 def __resizePackagesColumns(self):
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
82 """
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83 Private method to resize the columns of the packages list.
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
84 """
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
85 self.packagesList.header().setStretchLastSection(True)
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
86 self.packagesList.resizeColumnToContents(PipxWidget.PackageColumn)
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
87 self.packagesList.resizeColumnToContents(PipxWidget.VersionColumn)
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
88 self.packagesList.resizeColumnToContents(PipxWidget.PythonVersionColumn)
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
90 def __populatePackages(self):
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91 """
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
92 Private method to populate the packages list.
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
93 """
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94 self.packagesList.clear()
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
95
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
96 packages = self.__pipx.getInstalledPackages()
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
97 for package in packages:
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
98 topItem = QTreeWidgetItem(
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
99 self.packagesList,
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
100 [package["name"], package["version"], package["python"]],
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
101 )
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
102 for app, appPath in package["apps"]:
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
103 itm = QTreeWidgetItem(topItem, [app])
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
104 itm.setData(0, PipxWidget.AppPathRole, appPath)
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
105 self.__resizePackagesColumns()
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
106
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
107 @pyqtSlot()
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
108 def on_refreshButton_clicked(self):
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
109 """
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
110 Private slot to refresh the packages list.
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
111 """
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
112 self.__showPipxVersion()
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
113
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
114 expandedPackages = []
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
115 for row in range(self.packagesList.topLevelItemCount()):
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
116 itm = self.packagesList.topLevelItem(row)
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
117 if itm.isExpanded():
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
118 expandedPackages.append(itm.text(PipxWidget.PackageColumn))
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
119
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
120 self.__populatePackages()
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
121
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
122 for row in range(self.packagesList.topLevelItemCount()):
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
123 itm = self.packagesList.topLevelItem(row)
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
124 if itm.text(PipxWidget.PackageColumn) in expandedPackages:
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
125 itm.setExpanded(True)
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
126 self.__resizePackagesColumns()
4
097a06104774 Implemented two foundational dialogs for executing pipx commands and running applications from the list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
127
097a06104774 Implemented two foundational dialogs for executing pipx commands and running applications from the list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
128 @pyqtSlot(QTreeWidgetItem, int)
097a06104774 Implemented two foundational dialogs for executing pipx commands and running applications from the list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
129 def on_packagesList_itemActivated(self, item, column):
097a06104774 Implemented two foundational dialogs for executing pipx commands and running applications from the list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
130 """
097a06104774 Implemented two foundational dialogs for executing pipx commands and running applications from the list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
131 Private slot to start the activated item, if it is not a top level one
097a06104774 Implemented two foundational dialogs for executing pipx commands and running applications from the list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
132
097a06104774 Implemented two foundational dialogs for executing pipx commands and running applications from the list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
133 @param item reference to the activated item
097a06104774 Implemented two foundational dialogs for executing pipx commands and running applications from the list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
134 @type QTreeWidgetItem
097a06104774 Implemented two foundational dialogs for executing pipx commands and running applications from the list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
135 @param column column number of the activation
097a06104774 Implemented two foundational dialogs for executing pipx commands and running applications from the list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
136 @type int
097a06104774 Implemented two foundational dialogs for executing pipx commands and running applications from the list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
137 """
097a06104774 Implemented two foundational dialogs for executing pipx commands and running applications from the list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
138 if item.parent() is not None:
097a06104774 Implemented two foundational dialogs for executing pipx commands and running applications from the list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
139 app = item.data(0, PipxWidget.AppPathRole)
7
9a98f7260372 Modified the application execution dialog to allow the selection of a working directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
140 dlg = PipxAppStartDialog(app, self.__plugin, self)
4
097a06104774 Implemented two foundational dialogs for executing pipx commands and running applications from the list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
141 dlg.show()

eric ide

mercurial