Skip to content

Commit

Permalink
Merge pull request #5952 from borysiasty/plugin-notification
Browse files Browse the repository at this point in the history
[Plugin installer][needs-docs] Display notifications as an icon rather than a text
  • Loading branch information
borysiasty committed Dec 28, 2017
2 parents a650a03 + 671b772 commit 4783af6
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
2 changes: 2 additions & 0 deletions images/images.qrc
Expand Up @@ -458,6 +458,8 @@
<file>themes/default/pin.svg</file>
<file>themes/default/pluginExperimental.png</file>
<file>themes/default/pluginDeprecated.png</file>
<file>themes/default/pluginNew.svg</file>
<file>themes/default/pluginUpgrade.svg</file>
<file>themes/default/propertyicons/action.svg</file>
<file>themes/default/propertyicons/attributes.png</file>
<file>themes/default/propertyicons/CRS.svg</file>
Expand Down
1 change: 1 addition & 0 deletions images/themes/default/pluginNew.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions images/themes/default/pluginUpgrade.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 7 additions & 3 deletions python/pyplugin_installer/installer.py
Expand Up @@ -71,8 +71,8 @@ def __init__(self):

if repositories.checkingOnStart() and repositories.timeForChecking() and repositories.allEnabled():
# start fetching repositories
self.statusLabel = QLabel(self.tr("Looking for new plugins...") + " ", iface.mainWindow().statusBar())
iface.mainWindow().statusBar().insertPermanentWidget(0, self.statusLabel)
self.statusLabel = QLabel(iface.mainWindow().statusBar())
iface.mainWindow().statusBar().addPermanentWidget(self.statusLabel)
self.statusLabel.linkActivated.connect(self.showPluginManagerWhenReady)
repositories.checkingDone.connect(self.checkingDone)
for key in repositories.allEnabled():
Expand Down Expand Up @@ -150,19 +150,23 @@ def checkingDone(self):
# 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 = "pluginNew.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 = "pluginUpgrade.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/%s"></a>' % (tabIndex, icon))
self.statusLabel.setToolTip(status)
else:
iface.mainWindow().statusBar().removeWidget(self.statusLabel)
self.statusLabel = None
Expand Down

0 comments on commit 4783af6

Please sign in to comment.