[Plugin installer][needs-docs] Display an icon rather than a text in the status bar when new a plugin or plugin upgrade is available

This commit is contained in:
Borys Jurgiel 2017-12-26 21:22:37 +01:00
parent 9fb386ac60
commit 3a52412c20

View File

@ -150,19 +150,23 @@ class QgsPluginInstaller(QObject):
# look for news in the repositories
plugins.markNews()
status = ""
icon = ""
# first check for news
for key in plugins.all():
if plugins.all()[key]["status"] == "new":
status = self.tr("There is a new plugin available")
icon = "plugin-new.svg"
tabIndex = 4 # PLUGMAN_TAB_NEW
# then check for updates (and eventually overwrite status)
for key in plugins.all():
if plugins.all()[key]["status"] == "upgradeable":
status = self.tr("There is a plugin update available")
icon = "plugin-upgrade.svg"
tabIndex = 3 # PLUGMAN_TAB_UPGRADEABLE
# finally set the notify label
if status:
self.statusLabel.setText(u' <a href="%d">%s</a> ' % (tabIndex, status))
self.statusLabel.setText(u'<a href="%d"><img src="qrc:/images/themes/default/propertyicons/%s"></a>' % (tabIndex, icon))
self.statusLabel.setToolTip(status)
else:
iface.mainWindow().statusBar().removeWidget(self.statusLabel)
self.statusLabel = None