PluginPipxInterface.py

changeset 52
d9792a2b46fd
parent 49
ec976c5b88ae
child 56
2284c6696655
equal deleted inserted replaced
51:0143a56b2831 52:d9792a2b46fd
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.3.0", 39 "version": "10.3.1",
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"
255 255
256 if uiLayoutType == "Toolboxes": 256 if uiLayoutType == "Toolboxes":
257 self.__ui.rToolboxDock.show() 257 self.__ui.rToolboxDock.show()
258 self.__ui.rToolbox.setCurrentWidget(self.__widget) 258 self.__ui.rToolbox.setCurrentWidget(self.__widget)
259 elif uiLayoutType == "Sidebars": 259 elif uiLayoutType == "Sidebars":
260 self.__ui.rightSidebar.show() 260 try:
261 self.__ui.rightSidebar.setCurrentWidget(self.__widget) 261 self.__ui.activateLeftRightSidebarWidget(self.__widget)
262 except AttributeError:
263 self.__activateLeftRightSidebarWidget(self.__widget)
262 else: 264 else:
263 self.__widget.show() 265 self.__widget.show()
264 self.__widget.setFocus(Qt.FocusReason.ActiveWindowFocusReason) 266 self.__widget.setFocus(Qt.FocusReason.ActiveWindowFocusReason)
265 267
266 def setOutdatedIndicator(self, outdated): 268 def setOutdatedIndicator(self, outdated):
281 os.path.join("PipxInterface", "icons", iconName) 283 os.path.join("PipxInterface", "icons", iconName)
282 ), 284 ),
283 ) 285 )
284 elif uiLayoutType == "Sidebars": 286 elif uiLayoutType == "Sidebars":
285 iconName = "pipxOutdated96" if outdated else "pipx96" 287 iconName = "pipxOutdated96" if outdated else "pipx96"
286 index = self.__ui.rightSidebar.indexOf(self.__widget) 288 try:
287 self.__ui.rightSidebar.setTabIcon( 289 self.__ui.setLeftRightSidebarWidgetIcon(
288 index, 290 self.__widget,
289 EricPixmapCache.getIcon( 291 EricPixmapCache.getIcon(
290 os.path.join("PipxInterface", "icons", iconName) 292 os.path.join("PipxInterface", "icons", iconName)
291 ), 293 ),
292 ) 294 )
295 except AttributeError:
296 self.__setLeftRightSidebarWidgetIcon(
297 self.__widget,
298 EricPixmapCache.getIcon(
299 os.path.join("PipxInterface", "icons", iconName)
300 ),
301 )
293 302
294 def getPreferences(self, key): 303 def getPreferences(self, key):
295 """ 304 """
296 Public method to retrieve the various settings values. 305 Public method to retrieve the various settings values.
297 306
333 @type str 342 @type str
334 @param value the value to be set 343 @param value the value to be set
335 @type Any 344 @type Any
336 """ 345 """
337 Preferences.Prefs.settings.setValue(self.PreferencesKey + "/" + key, value) 346 Preferences.Prefs.settings.setValue(self.PreferencesKey + "/" + key, value)
347
348 ############################################################################
349 ## Methods for backward compatibility with eric-ide < 24.9
350 ############################################################################
351
352 def __activateLeftRightSidebarWidget(self, widget):
353 """
354 Private method to activate the given widget in the left or right
355 sidebar.
356
357 @param widget reference to the widget to be activated
358 @type QWidget
359 """
360 # This is for backward compatibility with eric-ide < 24.9.
361 sidebar = (
362 self.__ui.leftSidebar
363 if Preferences.getUI("CombinedLeftRightSidebar")
364 else self.__ui.rightSidebar
365 )
366 sidebar.show()
367 sidebar.setCurrentWidget(widget)
368
369 def __setLeftRightSidebarWidgetIcon(self, widget, icon):
370 """
371 Private method to set the icon of the given widget in the left or right
372 sidebar.
373
374 @param widget reference to the widget to set the icon for
375 @type QWidget
376 @param icon icon to be set
377 @type QIcon
378 """
379 sidebar = (
380 self.__ui.leftSidebar
381 if Preferences.getUI("CombinedLeftRightSidebar")
382 else self.__ui.rightSidebar
383 )
384 index = sidebar.indexOf(widget)
385 sidebar.setTabIcon(index, icon)
338 386
339 387
340 def installDependencies(pipInstall): 388 def installDependencies(pipInstall):
341 """ 389 """
342 Function to install dependencies of this plug-in. 390 Function to install dependencies of this plug-in.

eric ide

mercurial