eric6/PluginManager/PluginRepositoryDialog.py

changeset 8143
2c730d5fd177
parent 7960
e8fc383322f7
child 8218
7c09585bd960
--- a/eric6/PluginManager/PluginRepositoryDialog.py	Mon Mar 01 17:48:43 2021 +0100
+++ b/eric6/PluginManager/PluginRepositoryDialog.py	Tue Mar 02 17:17:09 2021 +0100
@@ -56,10 +56,10 @@
     """
     closeAndInstall = pyqtSignal()
     
-    DescrRole = Qt.UserRole
-    UrlRole = Qt.UserRole + 1
-    FilenameRole = Qt.UserRole + 2
-    AuthorRole = Qt.UserRole + 3
+    DescrRole = Qt.ItemDataRole.UserRole
+    UrlRole = Qt.ItemDataRole.UserRole + 1
+    FilenameRole = Qt.ItemDataRole.UserRole + 2
+    AuthorRole = Qt.ItemDataRole.UserRole + 3
 
     PluginStatusUpToDate = 0
     PluginStatusNew = 1
@@ -89,21 +89,23 @@
             self.__external = False
         
         self.__updateButton = self.buttonBox.addButton(
-            self.tr("Update"), QDialogButtonBox.ActionRole)
+            self.tr("Update"), QDialogButtonBox.ButtonRole.ActionRole)
         self.__downloadButton = self.buttonBox.addButton(
-            self.tr("Download"), QDialogButtonBox.ActionRole)
+            self.tr("Download"), QDialogButtonBox.ButtonRole.ActionRole)
         self.__downloadButton.setEnabled(False)
         self.__downloadInstallButton = self.buttonBox.addButton(
             self.tr("Download && Install"),
-            QDialogButtonBox.ActionRole)
+            QDialogButtonBox.ButtonRole.ActionRole)
         self.__downloadInstallButton.setEnabled(False)
         self.__downloadCancelButton = self.buttonBox.addButton(
-            self.tr("Cancel"), QDialogButtonBox.ActionRole)
+            self.tr("Cancel"), QDialogButtonBox.ButtonRole.ActionRole)
         self.__downloadCancelButton.setEnabled(False)
         self.__installButton = self.buttonBox.addButton(
-            self.tr("Close && Install"), QDialogButtonBox.ActionRole)
+            self.tr("Close && Install"),
+            QDialogButtonBox.ButtonRole.ActionRole)
         self.__installButton.setEnabled(False)
-        self.__closeButton = self.buttonBox.button(QDialogButtonBox.Close)
+        self.__closeButton = self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Close)
         self.__closeButton.setEnabled(True)
         
         self.repositoryUrlEdit.setText(
@@ -111,7 +113,8 @@
         
         self.repositoryList.headerItem().setText(
             self.repositoryList.columnCount(), "")
-        self.repositoryList.header().setSortIndicator(0, Qt.AscendingOrder)
+        self.repositoryList.header().setSortIndicator(
+            0, Qt.SortOrder.AscendingOrder)
         
         self.__pluginContextMenu = QMenu(self)
         self.__hideAct = self.__pluginContextMenu.addAction(
@@ -393,7 +396,7 @@
         if os.path.exists(self.pluginRepositoryFile):
             self.__repositoryMissing = False
             f = QFile(self.pluginRepositoryFile)
-            if f.open(QIODevice.ReadOnly):
+            if f.open(QIODevice.OpenModeFlag.ReadOnly):
                 from E5XML.PluginRepositoryReader import PluginRepositoryReader
                 reader = PluginRepositoryReader(f, self.addEntry)
                 reader.readXML()
@@ -451,8 +454,9 @@
         self.statusLabel.setText(url)
         
         request = QNetworkRequest(QUrl(url))
-        request.setAttribute(QNetworkRequest.CacheLoadControlAttribute,
-                             QNetworkRequest.AlwaysNetwork)
+        request.setAttribute(
+            QNetworkRequest.Attribute.CacheLoadControlAttribute,
+            QNetworkRequest.CacheLoadControl.AlwaysNetwork)
         reply = self.__networkManager.get(request)
         reply.finished.connect(
             lambda: self.__downloadFileDone(reply, filename, doneMethod))
@@ -478,9 +482,12 @@
         ok = True
         if reply in self.__replies:
             self.__replies.remove(reply)
-        if reply.error() != QNetworkReply.NoError:
+        if reply.error() != QNetworkReply.NetworkError.NoError:
             ok = False
-            if reply.error() != QNetworkReply.OperationCanceledError:
+            if (
+                reply.error() !=
+                QNetworkReply.NetworkError.OperationCanceledError
+            ):
                 E5MessageBox.warning(
                     self,
                     self.tr("Error downloading file"),
@@ -503,7 +510,7 @@
             return
         
         downloadIODevice = QFile(fileName + ".tmp")
-        downloadIODevice.open(QIODevice.WriteOnly)
+        downloadIODevice.open(QIODevice.OpenModeFlag.WriteOnly)
         # read data in chunks
         chunkSize = 64 * 1024 * 1024
         while True:
@@ -810,7 +817,7 @@
         """
         Private slot to handle the closeAndInstall signal.
         """
-        self.done(QDialog.Accepted + 1)
+        self.done(QDialog.DialogCode.Accepted + 1)
     
     def getDownloadedPlugins(self):
         """
@@ -963,7 +970,7 @@
                                         "PluginRepository")
     if os.path.exists(pluginRepositoryFile):
         f = QFile(pluginRepositoryFile)
-        if f.open(QIODevice.ReadOnly):
+        if f.open(QIODevice.OpenModeFlag.ReadOnly):
             from E5XML.PluginRepositoryReader import PluginRepositoryReader
             reader = PluginRepositoryReader(f, registerPlugin)
             reader.readXML()

eric ide

mercurial