|
43 | 43 | from qgis.PyQt.QtNetwork import QNetworkRequest
|
44 | 44 |
|
45 | 45 | import qgis
|
46 |
| -from qgis.core import Qgis, QgsApplication, QgsNetworkAccessManager, QgsSettings, QgsSettingsTree, QgsNetworkRequestParameters |
| 46 | +from qgis.core import Qgis, QgsApplication, QgsMessageLog, QgsNetworkAccessManager, QgsSettings, QgsSettingsTree, QgsNetworkRequestParameters |
47 | 47 | from qgis.gui import QgsMessageBar, QgsPasswordLineEdit, QgsHelp
|
48 | 48 | from qgis.utils import (iface, startPlugin, unloadPlugin, loadPlugin, OverrideCursor,
|
49 | 49 | reloadPlugin, updateAvailablePlugins, plugins_metadata_parser)
|
@@ -155,30 +155,30 @@ def checkingDone(self):
|
155 | 155 | plugins.rebuild()
|
156 | 156 | # look for news in the repositories
|
157 | 157 | plugins.markNews()
|
158 |
| - status = None |
159 | 158 | # then check for updates (and eventually overwrite status)
|
160 |
| - updatable_count = 0 |
161 |
| - updatable_plugin_name = None |
| 159 | + updatable_plugin_names = [] |
162 | 160 | for _, properties in plugins.all().items():
|
163 | 161 | if properties["status"] == "upgradeable":
|
164 |
| - updatable_count += 1 |
165 |
| - updatable_plugin_name = properties["name"] |
| 162 | + updatable_plugin_names.append(properties["name"]) |
166 | 163 |
|
167 |
| - if updatable_count: |
168 |
| - if updatable_count > 1: |
169 |
| - status = self.tr("Multiple plugin updates are available") |
170 |
| - else: |
171 |
| - status = self.tr("An update to the {} plugin is available").format(updatable_plugin_name) |
172 |
| - tabIndex = 3 # PLUGMAN_TAB_UPGRADEABLE |
173 |
| - |
174 |
| - # finally set the notify label |
175 |
| - if status: |
176 |
| - bar = iface.messageBar() |
177 |
| - self.message_bar_widget = bar.createMessage('', status) |
178 |
| - update_button = QPushButton("Install Updates…") |
179 |
| - update_button.pressed.connect(partial(self.showPluginManagerWhenReady, tabIndex)) |
180 |
| - self.message_bar_widget.layout().addWidget(update_button) |
181 |
| - bar.pushWidget(self.message_bar_widget, Qgis.Info) |
| 164 | + if not updatable_plugin_names: |
| 165 | + return |
| 166 | + |
| 167 | + if len(updatable_plugin_names) >= 2: |
| 168 | + status = self.tr("Multiple plugin updates are available") |
| 169 | + else: |
| 170 | + status = self.tr("An update to the {} plugin is available").format(updatable_plugin_names[0]) |
| 171 | + |
| 172 | + QgsMessageLog.logMessage( |
| 173 | + "Plugin update(s) available : {}".format(','.join(updatable_plugin_names)), self.tr("Plugins")) |
| 174 | + |
| 175 | + bar = iface.messageBar() |
| 176 | + self.message_bar_widget = bar.createMessage('', status) |
| 177 | + update_button = QPushButton(self.tr("Install Updates…")) |
| 178 | + tab_index = 3 # PLUGMAN_TAB_UPGRADEABLE |
| 179 | + update_button.pressed.connect(partial(self.showPluginManagerWhenReady, tab_index)) |
| 180 | + self.message_bar_widget.layout().addWidget(update_button) |
| 181 | + bar.pushWidget(self.message_bar_widget, Qgis.Info) |
182 | 182 |
|
183 | 183 | # ----------------------------------------- #
|
184 | 184 | def exportRepositoriesToManager(self):
|
|
0 commit comments