PluginPipxInterface.py

changeset 83
d841c572a465
parent 81
b6280afecc83
child 88
1e8e507ee860
equal deleted inserted replaced
82:417d6480e11e 83:d841c572a465
9 9
10 import importlib.util 10 import importlib.util
11 import os 11 import os
12 import sysconfig 12 import sysconfig
13 13
14 from PyQt6.QtCore import QCoreApplication, QObject, Qt, QTranslator 14 from PyQt6.QtCore import QCoreApplication, QObject, Qt, QTranslator, pyqtSignal
15 from PyQt6.QtGui import QKeySequence 15 from PyQt6.QtGui import QKeySequence
16 16
17 from eric7 import Globals, Preferences 17 from eric7 import Globals, Preferences
18 from eric7.EricGui import EricPixmapCache 18 from eric7.EricGui import EricPixmapCache
19 from eric7.EricGui.EricAction import EricAction 19 from eric7.EricGui.EricAction import EricAction
34 __header__ = { 34 __header__ = {
35 "name": "pipx Interface", 35 "name": "pipx Interface",
36 "author": "Detlev Offenbach <detlev@die-offenbachs.de>", 36 "author": "Detlev Offenbach <detlev@die-offenbachs.de>",
37 "autoactivate": True, 37 "autoactivate": True,
38 "deactivateable": True, 38 "deactivateable": True,
39 "version": "10.4.1", 39 "version": "10.5.0",
40 "className": "PluginPipxInterface", 40 "className": "PluginPipxInterface",
41 "packageName": "PipxInterface", 41 "packageName": "PipxInterface",
42 "shortDescription": "Graphical interface to the 'pipx' command.", 42 "shortDescription": "Graphical interface to the 'pipx' command.",
43 "longDescription": ( 43 "longDescription": (
44 "Plugin implementing widgets and dialogues to interact with the various pipx" 44 "Plugin implementing widgets and dialogues to interact with the various pipx"
130 130
131 131
132 class PluginPipxInterface(QObject): 132 class PluginPipxInterface(QObject):
133 """ 133 """
134 Class documentation goes here. 134 Class documentation goes here.
135
136 @signal preferencesChanged() emitted to signal a change of preferences. This
137 signal is simply relayed from the main UI.
135 """ 138 """
136 139
137 PreferencesKey = "Pipx" 140 PreferencesKey = "Pipx"
141
142 preferencesChanged = pyqtSignal()
138 143
139 def __init__(self, ui): 144 def __init__(self, ui):
140 """ 145 """
141 Constructor 146 Constructor
142 147
150 self.__defaults = { 155 self.__defaults = {
151 "RecentAppWorkdirs": [], 156 "RecentAppWorkdirs": [],
152 "MaxRecentAppWorkdirs": 20, 157 "MaxRecentAppWorkdirs": 20,
153 "IncludeOutdatedDependencies": True, 158 "IncludeOutdatedDependencies": True,
154 "AutoCheckOutdated": False, 159 "AutoCheckOutdated": False,
160 "PeriodicOutdatedCheckInterval": 1,
161 # interval in hours, 0 = disable; 1 h <= value <= 24 h
155 } 162 }
156 163
157 self.__translator = None 164 self.__translator = None
158 self.__loadTranslator() 165 self.__loadTranslator()
159 166
208 self.__ui.addEricActions([self.__activateAct], "ui") 215 self.__ui.addEricActions([self.__activateAct], "ui")
209 menu = self.__ui.getMenu("subwindow") 216 menu = self.__ui.getMenu("subwindow")
210 menu.addAction(self.__activateAct) 217 menu.addAction(self.__activateAct)
211 218
212 ericApp().getObject("PluginManager").shutdown.connect(self.__widget.shutdown) 219 ericApp().getObject("PluginManager").shutdown.connect(self.__widget.shutdown)
220 self.__ui.preferencesChanged.connect(self.preferencesChanged)
213 221
214 return None, True 222 return None, True
215 223
216 def deactivate(self): 224 def deactivate(self):
217 """ 225 """
218 Public method to deactivate this plug-in. 226 Public method to deactivate this plug-in.
219 """ 227 """
228 self.__ui.preferencesChanged.disconnect(self.preferencesChanged)
220 ericApp().getObject("PluginManager").shutdown.disconnect(self.__widget.shutdown) 229 ericApp().getObject("PluginManager").shutdown.disconnect(self.__widget.shutdown)
221 230
222 menu = self.__ui.getMenu("subwindow") 231 menu = self.__ui.getMenu("subwindow")
223 menu.removeAction(self.__activateAct) 232 menu.removeAction(self.__activateAct)
224 self.__ui.removeEricActions([self.__activateAct], "ui") 233 self.__ui.removeEricActions([self.__activateAct], "ui")
315 return Globals.toList( 324 return Globals.toList(
316 Preferences.Prefs.settings.value( 325 Preferences.Prefs.settings.value(
317 self.PreferencesKey + "/" + key, self.__defaults[key] 326 self.PreferencesKey + "/" + key, self.__defaults[key]
318 ) 327 )
319 ) 328 )
320 elif key in ("MaxRecentAppWorkdirs",): 329 elif key in ("MaxRecentAppWorkdirs", "PeriodicOutdatedCheckInterval"):
321 return int( 330 return int(
322 Preferences.Prefs.settings.value( 331 Preferences.Prefs.settings.value(
323 self.PreferencesKey + "/" + key, self.__defaults[key] 332 self.PreferencesKey + "/" + key, self.__defaults[key]
324 ) 333 )
325 ) 334 )

eric ide

mercurial