PluginPipxInterface.py

Thu, 29 Aug 2024 13:16:22 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Thu, 29 Aug 2024 13:16:22 +0200
changeset 63
4b38c24b15dd
parent 61
163461aefed6
child 65
f45739686aa1
permissions
-rw-r--r--

Corrected some source code documentation.

1
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1 # -*- coding: utf-8 -*-
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
2
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
3 # Copyright (c) 2024 Detlev Offenbach <detlev@die-offenbachs.de>
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
4 #
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
5
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
6 """
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
7 Module implementing the pipx Interface plug-in.
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
8 """
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
9
31
17e37d4ebe42 Changed the upgrade actions to first check for running applications of packages to be upgraded because this situation causes issues during the upgrade.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 29
diff changeset
10 import importlib.util
1
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
11 import os
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
12 import sysconfig
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
13
2
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
14 from PyQt6.QtCore import QCoreApplication, QObject, Qt, QTranslator
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
15 from PyQt6.QtGui import QKeySequence
1
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
16
7
9a98f7260372 Modified the application execution dialog to allow the selection of a working directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
17 from eric7 import Globals, Preferences
2
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
18 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: 1
diff changeset
19 from eric7.EricGui.EricAction import EricAction
1
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
20 from eric7.EricWidgets.EricApplication import ericApp
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
21 from eric7.SystemUtilities import OSUtilities
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
22
2
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
23 try:
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
24 from eric7.UI.UserInterface import UserInterfaceSide
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
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: 1
diff changeset
26 _Side = UserInterfaceSide.Right
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
27 except ImportError:
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
28 # backward compatibility for eric < 24.2
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
29 from eric7.UI.UserInterface import UserInterface
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
30
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
31 _Side = UserInterface.RightSide
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
32
1
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
33 # Start-Of-Header
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
34 __header__ = {
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
35 "name": "pipx Interface",
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
36 "author": "Detlev Offenbach <detlev@die-offenbachs.de>",
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
37 "autoactivate": True,
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
38 "deactivateable": True,
61
163461aefed6 Fixed a few issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
39 "version": "10.3.4",
1
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
40 "className": "PluginPipxInterface",
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
41 "packageName": "PipxInterface",
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
42 "shortDescription": "Graphical interface to the 'pipx' command.",
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
43 "longDescription": (
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
44 "Plugin implementing widgets and dialogues to interact with the various pipx"
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
45 " commands and to start pipx managed applications from within the eric-ide."
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
46 ),
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
47 "needsRestart": False,
29
9a783db4f4ed Prepared a new release.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 23
diff changeset
48 "hasCompiledForms": True,
1
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
49 "pyqtApi": 2,
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
50 }
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
51 # End-Of-Header
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
52
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
53 error = "" # noqa: U200
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
54
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
55 pipxInterfacePluginObject = None
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
56
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
57
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
58 def exeDisplayData():
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
59 """
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
60 Module function to support the display of some executable info.
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
61
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
62 @return dictionary containing the data to query the presence of
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
63 the executable
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
64 @rtype dict
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
65 """
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
66 pipx = os.path.join(sysconfig.get_path("scripts"), "pipx")
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
67 if OSUtilities.isWindowsPlatform():
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
68 pipx += ".exe"
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
69
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
70 data = {
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
71 "programEntry": True,
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
72 "header": QCoreApplication.translate(
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
73 "PluginPipxInterface", "PyPI Application Management"
2
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
74 ),
1
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
75 "exe": pipx,
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
76 "versionCommand": "--version",
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
77 "versionStartsWith": "",
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
78 "versionRe": None,
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
79 "versionPosition": -1,
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
80 "version": "",
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
81 "versionCleanup": None,
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
82 "exeModule": None,
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
83 }
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
84
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
85 return data
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
86
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
87
63
4b38c24b15dd Corrected some source code documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 61
diff changeset
88 def createPipxPage(_configDlg):
1
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
89 """
63
4b38c24b15dd Corrected some source code documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 61
diff changeset
90 Module function to create the pipx configuration page.
1
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
91
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
92 @param _configDlg reference to the configuration dialog (unused)
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
93 @type ConfigurationWidget
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
94 @return reference to the configuration page
63
4b38c24b15dd Corrected some source code documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 61
diff changeset
95 @rtype PipxPage
1
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
96 """
15
2fb8d19c38ae Corrected some code style and formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
97 from PipxInterface.ConfigurationPage.PipxPage import PipxPage # noqa: I102
2fb8d19c38ae Corrected some code style and formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
98
1
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
99 global pipxInterfacePluginObject
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
100
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
101 page = PipxPage(pipxInterfacePluginObject)
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
102 return page
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
103
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
104
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
105 def getConfigData():
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
106 """
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
107 Module function returning data as required by the configuration dialog.
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
108
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
109 @return dictionary containing the relevant data
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
110 @rtype dict
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
111 """
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
112 return {
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
113 "pipxPage": [
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
114 QCoreApplication.translate(
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
115 "PluginPipxInterface", "Python Application Management"
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
116 ),
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
117 os.path.join("PipxInterface", "icons", "pipx22"),
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
118 createPipxPage,
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
119 None,
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
120 None,
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
121 ],
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
122 }
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
123
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
124
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
125 def prepareUninstall():
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
126 """
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
127 Module function to prepare for an un-installation.
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
128 """
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
129 Preferences.getSettings().remove(PluginPipxInterface.PreferencesKey)
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
130
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
131
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
132 class PluginPipxInterface(QObject):
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
133 """
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
134 Class documentation goes here.
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
135 """
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
136
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
137 PreferencesKey = "Pipx"
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
138
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
139 def __init__(self, ui):
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
140 """
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
141 Constructor
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
142
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
143 @param ui reference to the user interface object
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
144 @type UI.UserInterface
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
145 """
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
146 super().__init__(ui)
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
147 self.__ui = ui
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
148 self.__initialize()
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
149
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
150 self.__defaults = {
7
9a98f7260372 Modified the application execution dialog to allow the selection of a working directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
151 "RecentAppWorkdirs": [],
9a98f7260372 Modified the application execution dialog to allow the selection of a working directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
152 "MaxRecentAppWorkdirs": 20,
32
b7a3ae7519ba - Implemented some enhancements related to indicating outdated packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 31
diff changeset
153 "IncludeOutdatedDependencies": True,
b7a3ae7519ba - Implemented some enhancements related to indicating outdated packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 31
diff changeset
154 "AutoCheckOutdated": False,
1
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
155 }
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
156
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
157 self.__translator = None
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
158 self.__loadTranslator()
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
159
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
160 def __initialize(self):
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
161 """
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
162 Private slot to (re)initialize the plugin.
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
163 """
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
164 self.__widget = None
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
165
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
166 def activate(self):
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
167 """
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
168 Public method to activate this plug-in.
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
169
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
170 @return tuple of None and activation status
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
171 @rtype bool
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
172 """
15
2fb8d19c38ae Corrected some code style and formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
173 from PipxInterface.PipxWidget import PipxWidget # noqa: I102
2fb8d19c38ae Corrected some code style and formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
174
2
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
175 global error, pipxInterfacePluginObject
1
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
176 error = "" # clear previous error
2
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
177 pipxInterfacePluginObject = self
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
178
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
179 self.__widget = PipxWidget(self, fromEric=True)
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
180 iconName = "pipx96" if self.__ui.getLayoutType() == "Sidebars" else "pipx22"
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
181 self.__ui.addSideWidget(
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
182 _Side,
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
183 self.__widget,
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
184 EricPixmapCache.getIcon(os.path.join("PipxInterface", "icons", iconName)),
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
185 self.tr("PyPI Application Management"),
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
186 )
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
187
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
188 self.__activateAct = EricAction(
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
189 self.tr("PyPI Application Management"),
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
190 self.tr("PyPI Application Management"),
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
191 QKeySequence(self.tr("Ctrl+Alt+Shift+A")),
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
192 0,
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
193 self,
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
194 "pipx_interface_activate",
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
195 )
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
196 self.__activateAct.setStatusTip(
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
197 self.tr("Switch the input focus to the PyPI Application Management window.")
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
198 )
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
199 self.__activateAct.setWhatsThis(
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
200 self.tr(
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
201 """<b>Activate PyPI Application Management</b>"""
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
202 """<p>This switches the input focus to the PyPI Application"""
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
203 """ Management window.</p>"""
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
204 )
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
205 )
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
206 self.__activateAct.triggered.connect(self.__activateWidget)
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
207
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
208 self.__ui.addEricActions([self.__activateAct], "ui")
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
209 menu = self.__ui.getMenu("subwindow")
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
210 menu.addAction(self.__activateAct)
1
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
211
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
212 return None, True
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
213
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
214 def deactivate(self):
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
215 """
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
216 Public method to deactivate this plug-in.
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
217 """
2
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
218 menu = self.__ui.getMenu("subwindow")
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
219 menu.removeAction(self.__activateAct)
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
220 self.__ui.removeEricActions([self.__activateAct], "ui")
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
221 self.__ui.removeSideWidget(self.__widget)
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
222
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
223 self.__initialize()
1
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
224
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
225 def __loadTranslator(self):
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
226 """
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
227 Private method to load the translation file.
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
228 """
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
229 if self.__ui is not None:
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
230 loc = self.__ui.getLocale()
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
231 if loc and loc != "C":
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
232 locale_dir = os.path.join(
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
233 os.path.dirname(__file__), "PipxInterface", "i18n"
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
234 )
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
235 translation = "pipx_{0}".format(loc)
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
236 translator = QTranslator(None)
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
237 loaded = translator.load(translation, locale_dir)
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
238 if loaded:
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
239 self.__translator = translator
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
240 ericApp().installTranslator(self.__translator)
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
241 else:
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
242 print(
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
243 "Warning: translation file '{0}' could not be"
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
244 " loaded.".format(translation)
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
245 )
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
246 print("Using default.")
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
247
2
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
248 def __activateWidget(self):
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
249 """
58
14c5df20f271 Corrected a documentation typo.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 56
diff changeset
250 Private slot to handle the activation of the pipx interface.
2
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
251 """
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
252 uiLayoutType = self.__ui.getLayoutType()
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
253
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
254 if uiLayoutType == "Toolboxes":
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
255 self.__ui.rToolboxDock.show()
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
256 self.__ui.rToolbox.setCurrentWidget(self.__widget)
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
257 elif uiLayoutType == "Sidebars":
52
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
258 try:
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
259 self.__ui.activateLeftRightSidebarWidget(self.__widget)
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
260 except AttributeError:
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
261 self.__activateLeftRightSidebarWidget(self.__widget)
2
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
262 else:
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
263 self.__widget.show()
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
264 self.__widget.setFocus(Qt.FocusReason.ActiveWindowFocusReason)
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
265
43
2ef4c1f1adea Added code to indicate the existence of outdated packages or dependencies in the icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
266 def setOutdatedIndicator(self, outdated):
2ef4c1f1adea Added code to indicate the existence of outdated packages or dependencies in the icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
267 """
44
e5e923c6a6db Corrected some code style and formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
268 Public method to set or clear the outdated indication of the pipx icon.
43
2ef4c1f1adea Added code to indicate the existence of outdated packages or dependencies in the icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
269
2ef4c1f1adea Added code to indicate the existence of outdated packages or dependencies in the icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
270 @param outdated flag indicating outdated packages or dependencies
2ef4c1f1adea Added code to indicate the existence of outdated packages or dependencies in the icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
271 @type bool
2ef4c1f1adea Added code to indicate the existence of outdated packages or dependencies in the icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
272 """
2ef4c1f1adea Added code to indicate the existence of outdated packages or dependencies in the icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
273 uiLayoutType = self.__ui.getLayoutType()
2ef4c1f1adea Added code to indicate the existence of outdated packages or dependencies in the icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
274
2ef4c1f1adea Added code to indicate the existence of outdated packages or dependencies in the icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
275 if uiLayoutType == "Toolboxes":
2ef4c1f1adea Added code to indicate the existence of outdated packages or dependencies in the icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
276 iconName = "pipxOutdated22" if outdated else "pipx22"
2ef4c1f1adea Added code to indicate the existence of outdated packages or dependencies in the icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
277 index = self.__ui.rToolbox.indexOf(self.__widget)
2ef4c1f1adea Added code to indicate the existence of outdated packages or dependencies in the icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
278 self.__ui.rToolbox.setItemIcon(
2ef4c1f1adea Added code to indicate the existence of outdated packages or dependencies in the icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
279 index,
2ef4c1f1adea Added code to indicate the existence of outdated packages or dependencies in the icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
280 EricPixmapCache.getIcon(
2ef4c1f1adea Added code to indicate the existence of outdated packages or dependencies in the icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
281 os.path.join("PipxInterface", "icons", iconName)
44
e5e923c6a6db Corrected some code style and formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
282 ),
43
2ef4c1f1adea Added code to indicate the existence of outdated packages or dependencies in the icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
283 )
2ef4c1f1adea Added code to indicate the existence of outdated packages or dependencies in the icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
284 elif uiLayoutType == "Sidebars":
2ef4c1f1adea Added code to indicate the existence of outdated packages or dependencies in the icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
285 iconName = "pipxOutdated96" if outdated else "pipx96"
52
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
286 try:
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
287 self.__ui.setLeftRightSidebarWidgetIcon(
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
288 self.__widget,
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
289 EricPixmapCache.getIcon(
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
290 os.path.join("PipxInterface", "icons", iconName)
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
291 ),
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
292 )
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
293 except AttributeError:
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
294 self.__setLeftRightSidebarWidgetIcon(
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
295 self.__widget,
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
296 EricPixmapCache.getIcon(
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
297 os.path.join("PipxInterface", "icons", iconName)
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
298 ),
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
299 )
43
2ef4c1f1adea Added code to indicate the existence of outdated packages or dependencies in the icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
300
1
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
301 def getPreferences(self, key):
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
302 """
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
303 Public method to retrieve the various settings values.
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
304
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
305 @param key the key of the value to get
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
306 @type str
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
307 @return the requested setting value
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
308 @rtype Any
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
309 """
7
9a98f7260372 Modified the application execution dialog to allow the selection of a working directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
310 if key in ("RecentAppWorkdirs",):
9a98f7260372 Modified the application execution dialog to allow the selection of a working directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
311 return Globals.toList(
9a98f7260372 Modified the application execution dialog to allow the selection of a working directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
312 Preferences.Prefs.settings.value(
9a98f7260372 Modified the application execution dialog to allow the selection of a working directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
313 self.PreferencesKey + "/" + key, self.__defaults[key]
9a98f7260372 Modified the application execution dialog to allow the selection of a working directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
314 )
9a98f7260372 Modified the application execution dialog to allow the selection of a working directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
315 )
9a98f7260372 Modified the application execution dialog to allow the selection of a working directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
316 elif key in ("MaxRecentAppWorkdirs",):
9a98f7260372 Modified the application execution dialog to allow the selection of a working directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
317 return int(
9a98f7260372 Modified the application execution dialog to allow the selection of a working directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
318 Preferences.Prefs.settings.value(
9a98f7260372 Modified the application execution dialog to allow the selection of a working directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
319 self.PreferencesKey + "/" + key, self.__defaults[key]
9a98f7260372 Modified the application execution dialog to allow the selection of a working directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
320 )
9a98f7260372 Modified the application execution dialog to allow the selection of a working directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
321 )
32
b7a3ae7519ba - Implemented some enhancements related to indicating outdated packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 31
diff changeset
322 elif key in ("IncludeOutdatedDependencies", "AutoCheckOutdated"):
b7a3ae7519ba - Implemented some enhancements related to indicating outdated packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 31
diff changeset
323 return Globals.toBool(
b7a3ae7519ba - Implemented some enhancements related to indicating outdated packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 31
diff changeset
324 Preferences.Prefs.settings.value(
36
5b9bc68ef028 bug fixes
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
325 self.PreferencesKey + "/" + key, self.__defaults[key]
32
b7a3ae7519ba - Implemented some enhancements related to indicating outdated packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 31
diff changeset
326 )
b7a3ae7519ba - Implemented some enhancements related to indicating outdated packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 31
diff changeset
327 )
b7a3ae7519ba - Implemented some enhancements related to indicating outdated packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 31
diff changeset
328 else:
b7a3ae7519ba - Implemented some enhancements related to indicating outdated packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 31
diff changeset
329 return Preferences.Prefs.settings.value(
36
5b9bc68ef028 bug fixes
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
330 self.PreferencesKey + "/" + key, self.__defaults[key]
32
b7a3ae7519ba - Implemented some enhancements related to indicating outdated packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 31
diff changeset
331 )
7
9a98f7260372 Modified the application execution dialog to allow the selection of a working directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
332
1
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
333 return None
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
334
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
335 def setPreferences(self, key, value):
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
336 """
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
337 Public method to store the various settings values.
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
338
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
339 @param key the key of the setting to be set
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
340 @type str
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
341 @param value the value to be set
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
342 @type Any
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
343 """
7
9a98f7260372 Modified the application execution dialog to allow the selection of a working directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
344 Preferences.Prefs.settings.setValue(self.PreferencesKey + "/" + key, value)
1
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
345
52
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
346 ############################################################################
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
347 ## Methods for backward compatibility with eric-ide < 24.9
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
348 ############################################################################
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
349
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
350 def __activateLeftRightSidebarWidget(self, widget):
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
351 """
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
352 Private method to activate the given widget in the left or right
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
353 sidebar.
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
354
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
355 @param widget reference to the widget to be activated
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
356 @type QWidget
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
357 """
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
358 # This is for backward compatibility with eric-ide < 24.9.
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
359 sidebar = (
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
360 self.__ui.leftSidebar
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
361 if Preferences.getUI("CombinedLeftRightSidebar")
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
362 else self.__ui.rightSidebar
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
363 )
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
364 sidebar.show()
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
365 sidebar.setCurrentWidget(widget)
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
366
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
367 def __setLeftRightSidebarWidgetIcon(self, widget, icon):
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
368 """
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
369 Private method to set the icon of the given widget in the left or right
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
370 sidebar.
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
371
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
372 @param widget reference to the widget to set the icon for
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
373 @type QWidget
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
374 @param icon icon to be set
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
375 @type QIcon
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
376 """
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
377 sidebar = (
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
378 self.__ui.leftSidebar
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
379 if Preferences.getUI("CombinedLeftRightSidebar")
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
380 else self.__ui.rightSidebar
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
381 )
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
382 index = sidebar.indexOf(widget)
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
383 sidebar.setTabIcon(index, icon)
d9792a2b46fd Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
384
1
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
385
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
386 def installDependencies(pipInstall):
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
387 """
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
388 Function to install dependencies of this plug-in.
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
389
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
390 @param pipInstall function to be called with a list of package names.
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
391 @type function
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
392 """
31
17e37d4ebe42 Changed the upgrade actions to first check for running applications of packages to be upgraded because this situation causes issues during the upgrade.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 29
diff changeset
393 packagesToInstall = []
17e37d4ebe42 Changed the upgrade actions to first check for running applications of packages to be upgraded because this situation causes issues during the upgrade.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 29
diff changeset
394 if importlib.util.find_spec("pipx") is None:
17e37d4ebe42 Changed the upgrade actions to first check for running applications of packages to be upgraded because this situation causes issues during the upgrade.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 29
diff changeset
395 packagesToInstall.append("pipx>=1.5.0")
17e37d4ebe42 Changed the upgrade actions to first check for running applications of packages to be upgraded because this situation causes issues during the upgrade.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 29
diff changeset
396 if importlib.util.find_spec("psutil") is None:
17e37d4ebe42 Changed the upgrade actions to first check for running applications of packages to be upgraded because this situation causes issues during the upgrade.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 29
diff changeset
397 packagesToInstall.append("psutil")
17e37d4ebe42 Changed the upgrade actions to first check for running applications of packages to be upgraded because this situation causes issues during the upgrade.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 29
diff changeset
398
17e37d4ebe42 Changed the upgrade actions to first check for running applications of packages to be upgraded because this situation causes issues during the upgrade.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 29
diff changeset
399 if packagesToInstall:
17e37d4ebe42 Changed the upgrade actions to first check for running applications of packages to be upgraded because this situation causes issues during the upgrade.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 29
diff changeset
400 pipInstall(packagesToInstall)
1
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
401
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
402
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
403 #
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
404 # eflag: noqa = M801, U200

eric ide

mercurial