1269 |
1269 |
1270 self.__updateAvailable = False |
1270 self.__updateAvailable = False |
1271 |
1271 |
1272 request = QNetworkRequest( |
1272 request = QNetworkRequest( |
1273 QUrl(Preferences.getUI("PluginRepositoryUrl6"))) |
1273 QUrl(Preferences.getUI("PluginRepositoryUrl6"))) |
1274 request.setAttribute(QNetworkRequest.CacheLoadControlAttribute, |
1274 request.setAttribute( |
1275 QNetworkRequest.AlwaysNetwork) |
1275 QNetworkRequest.Attribute.CacheLoadControlAttribute, |
|
1276 QNetworkRequest.CacheLoadControl.AlwaysNetwork) |
1276 reply = self.__networkManager.get(request) |
1277 reply = self.__networkManager.get(request) |
1277 reply.finished.connect( |
1278 reply.finished.connect( |
1278 lambda: self.__downloadRepositoryFileDone(reply)) |
1279 lambda: self.__downloadRepositoryFileDone(reply)) |
1279 self.__replies.append(reply) |
1280 self.__replies.append(reply) |
1280 |
1281 |
1286 @type QNetworkReply |
1287 @type QNetworkReply |
1287 """ |
1288 """ |
1288 if reply in self.__replies: |
1289 if reply in self.__replies: |
1289 self.__replies.remove(reply) |
1290 self.__replies.remove(reply) |
1290 |
1291 |
1291 if reply.error() != QNetworkReply.NoError: |
1292 if reply.error() != QNetworkReply.NetworkError.NoError: |
1292 E5MessageBox.warning( |
1293 E5MessageBox.warning( |
1293 None, |
1294 None, |
1294 self.tr("Error downloading file"), |
1295 self.tr("Error downloading file"), |
1295 self.tr( |
1296 self.tr( |
1296 """<p>Could not download the requested file""" |
1297 """<p>Could not download the requested file""" |
1300 ) |
1301 ) |
1301 reply.deleteLater() |
1302 reply.deleteLater() |
1302 return |
1303 return |
1303 |
1304 |
1304 ioDevice = QFile(self.pluginRepositoryFile + ".tmp") |
1305 ioDevice = QFile(self.pluginRepositoryFile + ".tmp") |
1305 ioDevice.open(QIODevice.WriteOnly) |
1306 ioDevice.open(QIODevice.OpenModeFlag.WriteOnly) |
1306 ioDevice.write(reply.readAll()) |
1307 ioDevice.write(reply.readAll()) |
1307 ioDevice.close() |
1308 ioDevice.close() |
1308 if QFile.exists(self.pluginRepositoryFile): |
1309 if QFile.exists(self.pluginRepositoryFile): |
1309 QFile.remove(self.pluginRepositoryFile) |
1310 QFile.remove(self.pluginRepositoryFile) |
1310 ioDevice.rename(self.pluginRepositoryFile) |
1311 ioDevice.rename(self.pluginRepositoryFile) |
1311 reply.deleteLater() |
1312 reply.deleteLater() |
1312 |
1313 |
1313 if os.path.exists(self.pluginRepositoryFile): |
1314 if os.path.exists(self.pluginRepositoryFile): |
1314 f = QFile(self.pluginRepositoryFile) |
1315 f = QFile(self.pluginRepositoryFile) |
1315 if f.open(QIODevice.ReadOnly): |
1316 if f.open(QIODevice.OpenModeFlag.ReadOnly): |
1316 # save current URL |
1317 # save current URL |
1317 url = Preferences.getUI("PluginRepositoryUrl6") |
1318 url = Preferences.getUI("PluginRepositoryUrl6") |
1318 |
1319 |
1319 # read the repository file |
1320 # read the repository file |
1320 from E5XML.PluginRepositoryReader import PluginRepositoryReader |
1321 from E5XML.PluginRepositoryReader import PluginRepositoryReader |