PluginPipxInterface.py

Thu, 01 Aug 2024 11:09:54 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Thu, 01 Aug 2024 11:09:54 +0200
changeset 52
d9792a2b46fd
parent 49
ec976c5b88ae
child 56
2284c6696655
permissions
-rw-r--r--

Fixed an issue causing an exception on computers with a small screen or when the `Combined Sidebars` option is selected.

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,
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
39 "version": "10.3.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
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
88 def createPipxPage(
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
89 _configDlg,
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
90 ):
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 Module function to create the autocompletion configuration page.
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
93
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
94 @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
95 @type ConfigurationWidget
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
96 @return reference to the configuration page
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
97 @rtype AutoCompletionRopePage
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
98 """
15
2fb8d19c38ae Corrected some code style and formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
99 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
100
1
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
101 global pipxInterfacePluginObject
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
102
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
103 page = PipxPage(pipxInterfacePluginObject)
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
104 return page
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
105
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 def getConfigData():
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 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
110
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
111 @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
112 @rtype dict
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
113 """
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
114 return {
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
115 "pipxPage": [
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
116 QCoreApplication.translate(
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
117 "PluginPipxInterface", "Python Application Management"
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
118 ),
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
119 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
120 createPipxPage,
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
121 None,
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
122 None,
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
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 def prepareUninstall():
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 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
130 """
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
131 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
132
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 PluginPipxInterface(QObject):
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 Class documentation goes here.
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
137 """
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 PreferencesKey = "Pipx"
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 def __init__(self, ui):
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 Constructor
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
144
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
145 @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
146 @type UI.UserInterface
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
147 """
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
148 super().__init__(ui)
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
149 self.__ui = ui
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
150 self.__initialize()
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
151
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
152 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
153 "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
154 "MaxRecentAppWorkdirs": 20,
32
b7a3ae7519ba - Implemented some enhancements related to indicating outdated packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 31
diff changeset
155 "IncludeOutdatedDependencies": True,
b7a3ae7519ba - Implemented some enhancements related to indicating outdated packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 31
diff changeset
156 "AutoCheckOutdated": False,
1
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
157 }
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
158
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
159 self.__translator = None
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
160 self.__loadTranslator()
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 def __initialize(self):
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 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
165 """
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
166 self.__widget = None
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 def activate(self):
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 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
171
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
172 @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
173 @rtype bool
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
174 """
15
2fb8d19c38ae Corrected some code style and formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
175 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
176
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 global error, pipxInterfacePluginObject
1
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
178 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
179 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
180
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.__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
182 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
183 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
184 _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
185 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
186 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
187 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
188 )
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
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.__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
191 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
192 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
193 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
194 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
195 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
196 "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
197 )
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 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
199 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
200 )
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 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
202 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
203 """<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
204 """<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
205 """ 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
206 )
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.__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
209
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 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
211 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
212 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
213
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 """
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
220 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
221 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
222 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
223 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
224
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.__initialize()
1
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 def __loadTranslator(self):
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 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
230 """
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
231 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
232 loc = self.__ui.getLocale()
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
233 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
234 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
235 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
236 )
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
237 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
238 translator = QTranslator(None)
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
239 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
240 if loaded:
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
241 self.__translator = translator
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
242 ericApp().installTranslator(self.__translator)
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
243 else:
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
244 print(
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
245 "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
246 " loaded.".format(translation)
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
247 )
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
248 print("Using default.")
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
249
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
250 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
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 Private slot to handle the activation of the MQTT Monitor.
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 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
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 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
257 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
258 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
259 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
260 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
261 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
262 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
263 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
264 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
265 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
266 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
267
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
268 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
269 """
44
e5e923c6a6db Corrected some code style and formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
270 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
271
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 @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
273 @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
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 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
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 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
278 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
279 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
280 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
281 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
282 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
283 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
284 ),
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
285 )
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
286 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
287 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
288 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
289 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
290 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
291 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
292 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
293 ),
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 )
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 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
296 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
297 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
298 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
299 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
300 ),
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 )
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
302
1
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
303 def getPreferences(self, key):
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 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
306
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
307 @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
308 @type str
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
309 @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
310 @rtype Any
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
311 """
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
312 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
313 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
314 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
315 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
316 )
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 )
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 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
319 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
320 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
321 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
322 )
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 )
32
b7a3ae7519ba - Implemented some enhancements related to indicating outdated packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 31
diff changeset
324 elif key in ("IncludeOutdatedDependencies", "AutoCheckOutdated"):
b7a3ae7519ba - Implemented some enhancements related to indicating outdated packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 31
diff changeset
325 return Globals.toBool(
b7a3ae7519ba - Implemented some enhancements related to indicating outdated packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 31
diff changeset
326 Preferences.Prefs.settings.value(
36
5b9bc68ef028 bug fixes
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
327 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
328 )
b7a3ae7519ba - Implemented some enhancements related to indicating outdated packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 31
diff changeset
329 )
b7a3ae7519ba - Implemented some enhancements related to indicating outdated packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 31
diff changeset
330 else:
b7a3ae7519ba - Implemented some enhancements related to indicating outdated packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 31
diff changeset
331 return Preferences.Prefs.settings.value(
36
5b9bc68ef028 bug fixes
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
332 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
333 )
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
334
1
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
335 return None
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 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
338 """
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
339 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
340
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
341 @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
342 @type str
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
343 @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
344 @type Any
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
345 """
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
346 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
347
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
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 ## 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
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
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 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
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 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
355 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
356
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 @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
358 @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
359 """
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 # 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
361 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
362 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
363 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
364 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
365 )
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 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
367 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
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 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
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 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
372 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
373
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 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
375 @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
376 @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
377 @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
378 """
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 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
380 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
381 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
382 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
383 )
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 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
385 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
386
1
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 def installDependencies(pipInstall):
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 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
391
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
392 @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
393 @type function
d83409a59365 Implemented the basic skeleton for the pipx Interface plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
394 """
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
395 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
396 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
397 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
398 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
399 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
400
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 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
402 pipInstall(packagesToInstall)
1
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
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 # eflag: noqa = M801, U200

eric ide

mercurial