--- a/eric6/WebBrowser/SpellCheck/ManageDictionariesDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/SpellCheck/ManageDictionariesDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -32,10 +32,10 @@ """ Class implementing a dialog to install spell checking dictionaries. """ - FilenameRole = Qt.UserRole - UrlRole = Qt.UserRole + 1 - DocumentationDirRole = Qt.UserRole + 2 - LocalesRole = Qt.UserRole + 3 + FilenameRole = Qt.ItemDataRole.UserRole + UrlRole = Qt.ItemDataRole.UserRole + 1 + DocumentationDirRole = Qt.ItemDataRole.UserRole + 2 + LocalesRole = Qt.ItemDataRole.UserRole + 3 def __init__(self, writeableDirectories, parent=None): """ @@ -50,15 +50,17 @@ self.setupUi(self) self.__refreshButton = self.buttonBox.addButton( - self.tr("Refresh"), QDialogButtonBox.ActionRole) + self.tr("Refresh"), QDialogButtonBox.ButtonRole.ActionRole) self.__installButton = self.buttonBox.addButton( - self.tr("Install Selected"), QDialogButtonBox.ActionRole) + self.tr("Install Selected"), + QDialogButtonBox.ButtonRole.ActionRole) self.__installButton.setEnabled(False) self.__uninstallButton = self.buttonBox.addButton( - self.tr("Uninstall Selected"), QDialogButtonBox.ActionRole) + self.tr("Uninstall Selected"), + QDialogButtonBox.ButtonRole.ActionRole) self.__uninstallButton.setEnabled(False) self.__cancelButton = self.buttonBox.addButton( - self.tr("Cancel"), QDialogButtonBox.ActionRole) + self.tr("Cancel"), QDialogButtonBox.ButtonRole.ActionRole) self.__cancelButton.setEnabled(False) self.locationComboBox.addItems(writeableDirectories) @@ -104,7 +106,7 @@ self.locationComboBox.count() > 0 and len([itm for itm in self.dictionariesList.selectedItems() - if itm.checkState() == Qt.Checked + if itm.checkState() == Qt.CheckState.Checked ]) ) @@ -147,8 +149,9 @@ self.__downloadCancelled = False request = QNetworkRequest(QUrl(url)) - request.setAttribute(QNetworkRequest.CacheLoadControlAttribute, - QNetworkRequest.AlwaysNetwork) + request.setAttribute( + QNetworkRequest.Attribute.CacheLoadControlAttribute, + QNetworkRequest.CacheLoadControl.AlwaysNetwork) reply = WebBrowserWindow.networkManager().get(request) reply.finished.connect( lambda: self.__listFileDownloaded(reply)) @@ -172,7 +175,7 @@ self.__replies.remove(reply) reply.deleteLater() - if reply.error() != QNetworkReply.NoError: + if reply.error() != QNetworkReply.NetworkError.NoError: if not self.__downloadCancelled: E5MessageBox.warning( self, @@ -263,7 +266,7 @@ itm = QListWidgetItem( self.tr("{0} ({1})").format(short, " ".join(locales)), self.dictionariesList) - itm.setCheckState(Qt.Unchecked) + itm.setCheckState(Qt.CheckState.Unchecked) itm.setData(ManageDictionariesDialog.FilenameRole, filename) itm.setData(ManageDictionariesDialog.UrlRole, url) @@ -291,13 +294,13 @@ itm = self.dictionariesList.item(row) locales = set(itm.data(ManageDictionariesDialog.LocalesRole)) if locales.intersection(installedLocales): - itm.setCheckState(Qt.Checked) + itm.setCheckState(Qt.CheckState.Checked) else: - itm.setCheckState(Qt.Unchecked) + itm.setCheckState(Qt.CheckState.Unchecked) else: for row in range(self.dictionariesList.count()): itm = self.dictionariesList.item(row) - itm.setCheckState(Qt.Unchecked) + itm.setCheckState(Qt.CheckState.Unchecked) def __installSelected(self): """ @@ -329,8 +332,9 @@ self.__downloadCancelled = False request = QNetworkRequest(QUrl(url)) - request.setAttribute(QNetworkRequest.CacheLoadControlAttribute, - QNetworkRequest.AlwaysNetwork) + request.setAttribute( + QNetworkRequest.Attribute.CacheLoadControlAttribute, + QNetworkRequest.CacheLoadControl.AlwaysNetwork) reply = WebBrowserWindow.networkManager().get(request) reply.finished.connect( lambda: self.__installDictionary(reply)) @@ -352,7 +356,7 @@ self.__replies.remove(reply) reply.deleteLater() - if reply.error() != QNetworkReply.NoError: + if reply.error() != QNetworkReply.NetworkError.NoError: if not self.__downloadCancelled: E5MessageBox.warning( self, @@ -409,7 +413,7 @@ itemsToDelete = [ itm for itm in self.dictionariesList.selectedItems() - if itm.checkState() == Qt.Checked + if itm.checkState() == Qt.CheckState.Checked ] for itm in itemsToDelete: documentationDir = itm.data(