61 been activated |
61 been activated |
62 @signal pluginAboutToBeDeactivated(moduleName, pluginObject) emitted just |
62 @signal pluginAboutToBeDeactivated(moduleName, pluginObject) emitted just |
63 before a plugin is deactivated |
63 before a plugin is deactivated |
64 @signal pluginDeactivated(moduleName, pluginObject) emitted just after |
64 @signal pluginDeactivated(moduleName, pluginObject) emitted just after |
65 a plugin was deactivated |
65 a plugin was deactivated |
|
66 @signal pluginRepositoryFileDownloaded() emitted to indicate a completed |
|
67 download of the plugin repository file |
66 """ |
68 """ |
67 shutdown = pyqtSignal() |
69 shutdown = pyqtSignal() |
68 pluginAboutToBeActivated = pyqtSignal(str, object) |
70 pluginAboutToBeActivated = pyqtSignal(str, object) |
69 pluginActivated = pyqtSignal(str, object) |
71 pluginActivated = pyqtSignal(str, object) |
70 allPlugginsActivated = pyqtSignal() |
72 allPlugginsActivated = pyqtSignal() |
71 pluginAboutToBeDeactivated = pyqtSignal(str, object) |
73 pluginAboutToBeDeactivated = pyqtSignal(str, object) |
72 pluginDeactivated = pyqtSignal(str, object) |
74 pluginDeactivated = pyqtSignal(str, object) |
|
75 pluginRepositoryFileDownloaded = pyqtSignal() |
73 |
76 |
74 def __init__(self, parent=None, disabledPlugins=None, doLoadPlugins=True, |
77 def __init__(self, parent=None, disabledPlugins=None, doLoadPlugins=True, |
75 develPlugin=None): |
78 develPlugin=None): |
76 """ |
79 """ |
77 Constructor |
80 Constructor |
1229 def checkPluginUpdatesAvailable(self): |
1232 def checkPluginUpdatesAvailable(self): |
1230 """ |
1233 """ |
1231 Public method to check the availability of updates of plug-ins. |
1234 Public method to check the availability of updates of plug-ins. |
1232 """ |
1235 """ |
1233 period = Preferences.getPluginManager("UpdatesCheckInterval") |
1236 period = Preferences.getPluginManager("UpdatesCheckInterval") |
|
1237 # 0 = off |
|
1238 # 1 = daily |
|
1239 # 2 = weekly |
|
1240 # 3 = monthly |
|
1241 # 4 = always |
|
1242 |
1234 if period == 0 or not self.__ui.isOnline(): |
1243 if period == 0 or not self.__ui.isOnline(): |
1235 return |
1244 return |
|
1245 |
1236 elif period in [1, 2, 3]: |
1246 elif period in [1, 2, 3]: |
1237 lastModified = QFileInfo(self.pluginRepositoryFile).lastModified() |
1247 lastModified = QFileInfo(self.pluginRepositoryFile).lastModified() |
1238 if lastModified.isValid() and lastModified.date().isValid(): |
1248 if lastModified.isValid() and lastModified.date().isValid(): |
1239 lastModifiedDate = lastModified.date() |
1249 lastModifiedDate = lastModified.date() |
1240 now = QDate.currentDate() |
1250 now = QDate.currentDate() |
1245 lastModifiedDate.daysInMonth())) |
1255 lastModifiedDate.daysInMonth())) |
1246 ): |
1256 ): |
1247 # daily, weekly, monthly |
1257 # daily, weekly, monthly |
1248 return |
1258 return |
1249 |
1259 |
|
1260 self.downLoadRepositoryFile() |
|
1261 |
|
1262 def downLoadRepositoryFile(self, url=None): |
|
1263 """ |
|
1264 Public method to download the plugin repository file. |
|
1265 |
|
1266 @param url URL to get the plugin repository file from |
|
1267 (defaults to None) |
|
1268 @type QUrl or str (optional) |
|
1269 """ |
1250 self.__updateAvailable = False |
1270 self.__updateAvailable = False |
1251 |
1271 |
1252 request = QNetworkRequest( |
1272 if url is None: |
1253 QUrl(Preferences.getUI("PluginRepositoryUrl7"))) |
1273 url = Preferences.getUI("PluginRepositoryUrl7") |
|
1274 request = QNetworkRequest(QUrl(url)) |
1254 request.setAttribute( |
1275 request.setAttribute( |
1255 QNetworkRequest.Attribute.CacheLoadControlAttribute, |
1276 QNetworkRequest.Attribute.CacheLoadControlAttribute, |
1256 QNetworkRequest.CacheLoadControl.AlwaysNetwork) |
1277 QNetworkRequest.CacheLoadControl.AlwaysNetwork) |
1257 reply = self.__networkManager.get(request) |
1278 reply = self.__networkManager.get(request) |
1258 reply.finished.connect( |
1279 reply.finished.connect( |
1308 self.checkPluginUpdatesAvailable() |
1329 self.checkPluginUpdatesAvailable() |
1309 return |
1330 return |
1310 |
1331 |
1311 if self.__updateAvailable: |
1332 if self.__updateAvailable: |
1312 self.__ui.activatePluginRepositoryViewer() |
1333 self.__ui.activatePluginRepositoryViewer() |
|
1334 else: |
|
1335 self.pluginRepositoryFileDownloaded.emit() |
1313 |
1336 |
1314 def checkPluginEntry(self, name, short, description, url, author, version, |
1337 def checkPluginEntry(self, name, short, description, url, author, version, |
1315 filename, status): |
1338 filename, status): |
1316 """ |
1339 """ |
1317 Public method to check a plug-in's data for an update. |
1340 Public method to check a plug-in's data for an update. |