PluginPipxInterface.py

Sun, 15 Sep 2024 17:10:27 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 15 Sep 2024 17:10:27 +0200
changeset 81
b6280afecc83
parent 78
5efcdee9c170
child 83
d841c572a465
permissions
-rw-r--r--

Added code to kill running async processes when shutting down the eric IDE.

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,
81
b6280afecc83 Added code to kill running async processes when shutting down the eric IDE.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 78
diff changeset
39 "version": "10.4.1",
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
81
b6280afecc83 Added code to kill running async processes when shutting down the eric IDE.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 78
diff changeset
212 ericApp().getObject("PluginManager").shutdown.connect(self.__widget.shutdown)
b6280afecc83 Added code to kill running async processes when shutting down the eric IDE.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 78
diff changeset
213
1
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
214 return None, True
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 def deactivate(self):
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
217 """
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
218 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
219 """
81
b6280afecc83 Added code to kill running async processes when shutting down the eric IDE.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 78
diff changeset
220 ericApp().getObject("PluginManager").shutdown.disconnect(self.__widget.shutdown)
b6280afecc83 Added code to kill running async processes when shutting down the eric IDE.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 78
diff changeset
221
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
222 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
223 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
224 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
225 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
226
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
227 self.__initialize()
1
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 def __loadTranslator(self):
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
230 """
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
231 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
232 """
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
233 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
234 loc = self.__ui.getLocale()
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
235 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
236 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
237 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
238 )
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
239 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
240 translator = QTranslator(None)
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
241 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
242 if loaded:
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
243 self.__translator = translator
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
244 ericApp().installTranslator(self.__translator)
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
245 else:
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
246 print(
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
247 "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
248 " loaded.".format(translation)
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
249 )
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
250 print("Using default.")
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
251
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
252 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
253 """
58
14c5df20f271 Corrected a documentation typo.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 56
diff changeset
254 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
255 """
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 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
257
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
258 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
259 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
260 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
261 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
262 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
263 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
264 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
265 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
266 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
267 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
268 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
269
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
270 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
271 """
44
e5e923c6a6db Corrected some code style and formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
272 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
273
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 @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
275 @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
276 """
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 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
278
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 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
280 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
281 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
282 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
283 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
284 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
285 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
286 ),
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
287 )
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
288 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
289 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
290 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
291 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
292 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
293 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
294 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
295 ),
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 )
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 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
298 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
299 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
300 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
301 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
302 ),
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
303 )
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
304
1
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
305 def getPreferences(self, key):
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
306 """
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
307 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
308
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
309 @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
310 @type str
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
311 @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
312 @rtype Any
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
313 """
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
314 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
315 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
316 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
317 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
318 )
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 )
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 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
321 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
322 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
323 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
324 )
9a98f7260372 Modified the application execution dialog to allow the selection of a working directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
325 )
32
b7a3ae7519ba - Implemented some enhancements related to indicating outdated packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 31
diff changeset
326 elif key in ("IncludeOutdatedDependencies", "AutoCheckOutdated"):
b7a3ae7519ba - Implemented some enhancements related to indicating outdated packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 31
diff changeset
327 return Globals.toBool(
b7a3ae7519ba - Implemented some enhancements related to indicating outdated packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 31
diff changeset
328 Preferences.Prefs.settings.value(
36
5b9bc68ef028 bug fixes
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
329 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
330 )
b7a3ae7519ba - Implemented some enhancements related to indicating outdated packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 31
diff changeset
331 )
b7a3ae7519ba - Implemented some enhancements related to indicating outdated packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 31
diff changeset
332 else:
b7a3ae7519ba - Implemented some enhancements related to indicating outdated packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 31
diff changeset
333 return Preferences.Prefs.settings.value(
36
5b9bc68ef028 bug fixes
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
334 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
335 )
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
336
1
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
337 return None
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 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
340 """
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
341 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
342
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
343 @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
344 @type str
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
345 @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
346 @type Any
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
347 """
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
348 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
349
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
350 ############################################################################
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 ## 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
352 ############################################################################
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
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 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
355 """
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 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
357 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
358
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 @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
360 @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
361 """
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 # 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
363 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
364 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
365 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
366 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
367 )
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 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
369 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
370
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 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
372 """
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 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
374 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
375
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 @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
377 @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
378 @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
379 @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
380 """
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 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
382 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
383 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
384 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
385 )
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
386 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
387 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
388
1
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 def installDependencies(pipInstall):
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
391 """
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
392 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
393
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
394 @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
395 @type function
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
396 """
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
397 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
398 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
399 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
400 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
401 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
402
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
403 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
404 pipInstall(packagesToInstall)
1
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
405
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
406
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
407 #
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
408 # eflag: noqa = M801, U200

eric ide

mercurial