Tue, 02 Mar 2021 17:17:09 +0100
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
--- a/eric6/CondaInterface/Conda.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/CondaInterface/Conda.py Tue Mar 02 17:17:09 2021 +0100 @@ -510,7 +510,7 @@ "Do you really want to uninstall these packages and" " their dependencies?"), packages) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: args = [ "remove", "--json",
--- a/eric6/CondaInterface/CondaExecDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/CondaInterface/CondaExecDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -36,8 +36,10 @@ super(CondaExecDialog, self).__init__(parent) self.setupUi(self) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.__condaCommand = command @@ -54,9 +56,13 @@ @param button button that was clicked @type QAbstractButton """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.accept() - elif button == self.buttonBox.button(QDialogButtonBox.Cancel): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): self.__finish(1, 0) def start(self, arguments): @@ -117,14 +123,17 @@ @type bool """ if (self.__process is not None and - self.__process.state() != QProcess.NotRunning): + self.__process.state() != QProcess.ProcessState.NotRunning): self.__process.terminate() QTimer.singleShot(2000, self.__process.kill) self.__process.waitForFinished(3000) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) self.progressLabel.hide() self.progressBar.hide() @@ -258,7 +267,7 @@ It reads the error output of the process and inserts it into the error pane. """ - self.__process.setReadChannel(QProcess.StandardError) + self.__process.setReadChannel(QProcess.ProcessChannel.StandardError) while self.__process.canReadLine(): stderr = str(self.__process.readLine(),
--- a/eric6/CondaInterface/CondaExportDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/CondaInterface/CondaExportDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -43,10 +43,10 @@ """ super(CondaExportDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) self.__refreshButton = self.buttonBox.addButton( - self.tr("&Refresh"), QDialogButtonBox.ActionRole) + self.tr("&Refresh"), QDialogButtonBox.ButtonRole.ActionRole) self.requirementsFilePicker.setMode(E5PathPickerModes.SaveFileMode) self.requirementsFilePicker.setFilters( @@ -96,7 +96,9 @@ @param button button that was clicked @type QAbstractButton """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() elif button == self.__refreshButton: self.__refresh()
--- a/eric6/CondaInterface/CondaInfoDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/CondaInterface/CondaInfoDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -30,7 +30,7 @@ """ super(CondaInfoDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) self.iconLabel.setPixmap( UI.PixmapCache.getPixmap("miniconda48"))
--- a/eric6/CondaInterface/CondaNewEnvironmentDataDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/CondaInterface/CondaNewEnvironmentDataDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -58,7 +58,8 @@ if self.__requirementsMode: enable &= bool(self.requirementsFilePicker.text()) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enable) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(enable) @pyqtSlot(str) def on_nameEdit_textChanged(self, txt):
--- a/eric6/CondaInterface/CondaPackageDetailsWidget.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/CondaInterface/CondaPackageDetailsWidget.py Tue Mar 02 17:17:09 2021 +0100 @@ -55,7 +55,8 @@ self.dependenciesEdit.setPlainText("\n".join(details["depends"])) if "timestamp" in details: - dt = QDateTime.fromMSecsSinceEpoch(details["timestamp"], Qt.UTC) + dt = QDateTime.fromMSecsSinceEpoch(details["timestamp"], + Qt.TimeSpec.UTC) self.timestampLabel.setText(dt.toString("yyyy-MM-dd hh:mm:ss t")) self.resize(600, 450) @@ -84,7 +85,8 @@ size = self.__cw.size() self.__layout.addWidget(self.__cw) self.__buttonBox = QDialogButtonBox(self) - self.__buttonBox.setStandardButtons(QDialogButtonBox.Close) + self.__buttonBox.setStandardButtons( + QDialogButtonBox.StandardButton.Close) self.__layout.addWidget(self.__buttonBox) self.resize(size)
--- a/eric6/CondaInterface/CondaPackagesWidget.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/CondaInterface/CondaPackagesWidget.py Tue Mar 02 17:17:09 2021 +0100 @@ -31,11 +31,11 @@ Class implementing the conda packages management widget. """ # Role definition of packages list - PackageVersionRole = Qt.UserRole + 1 - PackageBuildRole = Qt.UserRole + 2 + PackageVersionRole = Qt.ItemDataRole.UserRole + 1 + PackageBuildRole = Qt.ItemDataRole.UserRole + 2 # Role definitions of search results list - PackageDetailedDataRole = Qt.UserRole + 1 + PackageDetailedDataRole = Qt.ItemDataRole.UserRole + 1 def __init__(self, conda, parent=None): """ @@ -70,9 +70,11 @@ "conda_supermenu_button") self.condaMenuButton.setIcon(UI.PixmapCache.getIcon("superMenu")) self.condaMenuButton.setToolTip(self.tr("Conda Menu")) - self.condaMenuButton.setPopupMode(QToolButton.InstantPopup) - self.condaMenuButton.setToolButtonStyle(Qt.ToolButtonIconOnly) - self.condaMenuButton.setFocusPolicy(Qt.NoFocus) + self.condaMenuButton.setPopupMode( + QToolButton.ToolButtonPopupMode.InstantPopup) + self.condaMenuButton.setToolButtonStyle( + Qt.ToolButtonStyle.ToolButtonIconOnly) + self.condaMenuButton.setFocusPolicy(Qt.FocusPolicy.NoFocus) self.condaMenuButton.setAutoRaise(True) self.condaMenuButton.setShowMenuInside(True) @@ -241,7 +243,9 @@ prefix=prefix) for package, version, build in updateablePackages: items = self.packagesList.findItems( - package, Qt.MatchExactly | Qt.MatchCaseSensitive) + package, + Qt.MatchFlag.MatchExactly | + Qt.MatchFlag.MatchCaseSensitive) if items: itm = items[0] itm.setText(2, version) @@ -258,7 +262,7 @@ itm.data(2, self.PackageBuildRole), )) - self.packagesList.sortItems(0, Qt.AscendingOrder) + self.packagesList.sortItems(0, Qt.SortOrder.AscendingOrder) for col in range(self.packagesList.columnCount()): self.packagesList.resizeColumnToContents(col) self.packagesList.setUpdatesEnabled(True) @@ -287,7 +291,8 @@ self.__populateEnvironments() index = self.environmentsComboBox.findText( - currentEnvironment, Qt.MatchExactly | Qt.MatchCaseSensitive) + currentEnvironment, + Qt.MatchFlag.MatchExactly | Qt.MatchFlag.MatchCaseSensitive) if index != -1: self.environmentsComboBox.setCurrentIndex(index) @@ -386,7 +391,8 @@ citm.setData(0, self.PackageDetailedDataRole, detail) - self.searchResultList.sortItems(0, Qt.AscendingOrder) + self.searchResultList.sortItems( + 0, Qt.SortOrder.AscendingOrder) self.searchResultList.resizeColumnToContents(0) self.searchResultList.setUpdatesEnabled(True) if not ok: @@ -511,7 +517,7 @@ self.searchWidget.setVisible(checked) if checked: - self.searchEdit.setFocus(Qt.OtherFocusReason) + self.searchEdit.setFocus(Qt.FocusReason.OtherFocusReason) self.searchEdit.selectAll() self.__updateSearchActionButtons() @@ -556,7 +562,7 @@ self, self.tr("Install Packages"), self.tr("Package Specifications (separated by whitespace):"), - QLineEdit.Normal, + QLineEdit.EchoMode.Normal, minimumWidth=600) if ok and packageSpecs.strip(): packages = [p.strip() for p in packageSpecs.split()] @@ -616,7 +622,7 @@ if prefix: dlg = CondaNewEnvironmentDataDialog(self.tr("Clone Environment"), False, self) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: virtEnvName, envName, _ = dlg.getData() args = [ "--name", @@ -640,7 +646,7 @@ dlg = CondaNewEnvironmentDataDialog(self.tr("Create Environment"), True, self) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: virtEnvName, envName, requirements = dlg.getData() args = [ "--name",
--- a/eric6/Cooperation/ChatWidget.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Cooperation/ChatWidget.py Tue Mar 02 17:17:09 2021 +0100 @@ -83,7 +83,7 @@ self.__client.editorCommand.connect(self.__editorCommandMessage) self.serverButton.setText(self.tr("Start Server")) - self.serverLed.setColor(QColor(Qt.red)) + self.serverLed.setColor(QColor(Qt.GlobalColor.red)) if port == -1: port = Preferences.getCooperation("ServerPort") @@ -167,10 +167,10 @@ return color = self.chatEdit.textColor() - self.chatEdit.setTextColor(Qt.gray) + self.chatEdit.setTextColor(Qt.GlobalColor.gray) self.chatEdit.append( - QDateTime.currentDateTime().toString(Qt.SystemLocaleLongDate) + - ":") + QDateTime.currentDateTime().toString( + Qt.DateFormat.SystemLocaleLongDate) + ":") self.chatEdit.append(self.tr("* {0} has joined.\n").format(nick)) self.chatEdit.setTextColor(color) @@ -197,16 +197,16 @@ if nick == "": return - items = self.usersList.findItems(nick, Qt.MatchExactly) + items = self.usersList.findItems(nick, Qt.MatchFlag.MatchExactly) for item in items: self.usersList.takeItem(self.usersList.row(item)) del item color = self.chatEdit.textColor() - self.chatEdit.setTextColor(Qt.gray) + self.chatEdit.setTextColor(Qt.GlobalColor.gray) self.chatEdit.append( - QDateTime.currentDateTime().toString(Qt.SystemLocaleLongDate) + - ":") + QDateTime.currentDateTime().toString( + Qt.DateFormat.SystemLocaleLongDate) + ":") self.chatEdit.append(self.tr("* {0} has left.\n").format(nick)) self.chatEdit.setTextColor(color) @@ -230,8 +230,8 @@ return self.chatEdit.append( - QDateTime.currentDateTime().toString(Qt.SystemLocaleLongDate) + - " <" + from_ + ">:") + QDateTime.currentDateTime().toString( + Qt.DateFormat.SystemLocaleLongDate) + " <" + from_ + ">:") self.chatEdit.append(message + "\n") bar = self.chatEdit.verticalScrollBar() bar.setValue(bar.maximum()) @@ -308,7 +308,7 @@ Preferences.getCooperation("ServerPort")): self.serverPortSpin.setValue( Preferences.getCooperation("ServerPort")) - self.serverLed.setColor(QColor(Qt.red)) + self.serverLed.setColor(QColor(Qt.GlobalColor.red)) else: res, port = self.__client.startListening( self.serverPortSpin.value()) @@ -316,7 +316,7 @@ self.serverButton.setText(self.tr("Stop Server")) self.serverPortSpin.setValue(port) self.serverPortSpin.setEnabled(False) - self.serverLed.setColor(QColor(Qt.green)) + self.serverLed.setColor(QColor(Qt.GlobalColor.green)) else: self.__showErrorMessage( self.tr("! Server Error: {0}\n").format( @@ -332,11 +332,11 @@ if connected: self.connectButton.setText(self.tr("Disconnect")) self.connectButton.setEnabled(True) - self.connectionLed.setColor(QColor(Qt.green)) + self.connectionLed.setColor(QColor(Qt.GlobalColor.green)) else: self.connectButton.setText(self.tr("Connect")) self.connectButton.setEnabled(self.hostEdit.currentText() != "") - self.connectionLed.setColor(QColor(Qt.red)) + self.connectionLed.setColor(QColor(Qt.GlobalColor.red)) self.on_cancelEditButton_clicked() self.shareButton.setChecked(False) self.on_shareButton_clicked(False) @@ -358,10 +358,10 @@ @param message error message to show (string) """ color = self.chatEdit.textColor() - self.chatEdit.setTextColor(Qt.red) + self.chatEdit.setTextColor(Qt.GlobalColor.red) self.chatEdit.append( - QDateTime.currentDateTime().toString(Qt.SystemLocaleLongDate) + - ":") + QDateTime.currentDateTime().toString( + Qt.DateFormat.SystemLocaleLongDate) + ":") self.chatEdit.append(message + "\n") self.chatEdit.setTextColor(color) @@ -645,10 +645,10 @@ self.__client.kickUser(itm.text()) color = self.chatEdit.textColor() - self.chatEdit.setTextColor(Qt.darkYellow) + self.chatEdit.setTextColor(Qt.GlobalColor.darkYellow) self.chatEdit.append( - QDateTime.currentDateTime().toString(Qt.SystemLocaleLongDate) + - ":") + QDateTime.currentDateTime().toString( + Qt.DateFormat.SystemLocaleLongDate) + ":") self.chatEdit.append(self.tr("* {0} has been kicked.\n").format( itm.text().split("@")[0])) self.chatEdit.setTextColor(color) @@ -661,10 +661,10 @@ self.__client.banUser(itm.text()) color = self.chatEdit.textColor() - self.chatEdit.setTextColor(Qt.darkYellow) + self.chatEdit.setTextColor(Qt.GlobalColor.darkYellow) self.chatEdit.append( - QDateTime.currentDateTime().toString(Qt.SystemLocaleLongDate) + - ":") + QDateTime.currentDateTime().toString( + Qt.DateFormat.SystemLocaleLongDate) + ":") self.chatEdit.append(self.tr("* {0} has been banned.\n").format( itm.text().split("@")[0])) self.chatEdit.setTextColor(color) @@ -677,10 +677,10 @@ self.__client.banKickUser(itm.text()) color = self.chatEdit.textColor() - self.chatEdit.setTextColor(Qt.darkYellow) + self.chatEdit.setTextColor(Qt.GlobalColor.darkYellow) self.chatEdit.append( - QDateTime.currentDateTime().toString(Qt.SystemLocaleLongDate) + - ":") + QDateTime.currentDateTime().toString( + Qt.DateFormat.SystemLocaleLongDate) + ":") self.chatEdit.append( self.tr("* {0} has been banned and kicked.\n") .format(itm.text().split("@")[0]))
--- a/eric6/Cooperation/ChatWidget.ui Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Cooperation/ChatWidget.ui Tue Mar 02 17:17:09 2021 +0100 @@ -216,7 +216,7 @@ <enum>QComboBox::InsertAtTop</enum> </property> <property name="sizeAdjustPolicy"> - <enum>QComboBox::AdjustToMinimumContentsLength</enum> + <enum>QComboBox::AdjustToContents</enum> </property> </widget> </item>
--- a/eric6/Cooperation/CooperationClient.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Cooperation/CooperationClient.py Tue Mar 02 17:17:09 2021 +0100 @@ -215,7 +215,7 @@ @param connection connection that caused the error @type Connection """ - if socketError != QAbstractSocket.RemoteHostClosedError: + if socketError != QAbstractSocket.SocketError.RemoteHostClosedError: if connection.peerPort() != 0: msg = "* {0}:{1}\n{2}\n".format( connection.peerAddress().toString(),
--- a/eric6/DataViews/CodeMetricsDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/DataViews/CodeMetricsDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -34,10 +34,12 @@ """ super(CodeMetricsDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.summaryList.headerItem().setText( self.summaryList.columnCount(), "") @@ -52,7 +54,8 @@ self.__menu.addAction(self.tr("Collapse All"), self.__resultCollapse) self.__menu.addAction(self.tr("Expand All"), self.__resultExpand) - self.resultList.setContextMenuPolicy(Qt.CustomContextMenu) + self.resultList.setContextMenuPolicy( + Qt.ContextMenuPolicy.CustomContextMenu) self.resultList.customContextMenuRequested.connect( self.__showContextMenu) @@ -64,7 +67,8 @@ """ Private method to resize the list columns. """ - self.resultList.header().resizeSections(QHeaderView.ResizeToContents) + self.resultList.header().resizeSections( + QHeaderView.ResizeMode.ResizeToContents) self.resultList.header().setStretchLastSection(True) def __createResultItem(self, parent, values): @@ -83,14 +87,16 @@ data.append(value) itm = QTreeWidgetItem(parent, data) for col in range(1, 7): - itm.setTextAlignment(col, Qt.Alignment(Qt.AlignRight)) + itm.setTextAlignment( + col, Qt.Alignment(Qt.AlignmentFlag.AlignRight)) return itm def __resizeSummaryColumns(self): """ Private method to resize the list columns. """ - self.summaryList.header().resizeSections(QHeaderView.ResizeToContents) + self.summaryList.header().resizeSections( + QHeaderView.ResizeMode.ResizeToContents) self.summaryList.header().setStretchLastSection(True) def __createSummaryItem(self, col0, col1): @@ -101,7 +107,7 @@ @param col1 string for column 1 (string) """ itm = QTreeWidgetItem(self.summaryList, [col0, col1]) - itm.setTextAlignment(1, Qt.Alignment(Qt.AlignRight)) + itm.setTextAlignment(1, Qt.Alignment(Qt.AlignmentFlag.AlignRight)) def prepare(self, fileList, project): """ @@ -113,9 +119,12 @@ self.__fileList = fileList[:] self.__project = project - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) self.filterFrame.setVisible(True) @@ -132,9 +141,12 @@ the code metrics for (string or list of strings) """ self.cancelled = False - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) QApplication.processEvents() loc = QLocale() @@ -231,12 +243,17 @@ button. """ self.cancelled = True - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) - self.resultList.header().setSectionResizeMode(QHeaderView.Interactive) - self.summaryList.header().setSectionResizeMode(QHeaderView.Interactive) + self.resultList.header().setSectionResizeMode( + QHeaderView.ResizeMode.Interactive) + self.summaryList.header().setSectionResizeMode( + QHeaderView.ResizeMode.Interactive) def on_buttonBox_clicked(self, button): """ @@ -244,9 +261,13 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() - elif button == self.buttonBox.button(QDialogButtonBox.Cancel): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): self.__finish() @pyqtSlot()
--- a/eric6/DataViews/PyCoverageDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/DataViews/PyCoverageDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -38,10 +38,12 @@ """ super(PyCoverageDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.summaryList.headerItem().setText( self.summaryList.columnCount(), "") @@ -65,7 +67,8 @@ self.tr('Delete annotated files'), self.__deleteAnnotated) self.__menu.addSeparator() self.__menu.addAction(self.tr('Erase Coverage Info'), self.__erase) - self.resultList.setContextMenuPolicy(Qt.CustomContextMenu) + self.resultList.setContextMenuPolicy( + Qt.ContextMenuPolicy.CustomContextMenu) self.resultList.customContextMenuRequested.connect( self.__showContextMenu) @@ -135,7 +138,7 @@ missing ]) for col in range(1, 4): - itm.setTextAlignment(col, Qt.AlignRight) + itm.setTextAlignment(col, Qt.AlignmentFlag.AlignRight) if statements != executed: font = itm.font(0) font.setBold(True) @@ -235,7 +238,7 @@ "{0:.0f}%".format(pc) ]) for col in range(0, 3): - itm.setTextAlignment(col, Qt.AlignRight) + itm.setTextAlignment(col, Qt.AlignmentFlag.AlignRight) else: self.summaryGroup.hide() @@ -255,13 +258,18 @@ button. """ self.cancelled = True - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) QApplication.processEvents() - self.resultList.header().resizeSections(QHeaderView.ResizeToContents) + self.resultList.header().resizeSections( + QHeaderView.ResizeMode.ResizeToContents) self.resultList.header().setStretchLastSection(True) - self.summaryList.header().resizeSections(QHeaderView.ResizeToContents) + self.summaryList.header().resizeSections( + QHeaderView.ResizeMode.ResizeToContents) self.summaryList.header().setStretchLastSection(True) def on_buttonBox_clicked(self, button): @@ -270,9 +278,13 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() - elif button == self.buttonBox.button(QDialogButtonBox.Cancel): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): self.__finish() def __showContextMenu(self, coord): @@ -400,9 +412,12 @@ self.excludeList.remove(excludePattern) self.excludeList.insert(0, excludePattern) self.cancelled = False - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.start(self.__cfn, self.__fn) @pyqtSlot(QTreeWidgetItem, int)
--- a/eric6/DataViews/PyProfileDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/DataViews/PyProfileDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -65,10 +65,12 @@ """ super(PyProfileDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.cancelled = False self.exclude = True @@ -79,7 +81,8 @@ self.summaryList.headerItem().setText( self.summaryList.columnCount(), "") self.resultList.headerItem().setText(self.resultList.columnCount(), "") - self.resultList.header().setSortIndicator(0, Qt.DescendingOrder) + self.resultList.header().setSortIndicator( + 0, Qt.SortOrder.DescendingOrder) self.__menu = QMenu(self) self.filterItm = self.__menu.addAction( @@ -92,10 +95,12 @@ self.tr('Erase Timing Info'), self.__eraseTiming) self.__menu.addSeparator() self.__menu.addAction(self.tr('Erase All Infos'), self.__eraseAll) - self.resultList.setContextMenuPolicy(Qt.CustomContextMenu) + self.resultList.setContextMenuPolicy( + Qt.ContextMenuPolicy.CustomContextMenu) self.resultList.customContextMenuRequested.connect( self.__showContextMenu) - self.summaryList.setContextMenuPolicy(Qt.CustomContextMenu) + self.summaryList.setContextMenuPolicy( + Qt.ContextMenuPolicy.CustomContextMenu) self.summaryList.customContextMenuRequested.connect( self.__showContextMenu) @@ -125,7 +130,7 @@ functionName ]) for col in [0, 1, 2, 3, 4, 6]: - itm.setTextAlignment(col, Qt.AlignRight) + itm.setTextAlignment(col, Qt.AlignmentFlag.AlignRight) def __createSummaryItem(self, label, contents): """ @@ -135,7 +140,7 @@ @param contents text of the second column (string) """ itm = QTreeWidgetItem(self.summaryList, [label, contents]) - itm.setTextAlignment(1, Qt.AlignRight) + itm.setTextAlignment(1, Qt.AlignmentFlag.AlignRight) def __resortResultList(self): """ @@ -262,13 +267,18 @@ button. """ self.cancelled = True - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) QApplication.processEvents() - self.resultList.header().resizeSections(QHeaderView.ResizeToContents) + self.resultList.header().resizeSections( + QHeaderView.ResizeMode.ResizeToContents) self.resultList.header().setStretchLastSection(True) - self.summaryList.header().resizeSections(QHeaderView.ResizeToContents) + self.summaryList.header().resizeSections( + QHeaderView.ResizeMode.ResizeToContents) self.summaryList.header().setStretchLastSection(True) def __unfinish(self): @@ -276,9 +286,12 @@ Private slot called to revert the effects of the __finish slot. """ self.cancelled = False - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) def on_buttonBox_clicked(self, button): """ @@ -286,9 +299,13 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() - elif button == self.buttonBox.button(QDialogButtonBox.Cancel): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): self.__finish() def __showContextMenu(self, coord):
--- a/eric6/DebugClients/Python/QProcessExtension.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/DebugClients/Python/QProcessExtension.py Tue Mar 02 17:17:09 2021 +0100 @@ -68,14 +68,14 @@ if len(args) > 2: mode = args[2] else: - mode = module.QIODevice.ReadWrite + mode = module.QIODevice.OpenModeFlag.ReadWrite else: program = self.program() arguments = self.arguments() if len(args) == 1: mode = args[0] else: - mode = module.QIODevice.ReadWrite + mode = module.QIODevice.OpenModeFlag.ReadWrite ok = isPythonProgram(program) if ok: if startsWithShebang(program):
--- a/eric6/Debugger/BreakPointModel.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Debugger/BreakPointModel.py Tue Mar 02 17:17:09 2021 +0100 @@ -43,13 +43,13 @@ self.tr('Enabled'), self.tr('Ignore Count'), ] - self.alignments = [Qt.Alignment(Qt.AlignLeft), - Qt.Alignment(Qt.AlignRight), - Qt.Alignment(Qt.AlignLeft), - Qt.Alignment(Qt.AlignHCenter), - Qt.Alignment(Qt.AlignHCenter), - Qt.Alignment(Qt.AlignRight), - Qt.Alignment(Qt.AlignHCenter), + self.alignments = [Qt.Alignment(Qt.AlignmentFlag.AlignLeft), + Qt.Alignment(Qt.AlignmentFlag.AlignRight), + Qt.Alignment(Qt.AlignmentFlag.AlignLeft), + Qt.Alignment(Qt.AlignmentFlag.AlignHCenter), + Qt.Alignment(Qt.AlignmentFlag.AlignHCenter), + Qt.Alignment(Qt.AlignmentFlag.AlignRight), + Qt.Alignment(Qt.AlignmentFlag.AlignHCenter), ] def columnCount(self, parent=None): @@ -78,7 +78,7 @@ else: return 0 - def data(self, index, role=Qt.DisplayRole): + def data(self, index, role=Qt.ItemDataRole.DisplayRole): """ Public method to get the requested data. @@ -92,7 +92,7 @@ if not index.isValid(): return None - if role == Qt.DisplayRole: + if role == Qt.ItemDataRole.DisplayRole: if index.column() == 0: filename = self.breakpoints[index.row()][0] if self.__project.isOpen(): @@ -102,21 +102,21 @@ elif index.column() in (1, 2, 5): return self.breakpoints[index.row()][index.column()] - if role == Qt.CheckStateRole: + if role == Qt.ItemDataRole.CheckStateRole: if index.column() in (3, 4): return self.breakpoints[index.row()][index.column()] - if role == Qt.ToolTipRole: + if role == Qt.ItemDataRole.ToolTipRole: if index.column() in (0, 2): return self.breakpoints[index.row()][index.column()] - if role == Qt.TextAlignmentRole: + if role == Qt.ItemDataRole.TextAlignmentRole: if index.column() < len(self.alignments): return self.alignments[index.column()] return None - def setData(self, index, value, role=Qt.EditRole): + def setData(self, index, value, role=Qt.ItemDataRole.EditRole): """ Public method to change data in the model. @@ -149,11 +149,12 @@ @rtype Qt.ItemFlags """ if not index.isValid(): - return Qt.ItemIsEnabled + return Qt.ItemFlag.ItemIsEnabled - return Qt.ItemIsEnabled | Qt.ItemIsSelectable + return Qt.ItemFlag.ItemIsEnabled | Qt.ItemFlag.ItemIsSelectable - def headerData(self, section, orientation, role=Qt.DisplayRole): + def headerData(self, section, orientation, + role=Qt.ItemDataRole.DisplayRole): """ Public method to get header data. @@ -166,7 +167,10 @@ @return header data @rtype str """ - if orientation == Qt.Horizontal and role == Qt.DisplayRole: + if ( + orientation == Qt.Orientation.Horizontal and + role == Qt.ItemDataRole.DisplayRole + ): if section >= len(self.header): return "" else:
--- a/eric6/Debugger/BreakPointViewer.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Debugger/BreakPointViewer.py Tue Mar 02 17:17:09 2021 +0100 @@ -46,12 +46,14 @@ self.setItemsExpandable(False) self.setRootIsDecorated(False) self.setAlternatingRowColors(True) - self.setSelectionMode(QAbstractItemView.ExtendedSelection) - self.setSelectionBehavior(QAbstractItemView.SelectRows) + self.setSelectionMode( + QAbstractItemView.SelectionMode.ExtendedSelection) + self.setSelectionBehavior( + QAbstractItemView.SelectionBehavior.SelectRows) self.setWindowTitle(self.tr("Breakpoints")) - self.setContextMenuPolicy(Qt.CustomContextMenu) + self.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu) self.customContextMenuRequested.connect(self.__showContextMenu) self.doubleClicked.connect(self.__doubleClicked) @@ -78,7 +80,7 @@ super(BreakPointViewer, self).setModel(self.sortingModel) header = self.header() - header.setSortIndicator(0, Qt.AscendingOrder) + header.setSortIndicator(0, Qt.SortOrder.AscendingOrder) header.setSortIndicatorShown(True) header.setSectionsClickable(True) @@ -98,7 +100,7 @@ Private slot to resize the view when items get added, edited or deleted. """ - self.header().resizeSections(QHeaderView.ResizeToContents) + self.header().resizeSections(QHeaderView.ResizeMode.ResizeToContents) self.header().setStretchLastSection(True) def __resort(self): @@ -144,10 +146,14 @@ if selected: flags = QItemSelectionModel.SelectionFlags( - QItemSelectionModel.ClearAndSelect | QItemSelectionModel.Rows) + QItemSelectionModel.SelectionFlag.ClearAndSelect | + QItemSelectionModel.SelectionFlag.Rows + ) else: flags = QItemSelectionModel.SelectionFlags( - QItemSelectionModel.Deselect | QItemSelectionModel.Rows) + QItemSelectionModel.SelectionFlag.Deselect | + QItemSelectionModel.SelectionFlag.Rows + ) self.selectionModel().select(index, flags) def __createPopupMenus(self): @@ -245,7 +251,7 @@ dlg = EditBreakpointDialog((self.fnHistory[0], None), None, self.condHistory, self, modal=1, addMode=1, filenameHistory=self.fnHistory) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: fn, line, cond, temp, enabled, count = dlg.getAddData() if fn is not None: if fn in self.fnHistory: @@ -306,7 +312,7 @@ dlg = EditBreakpointDialog( (fn, line), (cond, temp, enabled, count), self.condHistory, self, modal=True) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: cond, temp, enabled, count = dlg.getData() if cond: if cond in self.condHistory:
--- a/eric6/Debugger/CallStackViewer.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Debugger/CallStackViewer.py Tue Mar 02 17:17:09 2021 +0100 @@ -28,8 +28,8 @@ sourceFile = pyqtSignal(str, int) frameSelected = pyqtSignal(int) - FilenameRole = Qt.UserRole + 1 - LinenoRole = Qt.UserRole + 2 + FilenameRole = Qt.ItemDataRole.UserRole + 1 + LinenoRole = Qt.ItemDataRole.UserRole + 2 def __init__(self, debugServer, parent=None): """ @@ -61,7 +61,8 @@ self.__menu.addAction(self.tr("Clear"), self.__callStackList.clear) self.__menu.addSeparator() self.__menu.addAction(self.tr("Save"), self.__saveStackTrace) - self.__callStackList.setContextMenuPolicy(Qt.CustomContextMenu) + self.__callStackList.setContextMenuPolicy( + Qt.ContextMenuPolicy.CustomContextMenu) self.__callStackList.customContextMenuRequested.connect( self.__showContextMenu)
--- a/eric6/Debugger/CallTraceViewer.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Debugger/CallTraceViewer.py Tue Mar 02 17:17:09 2021 +0100 @@ -184,7 +184,7 @@ f.write("{0}\n\n".format(len(title) * "=")) itm = self.callTrace.topLevelItem(0) while itm is not None: - isCall = itm.data(0, Qt.UserRole) + isCall = itm.data(0, Qt.ItemDataRole.UserRole) if isCall: call = "->" else: @@ -287,7 +287,7 @@ self.__entryFormat.format(fromFile, fromLine, fromFunction), self.__entryFormat.format(toFile, toLine, toFunction)]) itm.setIcon(0, icon) - itm.setData(0, Qt.UserRole, isCall) + itm.setData(0, Qt.ItemDataRole.UserRole, isCall) itm.setExpanded(True) if isCall:
--- a/eric6/Debugger/DebugServer.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Debugger/DebugServer.py Tue Mar 02 17:17:09 2021 +0100 @@ -212,9 +212,11 @@ self.networkInterface = Preferences.getDebugger("NetworkInterface") if self.networkInterface == "all": - hostAddress = QHostAddress("0.0.0.0") # QHostAddress.Any) # secok + hostAddress = QHostAddress("0.0.0.0") + # QHostAddress.SpecialAddress.Any) # secok elif self.networkInterface == "allv6": - hostAddress = QHostAddress("::") # QHostAddress.AnyIPv6) + hostAddress = QHostAddress("::") + # QHostAddress.SpecialAddress.AnyIPv6) else: hostAddress = QHostAddress(self.networkInterface) self.networkInterfaceName, self.networkInterfaceIndex = (
--- a/eric6/Debugger/DebugUI.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Debugger/DebugUI.py Tue Mar 02 17:17:09 2021 +0100 @@ -201,7 +201,7 @@ self.tr('Run Script'), UI.PixmapCache.getIcon("runScript"), self.tr('&Run Script...'), - Qt.Key_F2, 0, self, 'dbg_run_script') + Qt.Key.Key_F2, 0, self, 'dbg_run_script') self.runAct.setStatusTip(self.tr('Run the current Script')) self.runAct.setWhatsThis(self.tr( """<b>Run Script</b>""" @@ -215,8 +215,9 @@ self.runProjectAct = E5Action( self.tr('Run Project'), UI.PixmapCache.getIcon("runProject"), - self.tr('Run &Project...'), Qt.SHIFT + Qt.Key_F2, 0, self, - 'dbg_run_project') + self.tr('Run &Project...'), + Qt.Modifier.SHIFT + Qt.Key.Key_F2, + 0, self, 'dbg_run_project') self.runProjectAct.setStatusTip(self.tr('Run the current Project')) self.runProjectAct.setWhatsThis(self.tr( """<b>Run Project</b>""" @@ -293,7 +294,7 @@ self.debugAct = E5Action( self.tr('Debug Script'), UI.PixmapCache.getIcon("debugScript"), - self.tr('&Debug Script...'), Qt.Key_F5, 0, self, + self.tr('&Debug Script...'), Qt.Key.Key_F5, 0, self, 'dbg_debug_script') self.debugAct.setStatusTip(self.tr('Debug the current Script')) self.debugAct.setWhatsThis(self.tr( @@ -309,8 +310,9 @@ self.debugProjectAct = E5Action( self.tr('Debug Project'), UI.PixmapCache.getIcon("debugProject"), - self.tr('Debug &Project...'), Qt.SHIFT + Qt.Key_F5, 0, self, - 'dbg_debug_project') + self.tr('Debug &Project...'), + Qt.Modifier.SHIFT + Qt.Key.Key_F5, + 0, self, 'dbg_debug_project') self.debugProjectAct.setStatusTip(self.tr( 'Debug the current Project')) self.debugProjectAct.setWhatsThis(self.tr( @@ -326,7 +328,7 @@ self.restartAct = E5Action( self.tr('Restart'), UI.PixmapCache.getIcon("debugRestart"), - self.tr('Restart'), Qt.Key_F4, 0, self, 'dbg_restart_script') + self.tr('Restart'), Qt.Key.Key_F4, 0, self, 'dbg_restart_script') self.restartAct.setStatusTip(self.tr( 'Restart the last debugged script')) self.restartAct.setWhatsThis(self.tr( @@ -342,7 +344,7 @@ self.stopAct = E5Action( self.tr('Stop'), UI.PixmapCache.getIcon("stopScript"), - self.tr('Stop'), Qt.SHIFT + Qt.Key_F10, 0, + self.tr('Stop'), Qt.Modifier.SHIFT + Qt.Key.Key_F10, 0, self, 'dbg_stop_script') self.stopAct.setStatusTip(self.tr("""Stop the running script.""")) self.stopAct.setWhatsThis(self.tr( @@ -357,7 +359,7 @@ act = E5Action( self.tr('Continue'), UI.PixmapCache.getIcon("continue"), - self.tr('&Continue'), Qt.Key_F6, 0, + self.tr('&Continue'), Qt.Key.Key_F6, 0, self.debugActGrp, 'dbg_continue') act.setStatusTip( self.tr('Continue running the program from the current line')) @@ -373,8 +375,9 @@ act = E5Action( self.tr('Continue to Cursor'), UI.PixmapCache.getIcon("continueToCursor"), - self.tr('Continue &To Cursor'), Qt.SHIFT + Qt.Key_F6, 0, - self.debugActGrp, 'dbg_continue_to_cursor') + self.tr('Continue &To Cursor'), + Qt.Modifier.SHIFT + Qt.Key.Key_F6, + 0, self.debugActGrp, 'dbg_continue_to_cursor') act.setStatusTip(self.tr( """Continue running the program from the""" """ current line to the current cursor position""")) @@ -389,7 +392,7 @@ act = E5Action( self.tr('Continue Until'), UI.PixmapCache.getIcon("continueUntil"), - self.tr('Continue &Until'), Qt.CTRL + Qt.Key_F6, 0, + self.tr('Continue &Until'), Qt.Modifier.CTRL + Qt.Key.Key_F6, 0, self.debugActGrp, 'dbg_continue_until') act.setStatusTip(self.tr( """Continue running the program from the current line to the""" @@ -406,7 +409,7 @@ act = E5Action( self.tr('Move Instruction Pointer to Cursor'), UI.PixmapCache.getIcon("moveInstructionPointer"), - self.tr('&Jump To Cursor'), Qt.Key_F12, 0, + self.tr('&Jump To Cursor'), Qt.Key.Key_F12, 0, self.debugActGrp, 'dbg_jump_to_cursor') act.setStatusTip(self.tr( """Skip the code from the""" @@ -426,7 +429,7 @@ act = E5Action( self.tr('Single Step'), UI.PixmapCache.getIcon("step"), - self.tr('Sin&gle Step'), Qt.Key_F7, 0, + self.tr('Sin&gle Step'), Qt.Key.Key_F7, 0, self.debugActGrp, 'dbg_single_step') act.setStatusTip(self.tr('Execute a single Python statement')) act.setWhatsThis(self.tr( @@ -442,7 +445,7 @@ act = E5Action( self.tr('Step Over'), UI.PixmapCache.getIcon("stepOver"), - self.tr('Step &Over'), Qt.Key_F8, 0, + self.tr('Step &Over'), Qt.Key.Key_F8, 0, self.debugActGrp, 'dbg_step_over') act.setStatusTip(self.tr( """Execute a single Python statement staying""" @@ -461,7 +464,7 @@ act = E5Action( self.tr('Step Out'), UI.PixmapCache.getIcon("stepOut"), - self.tr('Step Ou&t'), Qt.Key_F9, 0, + self.tr('Step Ou&t'), Qt.Key.Key_F9, 0, self.debugActGrp, 'dbg_step_out') act.setStatusTip(self.tr( """Execute Python statements until leaving""" @@ -480,7 +483,7 @@ act = E5Action( self.tr('Stop'), UI.PixmapCache.getIcon("stepQuit"), - self.tr('&Stop'), Qt.Key_F10, 0, + self.tr('&Stop'), Qt.Key.Key_F10, 0, self.debugActGrp, 'dbg_stop') act.setStatusTip(self.tr('Stop debugging')) act.setWhatsThis(self.tr( @@ -1472,7 +1475,7 @@ dlg = EditBreakpointDialog( (fn, line), (cond, temp, enabled, count), [], self.ui, modal=True) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: cond, temp, enabled, count = dlg.getData() model.setBreakPointByIndex(index, fn, line, (cond, temp, enabled, count)) @@ -1509,7 +1512,7 @@ from .EditWatchpointDialog import EditWatchpointDialog dlg = EditWatchpointDialog( (cond, temp, enabled, count, special), self.ui) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: cond, temp, enabled, count, special = dlg.getData() # check for duplicates @@ -1545,7 +1548,7 @@ dlg = VariablesFilterDialog(self.ui, 'Filter Dialog', True) dlg.setSelection(self.__localsVarFilterList, self.__globalsVarFilterList) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: self.__localsVarFilterList, self.__globalsVarFilterList = ( dlg.getSelection() ) @@ -1558,7 +1561,7 @@ """ from .ExceptionsFilterDialog import ExceptionsFilterDialog dlg = ExceptionsFilterDialog(self.excList, ignore=False) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: self.excList = dlg.getExceptionsList()[:] # keep a copy def __configureIgnoredExceptions(self): @@ -1567,7 +1570,7 @@ """ from .ExceptionsFilterDialog import ExceptionsFilterDialog dlg = ExceptionsFilterDialog(self.excIgnoreList, ignore=True) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: self.excIgnoreList = dlg.getExceptionsList()[:] # keep a copy def __toggleBreakpoint(self): @@ -1689,7 +1692,7 @@ cap, self.lastUsedVenvName, self.argvHistory, self.wdHistory, self.envHistory, self.exceptions, self.ui, 2, autoClearShell=self.autoClearShell) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: (lastUsedVenvName, argv, wd, env, exceptions, clearShell, console) = dlg.getData() eraseCoverage = dlg.getCoverageData() @@ -1826,7 +1829,7 @@ cap, self.lastUsedVenvName, self.argvHistory, self.wdHistory, self.envHistory, self.exceptions, self.ui, 3, autoClearShell=self.autoClearShell) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: (lastUsedVenvName, argv, wd, env, exceptions, clearShell, console) = dlg.getData() eraseTimings = dlg.getProfilingData() @@ -1963,7 +1966,7 @@ cap, self.lastUsedVenvName, self.argvHistory, self.wdHistory, self.envHistory, self.exceptions, self.ui, 1, autoClearShell=self.autoClearShell) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: (lastUsedVenvName, argv, wd, env, exceptions, clearShell, console) = dlg.getData() @@ -2099,7 +2102,7 @@ autoContinue=self.autoContinue, enableMultiprocess=self.enableMultiprocess, multiprocessNoDebugHistory=self.multiprocessNoDebugHistory) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: (lastUsedVenvName, argv, wd, env, exceptions, clearShell, console) = dlg.getData() (tracePython, autoContinue, enableMultiprocess,
--- a/eric6/Debugger/DebugViewer.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Debugger/DebugViewer.py Tue Mar 02 17:17:09 2021 +0100 @@ -50,8 +50,8 @@ sourceFile = pyqtSignal(str, int) preferencesChanged = pyqtSignal() - ThreadIdRole = Qt.UserRole + 1 - DebuggerStateRole = Qt.UserRole + 2 + ThreadIdRole = Qt.ItemDataRole.UserRole + 1 + DebuggerStateRole = Qt.ItemDataRole.UserRole + 2 # Map debug state to icon name StateIcon = { @@ -93,7 +93,7 @@ self.__mainLayout.setContentsMargins(0, 3, 0, 0) self.setLayout(self.__mainLayout) - self.__mainSplitter = QSplitter(Qt.Vertical, self) + self.__mainSplitter = QSplitter(Qt.Orientation.Vertical, self) self.__mainLayout.addWidget(self.__mainSplitter) # add the viewer showing the connected debug backends @@ -135,7 +135,7 @@ self.globalsFilterEdit = QLineEdit(self.glvWidget) self.globalsFilterEdit.setSizePolicy( - QSizePolicy.Expanding, QSizePolicy.Fixed) + QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Fixed) self.glvWidgetHLayout.addWidget(self.globalsFilterEdit) self.globalsFilterEdit.setToolTip( self.tr("Enter regular expression patterns separated by ';'" @@ -174,7 +174,7 @@ self.stackComboBox = QComboBox(self.lvWidget) self.stackComboBox.setSizePolicy( - QSizePolicy.Expanding, QSizePolicy.Fixed) + QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Fixed) self.lvWidgetHLayout1.addWidget(self.stackComboBox) self.sourceButton = QPushButton(self.tr('Source'), self.lvWidget) @@ -190,7 +190,7 @@ self.localsFilterEdit = QLineEdit(self.lvWidget) self.localsFilterEdit.setSizePolicy( - QSizePolicy.Expanding, QSizePolicy.Fixed) + QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Fixed) self.lvWidgetHLayout2.addWidget(self.localsFilterEdit) self.localsFilterEdit.setToolTip( self.tr( @@ -709,7 +709,7 @@ .format(debuggerId)) self.__debuggersList.header().resizeSections( - QHeaderView.ResizeToContents) + QHeaderView.ResizeMode.ResizeToContents) if self.__debuggersList.topLevelItemCount() == 1: # it is the only item, select it as the current one @@ -723,7 +723,7 @@ @type str """ debuggerItems = self.__debuggersList.findItems( - debuggerId, Qt.MatchExactly) + debuggerId, Qt.MatchFlag.MatchExactly) if debuggerItems: debuggerItem = debuggerItems[0] currentItem = self.__debuggersList.currentItem() @@ -802,7 +802,7 @@ debuggerItem = None if debuggerId: foundItems = self.__debuggersList.findItems( - debuggerId, Qt.MatchExactly) + debuggerId, Qt.MatchFlag.MatchExactly) if foundItems: debuggerItem = foundItems[0] if debuggerItem is None: @@ -821,7 +821,7 @@ debuggerItem.setText(1, stateText) self.__debuggersList.header().resizeSections( - QHeaderView.ResizeToContents) + QHeaderView.ResizeMode.ResizeToContents) def __removeDebugger(self, debuggerId): """ @@ -831,7 +831,7 @@ @type str """ foundItems = self.__debuggersList.findItems( - debuggerId, Qt.MatchExactly) + debuggerId, Qt.MatchFlag.MatchExactly) if foundItems: index = self.__debuggersList.indexOfTopLevelItem(foundItems[0]) itm = self.__debuggersList.takeTopLevelItem(index) @@ -852,7 +852,7 @@ debugStatus = -1 # i.e. running debuggerItems = self.__debuggersList.findItems( - debuggerId, Qt.MatchExactly) + debuggerId, Qt.MatchFlag.MatchExactly) if debuggerItems: debuggerItem = debuggerItems[0] @@ -890,7 +890,7 @@ debuggerItem.setExpanded(debuggerItem.childCount() > 0) self.__debuggersList.header().resizeSections( - QHeaderView.ResizeToContents) + QHeaderView.ResizeMode.ResizeToContents) self.__debuggersList.header().setStretchLastSection(True) self.__doDebuggersListUpdate = True @@ -918,7 +918,7 @@ debuggerItem = None if debuggerId: foundItems = self.__debuggersList.findItems( - debuggerId, Qt.MatchExactly) + debuggerId, Qt.MatchFlag.MatchExactly) if foundItems: debuggerItem = foundItems[0] if debuggerItem is None: @@ -944,4 +944,4 @@ childItem.setText(1, stateText) self.__debuggersList.header().resizeSections( - QHeaderView.ResizeToContents) + QHeaderView.ResizeMode.ResizeToContents)
--- a/eric6/Debugger/EditBreakpointDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Debugger/EditBreakpointDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -45,9 +45,10 @@ self.filenamePicker.setMode(E5PathPickerModes.OpenFileMode) self.filenamePicker.setSizeAdjustPolicy( - QComboBox.AdjustToMinimumContentsLength) + QComboBox.SizeAdjustPolicy.AdjustToContents) - self.okButton = self.buttonBox.button(QDialogButtonBox.Ok) + self.okButton = self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok) fn, lineno = breakPointId
--- a/eric6/Debugger/EditBreakpointDialog.ui Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Debugger/EditBreakpointDialog.ui Tue Mar 02 17:17:09 2021 +0100 @@ -98,7 +98,7 @@ <bool>true</bool> </property> <property name="sizeAdjustPolicy"> - <enum>QComboBox::AdjustToMinimumContentsLength</enum> + <enum>QComboBox::AdjustToContents</enum> </property> </widget> </item>
--- a/eric6/Debugger/EditWatchpointDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Debugger/EditWatchpointDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -33,7 +33,8 @@ self.setObjectName(name) self.setModal(modal) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) # connect our widgets self.conditionEdit.textChanged.connect(self.__textChanged) @@ -77,15 +78,16 @@ """ if self.conditionButton.isChecked(): self.buttonBox.button( - QDialogButtonBox.Ok + QDialogButtonBox.StandardButton.Ok ).setEnabled(self.conditionEdit.text() != "") elif self.specialButton.isChecked(): self.buttonBox.button( - QDialogButtonBox.Ok + QDialogButtonBox.StandardButton.Ok ).setEnabled(self.specialEdit.text() != "") else: # should not happen - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) def getData(self): """
--- a/eric6/Debugger/ExceptionLogger.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Debugger/ExceptionLogger.py Tue Mar 02 17:17:09 2021 +0100 @@ -40,7 +40,7 @@ self.setHeaderLabels([self.tr("Exception")]) self.setSortingEnabled(False) - self.setContextMenuPolicy(Qt.CustomContextMenu) + self.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu) self.customContextMenuRequested.connect(self.__showContextMenu) self.itemDoubleClicked.connect(self.__itemDoubleClicked)
--- a/eric6/Debugger/ExceptionsFilterDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Debugger/ExceptionsFilterDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -36,7 +36,8 @@ self.exceptionList.setToolTip( self.tr("List of ignored exceptions")) - self.okButton = self.buttonBox.button(QDialogButtonBox.Ok) + self.okButton = self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok) @pyqtSlot() def on_exceptionList_itemSelectionChanged(self):
--- a/eric6/Debugger/StartCoverageDialog.ui Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Debugger/StartCoverageDialog.ui Tue Mar 02 17:17:09 2021 +0100 @@ -133,6 +133,9 @@ <string><b>Virtual Environment</b> <p>Enter the virtual environment to be used. Leave it empty to use the default environment, i.e. the one configured globally or per project.</p></string> </property> + <property name="sizeAdjustPolicy"> + <enum>QComboBox::AdjustToContentsOnFirstShow</enum> + </property> </widget> </item> <item row="0" column="0">
--- a/eric6/Debugger/StartDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Debugger/StartDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -101,14 +101,15 @@ self.ui.workdirPicker.setMode(E5PathPickerModes.DirectoryMode) self.ui.workdirPicker.setDefaultDirectory( Preferences.getMultiProject("Workspace")) - self.ui.workdirPicker.setInsertPolicy(QComboBox.InsertAtTop) + self.ui.workdirPicker.setInsertPolicy( + QComboBox.InsertPolicy.InsertAtTop) self.ui.workdirPicker.setSizeAdjustPolicy( - QComboBox.AdjustToMinimumContentsLength) + QComboBox.SizeAdjustPolicy.AdjustToContents) self.clearButton = self.ui.buttonBox.addButton( - self.tr("Clear Histories"), QDialogButtonBox.ActionRole) + self.tr("Clear Histories"), QDialogButtonBox.ButtonRole.ActionRole) self.editButton = self.ui.buttonBox.addButton( - self.tr("Edit History"), QDialogButtonBox.ActionRole) + self.tr("Edit History"), QDialogButtonBox.ButtonRole.ActionRole) self.setWindowTitle(caption) self.ui.cmdlineCombo.clear() @@ -161,8 +162,9 @@ """ Private slot to enable/disable the OK button. """ - self.ui.buttonBox.button(QDialogButtonBox.Ok).setDisabled( - self.ui.modFuncCombo.currentText() == "") + self.ui.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setDisabled( + self.ui.modFuncCombo.currentText() == "") def getData(self): """ @@ -296,7 +298,7 @@ if history: from .StartHistoryEditDialog import StartHistoryEditDialog dlg = StartHistoryEditDialog(history, self) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: history = dlg.getHistory() combo = combos[historiesIndex] if combo:
--- a/eric6/Debugger/StartHistoryEditDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Debugger/StartHistoryEditDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -34,7 +34,7 @@ self.historyList.addItems(history) for row in range(self.historyList.count()): itm = self.historyList.item(row) - flags = itm.flags() | Qt.ItemIsEditable + flags = itm.flags() | Qt.ItemFlag.ItemIsEditable itm.setFlags(flags) self.__updateEditButtons() @@ -65,7 +65,7 @@ self, self.tr("Edit History Entry"), self.tr("Enter the new text:"), - QLineEdit.Normal, + QLineEdit.EchoMode.Normal, itm.text()) if ok: itm.setText(historyText)
--- a/eric6/Debugger/VariablesFilterDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Debugger/VariablesFilterDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -38,15 +38,16 @@ self.setupUi(self) self.defaultButton = self.buttonBox.addButton( - self.tr("Save Default"), QDialogButtonBox.ActionRole) + self.tr("Save Default"), QDialogButtonBox.ButtonRole.ActionRole) #populate the list widgets and set the default selection for widget in self.localsList, self.globalsList: for varType, varTypeStr in ConfigVarTypeDispStrings.items(): itm = QListWidgetItem(self.tr(varTypeStr), widget) - itm.setData(Qt.UserRole, varType) - itm.setFlags(Qt.ItemIsEnabled | Qt.ItemIsUserCheckable) - itm.setCheckState(Qt.Unchecked) + itm.setData(Qt.ItemDataRole.UserRole, varType) + itm.setFlags(Qt.ItemFlag.ItemIsEnabled | + Qt.ItemFlag.ItemIsUserCheckable) + itm.setCheckState(Qt.CheckState.Unchecked) widget.addItem(itm) lDefaultFilter, gDefaultFilter = Preferences.getVarFilters() @@ -64,14 +65,14 @@ lList = [] for row in range(self.localsList.count()): itm = self.localsList.item(row) - if itm.checkState() == Qt.Unchecked: - lList.append(itm.data(Qt.UserRole)) + if itm.checkState() == Qt.CheckState.Unchecked: + lList.append(itm.data(Qt.ItemDataRole.UserRole)) gList = [] for row in range(self.globalsList.count()): itm = self.globalsList.item(row) - if itm.checkState() == Qt.Unchecked: - gList.append(itm.data(Qt.UserRole)) + if itm.checkState() == Qt.CheckState.Unchecked: + gList.append(itm.data(Qt.ItemDataRole.UserRole)) return (lList, gList) def setSelection(self, lList, gList): @@ -85,17 +86,17 @@ """ for row in range(self.localsList.count()): itm = self.localsList.item(row) - if itm.data(Qt.UserRole) in lList: - itm.setCheckState(Qt.Unchecked) + if itm.data(Qt.ItemDataRole.UserRole) in lList: + itm.setCheckState(Qt.CheckState.Unchecked) else: - itm.setCheckState(Qt.Checked) + itm.setCheckState(Qt.CheckState.Checked) for row in range(self.globalsList.count()): itm = self.globalsList.item(row) - if itm.data(Qt.UserRole) in gList: - itm.setCheckState(Qt.Unchecked) + if itm.data(Qt.ItemDataRole.UserRole) in gList: + itm.setCheckState(Qt.CheckState.Unchecked) else: - itm.setCheckState(Qt.Checked) + itm.setCheckState(Qt.CheckState.Checked) def on_buttonBox_clicked(self, button): """
--- a/eric6/Debugger/VariablesViewer.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Debugger/VariablesViewer.py Tue Mar 02 17:17:09 2021 +0100 @@ -25,7 +25,7 @@ import Preferences import Utilities -SORT_ROLE = Qt.UserRole +SORT_ROLE = Qt.ItemDataRole.UserRole class VariableItem(object): @@ -554,9 +554,9 @@ @rtype QtCore.Qt.ItemFlag """ if not index.isValid(): - return Qt.NoItemFlags + return Qt.ItemFlag.NoItemFlags - return Qt.ItemIsEnabled | Qt.ItemIsSelectable + return Qt.ItemFlag.ItemIsEnabled | Qt.ItemFlag.ItemIsSelectable def hasChildren(self, parent=QModelIndex()): """ @@ -619,7 +619,7 @@ row = parentNode.parent.children.index(parentNode) return self.createIndex(row, 0, parentNode) - def data(self, index, role=Qt.DisplayRole): + def data(self, index, role=Qt.ItemDataRole.DisplayRole): """ Public method get the role data of item. @@ -636,7 +636,9 @@ node = index.internalPointer() column = index.column() - if role in (Qt.DisplayRole, SORT_ROLE, Qt.EditRole): + if role in ( + Qt.ItemDataRole.DisplayRole, SORT_ROLE, Qt.ItemDataRole.EditRole + ): try: if column == 0: # Sort first column with values from third column @@ -654,13 +656,13 @@ except AttributeError: return ['None', '', '', ''][column] - elif role == Qt.BackgroundRole: + elif role == Qt.ItemDataRole.BackgroundRole: if node in node.parent.changedItems: return self.__bgColorChanged elif node in node.parent.newItems: return self.__bgColorNew - elif role == Qt.ToolTipRole: + elif role == Qt.ItemDataRole.ToolTipRole: if column == 0: tooltip = node.name + node.indicator elif column == 1: @@ -701,7 +703,8 @@ return None - def headerData(self, section, orientation, role=Qt.DisplayRole): + def headerData(self, section, orientation, + role=Qt.ItemDataRole.DisplayRole): """ Public method get the header names. @@ -714,7 +717,10 @@ @return header name @rtype str or None """ - if role != Qt.DisplayRole or orientation != Qt.Horizontal: + if ( + role != Qt.ItemDataRole.DisplayRole or + orientation != Qt.Orientation.Horizontal + ): return None if section == 0: @@ -952,7 +958,8 @@ self.setSortingEnabled(True) self.setAlternatingRowColors(True) - self.setSelectionBehavior(QAbstractItemView.SelectRows) + self.setSelectionBehavior( + QAbstractItemView.SelectionBehavior.SelectRows) if self.__globalScope: self.setWindowTitle(self.tr("Global Variables")) @@ -970,7 +977,7 @@ )) header = self.header() - header.setSortIndicator(0, Qt.AscendingOrder) + header.setSortIndicator(0, Qt.SortOrder.AscendingOrder) header.setSortIndicatorShown(True) try: @@ -985,7 +992,7 @@ header.sortIndicatorChanged.connect(lambda *x: self.varModel.getMore()) self.__createPopupMenus() - self.setContextMenuPolicy(Qt.CustomContextMenu) + self.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu) self.customContextMenuRequested.connect(self.__showContextMenu) self.resortEnabled = True
--- a/eric6/Debugger/WatchPointModel.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Debugger/WatchPointModel.py Tue Mar 02 17:17:09 2021 +0100 @@ -37,11 +37,11 @@ self.tr('Enabled'), self.tr('Ignore Count'), ] - self.alignments = [Qt.Alignment(Qt.AlignLeft), - Qt.Alignment(Qt.AlignLeft), - Qt.Alignment(Qt.AlignHCenter), - Qt.Alignment(Qt.AlignHCenter), - Qt.Alignment(Qt.AlignRight), + self.alignments = [Qt.Alignment(Qt.AlignmentFlag.AlignLeft), + Qt.Alignment(Qt.AlignmentFlag.AlignLeft), + Qt.Alignment(Qt.AlignmentFlag.AlignHCenter), + Qt.Alignment(Qt.AlignmentFlag.AlignHCenter), + Qt.Alignment(Qt.AlignmentFlag.AlignRight), ] def columnCount(self, parent=None): @@ -77,19 +77,19 @@ if not index.isValid(): return None - if role == Qt.DisplayRole: + if role == Qt.ItemDataRole.DisplayRole: if index.column() in [0, 1, 4]: return self.watchpoints[index.row()][index.column()] - if role == Qt.CheckStateRole: + if role == Qt.ItemDataRole.CheckStateRole: if index.column() in [2, 3]: return self.watchpoints[index.row()][index.column()] - if role == Qt.ToolTipRole: + if role == Qt.ItemDataRole.ToolTipRole: if index.column() in [0, 1]: return self.watchpoints[index.row()][index.column()] - if role == Qt.TextAlignmentRole: + if role == Qt.ItemDataRole.TextAlignmentRole: if index.column() < len(self.alignments): return self.alignments[index.column()] @@ -103,11 +103,12 @@ @return item flags for the given index (Qt.ItemFlags) """ if not index.isValid(): - return Qt.ItemIsEnabled + return Qt.ItemFlag.ItemIsEnabled - return Qt.ItemIsEnabled | Qt.ItemIsSelectable + return Qt.ItemFlag.ItemIsEnabled | Qt.ItemFlag.ItemIsSelectable - def headerData(self, section, orientation, role=Qt.DisplayRole): + def headerData(self, section, orientation, + role=Qt.ItemDataRole.DisplayRole): """ Public method to get header data. @@ -116,7 +117,10 @@ @param role role of the requested data (Qt.ItemDataRole) @return header data """ - if orientation == Qt.Horizontal and role == Qt.DisplayRole: + if ( + orientation == Qt.Orientation.Horizontal and + role == Qt.ItemDataRole.DisplayRole + ): if section >= len(self.header): return "" else:
--- a/eric6/Debugger/WatchPointViewer.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Debugger/WatchPointViewer.py Tue Mar 02 17:17:09 2021 +0100 @@ -41,12 +41,14 @@ self.setItemsExpandable(False) self.setRootIsDecorated(False) self.setAlternatingRowColors(True) - self.setSelectionMode(QAbstractItemView.ExtendedSelection) - self.setSelectionBehavior(QAbstractItemView.SelectRows) + self.setSelectionMode( + QAbstractItemView.SelectionMode.ExtendedSelection) + self.setSelectionBehavior( + QAbstractItemView.SelectionBehavior.SelectRows) self.setWindowTitle(self.tr("Watchpoints")) - self.setContextMenuPolicy(Qt.CustomContextMenu) + self.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu) self.customContextMenuRequested.connect(self.__showContextMenu) self.doubleClicked.connect(self.__doubleClicked) @@ -66,7 +68,7 @@ super(WatchPointViewer, self).setModel(self.sortingModel) header = self.header() - header.setSortIndicator(0, Qt.AscendingOrder) + header.setSortIndicator(0, Qt.SortOrder.AscendingOrder) header.setSortIndicatorShown(True) header.setSectionsClickable(True) @@ -86,7 +88,7 @@ Private slot to resize the view when items get added, edited or deleted. """ - self.header().resizeSections(QHeaderView.ResizeToContents) + self.header().resizeSections(QHeaderView.ResizeMode.ResizeToContents) self.header().setStretchLastSection(True) def __resort(self): @@ -126,10 +128,12 @@ if selected: flags = QItemSelectionModel.SelectionFlags( - QItemSelectionModel.ClearAndSelect | QItemSelectionModel.Rows) + QItemSelectionModel.SelectionFlag.ClearAndSelect | + QItemSelectionModel.SelectionFlag.Rows) else: flags = QItemSelectionModel.SelectionFlags( - QItemSelectionModel.Deselect | QItemSelectionModel.Rows) + QItemSelectionModel.SelectionFlag.Deselect | + QItemSelectionModel.SelectionFlag.Rows) self.selectionModel().select(index, flags) def __createPopupMenus(self): @@ -259,7 +263,7 @@ """ from .EditWatchpointDialog import EditWatchpointDialog dlg = EditWatchpointDialog(("", False, True, 0, ""), self) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: cond, temp, enabled, ignorecount, special = dlg.getData() if not self.__findDuplicates(cond, special, True): self.__model.addWatchPoint(cond, special, @@ -301,7 +305,7 @@ from .EditWatchpointDialog import EditWatchpointDialog dlg = EditWatchpointDialog( (cond, temp, enabled, count, special), self) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: cond, temp, enabled, count, special = dlg.getData() if not self.__findDuplicates(cond, special, True, sindex): self.__model.setWatchPointByIndex(
--- a/eric6/E5Graphics/E5ArrowItem.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Graphics/E5ArrowItem.py Tue Mar 02 17:17:09 2021 +0100 @@ -51,14 +51,15 @@ self._type = arrowType if colors is None: - self._colors = (QColor(Qt.black), QColor(Qt.white)) + self._colors = (QColor(Qt.GlobalColor.black), + QColor(Qt.GlobalColor.white)) else: self._colors = colors self._halfLength = 13.0 - self.setFlag(QGraphicsItem.ItemIsMovable, True) - self.setFlag(QGraphicsItem.ItemIsSelectable, True) + self.setFlag(QGraphicsItem.GraphicsItemFlag.ItemIsMovable, True) + self.setFlag(QGraphicsItem.GraphicsItemFlag.ItemIsSelectable, True) def setPoints(self, xa, ya, xb, yb): """ @@ -116,8 +117,8 @@ @param widget optional reference to the widget painted on (QWidget) """ if ( - (option.state & QStyle.State_Selected) == - QStyle.State(QStyle.State_Selected) + (option.state & QStyle.StateFlag.State_Selected) == + QStyle.State(QStyle.StateFlag.State_Selected) ): width = 2 else: @@ -126,8 +127,8 @@ # draw the line first line = QLineF(self._origin, self._end) painter.setPen( - QPen(self._colors[0], width, Qt.SolidLine, Qt.FlatCap, - Qt.MiterJoin)) + QPen(self._colors[0], width, Qt.PenStyle.SolidLine, + Qt.PenCapStyle.FlatCap, Qt.PenJoinStyle.MiterJoin)) painter.drawLine(line) # draw the arrow head
--- a/eric6/E5Graphics/E5GraphicsView.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Graphics/E5GraphicsView.py Tue Mar 02 17:17:09 2021 +0100 @@ -47,12 +47,14 @@ self.__initialSceneSize = self.scene().sceneRect().size() self.setBackgroundBrush(QBrush(self.getBackgroundColor())) - self.setRenderHint(QPainter.Antialiasing, True) - self.setDragMode(QGraphicsView.RubberBandDrag) - self.setAlignment(Qt.Alignment(Qt.AlignLeft | Qt.AlignTop)) - self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOn) - self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn) - self.setViewportUpdateMode(QGraphicsView.SmartViewportUpdate) + self.setRenderHint(QPainter.RenderHint.Antialiasing, True) + self.setDragMode(QGraphicsView.DragMode.RubberBandDrag) + self.setAlignment(Qt.Alignment( + Qt.AlignmentFlag.AlignLeft | Qt.AlignmentFlag.AlignTop)) + self.setHorizontalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOn) + self.setVerticalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOn) + self.setViewportUpdateMode( + QGraphicsView.ViewportUpdateMode.SmartViewportUpdate) self.setWhatsThis(self.tr( "<b>Graphics View</b>\n" @@ -305,7 +307,7 @@ paintDevice.setViewBox(rect) paintDevice.setFileName(filename) painter = QPainter(paintDevice) - painter.setRenderHint(QPainter.Antialiasing, True) + painter.setRenderHint(QPainter.RenderHint.Antialiasing, True) self.scene().render(painter, QRectF(), rect) # step 3: reselect the widgets @@ -420,7 +422,7 @@ marginX + width, marginY + height + 2) painter.setFont(font) painter.drawText(marginX, marginY + height + 4, width, - fontHeight, Qt.AlignRight, s) + fontHeight, Qt.AlignmentFlag.AlignRight, s) if not finishX or not finishY: printer.newPage() page += 1
--- a/eric6/E5Gui/E5Action.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Gui/E5Action.py Tue Mar 02 17:17:09 2021 +0100 @@ -180,7 +180,8 @@ """ Private slot to add the primary keyboard accelerator to the tooltip. """ - shortcut = self.shortcut().toString(QKeySequence.NativeText) + shortcut = self.shortcut().toString( + QKeySequence.SequenceFormat.NativeText) if shortcut: if e5App().isLeftToRight(): fmt = "{0} ({1})"
--- a/eric6/E5Gui/E5AnimatedWidget.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Gui/E5AnimatedWidget.py Tue Mar 02 17:17:09 2021 +0100 @@ -61,7 +61,7 @@ """ Public slot to start the animation. """ - if self.__timeline.state() == QTimeLine.Running: + if self.__timeline.state() == QTimeLine.State.Running: return shown = 0 @@ -77,7 +77,7 @@ self.__startY = hidden self.__stepHeight = self.__widget.height() / 100.0 - self.__timeline.setDirection(QTimeLine.Forward) + self.__timeline.setDirection(QTimeLine.Direction.Forward) self.__timeline.start() @pyqtSlot(int) @@ -97,10 +97,10 @@ """ Public slot to hide the animated widget. """ - if self.__timeline.state() == QTimeLine.Running: + if self.__timeline.state() == QTimeLine.State.Running: return - self.__timeline.setDirection(QTimeLine.Backward) + self.__timeline.setDirection(QTimeLine.Direction.Backward) self.__timeline.finished.connect(self.close) self.__timeline.start()
--- a/eric6/E5Gui/E5Application.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Gui/E5Application.py Tue Mar 02 17:17:09 2021 +0100 @@ -11,8 +11,10 @@ from PyQt5.QtGui import QPalette from PyQt5.QtWidgets import QApplication -QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling, True) -QCoreApplication.setAttribute(Qt.AA_ShareOpenGLContexts, True) +QCoreApplication.setAttribute( + Qt.ApplicationAttribute.AA_EnableHighDpiScaling, True) +QCoreApplication.setAttribute( + Qt.ApplicationAttribute.AA_ShareOpenGLContexts, True) class E5Application(QApplication): @@ -29,8 +31,9 @@ super(E5Application, self).__init__(argv) QCoreApplication.setAttribute( - Qt.AA_DontCreateNativeWidgetSiblings, True) - QCoreApplication.setAttribute(Qt.AA_UseHighDpiPixmaps, True) + Qt.ApplicationAttribute.AA_DontCreateNativeWidgetSiblings, True) + QCoreApplication.setAttribute( + Qt.ApplicationAttribute.AA_UseHighDpiPixmaps, True) self.__objectRegistry = {} self.__pluginObjectRegistry = {} @@ -147,7 +150,7 @@ @rtype bool """ palette = self.palette() - lightness = palette.color(QPalette.Window).lightness() + lightness = palette.color(QPalette.ColorRole.Window).lightness() return lightness <= 128 e5App = QCoreApplication.instance
--- a/eric6/E5Gui/E5ClickableLabel.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Gui/E5ClickableLabel.py Tue Mar 02 17:17:09 2021 +0100 @@ -31,7 +31,7 @@ """ super(E5ClickableLabel, self).__init__(parent) - self.setCursor(Qt.PointingHandCursor) + self.setCursor(Qt.CursorShape.PointingHandCursor) def mouseReleaseEvent(self, evt): """ @@ -39,13 +39,16 @@ @param evt mouse event (QMouseEvent) """ - if evt.button() == Qt.LeftButton and self.rect().contains(evt.pos()): - if evt.modifiers() == Qt.ControlModifier: + if ( + evt.button() == Qt.MouseButton.LeftButton and + self.rect().contains(evt.pos()) + ): + if evt.modifiers() == Qt.KeyboardModifier.ControlModifier: self.middleClicked.emit(evt.globalPos()) else: self.clicked.emit(evt.globalPos()) elif ( - evt.button() == Qt.MidButton and + evt.button() == Qt.MouseButton.MidButton and self.rect().contains(evt.pos()) ): self.middleClicked.emit(evt.globalPos())
--- a/eric6/E5Gui/E5ComboSelectionDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Gui/E5ComboSelectionDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -53,7 +53,8 @@ @param txt text of the selected entry @type str """ - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(bool(txt)) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(bool(txt)) def getSelection(self): """
--- a/eric6/E5Gui/E5Completers.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Gui/E5Completers.py Tue Mar 02 17:17:09 2021 +0100 @@ -20,7 +20,7 @@ Class implementing a completer for file names. """ def __init__(self, parent=None, - completionMode=QCompleter.PopupCompletion, + completionMode=QCompleter.CompletionMode.PopupCompletion, showHidden=False): """ Constructor @@ -34,17 +34,23 @@ super(E5FileCompleter, self).__init__(parent) self.__model = QFileSystemModel(self) if showHidden: - self.__model.setFilter( - QDir.Filters(QDir.Dirs | QDir.Files | QDir.Drives | - QDir.AllDirs | QDir.Hidden)) + self.__model.setFilter(QDir.Filters( + QDir.Filter.Dirs | + QDir.Filter.Files | + QDir.Filter.Drives | + QDir.Filter.AllDirs | + QDir.Filter.Hidden)) else: self.__model.setFilter(QDir.Filters( - QDir.Dirs | QDir.Files | QDir.Drives | QDir.AllDirs)) + QDir.Filter.Dirs | + QDir.Filter.Files | + QDir.Filter.Drives | + QDir.Filter.AllDirs)) self.__model.setRootPath("") self.setModel(self.__model) self.setCompletionMode(completionMode) if isWindowsPlatform(): - self.setCaseSensitivity(Qt.CaseInsensitive) + self.setCaseSensitivity(Qt.CaseSensitivity.CaseInsensitive) if parent: parent.setCompleter(self) @@ -74,7 +80,7 @@ Class implementing a completer for directory names. """ def __init__(self, parent=None, - completionMode=QCompleter.PopupCompletion, + completionMode=QCompleter.CompletionMode.PopupCompletion, showHidden=False): """ Constructor @@ -88,16 +94,18 @@ super(E5DirCompleter, self).__init__(parent) self.__model = QFileSystemModel(self) if showHidden: - self.__model.setFilter( - QDir.Filters(QDir.Drives | QDir.AllDirs | QDir.Hidden)) + self.__model.setFilter(QDir.Filters( + QDir.Filter.Drives | + QDir.Filter.AllDirs | + QDir.Filter.Hidden)) else: self.__model.setFilter( - QDir.Filters(QDir.Drives | QDir.AllDirs)) + QDir.Filters(QDir.Filter.Drives | QDir.Filter.AllDirs)) self.__model.setRootPath("") self.setModel(self.__model) self.setCompletionMode(completionMode) if isWindowsPlatform(): - self.setCaseSensitivity(Qt.CaseInsensitive) + self.setCaseSensitivity(Qt.CaseSensitivity.CaseInsensitive) if parent: parent.setCompleter(self) @@ -127,7 +135,7 @@ Class implementing a completer for string lists. """ def __init__(self, parent=None, strings=None, - completionMode=QCompleter.PopupCompletion): + completionMode=QCompleter.CompletionMode.PopupCompletion): """ Constructor
--- a/eric6/E5Gui/E5ErrorMessage.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Gui/E5ErrorMessage.py Tue Mar 02 17:17:09 2021 +0100 @@ -24,8 +24,8 @@ _origMsgHandler = None _filterSettings = QSettings( - QSettings.IniFormat, - QSettings.UserScope, + QSettings.Format.IniFormat, + QSettings.Scope.UserScope, Globals.settingsNameOrganization, "eric6messagefilters") _defaultFilters = [ @@ -96,7 +96,7 @@ Globals.toList(_filterSettings.value( "MessageFilters", _defaultFilters)), _defaultFilters) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: filters = dlg.getFilters() _filterSettings.setValue("MessageFilters", filters) @@ -151,7 +151,7 @@ QMetaObject.invokeMethod( _msgHandlerDialog, "showMessage", - Qt.QueuedConnection, + Qt.ConnectionType.QueuedConnection, Q_ARG(str, msg)) return except RuntimeError:
--- a/eric6/E5Gui/E5FileDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Gui/E5FileDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -15,14 +15,14 @@ Options = QFileDialog.Options Option = QFileDialog.Option -ShowDirsOnly = QFileDialog.ShowDirsOnly -DontResolveSymlinks = QFileDialog.DontResolveSymlinks -DontConfirmOverwrite = QFileDialog.DontConfirmOverwrite -DontUseNativeDialog = QFileDialog.DontUseNativeDialog -ReadOnly = QFileDialog.ReadOnly -HideNameFilterDetails = QFileDialog.HideNameFilterDetails -DontUseSheet = QFileDialog.DontUseSheet -DontUseCustomDirectoryIcons = QFileDialog.DontUseCustomDirectoryIcons +ShowDirsOnly = QFileDialog.Option.ShowDirsOnly +DontResolveSymlinks = QFileDialog.Option.DontResolveSymlinks +DontConfirmOverwrite = QFileDialog.Option.DontConfirmOverwrite +DontUseNativeDialog = QFileDialog.Option.DontUseNativeDialog +ReadOnly = QFileDialog.Option.ReadOnly +HideNameFilterDetails = QFileDialog.Option.HideNameFilterDetails +DontUseSheet = QFileDialog.Option.DontUseSheet +DontUseCustomDirectoryIcons = QFileDialog.Option.DontUseCustomDirectoryIcons def __reorderFilter(filterStr, initialFilter=""): @@ -59,7 +59,7 @@ if options is None: options = QFileDialog.Options() if Globals.isLinuxPlatform(): - options |= QFileDialog.DontUseNativeDialog + options |= QFileDialog.Option.DontUseNativeDialog return QFileDialog.getOpenFileName( parent, caption, directory, filterStr, "", options)[0] @@ -82,7 +82,7 @@ if options is None: options = QFileDialog.Options() if Globals.isLinuxPlatform(): - options |= QFileDialog.DontUseNativeDialog + options |= QFileDialog.Option.DontUseNativeDialog newfilter = __reorderFilter(filterStr, initialFilter) return QFileDialog.getOpenFileName( parent, caption, directory, newfilter, initialFilter, options) @@ -103,7 +103,7 @@ if options is None: options = QFileDialog.Options() if Globals.isLinuxPlatform(): - options |= QFileDialog.DontUseNativeDialog + options |= QFileDialog.Option.DontUseNativeDialog return QFileDialog.getOpenFileNames( parent, caption, directory, filterStr, "", options)[0] @@ -127,7 +127,7 @@ if options is None: options = QFileDialog.Options() if Globals.isLinuxPlatform(): - options |= QFileDialog.DontUseNativeDialog + options |= QFileDialog.Option.DontUseNativeDialog newfilter = __reorderFilter(filterStr, initialFilter) return QFileDialog.getOpenFileNames( parent, caption, directory, newfilter, initialFilter, options) @@ -148,7 +148,7 @@ if options is None: options = QFileDialog.Options() if Globals.isLinuxPlatform(): - options |= QFileDialog.DontUseNativeDialog + options |= QFileDialog.Option.DontUseNativeDialog return QFileDialog.getSaveFileName( parent, caption, directory, filterStr, "", options)[0] @@ -171,14 +171,15 @@ if options is None: options = QFileDialog.Options() if Globals.isLinuxPlatform(): - options |= QFileDialog.DontUseNativeDialog + options |= QFileDialog.Option.DontUseNativeDialog newfilter = __reorderFilter(filterStr, initialFilter) return QFileDialog.getSaveFileName( parent, caption, directory, newfilter, initialFilter, options) def getExistingDirectory(parent=None, caption="", - directory="", options=QFileDialog.ShowDirsOnly): + directory="", + options=QFileDialog.Option.ShowDirsOnly): """ Module function to get the name of a directory. @@ -189,6 +190,6 @@ @return name of selected directory (string) """ if Globals.isLinuxPlatform(): - options |= QFileDialog.DontUseNativeDialog + options |= QFileDialog.Option.DontUseNativeDialog return QFileDialog.getExistingDirectory(parent, caption, directory, options)
--- a/eric6/E5Gui/E5FileSaveConfirmDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Gui/E5FileSaveConfirmDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -59,11 +59,11 @@ self.__buttonBox = QDialogButtonBox(self) self.__cancelButton = self.__buttonBox.addButton( - QDialogButtonBox.Cancel) + QDialogButtonBox.StandardButton.Cancel) self.__overwriteButton = self.__buttonBox.addButton( - self.tr("Overwrite"), QDialogButtonBox.AcceptRole) + self.tr("Overwrite"), QDialogButtonBox.ButtonRole.AcceptRole) self.__renameButton = self.__buttonBox.addButton( - self.tr("Rename"), QDialogButtonBox.AcceptRole) + self.tr("Rename"), QDialogButtonBox.ButtonRole.AcceptRole) self.__layout.addWidget(self.__label) self.__layout.addWidget(self.__pathPicker)
--- a/eric6/E5Gui/E5GenericDiffHighlighter.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Gui/E5GenericDiffHighlighter.py Tue Mar 02 17:17:09 2021 +0100 @@ -112,7 +112,7 @@ charFormat.setBackground(bg) if bold: - charFormat.setFontWeight(QFont.Bold) + charFormat.setFontWeight(QFont.Weight.Bold) return charFormat
--- a/eric6/E5Gui/E5Led.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Gui/E5Led.py Tue Mar 02 17:17:09 2021 +0100 @@ -85,15 +85,16 @@ gradient.setColorAt(0.6, color) if self.__framedLed: gradient.setColorAt(0.9, color.darker()) - gradient.setColorAt(1.0, self.palette().color(QPalette.Dark)) + gradient.setColorAt( + 1.0, self.palette().color(QPalette.ColorRole.Dark)) else: gradient.setColorAt(1.0, color.darker()) # now do the drawing paint = QPainter(self) - paint.setRenderHint(QPainter.Antialiasing, True) + paint.setRenderHint(QPainter.RenderHint.Antialiasing, True) paint.setBrush(QBrush(gradient)) - paint.setPen(Qt.NoPen) + paint.setPen(Qt.PenStyle.NoPen) paint.drawEllipse(1, 1, width, width) paint.end() @@ -109,14 +110,14 @@ # now do the drawing painter = QPainter(self) - painter.setRenderHint(QPainter.Antialiasing, True) + painter.setRenderHint(QPainter.RenderHint.Antialiasing, True) color = self.__led_on and self.__led_color or self.__offcolor painter.setPen(color.lighter(200)) painter.drawLine(left, 0, left, height - 1) painter.drawLine(left + 1, 0, right - 1, 0) if self.__framedLed: - painter.setPen(self.palette().color(QPalette.Dark)) + painter.setPen(self.palette().color(QPalette.ColorRole.Dark)) else: painter.setPen(color.darker()) painter.drawLine(left + 1, height - 1, right - 1, height - 1) @@ -295,7 +296,7 @@ """ super(E5ClickableLed, self).__init__(parent, color, shape, rectRatio) - self.setCursor(Qt.PointingHandCursor) + self.setCursor(Qt.CursorShape.PointingHandCursor) def mouseReleaseEvent(self, evt): """ @@ -303,13 +304,16 @@ @param evt mouse event (QMouseEvent) """ - if evt.button() == Qt.LeftButton and self.rect().contains(evt.pos()): - if evt.modifiers() == Qt.ControlModifier: + if ( + evt.button() == Qt.MouseButton.LeftButton and + self.rect().contains(evt.pos()) + ): + if evt.modifiers() == Qt.KeyboardModifier.ControlModifier: self.middleClicked.emit(evt.globalPos()) else: self.clicked.emit(evt.globalPos()) elif ( - evt.button() == Qt.MidButton and + evt.button() == Qt.MouseButton.MidButton and self.rect().contains(evt.pos()) ): self.middleClicked.emit(evt.globalPos())
--- a/eric6/E5Gui/E5LineEdit.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Gui/E5LineEdit.py Tue Mar 02 17:17:09 2021 +0100 @@ -39,7 +39,7 @@ @param evt reference to the event (QEvent) @return flag indicating, whether the event was recognized (boolean) """ - if evt.type() == QEvent.LayoutRequest: + if evt.type() == QEvent.Type.LayoutRequest: self.sizeHintChanged.emit() return QWidget.event(self, evt) @@ -74,31 +74,34 @@ self.__leftLayout = QHBoxLayout(self.__leftWidget) self.__leftLayout.setContentsMargins(0, 0, 2, 0) if QApplication.isRightToLeft(): - self.__leftLayout.setDirection(QBoxLayout.RightToLeft) + self.__leftLayout.setDirection(QBoxLayout.Direction.RightToLeft) else: - self.__leftLayout.setDirection(QBoxLayout.LeftToRight) - self.__leftLayout.setSizeConstraint(QLayout.SetFixedSize) + self.__leftLayout.setDirection(QBoxLayout.Direction.LeftToRight) + self.__leftLayout.setSizeConstraint( + QLayout.SizeConstraint.SetFixedSize) self.__rightWidget = E5LineEditSideWidget(self) self.__rightWidget.resize(0, 0) self.__rightLayout = QHBoxLayout(self.__rightWidget) self.__rightLayout.setContentsMargins(0, 0, 2, 0) if self.isRightToLeft(): - self.__rightLayout.setDirection(QBoxLayout.RightToLeft) + self.__rightLayout.setDirection(QBoxLayout.Direction.RightToLeft) else: - self.__rightLayout.setDirection(QBoxLayout.LeftToRight) + self.__rightLayout.setDirection(QBoxLayout.Direction.LeftToRight) horizontalSpacer = QSpacerItem( - 0, 0, QSizePolicy.Expanding, QSizePolicy.Minimum) + 0, 0, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum) self.__mainLayout.addWidget( - self.__leftWidget, 0, Qt.AlignVCenter | Qt.AlignLeft) + self.__leftWidget, 0, + Qt.AlignmentFlag.AlignVCenter | Qt.AlignmentFlag.AlignLeft) self.__mainLayout.addItem(horizontalSpacer) self.__mainLayout.addWidget( - self.__rightWidget, 0, Qt.AlignVCenter | Qt.AlignRight) + self.__rightWidget, 0, + Qt.AlignmentFlag.AlignVCenter | Qt.AlignmentFlag.AlignRight) if self.isRightToLeft(): - self.__mainLayout.setDirection(QBoxLayout.RightToLeft) + self.__mainLayout.setDirection(QBoxLayout.Direction.RightToLeft) else: - self.__mainLayout.setDirection(QBoxLayout.LeftToRight) + self.__mainLayout.setDirection(QBoxLayout.Direction.LeftToRight) self.setWidgetSpacing(3) self.__leftWidget.sizeHintChanged.connect(self._updateTextMargins) @@ -127,15 +130,21 @@ @param evt reference to the event (QEvent) @return flag indicating, whether the event was recognized (boolean) """ - if evt.type() == QEvent.LayoutDirectionChange: + if evt.type() == QEvent.Type.LayoutDirectionChange: if self.isRightToLeft(): - self.__mainLayout.setDirection(QBoxLayout.RightToLeft) - self.__leftLayout.setDirection(QBoxLayout.RightToLeft) - self.__rightLayout.setDirection(QBoxLayout.RightToLeft) + self.__mainLayout.setDirection( + QBoxLayout.Direction.RightToLeft) + self.__leftLayout.setDirection( + QBoxLayout.Direction.RightToLeft) + self.__rightLayout.setDirection( + QBoxLayout.Direction.RightToLeft) else: - self.__mainLayout.setDirection(QBoxLayout.LeftToRight) - self.__leftLayout.setDirection(QBoxLayout.LeftToRight) - self.__rightLayout.setDirection(QBoxLayout.LeftToRight) + self.__mainLayout.setDirection( + QBoxLayout.Direction.LeftToRight) + self.__leftLayout.setDirection( + QBoxLayout.Direction.LeftToRight) + self.__rightLayout.setDirection( + QBoxLayout.Direction.LeftToRight) return QLineEdit.event(self, evt) def _updateTextMargins(self):
--- a/eric6/E5Gui/E5LineEditButton.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Gui/E5LineEditButton.py Tue Mar 02 17:17:09 2021 +0100 @@ -27,8 +27,8 @@ self.__menu = None self.__image = None - self.setFocusPolicy(Qt.NoFocus) - self.setCursor(Qt.ArrowCursor) + self.setFocusPolicy(Qt.FocusPolicy.NoFocus) + self.setCursor(Qt.CursorShape.ArrowCursor) self.setMinimumSize(16, 16) self.clicked.connect(self.__clicked) @@ -90,7 +90,7 @@ triagPath.lineTo(startPos.x() + 4, startPos.y()) triagPath.lineTo(startPos.x() + 2, startPos.y() + 2) triagPath.closeSubpath() - painter.setPen(Qt.black) - painter.setBrush(Qt.black) - painter.setRenderHint(QPainter.Antialiasing, False) + painter.setPen(Qt.GlobalColor.black) + painter.setBrush(Qt.GlobalColor.black) + painter.setRenderHint(QPainter.RenderHint.Antialiasing, False) painter.drawPath(triagPath)
--- a/eric6/E5Gui/E5ListSelectionDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Gui/E5ListSelectionDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -20,7 +20,8 @@ Class implementing a dialog to select from a list of strings. """ def __init__(self, entries, - selectionMode=QAbstractItemView.ExtendedSelection, + selectionMode=QAbstractItemView.SelectionMode + .ExtendedSelection, title="", message="", checkBoxSelection=False, parent=None): """ Constructor @@ -50,17 +51,20 @@ self.__checkCount = 0 self.__isCheckBoxSelection = checkBoxSelection if self.__isCheckBoxSelection: - self.selectionList.setSelectionMode(QAbstractItemView.NoSelection) + self.selectionList.setSelectionMode( + QAbstractItemView.SelectionMode.NoSelection) for entry in entries: itm = QListWidgetItem(entry) - itm.setFlags(Qt.ItemIsUserCheckable | Qt.ItemIsEnabled) - itm.setCheckState(Qt.Unchecked) + itm.setFlags(Qt.ItemFlag.ItemIsUserCheckable | + Qt.ItemFlag.ItemIsEnabled) + itm.setCheckState(Qt.CheckState.Unchecked) self.selectionList.addItem(itm) else: self.selectionList.setSelectionMode(selectionMode) self.selectionList.addItems(entries) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) @pyqtSlot() def on_selectionList_itemSelectionChanged(self): @@ -68,8 +72,9 @@ Private slot handling a change of the selection. """ if not self.__isCheckBoxSelection: - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( - len(self.selectionList.selectedItems()) > 0) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled( + len(self.selectionList.selectedItems()) > 0) def on_selectionList_itemChanged(self, itm): """ @@ -79,11 +84,12 @@ @type QListWidgetItem """ if self.__isCheckBoxSelection: - if itm.checkState() == Qt.Checked: + if itm.checkState() == Qt.CheckState.Checked: self.__checkCount += 1 else: self.__checkCount -= 1 - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled( self.__checkCount > 0) def getSelection(self): @@ -97,7 +103,7 @@ if self.__isCheckBoxSelection: for row in range(self.selectionList.count()): item = self.selectionList.item(row) - if item.checkState() == Qt.Checked: + if item.checkState() == Qt.CheckState.Checked: entries.append(item.text()) else: for item in self.selectionList.selectedItems():
--- a/eric6/E5Gui/E5ListView.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Gui/E5ListView.py Tue Mar 02 17:17:09 2021 +0100 @@ -22,7 +22,7 @@ @param evt reference to the event (QKeyEvent) """ if ( - evt.key() in [Qt.Key_Delete, Qt.Key_Backspace] and + evt.key() in [Qt.Key.Key_Delete, Qt.Key.Key_Backspace] and self.model() is not None ): self.removeSelected() @@ -49,7 +49,8 @@ idx = self.model().index(row - 1, 0, self.rootIndex()) self.selectionModel().select( idx, - QItemSelectionModel.SelectCurrent | QItemSelectionModel.Rows) + QItemSelectionModel.SelectionFlag.SelectCurrent | + QItemSelectionModel.SelectionFlag.Rows) self.setCurrentIndex(idx) def removeAll(self):
--- a/eric6/E5Gui/E5MapWidget.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Gui/E5MapWidget.py Tue Mar 02 17:17:09 2021 +0100 @@ -23,7 +23,7 @@ @param parent reference to the parent widget (QWidget) """ super(E5MapWidget, self).__init__(parent) - self.setAttribute(Qt.WA_OpaquePaintEvent) + self.setAttribute(Qt.WidgetAttribute.WA_OpaquePaintEvent) self.__width = 14 self.__lineBorder = 1 @@ -45,10 +45,10 @@ """ if self.__backgroundColor.toHsv().value() < 128: # dark background, use white slider - self.__sliderColor = Qt.white + self.__sliderColor = Qt.GlobalColor.white else: # light background, use black slider - self.__sliderColor = Qt.black + self.__sliderColor = Qt.GlobalColor.black def __updateMasterViewportWidth(self): """ @@ -71,7 +71,8 @@ @param master map master widget (QAbstractScrollArea) """ self._master = master - self._master.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn) + self._master.setVerticalScrollBarPolicy( + Qt.ScrollBarPolicy.ScrollBarAlwaysOn) self._master.verticalScrollBar().valueChanged.connect(self.update) self._master.verticalScrollBar().rangeChanged.connect(self.update) self.__updateMasterViewportWidth() @@ -203,7 +204,7 @@ if self._master: penColor = self.__sliderColor painter.setPen(penColor) - brushColor = Qt.transparent + brushColor = Qt.GlobalColor.transparent painter.setBrush(QBrush(brushColor)) painter.drawRect(self.__generateSliderRange( self._master.verticalScrollBar())) @@ -224,7 +225,7 @@ @param event reference to the mouse event (QMouseEvent) """ - if event.button() == Qt.LeftButton and self._master: + if event.button() == Qt.MouseButton.LeftButton and self._master: vsb = self._master.verticalScrollBar() value = self.position2Value(event.pos().y() - 1) vsb.setValue(value - 0.5 * vsb.pageStep()) # center on page @@ -236,7 +237,7 @@ @param event reference to the mouse event (QMouseEvent) """ - if event.buttons() & Qt.LeftButton and self._master: + if event.buttons() & Qt.MouseButton.LeftButton and self._master: vsb = self._master.verticalScrollBar() value = self.position2Value(event.pos().y() - 1) vsb.setValue(value - 0.5 * vsb.pageStep()) # center on page @@ -250,7 +251,7 @@ isVertical = event.angleDelta().x() == 0 if ( self._master and - event.modifiers() == Qt.NoModifier and + event.modifiers() == Qt.KeyboardModifier.NoModifier and isVertical ): QCoreApplication.sendEvent(self._master.verticalScrollBar(), event)
--- a/eric6/E5Gui/E5MessageBox.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Gui/E5MessageBox.py Tue Mar 02 17:17:09 2021 +0100 @@ -15,46 +15,46 @@ ############################################################################### # QMessageBox.Icon -NoIcon = QMessageBox.NoIcon -Critical = QMessageBox.Critical -Information = QMessageBox.Information -Question = QMessageBox.Question -Warning = QMessageBox.Warning # __IGNORE_WARNING_M131__ +NoIcon = QMessageBox.Icon.NoIcon +Critical = QMessageBox.Icon.Critical +Information = QMessageBox.Icon.Information +Question = QMessageBox.Icon.Question +Warning = QMessageBox.Icon.Warning # __IGNORE_WARNING_M131__ StandardButtons = QMessageBox.StandardButtons # QMessageBox.StandardButton -Abort = QMessageBox.Abort -Apply = QMessageBox.Apply -Cancel = QMessageBox.Cancel -Close = QMessageBox.Close -Discard = QMessageBox.Discard -Help = QMessageBox.Help -Ignore = QMessageBox.Ignore -No = QMessageBox.No -NoToAll = QMessageBox.NoToAll -Ok = QMessageBox.Ok -Open = QMessageBox.Open -Reset = QMessageBox.Reset -RestoreDefaults = QMessageBox.RestoreDefaults -Retry = QMessageBox.Retry -Save = QMessageBox.Save -SaveAll = QMessageBox.SaveAll -Yes = QMessageBox.Yes -YesToAll = QMessageBox.YesToAll -NoButton = QMessageBox.NoButton +Abort = QMessageBox.StandardButton.Abort +Apply = QMessageBox.StandardButton.Apply +Cancel = QMessageBox.StandardButton.Cancel +Close = QMessageBox.StandardButton.Close +Discard = QMessageBox.StandardButton.Discard +Help = QMessageBox.StandardButton.Help +Ignore = QMessageBox.StandardButton.Ignore +No = QMessageBox.StandardButton.No +NoToAll = QMessageBox.StandardButton.NoToAll +Ok = QMessageBox.StandardButton.Ok +Open = QMessageBox.StandardButton.Open +Reset = QMessageBox.StandardButton.Reset +RestoreDefaults = QMessageBox.StandardButton.RestoreDefaults +Retry = QMessageBox.StandardButton.Retry +Save = QMessageBox.StandardButton.Save +SaveAll = QMessageBox.StandardButton.SaveAll +Yes = QMessageBox.StandardButton.Yes +YesToAll = QMessageBox.StandardButton.YesToAll +NoButton = QMessageBox.StandardButton.NoButton # QMessageBox.ButtonRole -AcceptRole = QMessageBox.AcceptRole -ActionRole = QMessageBox.ActionRole -ApplyRole = QMessageBox.ApplyRole -DestructiveRole = QMessageBox.DestructiveRole -InvalidRole = QMessageBox.InvalidRole -HelpRole = QMessageBox.HelpRole -NoRole = QMessageBox.NoRole -RejectRole = QMessageBox.RejectRole -ResetRole = QMessageBox.ResetRole -YesRole = QMessageBox.YesRole +AcceptRole = QMessageBox.ButtonRole.AcceptRole +ActionRole = QMessageBox.ButtonRole.ActionRole +ApplyRole = QMessageBox.ButtonRole.ApplyRole +DestructiveRole = QMessageBox.ButtonRole.DestructiveRole +InvalidRole = QMessageBox.ButtonRole.InvalidRole +HelpRole = QMessageBox.ButtonRole.HelpRole +NoRole = QMessageBox.ButtonRole.NoRole +RejectRole = QMessageBox.ButtonRole.RejectRole +ResetRole = QMessageBox.ButtonRole.ResetRole +YesRole = QMessageBox.ButtonRole.YesRole ############################################################################### ## Replacement for the QMessageBox class ## @@ -66,7 +66,7 @@ Class implementing a replacement for QMessageBox. """ def __init__(self, icon, title, text, modal=False, - buttons=QMessageBox.NoButton, + buttons=QMessageBox.StandardButton.NoButton, parent=None): """ Constructor @@ -82,11 +82,11 @@ self.setIcon(icon) if modal: if parent is not None: - self.setWindowModality(Qt.WindowModal) + self.setWindowModality(Qt.WindowModality.WindowModal) else: - self.setWindowModality(Qt.ApplicationModal) + self.setWindowModality(Qt.WindowModality.ApplicationModal) else: - self.setWindowModality(Qt.NonModal) + self.setWindowModality(Qt.WindowModality.NonModal) if title == "": self.setWindowTitle("{0}".format( QApplication.applicationName())) @@ -102,8 +102,9 @@ def __messageBox(parent, title, text, icon, - buttons=QMessageBox.Ok, defaultButton=QMessageBox.NoButton, - textFormat=Qt.AutoText): + buttons=QMessageBox.StandardButton.Ok, + defaultButton=QMessageBox.StandardButton.NoButton, + textFormat=Qt.TextFormat.AutoText): """ Private module function to show a modal message box. @@ -121,7 +122,7 @@ messageBox = QMessageBox(parent) messageBox.setIcon(icon) if parent is not None: - messageBox.setWindowModality(Qt.WindowModal) + messageBox.setWindowModality(Qt.WindowModality.WindowModal) if title == "": messageBox.setWindowTitle("{0}".format( QApplication.applicationName())) @@ -135,7 +136,7 @@ messageBox.exec() clickedButton = messageBox.clickedButton() if clickedButton is None: - return QMessageBox.NoButton + return QMessageBox.StandardButton.NoButton else: return messageBox.standardButton(clickedButton) @@ -145,7 +146,8 @@ def critical(parent, title, text, - buttons=QMessageBox.Ok, defaultButton=QMessageBox.NoButton): + buttons=QMessageBox.StandardButton.Ok, + defaultButton=QMessageBox.StandardButton.NoButton): """ Function to show a modal critical message box. @@ -158,12 +160,13 @@ (QMessageBox.StandardButton) @return button pressed by the user (QMessageBox.StandardButton) """ - return __messageBox(parent, title, text, QMessageBox.Critical, + return __messageBox(parent, title, text, QMessageBox.Icon.Critical, buttons, defaultButton) def information(parent, title, text, - buttons=QMessageBox.Ok, defaultButton=QMessageBox.NoButton): + buttons=QMessageBox.StandardButton.Ok, + defaultButton=QMessageBox.StandardButton.NoButton): """ Function to show a modal information message box. @@ -176,12 +179,13 @@ (QMessageBox.StandardButton) @return button pressed by the user (QMessageBox.StandardButton) """ - return __messageBox(parent, title, text, QMessageBox.Information, + return __messageBox(parent, title, text, QMessageBox.Icon.Information, buttons, defaultButton) def question(parent, title, text, - buttons=QMessageBox.Ok, defaultButton=QMessageBox.NoButton): + buttons=QMessageBox.StandardButton.Ok, + defaultButton=QMessageBox.StandardButton.NoButton): """ Function to show a modal question message box. @@ -194,12 +198,13 @@ (QMessageBox.StandardButton) @return button pressed by the user (QMessageBox.StandardButton) """ - return __messageBox(parent, title, text, QMessageBox.Question, + return __messageBox(parent, title, text, QMessageBox.Icon.Question, buttons, defaultButton) def warning(parent, title, text, - buttons=QMessageBox.Ok, defaultButton=QMessageBox.NoButton): + buttons=QMessageBox.StandardButton.Ok, + defaultButton=QMessageBox.StandardButton.NoButton): """ Function to show a modal warning message box. @@ -212,7 +217,7 @@ (QMessageBox.StandardButton) @return button pressed by the user (QMessageBox.StandardButton) """ - return __messageBox(parent, title, text, QMessageBox.Warning, + return __messageBox(parent, title, text, QMessageBox.Icon.Warning, buttons, defaultButton) ############################################################################### @@ -221,7 +226,7 @@ def yesNo(parent, title, text, icon=Question, yesDefault=False, - textFormat=Qt.AutoText): + textFormat=Qt.TextFormat.AutoText): """ Function to show a model yes/no message box. @@ -241,13 +246,16 @@ res = __messageBox( parent, title, text, icon, - QMessageBox.StandardButtons(QMessageBox.Yes | QMessageBox.No), - yesDefault and QMessageBox.Yes or QMessageBox.No, + QMessageBox.StandardButtons(QMessageBox.StandardButton.Yes | + QMessageBox.StandardButton.No), + yesDefault and QMessageBox.StandardButton.Yes or + QMessageBox.StandardButton.No, textFormat) - return res == QMessageBox.Yes + return res == QMessageBox.StandardButton.Yes -def retryAbort(parent, title, text, icon=Question, textFormat=Qt.AutoText): +def retryAbort(parent, title, text, icon=Question, + textFormat=Qt.TextFormat.AutoText): """ Function to show a model abort/retry message box. @@ -265,13 +273,15 @@ res = __messageBox( parent, title, text, icon, - QMessageBox.StandardButtons(QMessageBox.Retry | QMessageBox.Abort), - QMessageBox.Retry, + QMessageBox.StandardButtons(QMessageBox.StandardButton.Retry | + QMessageBox.StandardButton.Abort), + QMessageBox.StandardButton.Retry, textFormat) - return res == QMessageBox.Retry + return res == QMessageBox.StandardButton.Retry -def okToClearData(parent, title, text, saveFunc, textFormat=Qt.AutoText): +def okToClearData(parent, title, text, saveFunc, + textFormat=Qt.TextFormat.AutoText): """ Function to show a model message box to ask for clearing the data. @@ -284,13 +294,15 @@ @return flag indicating that it is ok to clear the data (boolean) """ res = __messageBox( - parent, title, text, QMessageBox.Warning, + parent, title, text, QMessageBox.Icon.Warning, QMessageBox.StandardButtons( - QMessageBox.Abort | QMessageBox.Discard | QMessageBox.Save), - QMessageBox.Save, + QMessageBox.StandardButton.Abort | + QMessageBox.StandardButton.Discard | + QMessageBox.StandardButton.Save), + QMessageBox.StandardButton.Save, textFormat) - if res == QMessageBox.Abort: + if res == QMessageBox.StandardButton.Abort: return False - if res == QMessageBox.Save: + if res == QMessageBox.StandardButton.Save: return saveFunc() return True
--- a/eric6/E5Gui/E5ModelMenu.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Gui/E5ModelMenu.py Tue Mar 02 17:17:09 2021 +0100 @@ -41,8 +41,9 @@ self.setAcceptDrops(True) - self._mouseButton = Qt.NoButton - self._keyboardModifiers = Qt.KeyboardModifiers(Qt.NoModifier) + self._mouseButton = Qt.MouseButton.NoButton + self._keyboardModifiers = Qt.KeyboardModifiers( + Qt.KeyboardModifier.NoModifier) self.__dropRow = -1 self.__dropIndex = None @@ -203,7 +204,7 @@ modelMenu.triggered.disconnect(modelMenu.__actionTriggered) modelMenu.setTitle(title) - icon = parent.data(Qt.DecorationRole) + icon = parent.data(Qt.ItemDataRole.DecorationRole) if icon == NotImplemented or icon is None: icon = UI.PixmapCache.getIcon("defaultIcon") modelMenu.setIcon(icon) @@ -243,7 +244,7 @@ @param idx index of the item to create an action for (QModelIndex) @return reference to the created action (QAction) """ - icon = idx.data(Qt.DecorationRole) + icon = idx.data(Qt.ItemDataRole.DecorationRole) if icon == NotImplemented or icon is None: icon = UI.PixmapCache.getIcon("defaultIcon") action = self.makeAction(icon, idx.data(), self) @@ -269,7 +270,8 @@ self.__maxWidth = fm.horizontalAdvance("m") * 30 except AttributeError: self.__maxWidth = fm.width('m') * 30 - smallText = fm.elidedText(text, Qt.ElideMiddle, self.__maxWidth) + smallText = fm.elidedText(text, Qt.TextElideMode.ElideMiddle, + self.__maxWidth) return QAction(icon, smallText, parent) @@ -354,7 +356,7 @@ @param evt reference to the event object (QMouseEvent) """ - if evt.button() == Qt.LeftButton: + if evt.button() == Qt.MouseButton.LeftButton: self.__dragStartPosition = evt.pos() super(E5ModelMenu, self).mousePressEvent(evt) @@ -368,7 +370,7 @@ super(E5ModelMenu, self).mouseMoveEvent(evt) return - if not (evt.buttons() & Qt.LeftButton): + if not (evt.buttons() & Qt.MouseButton.LeftButton): super(E5ModelMenu, self).mouseMoveEvent(evt) return @@ -397,7 +399,7 @@ actionRect = self.actionGeometry(act) drag.setPixmap(self.grab(actionRect)) - if drag.exec() == Qt.MoveAction: + if drag.exec() == Qt.DropAction.MoveAction: row = idx.row() if self.__dropIndex == idx.parent() and self.__dropRow <= row: row += 1 @@ -417,7 +419,7 @@ self._mouseButton = evt.button() self._keyboardModifiers = evt.modifiers() - if evt.button() == Qt.LeftButton: + if evt.button() == Qt.MouseButton.LeftButton: self.__dragStartPosition = QPoint() super(E5ModelMenu, self).mouseReleaseEvent(evt) @@ -426,8 +428,9 @@ """ Public method to reset the saved internal state. """ - self._mouseButton = Qt.NoButton - self._keyboardModifiers = Qt.KeyboardModifiers(Qt.NoModifier) + self._mouseButton = Qt.MouseButton.NoButton + self._keyboardModifiers = Qt.KeyboardModifiers( + Qt.KeyboardModifier.NoModifier) def removeEntry(self, idx): """
--- a/eric6/E5Gui/E5ModelToolBar.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Gui/E5ModelToolBar.py Tue Mar 02 17:17:09 2021 +0100 @@ -42,8 +42,9 @@ self.setAcceptDrops(True) - self._mouseButton = Qt.NoButton - self._keyboardModifiers = Qt.KeyboardModifiers(Qt.NoModifier) + self._mouseButton = Qt.MouseButton.NoButton + self._keyboardModifiers = Qt.KeyboardModifiers( + Qt.KeyboardModifier.NoModifier) self.__dropRow = -1 self.__dropIndex = None @@ -109,8 +110,8 @@ for i in range(self.__model.rowCount(self.__root)): idx = self.__model.index(i, 0, self.__root) - title = idx.data(Qt.DisplayRole) - icon = idx.data(Qt.DecorationRole) + title = idx.data(Qt.ItemDataRole.DisplayRole) + icon = idx.data(Qt.ItemDataRole.DecorationRole) if icon == NotImplemented or icon is None: icon = QIcon() folder = self.__model.hasChildren(idx) @@ -126,8 +127,10 @@ menu.setModel(self.__model) menu.setRootIndex(idx) act.setMenu(menu) - button.setPopupMode(QToolButton.InstantPopup) - button.setToolButtonStyle(Qt.ToolButtonTextBesideIcon) + button.setPopupMode( + QToolButton.ToolButtonPopupMode.InstantPopup) + button.setToolButtonStyle( + Qt.ToolButtonStyle.ToolButtonTextBesideIcon) def index(self, action): """ @@ -165,15 +168,15 @@ @param evt reference to the event (QEvent) @return flag indicating that the event should be filtered out (boolean) """ - if evt.type() == QEvent.MouseButtonRelease: + if evt.type() == QEvent.Type.MouseButtonRelease: self._mouseButton = evt.button() self._keyboardModifiers = evt.modifiers() act = obj.defaultAction() idx = self.index(act) if idx.isValid(): self.activated[QModelIndex].emit(idx) - elif evt.type() == QEvent.MouseButtonPress: - if evt.buttons() & Qt.LeftButton: + elif evt.type() == QEvent.Type.MouseButtonPress: + if evt.buttons() & Qt.MouseButton.LeftButton: self.__dragStartPosition = self.mapFromGlobal(evt.globalPos()) return False @@ -232,7 +235,7 @@ super(E5ModelToolBar, self).mouseMoveEvent(evt) return - if not (evt.buttons() & Qt.LeftButton): + if not (evt.buttons() & Qt.MouseButton.LeftButton): super(E5ModelToolBar, self).mouseMoveEvent(evt) return @@ -256,7 +259,7 @@ actionRect = self.actionGeometry(act) drag.setPixmap(self.grab(actionRect)) - if drag.exec() == Qt.MoveAction: + if drag.exec() == Qt.DropAction.MoveAction: row = idx.row() if self.__dropIndex == idx.parent() and self.__dropRow <= row: row += 1 @@ -285,5 +288,6 @@ """ Public method to reset the saved internal state. """ - self._mouseButton = Qt.NoButton - self._keyboardModifiers = Qt.KeyboardModifiers(Qt.NoModifier) + self._mouseButton = Qt.MouseButton.NoButton + self._keyboardModifiers = Qt.KeyboardModifiers( + Qt.KeyboardModifier.NoModifier)
--- a/eric6/E5Gui/E5OverrideCursor.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Gui/E5OverrideCursor.py Tue Mar 02 17:17:09 2021 +0100 @@ -18,7 +18,7 @@ """ Class implementing a context manager class for an override cursor. """ - def __init__(self, cursorShape=Qt.WaitCursor): + def __init__(self, cursorShape=Qt.CursorShape.WaitCursor): """ Constructor @@ -35,7 +35,8 @@ @rtype E5OverrideCursor """ QGuiApplication.setOverrideCursor(QCursor(self.__cursorShape)) - QGuiApplication.processEvents(QEventLoop.ExcludeUserInputEvents) + QGuiApplication.processEvents( + QEventLoop.ProcessEventsFlag.ExcludeUserInputEvents) return self @@ -51,7 +52,8 @@ @rtype None """ QGuiApplication.restoreOverrideCursor() - QGuiApplication.processEvents(QEventLoop.ExcludeUserInputEvents) + QGuiApplication.processEvents( + QEventLoop.ProcessEventsFlag.ExcludeUserInputEvents) return None # __IGNORE_WARNING_M831__ @@ -80,7 +82,8 @@ if cursor is not None: self.__cursorShape = cursor.shape() QGuiApplication.restoreOverrideCursor() - QGuiApplication.processEvents(QEventLoop.ExcludeUserInputEvents) + QGuiApplication.processEvents( + QEventLoop.ProcessEventsFlag.ExcludeUserInputEvents) return self @@ -97,7 +100,8 @@ """ if self.__cursorShape is not None: QGuiApplication.setOverrideCursor(QCursor(self.__cursorShape)) - QGuiApplication.processEvents(QEventLoop.ExcludeUserInputEvents) + QGuiApplication.processEvents( + QEventLoop.ProcessEventsFlag.ExcludeUserInputEvents) return None # __IGNORE_WARNING_M831__ @@ -106,7 +110,7 @@ """ Class implementing a QProcess subclass controlling an override cursor. """ - def __init__(self, parent=None, cursorShape=Qt.WaitCursor): + def __init__(self, parent=None, cursorShape=Qt.CursorShape.WaitCursor): """ Constructor @@ -128,7 +132,8 @@ Private slot setting the cursor after the process has started. """ QGuiApplication.setOverrideCursor(QCursor(self.__cursorShape)) - QGuiApplication.processEvents(QEventLoop.ExcludeUserInputEvents) + QGuiApplication.processEvents( + QEventLoop.ProcessEventsFlag.ExcludeUserInputEvents) @pyqtSlot() def __processFinished(self): @@ -136,4 +141,5 @@ Private slot resetting the cursor when the process finished. """ QGuiApplication.restoreOverrideCursor() - QGuiApplication.processEvents(QEventLoop.ExcludeUserInputEvents) + QGuiApplication.processEvents( + QEventLoop.ProcessEventsFlag.ExcludeUserInputEvents)
--- a/eric6/E5Gui/E5PassivePopup.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Gui/E5PassivePopup.py Tue Mar 02 17:17:09 2021 +0100 @@ -41,7 +41,7 @@ self.__fixedPosition = QPoint() self.setWindowFlags(POPUP_FLAGS) - self.setFrameStyle(QFrame.Box | QFrame.Plain) + self.setFrameStyle(QFrame.Shape.Box | QFrame.Shadow.Plain) self.setLineWidth(2) self.__hideTimer.timeout.connect(self.hide) self.clicked.connect(self.hide) @@ -235,5 +235,5 @@ DEFAULT_POPUP_TYPE = E5PassivePopup.Boxed DEFAULT_POPUP_TIME = 6 * 1000 POPUP_FLAGS = Qt.WindowFlags( - Qt.Tool | Qt.X11BypassWindowManagerHint | - Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint) + Qt.WindowType.Tool | Qt.WindowType.X11BypassWindowManagerHint | + Qt.WindowType.WindowStaysOnTopHint | Qt.WindowType.FramelessWindowHint)
--- a/eric6/E5Gui/E5PathPicker.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Gui/E5PathPicker.py Tue Mar 02 17:17:09 2021 +0100 @@ -96,7 +96,7 @@ "E5PathPickerBase", "Enter Path Name")) self.__button = QToolButton(self) - self.__button.setToolButtonStyle(Qt.ToolButtonIconOnly) + self.__button.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonIconOnly) self.__button.setIcon(UI.PixmapCache.getIcon("open")) self.__layout.addWidget(self._editor) @@ -110,8 +110,9 @@ self._editor.editTextChanged.connect(self.editTextChanged) self.setFocusProxy(self._editor) - self.setFocusPolicy(Qt.StrongFocus) - self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred) + self.setFocusPolicy(Qt.FocusPolicy.StrongFocus) + self.setSizePolicy(QSizePolicy.Policy.Expanding, + QSizePolicy.Policy.Preferred) self.__button.setEnabled(self.__mode != E5PathPickerModes.NoMode)
--- a/eric6/E5Gui/E5PathPickerDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Gui/E5PathPickerDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -35,7 +35,8 @@ self.__pathPicker = E5PathPicker(self) self.__buttonBox = QDialogButtonBox( - QDialogButtonBox.Cancel | QDialogButtonBox.Ok, self) + QDialogButtonBox.StandardButton.Cancel | + QDialogButtonBox.StandardButton.Ok, self) self.__layout.addWidget(self.__label) self.__layout.addWidget(self.__pathPicker) @@ -150,7 +151,7 @@ dlg.setPickerFilters(";;".join(filters)) # step 2: show the dialog and get the result - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: ok = True path = dlg.getPath().strip() else:
--- a/eric6/E5Gui/E5PlainTextDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Gui/E5PlainTextDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -33,7 +33,8 @@ self.setupUi(self) self.copyButton = self.buttonBox.addButton( - self.tr("Copy to Clipboard"), QDialogButtonBox.ActionRole) + self.tr("Copy to Clipboard"), + QDialogButtonBox.ButtonRole.ActionRole) self.copyButton.clicked.connect(self.on_copyButton_clicked) self.setWindowTitle(title)
--- a/eric6/E5Gui/E5ProcessDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Gui/E5ProcessDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -48,8 +48,10 @@ super(E5ProcessDialog, self).__init__(parent) self.setupUi(self) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) font = Preferences.getEditorOtherFonts("MonospacedFont") self.resultbox.setFontFamily(font.family()) @@ -77,7 +79,7 @@ """ if ( self.__process is not None and - self.__process.state() != QProcess.NotRunning + self.__process.state() != QProcess.ProcessState.NotRunning ): self.__process.terminate() QTimer.singleShot(2000, self.__process.kill) @@ -88,11 +90,15 @@ self.__process = None - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) - self.buttonBox.button(QDialogButtonBox.Close).setFocus( - Qt.OtherFocusReason) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setFocus( + Qt.FocusReason.OtherFocusReason) def on_buttonBox_clicked(self, button): """ @@ -101,9 +107,13 @@ @param button button that was clicked @type QAbstractButton """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() - elif button == self.buttonBox.button(QDialogButtonBox.Cancel): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): self.statusLabel.setText(self.tr("Process canceled.")) self.__finish() @@ -116,10 +126,13 @@ @param exitStatus exit status of the process @type QProcess.ExitStatus """ - self.__normal = (exitStatus == QProcess.NormalExit) and (exitCode == 0) + self.__normal = ( + (exitStatus == QProcess.ExitStatus.NormalExit) and + (exitCode == 0) + ) if self.__normal: self.statusLabel.setText(self.tr("Process finished successfully.")) - elif exitStatus == QProcess.CrashExit: + elif exitStatus == QProcess.ExitStatus.CrashExit: self.statusLabel.setText(self.tr("Process crashed.")) else: self.statusLabel.setText( @@ -256,9 +269,9 @@ @type bool """ if isOn: - self.input.setEchoMode(QLineEdit.Password) + self.input.setEchoMode(QLineEdit.EchoMode.Password) else: - self.input.setEchoMode(QLineEdit.Normal) + self.input.setEchoMode(QLineEdit.EchoMode.Normal) @pyqtSlot() def on_sendButton_clicked(self):
--- a/eric6/E5Gui/E5SideBar.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Gui/E5SideBar.py Tue Mar 02 17:17:09 2021 +0100 @@ -45,7 +45,7 @@ self.__tabBar = QTabBar() self.__tabBar.setDrawBase(True) - self.__tabBar.setShape(QTabBar.RoundedNorth) + self.__tabBar.setShape(QTabBar.Shape.RoundedNorth) self.__tabBar.setUsesScrollButtons(True) self.__tabBar.setDrawBase(False) self.__stackedWidget = QStackedWidget(self) @@ -57,9 +57,9 @@ self.__autoHideButton.setChecked(True) self.__autoHideButton.setToolTip( self.tr("Deselect to activate automatic collapsing")) - self.barLayout = QBoxLayout(QBoxLayout.LeftToRight) + self.barLayout = QBoxLayout(QBoxLayout.Direction.LeftToRight) self.barLayout.setContentsMargins(0, 0, 0, 0) - self.layout = QBoxLayout(QBoxLayout.TopToBottom) + self.layout = QBoxLayout(QBoxLayout.Direction.TopToBottom) self.layout.setContentsMargins(0, 0, 0, 0) self.layout.setSpacing(0) self.barLayout.addWidget(self.__autoHideButton) @@ -239,7 +239,7 @@ @return flag indicating, if the event was handled (boolean) """ if obj == self.__tabBar: - if evt.type() == QEvent.MouseButtonPress: + if evt.type() == QEvent.Type.MouseButtonPress: pos = evt.pos() for i in range(self.__tabBar.count()): if self.__tabBar.tabRect(i).contains(pos): @@ -253,7 +253,7 @@ return True elif self.isMinimized(): self.expand() - elif evt.type() == QEvent.Wheel: + elif evt.type() == QEvent.Type.Wheel: delta = evt.angleDelta().y() if delta > 0: self.prevTab() @@ -439,33 +439,35 @@ @param orient orientation of the sidebar (North, East, South, West) """ if orient == E5SideBar.North: - self.__tabBar.setShape(QTabBar.RoundedNorth) + self.__tabBar.setShape(QTabBar.Shape.RoundedNorth) self.__tabBar.setSizePolicy( - QSizePolicy.Expanding, QSizePolicy.Preferred) - self.barLayout.setDirection(QBoxLayout.LeftToRight) - self.layout.setDirection(QBoxLayout.TopToBottom) - self.layout.setAlignment(self.barLayout, Qt.AlignLeft) + QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Preferred) + self.barLayout.setDirection(QBoxLayout.Direction.LeftToRight) + self.layout.setDirection(QBoxLayout.Direction.TopToBottom) + self.layout.setAlignment(self.barLayout, + Qt.AlignmentFlag.AlignLeft) elif orient == E5SideBar.East: - self.__tabBar.setShape(QTabBar.RoundedEast) + self.__tabBar.setShape(QTabBar.Shape.RoundedEast) self.__tabBar.setSizePolicy( - QSizePolicy.Preferred, QSizePolicy.Expanding) - self.barLayout.setDirection(QBoxLayout.TopToBottom) - self.layout.setDirection(QBoxLayout.RightToLeft) - self.layout.setAlignment(self.barLayout, Qt.AlignTop) + QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Expanding) + self.barLayout.setDirection(QBoxLayout.Direction.TopToBottom) + self.layout.setDirection(QBoxLayout.Direction.RightToLeft) + self.layout.setAlignment(self.barLayout, Qt.AlignmentFlag.AlignTop) elif orient == E5SideBar.South: - self.__tabBar.setShape(QTabBar.RoundedSouth) + self.__tabBar.setShape(QTabBar.Shape.RoundedSouth) self.__tabBar.setSizePolicy( - QSizePolicy.Expanding, QSizePolicy.Preferred) - self.barLayout.setDirection(QBoxLayout.LeftToRight) - self.layout.setDirection(QBoxLayout.BottomToTop) - self.layout.setAlignment(self.barLayout, Qt.AlignLeft) + QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Preferred) + self.barLayout.setDirection(QBoxLayout.Direction.LeftToRight) + self.layout.setDirection(QBoxLayout.Direction.BottomToTop) + self.layout.setAlignment(self.barLayout, + Qt.AlignmentFlag.AlignLeft) elif orient == E5SideBar.West: - self.__tabBar.setShape(QTabBar.RoundedWest) + self.__tabBar.setShape(QTabBar.Shape.RoundedWest) self.__tabBar.setSizePolicy( - QSizePolicy.Preferred, QSizePolicy.Expanding) - self.barLayout.setDirection(QBoxLayout.TopToBottom) - self.layout.setDirection(QBoxLayout.LeftToRight) - self.layout.setAlignment(self.barLayout, Qt.AlignTop) + QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Expanding) + self.barLayout.setDirection(QBoxLayout.Direction.TopToBottom) + self.layout.setDirection(QBoxLayout.Direction.LeftToRight) + self.layout.setAlignment(self.barLayout, Qt.AlignmentFlag.AlignTop) self.__orientation = orient def tabIcon(self, index): @@ -567,8 +569,8 @@ self.__maxSize = self.maximumWidth() data = QByteArray() - stream = QDataStream(data, QIODevice.WriteOnly) - stream.setVersion(QDataStream.Qt_4_6) + stream = QDataStream(data, QIODevice.OpenModeFlag.WriteOnly) + stream.setVersion(QDataStream.Version.Qt_4_6) stream.writeUInt16(self.Version) stream.writeBool(self.__minimized) @@ -600,8 +602,8 @@ maxSize = self.maximumWidth() data = QByteArray(state) - stream = QDataStream(data, QIODevice.ReadOnly) - stream.setVersion(QDataStream.Qt_4_6) + stream = QDataStream(data, QIODevice.OpenModeFlag.ReadOnly) + stream.setVersion(QDataStream.Version.Qt_4_6) version = stream.readUInt16() # version minimized = stream.readBool()
--- a/eric6/E5Gui/E5SimpleHelpDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Gui/E5SimpleHelpDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -32,7 +32,7 @@ """ super(E5SimpleHelpDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) self.setWindowTitle(title) if label:
--- a/eric6/E5Gui/E5SqueezeLabels.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Gui/E5SqueezeLabels.py Tue Mar 02 17:17:09 2021 +0100 @@ -42,7 +42,7 @@ pixelLength = fm.width(self.__text) if pixelLength > self.contentsRect().width(): self.__elided = fm.elidedText( - self.text(), Qt.ElideMiddle, self.width()) + self.text(), Qt.TextElideMode.ElideMiddle, self.width()) super(E5SqueezeLabel, self).setText(self.__elided) else: super(E5SqueezeLabel, self).setText(self.__text)
--- a/eric6/E5Gui/E5StringListEditWidget.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Gui/E5StringListEditWidget.py Tue Mar 02 17:17:09 2021 +0100 @@ -34,7 +34,8 @@ self.__model = QStringListModel(self) self.__proxyModel = QSortFilterProxyModel(self) - self.__proxyModel.setFilterCaseSensitivity(Qt.CaseInsensitive) + self.__proxyModel.setFilterCaseSensitivity( + Qt.CaseSensitivity.CaseInsensitive) self.__proxyModel.setSourceModel(self.__model) self.stringList.setModel(self.__proxyModel) @@ -100,7 +101,7 @@ self, self.tr("Add Entry"), self.tr("Enter the entry to add to the list:"), - QLineEdit.Normal) + QLineEdit.EchoMode.Normal) if ok and entry != "" and entry not in self.__model.stringList(): self.__model.insertRow(self.__model.rowCount()) self.__model.setData(
--- a/eric6/E5Gui/E5TabWidget.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Gui/E5TabWidget.py Tue Mar 02 17:17:09 2021 +0100 @@ -72,7 +72,7 @@ @param event reference to the mouse press event (QMouseEvent) """ - if event.button() == Qt.LeftButton: + if event.button() == Qt.MouseButton.LeftButton: self.__dragStartPos = QPoint(event.pos()) E5WheelTabBar.mousePressEvent(self, event) @@ -83,7 +83,7 @@ @param event reference to the mouse move event (QMouseEvent) """ if ( - event.buttons() == Qt.MouseButtons(Qt.LeftButton) and + event.buttons() == Qt.MouseButtons(Qt.MouseButton.LeftButton) and (event.pos() - self.__dragStartPos).manhattanLength() > QApplication.startDragDistance() ): @@ -233,7 +233,7 @@ @param policy context menu policy to set (Qt.ContextMenuPolicy) """ self.tabBar().setContextMenuPolicy(policy) - if policy == Qt.CustomContextMenu: + if policy == Qt.ContextMenuPolicy.CustomContextMenu: self.tabBar().customContextMenuRequested.connect( self.__handleTabCustomContextMenuRequested) else: @@ -304,12 +304,12 @@ @return free side (QTabBar.ButtonPosition) """ side = self.__tabBar.style().styleHint( - QStyle.SH_TabBar_CloseButtonPosition, + QStyle.StyleHint.SH_TabBar_CloseButtonPosition, None, None, None) - if side == QTabBar.LeftSide: - side = QTabBar.RightSide + if side == QTabBar.ButtonPosition.LeftSide: + side = QTabBar.ButtonPosition.RightSide else: - side = QTabBar.LeftSide + side = QTabBar.ButtonPosition.LeftSide return side def animationLabel(self, index, animationFile, interval=100):
--- a/eric6/E5Gui/E5TableView.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Gui/E5TableView.py Tue Mar 02 17:17:09 2021 +0100 @@ -22,7 +22,7 @@ @param evt reference to the event (QKeyEvent) """ if ( - evt.key() in [Qt.Key_Delete, Qt.Key_Backspace] and + evt.key() in [Qt.Key.Key_Delete, Qt.Key.Key_Backspace] and self.model() is not None ): self.removeSelected() @@ -49,7 +49,8 @@ idx = self.model().index(row - 1, 0, self.rootIndex()) self.selectionModel().select( idx, - QItemSelectionModel.SelectCurrent | QItemSelectionModel.Rows) + QItemSelectionModel.SelectionFlag.SelectCurrent | + QItemSelectionModel.SelectionFlag.Rows) self.setCurrentIndex(idx) def removeAll(self):
--- a/eric6/E5Gui/E5TextEditSearchWidget.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Gui/E5TextEditSearchWidget.py Tue Mar 02 17:17:09 2021 +0100 @@ -42,10 +42,12 @@ self.__findBackwards = True self.__defaultBaseColor = ( - self.findtextCombo.lineEdit().palette().color(QPalette.Base) + self.findtextCombo.lineEdit().palette().color( + QPalette.ColorRole.Base) ) self.__defaultTextColor = ( - self.findtextCombo.lineEdit().palette().color(QPalette.Text) + self.findtextCombo.lineEdit().palette().color( + QPalette.ColorRole.Text) ) self.findHistory = [] @@ -82,7 +84,8 @@ self.horizontalLayout1.addWidget(self.label) self.findtextCombo = E5ClearableComboBox(self) - sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) + sizePolicy = QSizePolicy(QSizePolicy.Policy.Expanding, + QSizePolicy.Policy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( @@ -90,7 +93,7 @@ self.findtextCombo.setSizePolicy(sizePolicy) self.findtextCombo.setMinimumSize(QSize(100, 0)) self.findtextCombo.setEditable(True) - self.findtextCombo.setInsertPolicy(QComboBox.InsertAtTop) + self.findtextCombo.setInsertPolicy(QComboBox.InsertPolicy.InsertAtTop) self.findtextCombo.setDuplicatesEnabled(False) self.findtextCombo.setObjectName("findtextCombo") self.horizontalLayout1.addWidget(self.findtextCombo) @@ -200,8 +203,8 @@ @param event reference to the key press event (QKeyEvent) """ - if self.__textedit and event.key() == Qt.Key_Escape: - self.__textedit.setFocus(Qt.ActiveWindowFocusReason) + if self.__textedit and event.key() == Qt.Key.Key_Escape: + self.__textedit.setFocus(Qt.FocusReason.ActiveWindowFocusReason) event.accept() @pyqtSlot(str) @@ -289,22 +292,25 @@ @rtype bool """ if backwards: - flags = QTextDocument.FindFlags(QTextDocument.FindBackward) + flags = QTextDocument.FindFlags( + QTextDocument.FindFlag.FindBackward) else: flags = QTextDocument.FindFlags() if self.caseCheckBox.isChecked(): - flags |= QTextDocument.FindCaseSensitively + flags |= QTextDocument.FindFlag.FindCaseSensitively if self.wordCheckBox.isChecked(): - flags |= QTextDocument.FindWholeWords + flags |= QTextDocument.FindFlag.FindWholeWords ok = self.__textedit.find(self.findtextCombo.currentText(), flags) if not ok: # wrap around once cursor = self.__textedit.textCursor() if backwards: - moveOp = QTextCursor.End # move to end of document + moveOp = QTextCursor.MoveOperation.End + # move to end of document else: - moveOp = QTextCursor.Start # move to start of document + moveOp = QTextCursor.MoveOperation.Start + # move to start of document cursor.movePosition(moveOp) self.__textedit.setTextCursor(cursor) ok = self.__textedit.find(self.findtextCombo.currentText(), flags) @@ -323,9 +329,9 @@ findFlags = QWebEnginePage.FindFlags() if self.caseCheckBox.isChecked(): - findFlags |= QWebEnginePage.FindCaseSensitively + findFlags |= QWebEnginePage.FindFlag.FindCaseSensitively if backwards: - findFlags |= QWebEnginePage.FindBackward + findFlags |= QWebEnginePage.FindFlag.FindBackward self.__textedit.findText(self.findtextCombo.currentText(), findFlags, self.__findNextPrevCallback) @@ -353,10 +359,10 @@ le = self.findtextCombo.lineEdit() p = le.palette() if error: - p.setBrush(QPalette.Base, QBrush(QColor("#FF6666"))) - p.setBrush(QPalette.Text, QBrush(QColor("#000000"))) + p.setBrush(QPalette.ColorRole.Base, QBrush(QColor("#FF6666"))) + p.setBrush(QPalette.ColorRole.Text, QBrush(QColor("#000000"))) else: - p.setBrush(QPalette.Base, self.__defaultBaseColor) - p.setBrush(QPalette.Text, self.__defaultTextColor) + p.setBrush(QPalette.ColorRole.Base, self.__defaultBaseColor) + p.setBrush(QPalette.ColorRole.Text, self.__defaultTextColor) le.setPalette(p) le.update()
--- a/eric6/E5Gui/E5TextInputDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Gui/E5TextInputDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -38,7 +38,8 @@ self.__layout.addWidget(self.__lineEdit) self.__buttonBox = QDialogButtonBox( - QDialogButtonBox.Ok | QDialogButtonBox.Cancel, self) + QDialogButtonBox.StandardButton.Ok | + QDialogButtonBox.StandardButton.Cancel, self) self.__layout.addWidget(self.__buttonBox) self.__buttonBox.accepted.connect(self.accept) @@ -107,7 +108,7 @@ return self.label.text() -def getText(parent, title, label, mode=QLineEdit.Normal, text="", +def getText(parent, title, label, mode=QLineEdit.EchoMode.Normal, text="", minimumWidth=300): """ Function to get create a dialog to enter some text and return it. @@ -135,7 +136,7 @@ dlg.setTextValue(text) dlg.setMinimumWidth(minimumWidth) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: return True, dlg.textValue() else: return False, ""
--- a/eric6/E5Gui/E5ToolBarDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Gui/E5ToolBarDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -45,8 +45,8 @@ """ Class implementing a toolbar configuration dialog. """ - ActionIdRole = Qt.UserRole - WidgetActionRole = Qt.UserRole + 1 + ActionIdRole = Qt.ItemDataRole.UserRole + WidgetActionRole = Qt.ItemDataRole.UserRole + 1 def __init__(self, toolBarManager, parent=None): """ @@ -77,8 +77,9 @@ self.rightButton.setIcon(UI.PixmapCache.getIcon("1rightarrow")) self.__restoreDefaultsButton = self.buttonBox.button( - QDialogButtonBox.RestoreDefaults) - self.__resetButton = self.buttonBox.button(QDialogButtonBox.Reset) + QDialogButtonBox.StandardButton.RestoreDefaults) + self.__resetButton = self.buttonBox.button( + QDialogButtonBox.StandardButton.Reset) self.actionsTree.header().hide() self.__separatorText = self.tr("--Separator--") @@ -91,12 +92,16 @@ item = QTreeWidgetItem(categoryItem) item.setText(0, action.text()) item.setIcon(0, action.icon()) - item.setTextAlignment(0, Qt.AlignLeft | Qt.AlignVCenter) + item.setTextAlignment( + 0, + Qt.AlignmentFlag.AlignLeft | Qt.AlignmentFlag.AlignVCenter + ) item.setData(0, E5ToolBarDialog.ActionIdRole, int(id(action))) item.setData(0, E5ToolBarDialog.WidgetActionRole, False) if self.__manager.isWidgetAction(action): item.setData(0, E5ToolBarDialog.WidgetActionRole, True) - item.setData(0, Qt.TextColorRole, QColor(Qt.blue)) + item.setData(0, Qt.ItemDataRole.TextColorRole, + QColor(Qt.GlobalColor.blue)) self.__widgetActionToToolBarItemID[id(action)] = None categoryItem.setExpanded(True) @@ -122,7 +127,8 @@ if default: self.toolbarComboBox.setItemData( self.toolbarComboBox.count() - 1, - QColor(Qt.darkGreen), Qt.ForegroundRole) + QColor(Qt.GlobalColor.darkGreen), + Qt.ItemDataRole.ForegroundRole) self.toolbarComboBox.model().sort(0) self.toolbarComboBox.currentIndexChanged[int].connect( @@ -138,7 +144,7 @@ self, self.tr("New Toolbar"), self.tr("Toolbar Name:"), - QLineEdit.Normal) + QLineEdit.EchoMode.Normal) if ok and name: if self.toolbarComboBox.findText(name) != -1: # toolbar with this name already exists @@ -198,7 +204,7 @@ self, self.tr("Rename Toolbar"), self.tr("New Toolbar Name:"), - QLineEdit.Normal, + QLineEdit.EchoMode.Normal, oldName) if ok and newName: if oldName == newName: @@ -264,12 +270,14 @@ action = self.__manager.actionById(actionID) item.setText(action.text()) item.setIcon(action.icon()) - item.setTextAlignment(Qt.AlignLeft | Qt.AlignVCenter) + item.setTextAlignment(Qt.AlignmentFlag.AlignLeft | + Qt.AlignmentFlag.AlignVCenter) item.setData(E5ToolBarDialog.ActionIdRole, int(id(action))) item.setData(E5ToolBarDialog.WidgetActionRole, False) if self.__manager.isWidgetAction(action): item.setData(E5ToolBarDialog.WidgetActionRole, True) - item.setData(Qt.TextColorRole, QColor(Qt.blue)) + item.setData(Qt.ItemDataRole.TextColorRole, + QColor(Qt.GlobalColor.blue)) self.toolbarActionsList.setCurrentRow(0) self.__setupButtons() @@ -366,12 +374,14 @@ action = self.__manager.actionById(actionID) item.setText(action.text()) item.setIcon(action.icon()) - item.setTextAlignment(Qt.AlignLeft | Qt.AlignVCenter) + item.setTextAlignment(Qt.AlignmentFlag.AlignLeft | + Qt.AlignmentFlag.AlignVCenter) item.setData(E5ToolBarDialog.ActionIdRole, int(id(action))) item.setData(E5ToolBarDialog.WidgetActionRole, False) if self.__manager.isWidgetAction(action): item.setData(E5ToolBarDialog.WidgetActionRole, True) - item.setData(Qt.TextColorRole, QColor(Qt.blue)) + item.setData(Qt.ItemDataRole.TextColorRole, + QColor(Qt.GlobalColor.blue)) oldTbItemID = self.__widgetActionToToolBarItemID[actionID] if oldTbItemID is not None: self.__toolbarItems[oldTbItemID].actionIDs.remove(actionID) @@ -395,18 +405,28 @@ @param button reference to the button clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Cancel): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): self.reject() - elif button == self.buttonBox.button(QDialogButtonBox.Apply): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Apply + ): self.__saveToolBars() self.__setupButtons() - elif button == self.buttonBox.button(QDialogButtonBox.Ok): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok + ): self.__saveToolBars() self.accept() - elif button == self.buttonBox.button(QDialogButtonBox.Reset): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Reset + ): self.__resetCurrentToolbar() self.__setupButtons() - elif button == self.buttonBox.button(QDialogButtonBox.RestoreDefaults): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.RestoreDefaults + ): self.__restoreCurrentToolbarToDefault() self.__setupButtons()
--- a/eric6/E5Gui/E5ToolBarManager.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Gui/E5ToolBarManager.py Tue Mar 02 17:17:09 2021 +0100 @@ -483,8 +483,8 @@ @return saved state as a byte array (QByteArray) """ data = QByteArray() - stream = QDataStream(data, QIODevice.WriteOnly) - stream.setVersion(QDataStream.Qt_4_6) + stream = QDataStream(data, QIODevice.OpenModeFlag.WriteOnly) + stream.setVersion(QDataStream.Version.Qt_4_6) stream.writeUInt16(E5ToolBarManager.VersionMarker) stream.writeUInt16(version) @@ -540,8 +540,8 @@ return False data = QByteArray(state) - stream = QDataStream(data, QIODevice.ReadOnly) - stream.setVersion(QDataStream.Qt_4_6) + stream = QDataStream(data, QIODevice.OpenModeFlag.ReadOnly) + stream.setVersion(QDataStream.Version.Qt_4_6) marker = stream.readUInt16() vers = stream.readUInt16() if marker != E5ToolBarManager.VersionMarker or vers != version:
--- a/eric6/E5Gui/E5ToolBox.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Gui/E5ToolBox.py Tue Mar 02 17:17:09 2021 +0100 @@ -37,7 +37,7 @@ @param parent reference to the parent widget (QWidget) """ E5TabWidget.__init__(self, parent) - self.setTabPosition(QTabWidget.West) + self.setTabPosition(QTabWidget.TabPosition.West) self.setUsesScrollButtons(True) def addItem(self, widget, icon, text):
--- a/eric6/E5Gui/E5ToolButton.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Gui/E5ToolButton.py Tue Mar 02 17:17:09 2021 +0100 @@ -63,7 +63,7 @@ self.__pressTimer.setSingleShot(True) self.__pressTimer.setInterval( QApplication.style().styleHint( - QStyle.SH_ToolButton_PopupDelay, opt, self)) + QStyle.StyleHint.SH_ToolButton_PopupDelay, opt, self)) self.__pressTimer.timeout.connect(self.__showMenu) ################################################################## @@ -131,7 +131,10 @@ if self.__options & E5ToolButton.ShowMenuInsideOption: pos = self.mapToGlobal(self.rect().bottomRight()) - if QApplication.layoutDirection() == Qt.RightToLeft: + if ( + QApplication.layoutDirection() == + Qt.LayoutDirection.RightToLeft + ): pos.setX(pos.x() - self.rect().width()) else: pos.setX(pos.x() - self.__menu.sizeHint().width()) @@ -174,7 +177,7 @@ opt = QStyleOption() opt.initFrom(self) size = self.style().pixelMetric( - QStyle.PM_ToolBarIconSize, opt, self) + QStyle.PixelMetric.PM_ToolBarIconSize, opt, self) self.setIconSize(QSize(size, size)) else: self.__options &= ~E5ToolButton.ToolBarLookOption @@ -194,18 +197,18 @@ @param evt reference to the mouse event @type QMouseEvent """ - if self.popupMode() == QToolButton.DelayedPopup: + if self.popupMode() == QToolButton.ToolButtonPopupMode.DelayedPopup: self.__pressTimer.start() if ( - evt.buttons() == Qt.LeftButton and + evt.buttons() == Qt.MouseButton.LeftButton and self.__menu is not None and - self.popupMode() == QToolButton.InstantPopup + self.popupMode() == QToolButton.ToolButtonPopupMode.InstantPopup ): self.setDown(True) self.__showMenu() elif ( - evt.buttons() == Qt.RightButton and + evt.buttons() == Qt.MouseButton.RightButton and self.__menu is not None ): self.setDown(True) @@ -223,15 +226,15 @@ self.__pressTimer.stop() if ( - evt.button() == Qt.MiddleButton and + evt.button() == Qt.MouseButton.MiddleButton and self.rect().contains(evt.pos()) ): self.middleClicked.emit() self.setDown(False) elif ( - evt.button() == Qt.LeftButton and + evt.button() == Qt.MouseButton.LeftButton and self.rect().contains(evt.pos()) and - evt.modifiers() == Qt.ControlModifier + evt.modifiers() == Qt.KeyboardModifier.ControlModifier ): self.controlClicked.emit() self.setDown(False) @@ -249,7 +252,7 @@ self.__pressTimer.stop() - if evt.buttons() == Qt.LeftButton: + if evt.buttons() == Qt.MouseButton.LeftButton: self.doubleClicked.emit() def contextMenuEvent(self, evt):
--- a/eric6/E5Gui/E5TreeSortFilterProxyModel.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Gui/E5TreeSortFilterProxyModel.py Tue Mar 02 17:17:09 2021 +0100 @@ -25,7 +25,7 @@ """ super(E5TreeSortFilterProxyModel, self).__init__(parent) - self.setFilterCaseSensitivity(Qt.CaseInsensitive) + self.setFilterCaseSensitivity(Qt.CaseSensitivity.CaseInsensitive) def filterAcceptsRow(self, sourceRow, sourceParent): """
--- a/eric6/E5Gui/E5TreeView.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Gui/E5TreeView.py Tue Mar 02 17:17:09 2021 +0100 @@ -22,7 +22,7 @@ @param evt reference to the event (QKeyEvent) """ if ( - evt.key() in [Qt.Key_Delete, Qt.Key_Backspace] and + evt.key() in [Qt.Key.Key_Delete, Qt.Key.Key_Backspace] and self.model() is not None ): self.removeSelected()
--- a/eric6/E5Gui/E5TreeWidget.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Gui/E5TreeWidget.py Tue Mar 02 17:17:09 2021 +0100 @@ -38,7 +38,7 @@ self.__allTreeItems = [] self.__showMode = E5TreeWidget.ItemsCollapsed - self.setVerticalScrollMode(QAbstractItemView.ScrollPerPixel) + self.setVerticalScrollMode(QAbstractItemView.ScrollMode.ScrollPerPixel) self.itemChanged.connect(self.__scheduleRefresh) @@ -84,7 +84,7 @@ return False parentItem = parent elif isinstance(parent, str): - lst = self.findItems(parent, Qt.MatchExactly) + lst = self.findItems(parent, Qt.MatchFlag.MatchExactly) if not lst: return False parentItem = lst[0] @@ -113,7 +113,7 @@ return False parentItem = parent elif isinstance(parent, str): - lst = self.findItems(parent, Qt.MatchExactly) + lst = self.findItems(parent, Qt.MatchFlag.MatchExactly) if not lst: return False parentItem = lst[0] @@ -249,12 +249,12 @@ @param evt mouse press event (QMouseEvent) """ if ( - evt.modifiers() == Qt.ControlModifier and - evt.buttons() == Qt.LeftButton + evt.modifiers() == Qt.KeyboardModifier.ControlModifier and + evt.buttons() == Qt.MouseButton.LeftButton ): self.itemControlClicked.emit(self.itemAt(evt.pos())) return - elif evt.buttons() == Qt.MidButton: + elif evt.buttons() == Qt.MouseButton.MidButton: self.itemMiddleButtonClicked.emit(self.itemAt(evt.pos())) return else:
--- a/eric6/E5Network/E5GoogleMail.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Network/E5GoogleMail.py Tue Mar 02 17:17:09 2021 +0100 @@ -55,7 +55,8 @@ self.__browser.loadFinished.connect(self.__pageLoadFinished) self.__layout.addWidget(self.__browser) - self.__buttonBox = QDialogButtonBox(QDialogButtonBox.Close) + self.__buttonBox = QDialogButtonBox( + QDialogButtonBox.StandardButton.Close) self.__buttonBox.rejected.connect(self.reject) self.__layout.addWidget(self.__buttonBox) @@ -81,7 +82,7 @@ "https://accounts.google.com/o/oauth2/approval/v2"): urlQuery = QUrlQuery(url) approvalCode = urlQuery.queryItemValue( - "approvalCode", QUrl.FullyDecoded) + "approvalCode", QUrl.ComponentFormattingOption.FullyDecoded) if approvalCode: self.approvalCodeReceived.emit(approvalCode) self.close()
--- a/eric6/E5Network/E5NetworkHeaderDetailsDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Network/E5NetworkHeaderDetailsDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -25,7 +25,7 @@ """ super(E5NetworkHeaderDetailsDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) def setData(self, name, value): """
--- a/eric6/E5Network/E5NetworkProxyFactory.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Network/E5NetworkProxyFactory.py Tue Mar 02 17:17:09 2021 +0100 @@ -31,13 +31,13 @@ @return scheme (string, one of Http, Https, Ftp) """ scheme = "" - if proxyType == QNetworkProxy.HttpProxy: + if proxyType == QNetworkProxy.ProxyType.HttpProxy: scheme = "Http" - elif proxyType == QNetworkProxy.HttpCachingProxy: + elif proxyType == QNetworkProxy.ProxyType.HttpCachingProxy: scheme = "Https" - elif proxyType == QNetworkProxy.FtpCachingProxy: + elif proxyType == QNetworkProxy.ProxyType.FtpCachingProxy: scheme = "Ftp" - elif proxyType == QNetworkProxy.NoProxy: + elif proxyType == QNetworkProxy.ProxyType.NoProxy: scheme = "NoProxy" return scheme @@ -57,7 +57,7 @@ from UI.AuthenticationDialog import AuthenticationDialog dlg = AuthenticationDialog(info, proxy.user(), True) dlg.setData(proxy.user(), proxy.password()) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: username, password = dlg.getData() auth.setUser(username) auth.setPassword(password) @@ -158,12 +158,12 @@ @return list of proxies in order of preference (list of QNetworkProxy) """ if ( - query.queryType() == QNetworkProxyQuery.UrlRequest and + query.queryType() == QNetworkProxyQuery.QueryType.UrlRequest and query.protocolTag() in ["http", "https", "ftp"] ): # use proxy at all ? if not Preferences.getUI("UseProxy"): - return [QNetworkProxy(QNetworkProxy.NoProxy)] + return [QNetworkProxy(QNetworkProxy.ProxyType.NoProxy)] # test for exceptions exceptions = Preferences.getUI("ProxyExceptions") @@ -172,7 +172,7 @@ urlHost = query.url().host() for matcher in self.__hostnameMatchers: if matcher.match(urlHost): - return [QNetworkProxy(QNetworkProxy.NoProxy)] + return [QNetworkProxy(QNetworkProxy.ProxyType.NoProxy)] # determine proxy if Preferences.getUI("UseSystemProxy"): @@ -180,7 +180,7 @@ if ( not Globals.isWindowsPlatform() and len(proxyList) == 1 and - proxyList[0].type() == QNetworkProxy.NoProxy + proxyList[0].type() == QNetworkProxy.ProxyType.NoProxy ): # try it the Python way # scan the environment for variables named <scheme>_proxy @@ -194,11 +194,13 @@ ): url = QUrl(value) if url.scheme() in ["http", "https"]: - proxyType = QNetworkProxy.HttpProxy + proxyType = QNetworkProxy.ProxyType.HttpProxy elif url.scheme() == "ftp": - proxyType = QNetworkProxy.FtpCachingProxy + proxyType = ( + QNetworkProxy.ProxyType.FtpCachingProxy + ) else: - proxyType = QNetworkProxy.HttpProxy + proxyType = QNetworkProxy.ProxyType.HttpProxy proxy = QNetworkProxy( proxyType, url.host(), url.port(), url.userName(), url.password()) @@ -216,7 +218,7 @@ "ProxyPassword/{0}".format(scheme))) return proxyList else: - return [QNetworkProxy(QNetworkProxy.NoProxy)] + return [QNetworkProxy(QNetworkProxy.ProxyType.NoProxy)] else: if Preferences.getUI("UseHttpProxyForAll"): protocolKey = "Http" @@ -234,20 +236,26 @@ """Proxy usage was activated""" """ but no proxy host for protocol""" """ '{0}' configured.""").format(protocolKey)) - return [QNetworkProxy(QNetworkProxy.DefaultProxy)] + return [ + QNetworkProxy(QNetworkProxy.ProxyType.DefaultProxy) + ] else: if protocolKey in ["Http", "Https", "Ftp"]: if query.protocolTag() == "ftp": - proxyType = QNetworkProxy.FtpCachingProxy + proxyType = QNetworkProxy.ProxyType.FtpCachingProxy else: - proxyType = QNetworkProxy.HttpProxy + proxyType = QNetworkProxy.ProxyType.HttpProxy proxy = QNetworkProxy( proxyType, host, Preferences.getUI("ProxyPort/" + protocolKey), Preferences.getUI("ProxyUser/" + protocolKey), Preferences.getUI("ProxyPassword/" + protocolKey)) else: - proxy = QNetworkProxy(QNetworkProxy.DefaultProxy) - return [proxy, QNetworkProxy(QNetworkProxy.DefaultProxy)] + proxy = QNetworkProxy( + QNetworkProxy.ProxyType.DefaultProxy) + return [ + proxy, + QNetworkProxy(QNetworkProxy.ProxyType.DefaultProxy) + ] else: - return [QNetworkProxy(QNetworkProxy.NoProxy)] + return [QNetworkProxy(QNetworkProxy.ProxyType.NoProxy)]
--- a/eric6/E5Network/E5SslCertificateSelectionDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Network/E5SslCertificateSelectionDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -27,7 +27,7 @@ """ Class implementing a dialog to select a SSL certificate. """ - CertRole = Qt.UserRole + 1 + CertRole = Qt.ItemDataRole.UserRole + 1 def __init__(self, certificates, parent=None): """ @@ -62,7 +62,7 @@ self.certificatesTree.expandAll() for i in range(self.certificatesTree.columnCount()): self.certificatesTree.resizeColumnToContents(i) - self.certificatesTree.sortItems(0, Qt.AscendingOrder) + self.certificatesTree.sortItems(0, Qt.SortOrder.AscendingOrder) def __createCaCertificateEntry(self, cert): """ @@ -73,9 +73,11 @@ """ # step 1: extract the info to be shown organisation = Utilities.decodeString( - ", ".join(cert.subjectInfo(QSslCertificate.Organization))) + ", ".join(cert.subjectInfo( + QSslCertificate.SubjectInfo.Organization))) commonName = Utilities.decodeString( - ", ".join(cert.subjectInfo(QSslCertificate.CommonName))) + ", ".join(cert.subjectInfo( + QSslCertificate.SubjectInfo.CommonName))) if organisation is None or organisation == "": organisation = self.tr("(Unknown)") if commonName is None or commonName == "": @@ -85,7 +87,7 @@ # step 2: create the entry items = self.certificatesTree.findItems( organisation, - Qt.MatchFixedString | Qt.MatchCaseSensitive) + Qt.MatchFlag.MatchFixedString | Qt.MatchFlag.MatchCaseSensitive) if len(items) == 0: parent = QTreeWidgetItem(self.certificatesTree, [organisation]) parent.setFirstColumnSpanned(True)
--- a/eric6/E5Network/E5SslCertificatesDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Network/E5SslCertificatesDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -32,7 +32,7 @@ """ Class implementing a dialog to show and edit all certificates. """ - CertRole = Qt.UserRole + 1 + CertRole = Qt.ItemDataRole.UserRole + 1 def __init__(self, parent=None): """ @@ -87,9 +87,11 @@ """ # step 1: extract the info to be shown organisation = Utilities.decodeString( - ", ".join(cert.subjectInfo(QSslCertificate.Organization))) + ", ".join(cert.subjectInfo( + QSslCertificate.SubjectInfo.Organization))) commonName = Utilities.decodeString( - ", ".join(cert.subjectInfo(QSslCertificate.CommonName))) + ", ".join(cert.subjectInfo( + QSslCertificate.SubjectInfo.CommonName))) if organisation is None or organisation == "": organisation = self.tr("(Unknown)") if commonName is None or commonName == "": @@ -99,7 +101,7 @@ # step 2: create the entry items = self.serversCertificatesTree.findItems( organisation, - Qt.MatchFixedString | Qt.MatchCaseSensitive) + Qt.MatchFlag.MatchFixedString | Qt.MatchFlag.MatchCaseSensitive) if len(items) == 0: parent = QTreeWidgetItem( self.serversCertificatesTree, [organisation]) @@ -211,7 +213,8 @@ for cert in certs: if cert in sCerts: commonStr = ", ".join( - cert.subjectInfo(QSslCertificate.CommonName)) + cert.subjectInfo( + QSslCertificate.SubjectInfo.CommonName)) E5MessageBox.warning( self, self.tr("Import Certificate"), @@ -283,7 +286,7 @@ self.caCertificatesTree.expandAll() for i in range(self.caCertificatesTree.columnCount()): self.caCertificatesTree.resizeColumnToContents(i) - self.caCertificatesTree.sortItems(0, Qt.AscendingOrder) + self.caCertificatesTree.sortItems(0, Qt.SortOrder.AscendingOrder) def __createCaCertificateEntry(self, cert): """ @@ -293,9 +296,11 @@ """ # step 1: extract the info to be shown organisation = Utilities.decodeString( - ", ".join(cert.subjectInfo(QSslCertificate.Organization))) + ", ".join(cert.subjectInfo( + QSslCertificate.SubjectInfo.Organization))) commonName = Utilities.decodeString( - ", ".join(cert.subjectInfo(QSslCertificate.CommonName))) + ", ".join(cert.subjectInfo( + QSslCertificate.SubjectInfo.CommonName))) if organisation is None or organisation == "": organisation = self.tr("(Unknown)") if commonName is None or commonName == "": @@ -305,7 +310,7 @@ # step 2: create the entry items = self.caCertificatesTree.findItems( organisation, - Qt.MatchFixedString | Qt.MatchCaseSensitive) + Qt.MatchFlag.MatchFixedString | Qt.MatchFlag.MatchCaseSensitive) if len(items) == 0: parent = QTreeWidgetItem(self.caCertificatesTree, [organisation]) parent.setFirstColumnSpanned(True) @@ -395,7 +400,8 @@ for cert in certs: if cert in caCerts: commonStr = ", ".join( - cert.subjectInfo(QSslCertificate.CommonName)) + cert.subjectInfo( + QSslCertificate.SubjectInfo.CommonName)) E5MessageBox.warning( self, self.tr("Import Certificate"), @@ -463,7 +469,7 @@ return f = QFile(fname) - if not f.open(QIODevice.WriteOnly): + if not f.open(QIODevice.OpenModeFlag.WriteOnly): E5MessageBox.critical( self, self.tr("Export Certificate"), @@ -495,7 +501,7 @@ if fname: f = QFile(fname) - if not f.open(QIODevice.ReadOnly): + if not f.open(QIODevice.OpenModeFlag.ReadOnly): E5MessageBox.critical( self, self.tr("Export Certificate"), @@ -507,9 +513,9 @@ crt = f.readAll() f.close() - cert = QSslCertificate.fromData(crt, QSsl.Pem) + cert = QSslCertificate.fromData(crt, QSsl.EncodingFormat.Pem) if not cert: - cert = QSslCertificate.fromData(crt, QSsl.Der) + cert = QSslCertificate.fromData(crt, QSsl.EncodingFormat.Der) return cert
--- a/eric6/E5Network/E5SslCertificatesInfoWidget.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Network/E5SslCertificatesInfoWidget.py Tue Mar 02 17:17:09 2021 +0100 @@ -49,10 +49,12 @@ self.__chain = certificateChain[:] for cert in self.__chain: - name = ", ".join(cert.subjectInfo(QSslCertificate.CommonName)) + name = ", ".join(cert.subjectInfo( + QSslCertificate.SubjectInfo.CommonName)) if not name: name = ", ".join( - cert.subjectInfo(QSslCertificate.Organization)) + cert.subjectInfo( + QSslCertificate.SubjectInfo.Organization)) if not name: name = cert.serialNumber() self.chainComboBox.addItem(name) @@ -90,33 +92,36 @@ self.subjectCommonNameLabel.setText(self.__certificateString( ", ".join(certificate.subjectInfo( - QSslCertificate.CommonName)))) + QSslCertificate.SubjectInfo.CommonName)))) self.subjectOrganizationLabel.setText(self.__certificateString( ", ".join(certificate.subjectInfo( - QSslCertificate.Organization)))) + QSslCertificate.SubjectInfo.Organization)))) self.subjectOrganizationalUnitLabel.setText( self.__certificateString(", ".join( certificate.subjectInfo( - QSslCertificate.OrganizationalUnitName)))) + QSslCertificate.SubjectInfo.OrganizationalUnitName)))) self.issuerCommonNameLabel.setText(self.__certificateString( - ", ".join(certificate.issuerInfo(QSslCertificate.CommonName)))) + ", ".join(certificate.issuerInfo( + QSslCertificate.SubjectInfo.CommonName)))) self.issuerOrganizationLabel.setText(self.__certificateString( ", ".join(certificate.issuerInfo( - QSslCertificate.Organization)))) + QSslCertificate.SubjectInfo.Organization)))) self.issuerOrganizationalUnitLabel.setText( self.__certificateString(", ".join( certificate.issuerInfo( - QSslCertificate.OrganizationalUnitName)))) + QSslCertificate.SubjectInfo.OrganizationalUnitName)))) self.serialNumberLabel.setText(self.__serialNumber(certificate)) self.effectiveLabel.setText( certificate.effectiveDate().toString("yyyy-MM-dd")) self.expiresLabel.setText( certificate.expiryDate().toString("yyyy-MM-dd")) self.sha1Label.setText(self.__formatHexString( - str(certificate.digest(QCryptographicHash.Sha1).toHex(), + str(certificate.digest( + QCryptographicHash.Algorithm.Sha1).toHex(), encoding="ascii"))) self.md5Label.setText(self.__formatHexString( - str(certificate.digest(QCryptographicHash.Md5).toHex(), + str(certificate.digest( + QCryptographicHash.Algorithm.Md5).toHex(), encoding="ascii"))) if certificate.isBlacklisted():
--- a/eric6/E5Network/E5SslErrorHandler.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Network/E5SslErrorHandler.py Tue Mar 02 17:17:09 2021 +0100 @@ -58,14 +58,15 @@ sslCfg = QSslConfiguration.defaultConfiguration() sslCfg.setCaCertificates(caList) try: - sslProtocol = QSsl.TlsV1_1OrLater + sslProtocol = QSsl.SslProtocol.TlsV1_1OrLater if Globals.isWindowsPlatform() and platform.win32_ver()[0] == '7': - sslProtocol = QSsl.SecureProtocols + sslProtocol = QSsl.SslProtocol.SecureProtocols except AttributeError: - sslProtocol = QSsl.SecureProtocols + sslProtocol = QSsl.SslProtocol.SecureProtocols sslCfg.setProtocol(sslProtocol) try: - sslCfg.setSslOption(QSsl.SslOptionDisableCompression, True) + sslCfg.setSslOption(QSsl.SslOption.SslOptionDisableCompression, + True) except AttributeError: pass QSslConfiguration.setDefaultConfiguration(sslCfg) @@ -125,7 +126,7 @@ server += ":{0:d}".format(port) if errors: for err in errors: - if err.error() == QSslError.NoError: + if err.error() == QSslError.SslError.NoError: continue if server in caMerge and err.certificate() in caMerge[server]: continue @@ -173,12 +174,13 @@ caList.append(cert) sslCfg.setCaCertificates(caList) try: - sslCfg.setProtocol(QSsl.TlsV1_1OrLater) + sslCfg.setProtocol(QSsl.SslProtocol.TlsV1_1OrLater) except AttributeError: - sslCfg.setProtocol(QSsl.SecureProtocols) + sslCfg.setProtocol(QSsl.SslProtocol.SecureProtocols) try: - sslCfg.setSslOption(QSsl.SslOptionDisableCompression, - True) + sslCfg.setSslOption( + QSsl.SslOption.SslOptionDisableCompression, + True) except AttributeError: pass QSslConfiguration.setDefaultConfiguration(sslCfg) @@ -212,7 +214,8 @@ ).format( Utilities.html_encode( Utilities.decodeString( - ", ".join(cert.subjectInfo(QSslCertificate.CommonName)) + ", ".join(cert.subjectInfo( + QSslCertificate.SubjectInfo.CommonName)) ) ) ) @@ -222,7 +225,8 @@ ).format( Utilities.html_encode( Utilities.decodeString( - ", ".join(cert.subjectInfo(QSslCertificate.Organization)) + ", ".join(cert.subjectInfo( + QSslCertificate.SubjectInfo.Organization)) ) ) ) @@ -232,7 +236,8 @@ ).format( Utilities.html_encode( Utilities.decodeString( - ", ".join(cert.issuerInfo(QSslCertificate.CommonName)) + ", ".join(cert.issuerInfo( + QSslCertificate.SubjectInfo.CommonName)) ) ) )
--- a/eric6/E5Network/E5SslInfoWidget.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Network/E5SslInfoWidget.py Tue Mar 02 17:17:09 2021 +0100 @@ -47,11 +47,12 @@ ## Identity Information ########################################## imageLabel = QLabel(self) - layout.addWidget(imageLabel, rows, 0, Qt.AlignCenter) + layout.addWidget(imageLabel, rows, 0, Qt.AlignmentFlag.AlignCenter) label = QLabel(self) label.setWordWrap(True) - label.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred) + label.setSizePolicy(QSizePolicy.Policy.Expanding, + QSizePolicy.Policy.Preferred) label.setText(self.tr("Identity")) font = label.font() font.setBold(True) @@ -69,7 +70,7 @@ valid = not cert.isBlacklisted() if valid: txt = ", ".join( - cert.issuerInfo(QSslCertificate.CommonName)) + cert.issuerInfo(QSslCertificate.SubjectInfo.CommonName)) label.setText(self.tr( "The certificate for this site is valid" " and has been verified by:\n{0}").format( @@ -97,7 +98,7 @@ ## Identity Information ########################################## imageLabel = QLabel(self) - layout.addWidget(imageLabel, rows, 0, Qt.AlignCenter) + layout.addWidget(imageLabel, rows, 0, Qt.AlignmentFlag.AlignCenter) label = QLabel(self) label.setWordWrap(True) @@ -127,15 +128,15 @@ layout.addWidget(label, rows, 1) proto = cipher.protocol() - if proto == QSsl.SslV3: + if proto == QSsl.SslProtocol.SslV3: sslVersion = "SSL 3.0" imageLabel.setPixmap( UI.PixmapCache.getPixmap("securityLow32")) - elif proto == QSsl.TlsV1SslV3: + elif proto == QSsl.SslProtocol.TlsV1SslV3: sslVersion = "TLS 1.0/SSL 3.0" imageLabel.setPixmap( UI.PixmapCache.getPixmap("securityLow32")) - elif proto == QSsl.SslV2: + elif proto == QSsl.SslProtocol.SslV2: sslVersion = "SSL 2.0" imageLabel.setPixmap( UI.PixmapCache.getPixmap("securityLow32")) @@ -143,19 +144,19 @@ sslVersion = self.tr("unknown") imageLabel.setPixmap( UI.PixmapCache.getPixmap("securityLow32")) - if proto == QSsl.TlsV1_0: + if proto == QSsl.SslProtocol.TlsV1_0: sslVersion = "TLS 1.0" imageLabel.setPixmap( UI.PixmapCache.getPixmap("securityHigh32")) - elif proto == QSsl.TlsV1_1: + elif proto == QSsl.SslProtocol.TlsV1_1: sslVersion = "TLS 1.1" imageLabel.setPixmap( UI.PixmapCache.getPixmap("securityHigh32")) - elif proto == QSsl.TlsV1_2: + elif proto == QSsl.SslProtocol.TlsV1_2: sslVersion = "TLS 1.2" imageLabel.setPixmap( UI.PixmapCache.getPixmap("securityHigh32")) - elif proto == QSsl.TlsV1_3: + elif proto == QSsl.SslProtocol.TlsV1_3: sslVersion = "TLS 1.3" imageLabel.setPixmap( UI.PixmapCache.getPixmap("securityHigh32"))
--- a/eric6/E5Network/E5XmlRpcClient.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Network/E5XmlRpcClient.py Tue Mar 02 17:17:09 2021 +0100 @@ -49,7 +49,8 @@ self.__request = QNetworkRequest(QUrl(url)) self.__request.setRawHeader(b"User-Agent", b"E5XmlRpcClient/1.0") - self.__request.setHeader(QNetworkRequest.ContentTypeHeader, "text/xml") + self.__request.setHeader( + QNetworkRequest.KnownHeaders.ContentTypeHeader, "text/xml") def setUrl(self, url): """ @@ -77,8 +78,9 @@ if not isinstance(args, tuple): raise TypeError("argument 'args' must be tuple") - QGuiApplication.setOverrideCursor(QCursor(Qt.WaitCursor)) - QGuiApplication.processEvents(QEventLoop.ExcludeUserInputEvents) + QGuiApplication.setOverrideCursor(QCursor(Qt.CursorShape.WaitCursor)) + QGuiApplication.processEvents( + QEventLoop.ProcessEventsFlag.ExcludeUserInputEvents) data = xmlrpc.dumps(args, method).encode("utf-8") reply = self.__networkManager.post( @@ -101,7 +103,8 @@ @param errors list of SSL errors (list of QSslError) """ QGuiApplication.restoreOverrideCursor() - QGuiApplication.processEvents(QEventLoop.ExcludeUserInputEvents) + QGuiApplication.processEvents( + QEventLoop.ProcessEventsFlag.ExcludeUserInputEvents) ignored = self.__sslErrorHandler.sslErrorsReply(reply, errors)[0] if ignored == E5SslErrorHandler.NotIgnored and reply in self.__callmap: @@ -118,9 +121,10 @@ return QGuiApplication.restoreOverrideCursor() - QGuiApplication.processEvents(QEventLoop.ExcludeUserInputEvents) + QGuiApplication.processEvents( + QEventLoop.ProcessEventsFlag.ExcludeUserInputEvents) - if reply.error() != QNetworkReply.NoError: + if reply.error() != QNetworkReply.NetworkError.NoError: self.__callmap[reply][1](xmlrpc.TRANSPORT_ERROR, reply.errorString()) else:
--- a/eric6/E5Network/__init__.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Network/__init__.py Tue Mar 02 17:17:09 2021 +0100 @@ -33,7 +33,10 @@ @rtype bool """ h = QHostAddress(address) - return not h.isNull() and h.protocol() == QAbstractSocket.IPv4Protocol + return ( + not h.isNull() and + h.protocol() == QAbstractSocket.NetworkLayerProtocol.IPv4Protocol + ) def isValidIPv6Address(address): @@ -46,4 +49,7 @@ @rtype bool """ h = QHostAddress(address) - return not h.isNull() and h.protocol() == QAbstractSocket.IPv6Protocol + return ( + not h.isNull() and + h.protocol() == QAbstractSocket.NetworkLayerProtocol.IPv6Protocol + )
--- a/eric6/Graphics/AssociationItem.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Graphics/AssociationItem.py Tue Mar 02 17:17:09 2021 +0100 @@ -73,8 +73,8 @@ E5ArrowItem.__init__(self, QPointF(0, 0), QPointF(100, 100), arrowFilled, arrowType, colors, parent) - self.setFlag(QGraphicsItem.ItemIsMovable, False) - self.setFlag(QGraphicsItem.ItemIsSelectable, False) + self.setFlag(QGraphicsItem.GraphicsItemFlag.ItemIsMovable, False) + self.setFlag(QGraphicsItem.GraphicsItemFlag.ItemIsSelectable, False) if topToBottom: self.calculateEndingPoints = ( @@ -383,7 +383,7 @@ for line in lines: if ( intersectLine.intersect(line, intersectPoint) == - QLineF.BoundedIntersection + QLineF.IntersectType.BoundedIntersection ): return intersectPoint return QPointF(-1.0, -1.0)
--- a/eric6/Graphics/ClassItem.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Graphics/ClassItem.py Tue Mar 02 17:17:09 2021 +0100 @@ -198,8 +198,8 @@ """ pen = self.pen() if ( - (option.state & QStyle.State_Selected) == - QStyle.State(QStyle.State_Selected) + (option.state & QStyle.StateFlag.State_Selected) == + QStyle.State(QStyle.StateFlag.State_Selected) ): pen.setWidth(2) else:
--- a/eric6/Graphics/ModuleItem.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Graphics/ModuleItem.py Tue Mar 02 17:17:09 2021 +0100 @@ -148,8 +148,8 @@ """ pen = self.pen() if ( - (option.state & QStyle.State_Selected) == - QStyle.State(QStyle.State_Selected) + (option.state & QStyle.StateFlag.State_Selected) == + QStyle.State(QStyle.StateFlag.State_Selected) ): pen.setWidth(2) else:
--- a/eric6/Graphics/PackageItem.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Graphics/PackageItem.py Tue Mar 02 17:17:09 2021 +0100 @@ -168,8 +168,8 @@ """ pen = self.pen() if ( - (option.state & QStyle.State_Selected) == - QStyle.State(QStyle.State_Selected) + (option.state & QStyle.StateFlag.State_Selected) == + QStyle.State(QStyle.StateFlag.State_Selected) ): pen.setWidth(2) else:
--- a/eric6/Graphics/PixmapDiagram.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Graphics/PixmapDiagram.py Tue Mar 02 17:17:09 2021 +0100 @@ -53,14 +53,14 @@ self.pixmapLabel = QLabel() self.pixmapLabel.setObjectName("pixmapLabel") - self.pixmapLabel.setBackgroundRole(QPalette.Base) + self.pixmapLabel.setBackgroundRole(QPalette.ColorRole.Base) self.pixmapLabel.setSizePolicy( - QSizePolicy.Ignored, QSizePolicy.Ignored) + QSizePolicy.Policy.Ignored, QSizePolicy.Policy.Ignored) self.pixmapLabel.setScaledContents(True) self.pixmapView = QScrollArea() self.pixmapView.setObjectName("pixmapView") - self.pixmapView.setBackgroundRole(QPalette.Dark) + self.pixmapView.setBackgroundRole(QPalette.ColorRole.Dark) self.pixmapView.setWidget(self.pixmapLabel) self.setCentralWidget(self.pixmapView) @@ -84,7 +84,7 @@ self.__initContextMenu() self.__initToolBars() - self.grabGesture(Qt.PinchGesture) + self.grabGesture(Qt.GestureType.PinchGesture) def __initActions(self): """ @@ -115,7 +115,7 @@ self.__menu.addAction(self.printPreviewAct) self.__menu.addAction(self.printAct) - self.setContextMenuPolicy(Qt.CustomContextMenu) + self.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu) self.customContextMenuRequested.connect(self.__showContextMenu) def __showContextMenu(self, coord): @@ -139,8 +139,8 @@ self.graphicsToolBar.addAction(self.printPreviewAct) self.graphicsToolBar.addAction(self.printAct) - self.addToolBar(Qt.TopToolBarArea, self.windowToolBar) - self.addToolBar(Qt.TopToolBarArea, self.graphicsToolBar) + self.addToolBar(Qt.ToolBarArea.TopToolBarArea, self.windowToolBar) + self.addToolBar(Qt.ToolBarArea.TopToolBarArea, self.graphicsToolBar) def __showPixmap(self, filename): """ @@ -185,7 +185,7 @@ @param evt reference to the wheel event (QWheelEvent) """ - if evt.modifiers() & Qt.ControlModifier: + if evt.modifiers() & Qt.KeyboardModifier.ControlModifier: delta = evt.angleDelta().y() if delta < 0: self.__zoomOut() @@ -203,7 +203,7 @@ @param evt reference to the event (QEvent) @return flag indicating, if the event was handled (boolean) """ - if evt.type() == QEvent.Gesture: + if evt.type() == QEvent.Type.Gesture: self.gestureEvent(evt) return True @@ -215,11 +215,11 @@ @param evt reference to the gesture event (QGestureEvent """ - pinch = evt.gesture(Qt.PinchGesture) + pinch = evt.gesture(Qt.GestureType.PinchGesture) if pinch: - if pinch.state() == Qt.GestureStarted: + if pinch.state() == Qt.GestureState.GestureStarted: pinch.setTotalScaleFactor(self.__zoom() / 100) - elif pinch.state() == Qt.GestureUpdated: + elif pinch.state() == Qt.GestureState.GestureUpdated: self.__doZoom(int(pinch.totalScaleFactor() * 100)) evt.accept() @@ -306,16 +306,16 @@ """ Private slot called to print the diagram. """ - printer = QPrinter(mode=QPrinter.ScreenResolution) + printer = QPrinter(mode=QPrinter.PrinterMode.ScreenResolution) printer.setFullPage(True) if Preferences.getPrinter("ColorMode"): - printer.setColorMode(QPrinter.Color) + printer.setColorMode(QPrinter.ColorMode.Color) else: - printer.setColorMode(QPrinter.GrayScale) + printer.setColorMode(QPrinter.ColorMode.GrayScale) if Preferences.getPrinter("FirstPageFirst"): - printer.setPageOrder(QPrinter.FirstPageFirst) + printer.setPageOrder(QPrinter.PageOrder.FirstPageFirst) else: - printer.setPageOrder(QPrinter.LastPageFirst) + printer.setPageOrder(QPrinter.PageOrder.LastPageFirst) printer.setPrinterName(Preferences.getPrinter("PrinterName")) printDialog = QPrintDialog(printer, self) @@ -328,22 +328,22 @@ """ from PyQt5.QtPrintSupport import QPrintPreviewDialog - printer = QPrinter(mode=QPrinter.ScreenResolution) + printer = QPrinter(mode=QPrinter.PrinterMode.ScreenResolution) printer.setFullPage(True) if Preferences.getPrinter("ColorMode"): - printer.setColorMode(QPrinter.Color) + printer.setColorMode(QPrinter.ColorMode.Color) else: - printer.setColorMode(QPrinter.GrayScale) + printer.setColorMode(QPrinter.ColorMode.GrayScale) if Preferences.getPrinter("FirstPageFirst"): - printer.setPageOrder(QPrinter.FirstPageFirst) + printer.setPageOrder(QPrinter.PageOrder.FirstPageFirst) else: - printer.setPageOrder(QPrinter.LastPageFirst) + printer.setPageOrder(QPrinter.PageOrder.LastPageFirst) printer.setPageMargins( Preferences.getPrinter("LeftMargin") * 10, Preferences.getPrinter("TopMargin") * 10, Preferences.getPrinter("RightMargin") * 10, Preferences.getPrinter("BottomMargin") * 10, - QPrinter.Millimeter + QPrinter.Unit.Millimeter ) printer.setPrinterName(Preferences.getPrinter("PrinterName")) @@ -396,12 +396,12 @@ marginX + width, marginY + height + 2) painter.setFont(font) painter.drawText(marginX, marginY + height + 4, width, - fontHeight, Qt.AlignRight, s) + fontHeight, Qt.AlignmentFlag.AlignRight, s) # render the diagram size = self.pixmapLabel.pixmap().size() size.scale(QSize(width - 10, height - 10), # 5 px inner margin - Qt.KeepAspectRatio) + Qt.AspectRatioMode.KeepAspectRatio) painter.setViewport(marginX + 5, marginY + 5, size.width(), size.height()) painter.setWindow(self.pixmapLabel.pixmap().rect())
--- a/eric6/Graphics/SvgDiagram.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Graphics/SvgDiagram.py Tue Mar 02 17:17:09 2021 +0100 @@ -51,12 +51,13 @@ self.svgWidget = QSvgWidget() self.svgWidget.setObjectName("svgWidget") - self.svgWidget.setBackgroundRole(QPalette.Base) - self.svgWidget.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored) + self.svgWidget.setBackgroundRole(QPalette.ColorRole.Base) + self.svgWidget.setSizePolicy( + QSizePolicy.Policy.Ignored, QSizePolicy.Policy.Ignored) self.svgView = QScrollArea() self.svgView.setObjectName("svgView") - self.svgView.setBackgroundRole(QPalette.Dark) + self.svgView.setBackgroundRole(QPalette.ColorRole.Dark) self.svgView.setWidget(self.svgWidget) self.setCentralWidget(self.svgView) @@ -82,7 +83,7 @@ self.__initContextMenu() self.__initToolBars() - self.grabGesture(Qt.PinchGesture) + self.grabGesture(Qt.GestureType.PinchGesture) def __initActions(self): """ @@ -113,7 +114,7 @@ self.__menu.addAction(self.printPreviewAct) self.__menu.addAction(self.printAct) - self.setContextMenuPolicy(Qt.CustomContextMenu) + self.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu) self.customContextMenuRequested.connect(self.__showContextMenu) def __showContextMenu(self, coord): @@ -137,8 +138,8 @@ self.graphicsToolBar.addAction(self.printPreviewAct) self.graphicsToolBar.addAction(self.printAct) - self.addToolBar(Qt.TopToolBarArea, self.windowToolBar) - self.addToolBar(Qt.TopToolBarArea, self.graphicsToolBar) + self.addToolBar(Qt.ToolBarArea.TopToolBarArea, self.windowToolBar) + self.addToolBar(Qt.ToolBarArea.TopToolBarArea, self.graphicsToolBar) def getDiagramName(self): """ @@ -154,7 +155,7 @@ @param evt reference to the wheel event (QWheelEvent) """ - if evt.modifiers() & Qt.ControlModifier: + if evt.modifiers() & Qt.KeyboardModifier.ControlModifier: delta = evt.angleDelta().y() if delta < 0: self.__zoomOut() @@ -172,7 +173,7 @@ @param evt reference to the event (QEvent) @return flag indicating, if the event was handled (boolean) """ - if evt.type() == QEvent.Gesture: + if evt.type() == QEvent.Type.Gesture: self.gestureEvent(evt) return True @@ -184,11 +185,11 @@ @param evt reference to the gesture event (QGestureEvent """ - pinch = evt.gesture(Qt.PinchGesture) + pinch = evt.gesture(Qt.GestureType.PinchGesture) if pinch: - if pinch.state() == Qt.GestureStarted: + if pinch.state() == Qt.GestureState.GestureStarted: pinch.setTotalScaleFactor(self.__zoom() / 100) - elif pinch.state() == Qt.GestureUpdated: + elif pinch.state() == Qt.GestureState.GestureUpdated: self.__doZoom(int(pinch.totalScaleFactor() * 100)) evt.accept() @@ -273,16 +274,16 @@ """ Private slot called to print the diagram. """ - printer = QPrinter(mode=QPrinter.ScreenResolution) + printer = QPrinter(mode=QPrinter.PrinterMode.ScreenResolution) printer.setFullPage(True) if Preferences.getPrinter("ColorMode"): - printer.setColorMode(QPrinter.Color) + printer.setColorMode(QPrinter.ColorMode.Color) else: - printer.setColorMode(QPrinter.GrayScale) + printer.setColorMode(QPrinter.ColorMode.GrayScale) if Preferences.getPrinter("FirstPageFirst"): - printer.setPageOrder(QPrinter.FirstPageFirst) + printer.setPageOrder(QPrinter.PageOrder.FirstPageFirst) else: - printer.setPageOrder(QPrinter.LastPageFirst) + printer.setPageOrder(QPrinter.PageOrder.LastPageFirst) printerName = Preferences.getPrinter("PrinterName") if printerName: printer.setPrinterName(printerName) @@ -297,22 +298,22 @@ """ from PyQt5.QtPrintSupport import QPrintPreviewDialog - printer = QPrinter(mode=QPrinter.ScreenResolution) + printer = QPrinter(mode=QPrinter.PrinterMode.ScreenResolution) printer.setFullPage(True) if Preferences.getPrinter("ColorMode"): - printer.setColorMode(QPrinter.Color) + printer.setColorMode(QPrinter.ColorMode.Color) else: - printer.setColorMode(QPrinter.GrayScale) + printer.setColorMode(QPrinter.ColorMode.GrayScale) if Preferences.getPrinter("FirstPageFirst"): - printer.setPageOrder(QPrinter.FirstPageFirst) + printer.setPageOrder(QPrinter.PageOrder.FirstPageFirst) else: - printer.setPageOrder(QPrinter.LastPageFirst) + printer.setPageOrder(QPrinter.PageOrder.LastPageFirst) printer.setPageMargins( Preferences.getPrinter("LeftMargin") * 10, Preferences.getPrinter("TopMargin") * 10, Preferences.getPrinter("RightMargin") * 10, Preferences.getPrinter("BottomMargin") * 10, - QPrinter.Millimeter + QPrinter.Unit.Millimeter ) printerName = Preferences.getPrinter("PrinterName") if printerName: @@ -367,7 +368,7 @@ marginX + width, marginY + height + 2) painter.setFont(font) painter.drawText(marginX, marginY + height + 4, width, - fontHeight, Qt.AlignRight, s) + fontHeight, Qt.AlignmentFlag.AlignRight, s) # render the diagram painter.setViewport(marginX, marginY, width, height)
--- a/eric6/Graphics/UMLDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Graphics/UMLDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -129,9 +129,9 @@ self.umlToolBar = self.umlView.initToolBar() - self.addToolBar(Qt.TopToolBarArea, self.fileToolBar) - self.addToolBar(Qt.TopToolBarArea, self.windowToolBar) - self.addToolBar(Qt.TopToolBarArea, self.umlToolBar) + self.addToolBar(Qt.ToolBarArea.TopToolBarArea, self.fileToolBar) + self.addToolBar(Qt.ToolBarArea.TopToolBarArea, self.windowToolBar) + self.addToolBar(Qt.ToolBarArea.TopToolBarArea, self.umlToolBar) def show(self, fromFile=False): """
--- a/eric6/Graphics/UMLGraphicsView.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Graphics/UMLGraphicsView.py Tue Mar 02 17:17:09 2021 +0100 @@ -44,7 +44,8 @@ """ E5GraphicsView.__init__(self, scene, parent) self.setObjectName("UMLGraphicsView") - self.setViewportUpdateMode(QGraphicsView.FullViewportUpdate) + self.setViewportUpdateMode( + QGraphicsView.ViewportUpdateMode.FullViewportUpdate) self.diagramName = "Unnamed" self.__itemId = -1 @@ -66,7 +67,7 @@ scene.changed.connect(self.__sceneChanged) - self.grabGesture(Qt.PinchGesture) + self.grabGesture(Qt.GestureType.PinchGesture) def __initActions(self): """ @@ -126,37 +127,43 @@ self.alignLeftAct = QAction( UI.PixmapCache.getIcon("shapesAlignLeft"), self.tr("Align Left"), self) - self.alignMapper.setMapping(self.alignLeftAct, Qt.AlignLeft) + self.alignMapper.setMapping( + self.alignLeftAct, Qt.AlignmentFlag.AlignLeft) self.alignLeftAct.triggered.connect(self.alignMapper.map) self.alignHCenterAct = QAction( UI.PixmapCache.getIcon("shapesAlignHCenter"), self.tr("Align Center Horizontal"), self) - self.alignMapper.setMapping(self.alignHCenterAct, Qt.AlignHCenter) + self.alignMapper.setMapping( + self.alignHCenterAct, Qt.AlignmentFlag.AlignHCenter) self.alignHCenterAct.triggered.connect(self.alignMapper.map) self.alignRightAct = QAction( UI.PixmapCache.getIcon("shapesAlignRight"), self.tr("Align Right"), self) - self.alignMapper.setMapping(self.alignRightAct, Qt.AlignRight) + self.alignMapper.setMapping( + self.alignRightAct, Qt.AlignmentFlag.AlignRight) self.alignRightAct.triggered.connect(self.alignMapper.map) self.alignTopAct = QAction( UI.PixmapCache.getIcon("shapesAlignTop"), self.tr("Align Top"), self) - self.alignMapper.setMapping(self.alignTopAct, Qt.AlignTop) + self.alignMapper.setMapping( + self.alignTopAct, Qt.AlignmentFlag.AlignTop) self.alignTopAct.triggered.connect(self.alignMapper.map) self.alignVCenterAct = QAction( UI.PixmapCache.getIcon("shapesAlignVCenter"), self.tr("Align Center Vertical"), self) - self.alignMapper.setMapping(self.alignVCenterAct, Qt.AlignVCenter) + self.alignMapper.setMapping( + self.alignVCenterAct, Qt.AlignmentFlag.AlignVCenter) self.alignVCenterAct.triggered.connect(self.alignMapper.map) self.alignBottomAct = QAction( UI.PixmapCache.getIcon("shapesAlignBottom"), self.tr("Align Bottom"), self) - self.alignMapper.setMapping(self.alignBottomAct, Qt.AlignBottom) + self.alignMapper.setMapping( + self.alignBottomAct, Qt.AlignmentFlag.AlignBottom) self.alignBottomAct.triggered.connect(self.alignMapper.map) def __checkSizeActions(self): @@ -308,7 +315,7 @@ sceneRect = self.scene().sceneRect() dlg = UMLSceneSizeDialog(sceneRect.width(), sceneRect.height(), rect.width(), rect.height(), self) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: width, height = dlg.getData() self.setSceneSize(width, height) self.__checkSizeActions() @@ -400,22 +407,22 @@ """ Public slot called to print the diagram. """ - printer = QPrinter(mode=QPrinter.ScreenResolution) + printer = QPrinter(mode=QPrinter.PrinterMode.ScreenResolution) printer.setFullPage(True) if Preferences.getPrinter("ColorMode"): - printer.setColorMode(QPrinter.Color) + printer.setColorMode(QPrinter.ColorMode.Color) else: - printer.setColorMode(QPrinter.GrayScale) + printer.setColorMode(QPrinter.ColorMode.GrayScale) if Preferences.getPrinter("FirstPageFirst"): - printer.setPageOrder(QPrinter.FirstPageFirst) + printer.setPageOrder(QPrinter.PageOrder.FirstPageFirst) else: - printer.setPageOrder(QPrinter.LastPageFirst) + printer.setPageOrder(QPrinter.PageOrder.LastPageFirst) printer.setPageMargins( Preferences.getPrinter("LeftMargin") * 10, Preferences.getPrinter("TopMargin") * 10, Preferences.getPrinter("RightMargin") * 10, Preferences.getPrinter("BottomMargin") * 10, - QPrinter.Millimeter + QPrinter.Unit.Millimeter ) printerName = Preferences.getPrinter("PrinterName") if printerName: @@ -432,22 +439,22 @@ """ from PyQt5.QtPrintSupport import QPrintPreviewDialog - printer = QPrinter(mode=QPrinter.ScreenResolution) + printer = QPrinter(mode=QPrinter.PrinterMode.ScreenResolution) printer.setFullPage(True) if Preferences.getPrinter("ColorMode"): - printer.setColorMode(QPrinter.Color) + printer.setColorMode(QPrinter.ColorMode.Color) else: - printer.setColorMode(QPrinter.GrayScale) + printer.setColorMode(QPrinter.ColorMode.GrayScale) if Preferences.getPrinter("FirstPageFirst"): - printer.setPageOrder(QPrinter.FirstPageFirst) + printer.setPageOrder(QPrinter.PageOrder.FirstPageFirst) else: - printer.setPageOrder(QPrinter.LastPageFirst) + printer.setPageOrder(QPrinter.PageOrder.LastPageFirst) printer.setPageMargins( Preferences.getPrinter("LeftMargin") * 10, Preferences.getPrinter("TopMargin") * 10, Preferences.getPrinter("RightMargin") * 10, Preferences.getPrinter("BottomMargin") * 10, - QPrinter.Millimeter + QPrinter.Unit.Millimeter ) printerName = Preferences.getPrinter("PrinterName") if printerName: @@ -488,27 +495,27 @@ amount = None for i, item in enumerate(items): rect = item.sceneBoundingRect() - if alignment == Qt.AlignLeft: + if alignment == Qt.AlignmentFlag.AlignLeft: if amount is None or rect.x() < amount: amount = rect.x() index = i - elif alignment == Qt.AlignRight: + elif alignment == Qt.AlignmentFlag.AlignRight: if amount is None or rect.x() + rect.width() > amount: amount = rect.x() + rect.width() index = i - elif alignment == Qt.AlignHCenter: + elif alignment == Qt.AlignmentFlag.AlignHCenter: if amount is None or rect.width() > amount: amount = rect.width() index = i - elif alignment == Qt.AlignTop: + elif alignment == Qt.AlignmentFlag.AlignTop: if amount is None or rect.y() < amount: amount = rect.y() index = i - elif alignment == Qt.AlignBottom: + elif alignment == Qt.AlignmentFlag.AlignBottom: if amount is None or rect.y() + rect.height() > amount: amount = rect.y() + rect.height() index = i - elif alignment == Qt.AlignVCenter: + elif alignment == Qt.AlignmentFlag.AlignVCenter: if amount is None or rect.height() > amount: amount = rect.height() index = i @@ -520,26 +527,26 @@ continue itemrect = item.sceneBoundingRect() xOffset = yOffset = 0 - if alignment == Qt.AlignLeft: + if alignment == Qt.AlignmentFlag.AlignLeft: xOffset = rect.x() - itemrect.x() - elif alignment == Qt.AlignRight: + elif alignment == Qt.AlignmentFlag.AlignRight: xOffset = ( (rect.x() + rect.width()) - (itemrect.x() + itemrect.width()) ) - elif alignment == Qt.AlignHCenter: + elif alignment == Qt.AlignmentFlag.AlignHCenter: xOffset = ( (rect.x() + rect.width() // 2) - (itemrect.x() + itemrect.width() // 2) ) - elif alignment == Qt.AlignTop: + elif alignment == Qt.AlignmentFlag.AlignTop: yOffset = rect.y() - itemrect.y() - elif alignment == Qt.AlignBottom: + elif alignment == Qt.AlignmentFlag.AlignBottom: yOffset = ( (rect.y() + rect.height()) - (itemrect.y() + itemrect.height()) ) - elif alignment == Qt.AlignVCenter: + elif alignment == Qt.AlignmentFlag.AlignVCenter: yOffset = ( (rect.y() + rect.height() // 2) - (itemrect.y() + itemrect.height() // 2) @@ -575,20 +582,21 @@ @param evt reference to the key event (QKeyEvent) """ key = evt.key() - if key in [Qt.Key_Up, Qt.Key_Down, Qt.Key_Left, Qt.Key_Right]: + if key in [Qt.Key.Key_Up, Qt.Key.Key_Down, Qt.Key.Key_Left, + Qt.Key.Key_Right]: items = self.filteredItems(self.scene().selectedItems()) if items: - if evt.modifiers() & Qt.ControlModifier: + if evt.modifiers() & Qt.KeyboardModifier.ControlModifier: stepSize = 50 else: stepSize = 5 - if key == Qt.Key_Up: + if key == Qt.Key.Key_Up: dx = 0 dy = -stepSize - elif key == Qt.Key_Down: + elif key == Qt.Key.Key_Down: dx = 0 dy = stepSize - elif key == Qt.Key_Left: + elif key == Qt.Key.Key_Left: dx = -stepSize dy = 0 else: @@ -607,7 +615,7 @@ @param evt reference to the wheel event (QWheelEvent) """ - if evt.modifiers() & Qt.ControlModifier: + if evt.modifiers() & Qt.KeyboardModifier.ControlModifier: delta = evt.angleDelta().y() if delta < 0: self.zoomOut() @@ -625,7 +633,7 @@ @param evt reference to the event (QEvent) @return flag indicating, if the event was handled (boolean) """ - if evt.type() == QEvent.Gesture: + if evt.type() == QEvent.Type.Gesture: self.gestureEvent(evt) return True @@ -637,11 +645,11 @@ @param evt reference to the gesture event (QGestureEvent """ - pinch = evt.gesture(Qt.PinchGesture) + pinch = evt.gesture(Qt.GestureType.PinchGesture) if pinch: - if pinch.state() == Qt.GestureStarted: + if pinch.state() == Qt.GestureState.GestureStarted: pinch.setTotalScaleFactor(self.zoom() / 100.0) - elif pinch.state() == Qt.GestureUpdated: + elif pinch.state() == Qt.GestureState.GestureUpdated: self.setZoom(int(pinch.totalScaleFactor() * 100)) evt.accept()
--- a/eric6/Graphics/UMLItem.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Graphics/UMLItem.py Tue Mar 02 17:17:09 2021 +0100 @@ -63,7 +63,8 @@ self.model = model if colors is None: - self._colors = (QColor(Qt.black), QColor(Qt.white)) + self._colors = (QColor(Qt.GlobalColor.black), + QColor(Qt.GlobalColor.white)) else: self._colors = colors self.setPen(QPen(self._colors[0])) @@ -78,13 +79,14 @@ if rounded: p = self.pen() - p.setCapStyle(Qt.RoundCap) - p.setJoinStyle(Qt.RoundJoin) + p.setCapStyle(Qt.PenCapStyle.RoundCap) + p.setJoinStyle(Qt.PenJoinStyle.RoundJoin) - self.setFlag(QGraphicsItem.ItemIsMovable, True) - self.setFlag(QGraphicsItem.ItemIsSelectable, True) + self.setFlag(QGraphicsItem.GraphicsItemFlag.ItemIsMovable, True) + self.setFlag(QGraphicsItem.GraphicsItemFlag.ItemIsSelectable, True) try: - self.setFlag(QGraphicsItem.ItemSendsGeometryChanges, True) + self.setFlag( + QGraphicsItem.GraphicsItemFlag.ItemSendsGeometryChanges, True) except AttributeError: # only available for Qt 4.6.0 and newer pass @@ -175,7 +177,7 @@ @param value the value of the change @return adjusted values """ - if change == QGraphicsItem.ItemPositionChange: + if change == QGraphicsItem.GraphicsItemChange.ItemPositionChange: # 1. remember to adjust associations self.shouldAdjustAssociations = True @@ -199,8 +201,8 @@ """ pen = self.pen() if ( - (option.state & QStyle.State_Selected) == - QStyle.State(QStyle.State_Selected) + (option.state & QStyle.StateFlag.State_Selected) == + QStyle.State(QStyle.StateFlag.State_Selected) ): pen.setWidth(2) else:
--- a/eric6/HexEdit/HexEditChunks.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/HexEdit/HexEditChunks.py Tue Mar 02 17:17:09 2021 +0100 @@ -33,9 +33,9 @@ interface. When the app uses a QByteArray or Python bytearray interface, QBuffer is used to provide again a QIODevice like interface. No data will be changed, therefore HexEditChunks opens the QIODevice in - QIODevice.ReadOnly mode. After every access HexEditChunks closes the - QIODevice. That's why external applications can overwrite files while - HexEditWidget shows them. + QIODevice.OpenModeFlag.ReadOnly mode. After every access HexEditChunks + closes the QIODevice. That's why external applications can overwrite + files while HexEditWidget shows them. When the the user starts to edit the data, HexEditChunks creates a local copy of a chunk of data (4 kilobytes) and notes all changes there. Parallel @@ -74,7 +74,7 @@ @rtype bool """ self.__ioDevice = ioDevice - ok = self.__ioDevice.open(QIODevice.ReadOnly) + ok = self.__ioDevice.open(QIODevice.OpenModeFlag.ReadOnly) if ok: # open successfully self.__size = self.__ioDevice.size() @@ -119,7 +119,7 @@ elif (pos + maxSize) > self.__size: maxSize = self.__size - pos - self.__ioDevice.open(QIODevice.ReadOnly) + self.__ioDevice.open(QIODevice.OpenModeFlag.ReadOnly) while maxSize > 0: chunk.absPos = sys.maxsize @@ -185,7 +185,7 @@ # write all data count = self.__size - ok = ioDevice.open(QIODevice.WriteOnly) + ok = ioDevice.open(QIODevice.OpenModeFlag.WriteOnly) if ok: idx = pos while idx < count: @@ -434,7 +434,7 @@ newChunk = HexEditChunk() readAbsPos = absPos - ioDelta readPos = readAbsPos & self.READ_CHUNK_MASK - self.__ioDevice.open(QIODevice.ReadOnly) + self.__ioDevice.open(QIODevice.OpenModeFlag.ReadOnly) self.__ioDevice.seek(readPos) newChunk.data = bytearray(self.__ioDevice.read(self.CHUNK_SIZE)) self.__ioDevice.close()
--- a/eric6/HexEdit/HexEditGotoWidget.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/HexEdit/HexEditGotoWidget.py Tue Mar 02 17:17:09 2021 +0100 @@ -59,7 +59,7 @@ """ Private slot to close the widget. """ - self.__editor.setFocus(Qt.OtherFocusReason) + self.__editor.setFocus(Qt.FocusReason.OtherFocusReason) self.close() @pyqtSlot(int) @@ -139,7 +139,7 @@ @param event reference to the key press event @type QKeyEvent """ - if event.key() == Qt.Key_Escape: + if event.key() == Qt.Key.Key_Escape: self.close() def __convertText(self, txt, oldFormat, newFormat):
--- a/eric6/HexEdit/HexEditMainWindow.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/HexEdit/HexEditMainWindow.py Tue Mar 02 17:17:09 2021 +0100 @@ -607,7 +607,7 @@ """ with your prefered values.</p>""" )) self.prefAct.triggered.connect(self.__showPreferences) - self.prefAct.setMenuRole(QAction.PreferencesRole) + self.prefAct.setMenuRole(QAction.MenuRole.PreferencesRole) self.__actions.append(self.prefAct) def __setReadOnlyActionTexts(self): @@ -775,7 +775,8 @@ """<p>This part of the status bar displays the cursor""" """ address.</p>""" )) - self.__sbAddress.setFrameStyle(QFrame.StyledPanel | QFrame.Plain) + self.__sbAddress.setFrameStyle( + QFrame.Shape.StyledPanel | QFrame.Shadow.Plain) self.__sbSelection = QLabel(self.__statusBar) self.__statusBar.addPermanentWidget(self.__sbSelection) @@ -783,7 +784,8 @@ """<p>This part of the status bar displays some selection""" """ information.</p>""" )) - self.__sbSelection.setFrameStyle(QFrame.StyledPanel | QFrame.Plain) + self.__sbSelection.setFrameStyle( + QFrame.Shape.StyledPanel | QFrame.Shadow.Plain) self.__sbSize = QLabel(self.__statusBar) self.__statusBar.addPermanentWidget(self.__sbSize) @@ -791,14 +793,16 @@ """<p>This part of the status bar displays the size of the""" """ binary data.</p>""" )) - self.__sbSize.setFrameStyle(QFrame.StyledPanel | QFrame.Plain) + self.__sbSize.setFrameStyle( + QFrame.Shape.StyledPanel | QFrame.Shadow.Plain) self.__sbEditMode = E5ClickableLabel(self.__statusBar) self.__statusBar.addPermanentWidget(self.__sbEditMode) self.__sbEditMode.setWhatsThis(self.tr( """<p>This part of the status bar displays the edit mode.</p>""" )) - self.__sbEditMode.setFrameStyle(QFrame.StyledPanel | QFrame.Plain) + self.__sbEditMode.setFrameStyle( + QFrame.Shape.StyledPanel | QFrame.Shadow.Plain) self.__sbEditMode.clicked.connect(self.__toggleEditMode) self.__sbReadOnly = E5ClickableLabel(self.__statusBar) @@ -807,7 +811,8 @@ """<p>This part of the status bar displays the read""" """ only mode.</p>""" )) - self.__sbReadOnly.setFrameStyle(QFrame.StyledPanel | QFrame.Plain) + self.__sbReadOnly.setFrameStyle( + QFrame.Shape.StyledPanel | QFrame.Shadow.Plain) self.__sbReadOnly.clicked.connect(self.__toggleReadOnlyMode) self.__showEditMode(self.__editor.overwriteMode()) @@ -1370,7 +1375,7 @@ dlg.showConfigurationPageByName("hexEditorPage") dlg.exec() QCoreApplication.processEvents() - if dlg.result() == QDialog.Accepted: + if dlg.result() == QDialog.DialogCode.Accepted: dlg.setPreferences() Preferences.syncPreferences() self.__preferencesChangedByLocalPreferencesDialog()
--- a/eric6/HexEdit/HexEditSearchReplaceWidget.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/HexEdit/HexEditSearchReplaceWidget.py Tue Mar 02 17:17:09 2021 +0100 @@ -469,7 +469,7 @@ """ Private slot to close the widget. """ - self.__editor.setFocus(Qt.OtherFocusReason) + self.__editor.setFocus(Qt.FocusReason.OtherFocusReason) self.close() def keyPressEvent(self, event): @@ -479,7 +479,7 @@ @param event reference to the key press event @type QKeyEvent """ - if event.key() == Qt.Key_Escape: + if event.key() == Qt.Key.Key_Escape: self.close() def __convertText(self, txt, oldFormat, newFormat):
--- a/eric6/HexEdit/HexEditWidget.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/HexEdit/HexEditWidget.py Tue Mar 02 17:17:09 2021 +0100 @@ -134,10 +134,10 @@ self.setFont(QFont("Monospace", 10)) self.setAddressAreaColors( - self.palette().color(QPalette.WindowText), + self.palette().color(QPalette.ColorRole.WindowText), self.palette().alternateBase().color()) self.setHighlightColors( - self.palette().color(QPalette.WindowText), + self.palette().color(QPalette.ColorRole.WindowText), QColor(0xff, 0xff, 0x99, 0xff)) self.setSelectionColors( self.palette().highlightedText().color(), @@ -1193,80 +1193,82 @@ @type QKeyEvent """ # Cursor movements - if evt.matches(QKeySequence.MoveToNextChar): + if evt.matches(QKeySequence.StandardKey.MoveToNextChar): self.moveCursorToNextChar() - elif evt.matches(QKeySequence.MoveToPreviousChar): + elif evt.matches(QKeySequence.StandardKey.MoveToPreviousChar): self.moveCursorToPreviousChar() - elif evt.matches(QKeySequence.MoveToEndOfLine): + elif evt.matches(QKeySequence.StandardKey.MoveToEndOfLine): self.moveCursorToEndOfLine() - elif evt.matches(QKeySequence.MoveToStartOfLine): + elif evt.matches(QKeySequence.StandardKey.MoveToStartOfLine): self.moveCursorToStartOfLine() - elif evt.matches(QKeySequence.MoveToPreviousLine): + elif evt.matches(QKeySequence.StandardKey.MoveToPreviousLine): self.moveCursorToPreviousLine() - elif evt.matches(QKeySequence.MoveToNextLine): + elif evt.matches(QKeySequence.StandardKey.MoveToNextLine): self.moveCursorToNextLine() - elif evt.matches(QKeySequence.MoveToNextPage): + elif evt.matches(QKeySequence.StandardKey.MoveToNextPage): self.moveCursorToNextPage() - elif evt.matches(QKeySequence.MoveToPreviousPage): + elif evt.matches(QKeySequence.StandardKey.MoveToPreviousPage): self.moveCursorToPreviousPage() - elif evt.matches(QKeySequence.MoveToEndOfDocument): + elif evt.matches(QKeySequence.StandardKey.MoveToEndOfDocument): self.moveCursorToEndOfDocument() - elif evt.matches(QKeySequence.MoveToStartOfDocument): + elif evt.matches(QKeySequence.StandardKey.MoveToStartOfDocument): self.moveCursorToStartOfDocument() # Selection commands - elif evt.matches(QKeySequence.SelectAll): + elif evt.matches(QKeySequence.StandardKey.SelectAll): self.selectAll() - elif evt.matches(QKeySequence.SelectNextChar): + elif evt.matches(QKeySequence.StandardKey.SelectNextChar): self.selectNextChar() - elif evt.matches(QKeySequence.SelectPreviousChar): + elif evt.matches(QKeySequence.StandardKey.SelectPreviousChar): self.selectPreviousChar() - elif evt.matches(QKeySequence.SelectEndOfLine): + elif evt.matches(QKeySequence.StandardKey.SelectEndOfLine): self.selectToEndOfLine() - elif evt.matches(QKeySequence.SelectStartOfLine): + elif evt.matches(QKeySequence.StandardKey.SelectStartOfLine): self.selectToStartOfLine() - elif evt.matches(QKeySequence.SelectPreviousLine): + elif evt.matches(QKeySequence.StandardKey.SelectPreviousLine): self.selectPreviousLine() - elif evt.matches(QKeySequence.SelectNextLine): + elif evt.matches(QKeySequence.StandardKey.SelectNextLine): self.selectNextLine() - elif evt.matches(QKeySequence.SelectNextPage): + elif evt.matches(QKeySequence.StandardKey.SelectNextPage): self.selectNextPage() - elif evt.matches(QKeySequence.SelectPreviousPage): + elif evt.matches(QKeySequence.StandardKey.SelectPreviousPage): self.selectPreviousPage() - elif evt.matches(QKeySequence.SelectEndOfDocument): + elif evt.matches(QKeySequence.StandardKey.SelectEndOfDocument): self.selectEndOfDocument() - elif evt.matches(QKeySequence.SelectStartOfDocument): + elif evt.matches(QKeySequence.StandardKey.SelectStartOfDocument): self.selectStartOfDocument() # Edit commands - elif evt.matches(QKeySequence.Copy): + elif evt.matches(QKeySequence.StandardKey.Copy): self.copy() elif ( - evt.key() == Qt.Key_Insert and - evt.modifiers() == Qt.NoModifier + evt.key() == Qt.Key.Key_Insert and + evt.modifiers() == Qt.KeyboardModifier.NoModifier ): self.setOverwriteMode(not self.overwriteMode()) self.setCursorPosition(self.__cursorPosition) elif not self.__readOnly: - if evt.matches(QKeySequence.Cut): + if evt.matches(QKeySequence.StandardKey.Cut): self.cut() - elif evt.matches(QKeySequence.Paste): + elif evt.matches(QKeySequence.StandardKey.Paste): self.paste() - elif evt.matches(QKeySequence.Delete): + elif evt.matches(QKeySequence.StandardKey.Delete): self.deleteByte() elif ( - evt.key() == Qt.Key_Backspace and - evt.modifiers() == Qt.NoModifier + evt.key() == Qt.Key.Key_Backspace and + evt.modifiers() == Qt.KeyboardModifier.NoModifier ): self.deleteByteBack() - elif evt.matches(QKeySequence.Undo): + elif evt.matches(QKeySequence.StandardKey.Undo): self.undo() - elif evt.matches(QKeySequence.Redo): + elif evt.matches(QKeySequence.StandardKey.Redo): self.redo() elif QApplication.keyboardModifiers() in [ - Qt.NoModifier, Qt.KeypadModifier]: + Qt.KeyboardModifier.NoModifier, + Qt.KeyboardModifier.KeypadModifier + ]: # some hex input key = evt.text() if key and key in "0123456789abcdef": @@ -1337,7 +1339,7 @@ self.viewport().update() cPos = self.cursorPositionFromPoint(evt.pos()) if cPos >= 0: - if evt.modifiers() == Qt.ShiftModifier: + if evt.modifiers() == Qt.KeyboardModifier.ShiftModifier: self.__setSelection(cPos) else: self.__resetSelection(cPos) @@ -1361,7 +1363,8 @@ # draw some patterns if needed painter.fillRect( - evt.rect(), self.viewport().palette().color(QPalette.Base)) + evt.rect(), + self.viewport().palette().color(QPalette.ColorRole.Base)) if self.__addressArea: painter.fillRect( QRect(-pxOfsX, evt.rect().top(), @@ -1370,12 +1373,12 @@ self.__addressAreaBrush) if self.__asciiArea: linePos = self.__pxPosAsciiX - (self.__pxGapHexAscii // 2) - painter.setPen(Qt.gray) + painter.setPen(Qt.GlobalColor.gray) painter.drawLine(linePos - pxOfsX, evt.rect().top(), linePos - pxOfsX, self.height()) painter.setPen( - self.viewport().palette().color(QPalette.WindowText)) + self.viewport().palette().color(QPalette.ColorRole.WindowText)) # paint the address area if self.__addressArea: @@ -1396,9 +1399,9 @@ # paint hex and ascii area colStandard = QPen( - self.viewport().palette().color(QPalette.WindowText)) + self.viewport().palette().color(QPalette.ColorRole.WindowText)) - painter.setBackgroundMode(Qt.TransparentMode) + painter.setBackgroundMode(Qt.BGMode.TransparentMode) row = 0 pxPosY = pxPosStartY @@ -1412,7 +1415,8 @@ bPosLine + colIdx < len(self.__dataShown) and colIdx < self.BYTES_PER_LINE ): - c = self.viewport().palette().color(QPalette.Base) + c = self.viewport().palette().color( + QPalette.ColorRole.Base) painter.setPen(colStandard) posBa = self.__bPosFirst + bPosLine + colIdx @@ -1476,14 +1480,15 @@ row += 1 pxPosY += self.__pxCharHeight - painter.setBackgroundMode(Qt.TransparentMode) + painter.setBackgroundMode(Qt.BGMode.TransparentMode) painter.setPen( - self.viewport().palette().color(QPalette.WindowText)) + self.viewport().palette().color(QPalette.ColorRole.WindowText)) # paint cursor if self.__blink and not self.__readOnly and self.isActiveWindow(): painter.fillRect( - self.__cursorRect, self.palette().color(QPalette.WindowText)) + self.__cursorRect, + self.palette().color(QPalette.ColorRole.WindowText)) else: if self.__hexDataShown: try:
--- a/eric6/IconEditor/IconEditorGrid.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/IconEditor/IconEditorGrid.py Tue Mar 02 17:17:09 2021 +0100 @@ -123,10 +123,11 @@ """ super(IconEditorGrid, self).__init__(parent) - self.setAttribute(Qt.WA_StaticContents) - self.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum) + self.setAttribute(Qt.WidgetAttribute.WA_StaticContents) + self.setSizePolicy(QSizePolicy.Policy.Minimum, + QSizePolicy.Policy.Minimum) - self.__curColor = Qt.black + self.__curColor = Qt.GlobalColor.black self.__zoom = 12 self.__curTool = self.Pencil self.__startPos = QPoint() @@ -141,12 +142,14 @@ self.__undoStack = QUndoStack(self) self.__currentUndoCmd = None - self.__image = QImage(32, 32, QImage.Format_ARGB32) + self.__image = QImage(32, 32, QImage.Format.Format_ARGB32) self.__image.fill(qRgba(0, 0, 0, 0)) self.__markImage = QImage(self.__image) self.__markImage.fill(self.NoMarkColor.rgba()) - self.__compositingMode = QPainter.CompositionMode_SourceOver + self.__compositingMode = ( + QPainter.CompositionMode.CompositionMode_SourceOver + ) self.__lastPos = (-1, -1) self.__gridEnabled = True @@ -172,7 +175,7 @@ """ cursorsPath = os.path.join(os.path.dirname(__file__), "cursors") - self.__normalCursor = QCursor(Qt.ArrowCursor) + self.__normalCursor = QCursor(Qt.CursorShape.ArrowCursor) pix = QPixmap(os.path.join(cursorsPath, "colorpicker-cursor.xpm")) mask = pix.createHeuristicMask() @@ -332,7 +335,8 @@ @param clearUndo flag indicating to clear the undo stack (boolean) """ if newImage != self.__image: - self.__image = newImage.convertToFormat(QImage.Format_ARGB32) + self.__image = newImage.convertToFormat( + QImage.Format.Format_ARGB32) self.update() self.updateGeometry() self.resize(self.sizeHint()) @@ -430,13 +434,13 @@ j += 1 col = QColor("#aaa") - painter.setPen(Qt.DashLine) + painter.setPen(Qt.PenStyle.DashLine) for i in range(0, self.__image.width()): for j in range(0, self.__image.height()): rect = self.__pixelRect(i, j) if evt.region().intersects(rect): color = QColor.fromRgba(self.__image.pixel(i, j)) - painter.fillRect(rect, QBrush(Qt.white)) + painter.fillRect(rect, QBrush(Qt.GlobalColor.white)) painter.fillRect(QRect(rect.topLeft(), rect.center()), col) painter.fillRect(QRect(rect.center(), rect.bottomRight()), col) @@ -468,7 +472,7 @@ @param evt reference to the mouse event object (QMouseEvent) """ - if evt.button() == Qt.LeftButton: + if evt.button() == Qt.MouseButton.LeftButton: if self.__isPasting: self.__isPasting = False self.editPaste(True) @@ -519,11 +523,14 @@ """ self.positionChanged.emit(*self.__imageCoordinates(evt.pos())) - if self.__isPasting and not (evt.buttons() & Qt.LeftButton): + if ( + self.__isPasting and + not (evt.buttons() & Qt.MouseButton.LeftButton) + ): self.__drawPasteRect(evt.pos()) return - if evt.buttons() & Qt.LeftButton: + if evt.buttons() & Qt.MouseButton.LeftButton: if self.__curTool == self.Pencil: self.__setImagePixel(evt.pos(), True) self.setDirty(True) @@ -541,7 +548,7 @@ @param evt reference to the mouse event object (QMouseEvent) """ - if evt.button() == Qt.LeftButton: + if evt.button() == Qt.MouseButton.LeftButton: if self.__curTool in [self.Pencil, self.Rubber]: if self.__currentUndoCmd: self.__currentUndoCmd.setAfterImage(self.__image) @@ -831,7 +838,7 @@ img = QApplication.clipboard().image() ok = not img.isNull() if ok: - img = img.convertToFormat(QImage.Format_ARGB32) + img = img.convertToFormat(QImage.Format.Format_ARGB32) return img, ok @@ -846,7 +853,7 @@ cmd = IconEditCommand(self, self.tr("Cut Selection"), self.__image) - img = QImage(self.__selRect.size(), QImage.Format_ARGB32) + img = QImage(self.__selRect.size(), QImage.Format.Format_ARGB32) img.fill(qRgba(0, 0, 0, 0)) for i in range(0, self.__selRect.width()): for j in range(0, self.__selRect.height()): @@ -987,7 +994,7 @@ from .IconSizeDialog import IconSizeDialog dlg = IconSizeDialog(self.__image.width(), self.__image.height()) res = dlg.exec() - if res == QDialog.Accepted: + if res == QDialog.DialogCode.Accepted: newWidth, newHeight = dlg.getData() if ( newWidth != self.__image.width() or @@ -996,8 +1003,8 @@ cmd = IconEditCommand(self, self.tr("Resize Image"), self.__image) img = self.__image.scaled( - newWidth, newHeight, Qt.IgnoreAspectRatio, - Qt.SmoothTransformation) + newWidth, newHeight, Qt.AspectRatioMode.IgnoreAspectRatio, + Qt.TransformationMode.SmoothTransformation) self.setIconImage(img) self.setDirty(True) self.__undoStack.push(cmd) @@ -1010,9 +1017,9 @@ from .IconSizeDialog import IconSizeDialog dlg = IconSizeDialog(self.__image.width(), self.__image.height()) res = dlg.exec() - if res == QDialog.Accepted: + if res == QDialog.DialogCode.Accepted: width, height = dlg.getData() - img = QImage(width, height, QImage.Format_ARGB32) + img = QImage(width, height, QImage.Format.Format_ARGB32) img.fill(qRgba(0, 0, 0, 0)) self.setIconImage(img)
--- a/eric6/IconEditor/IconEditorPalette.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/IconEditor/IconEditorPalette.py Tue Mar 02 17:17:09 2021 +0100 @@ -34,17 +34,18 @@ """ super(IconEditorPalette, self).__init__(parent) - if self.layoutDirection == Qt.Horizontal: - direction = QBoxLayout.LeftToRight + if self.layoutDirection == Qt.Orientation.Horizontal: + direction = QBoxLayout.Direction.LeftToRight else: - direction = QBoxLayout.TopToBottom + direction = QBoxLayout.Direction.TopToBottom self.__layout = QBoxLayout(direction, self) self.setLayout(self.__layout) self.__preview = QLabel(self) - self.__preview.setFrameStyle(QFrame.Panel | QFrame.Sunken) + self.__preview.setFrameStyle(QFrame.Shape.Panel | QFrame.Shadow.Sunken) self.__preview.setFixedHeight(64) - self.__preview.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter) + self.__preview.setAlignment( + Qt.AlignmentFlag.AlignHCenter | Qt.AlignmentFlag.AlignVCenter) self.__preview.setWhatsThis(self.tr( """<b>Preview</b>""" """<p>This is a 1:1 preview of the current icon.</p>""" @@ -52,9 +53,10 @@ self.__layout.addWidget(self.__preview) self.__color = QLabel(self) - self.__color.setFrameStyle(QFrame.Panel | QFrame.Sunken) + self.__color.setFrameStyle(QFrame.Shape.Panel | QFrame.Shadow.Sunken) self.__color.setFixedHeight(24) - self.__color.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter) + self.__color.setAlignment( + Qt.AlignmentFlag.AlignHCenter | Qt.AlignmentFlag.AlignVCenter) self.__color.setWhatsThis(self.tr( """<b>Current Color</b>""" """<p>This is the currently selected color used for drawing.</p>""" @@ -62,7 +64,8 @@ self.__layout.addWidget(self.__color) self.__colorTxt = QLabel(self) - self.__colorTxt.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter) + self.__colorTxt.setAlignment( + Qt.AlignmentFlag.AlignHCenter | Qt.AlignmentFlag.AlignVCenter) self.__colorTxt.setWhatsThis(self.tr( """<b>Current Color Value</b>""" """<p>This is the currently selected color value used for""" @@ -113,7 +116,7 @@ self.__layout.addWidget(self.__compositingGroup) spacer = QSpacerItem( - 10, 10, QSizePolicy.Minimum, QSizePolicy.Expanding) + 10, 10, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding) self.__layout.addItem(spacer) def previewChanged(self, pixmap): @@ -170,9 +173,9 @@ @param mode compositing mode to set (QPainter.CompositionMode) """ - if mode == QPainter.CompositionMode_Source: + if mode == QPainter.CompositionMode.CompositionMode_Source: self.__sourceButton.setChecked(True) - elif mode == QPainter.CompositionMode_SourceOver: + elif mode == QPainter.CompositionMode.CompositionMode_SourceOver: self.__sourceOverButton.setChecked(True) def __compositingChanged(self, on): @@ -185,7 +188,7 @@ if on: if self.__sourceButton.isChecked(): self.compositingChanged.emit( - QPainter.CompositionMode_Source) + QPainter.CompositionMode.CompositionMode_Source) elif self.__sourceOverButton.isChecked(): self.compositingChanged.emit( - QPainter.CompositionMode_SourceOver) + QPainter.CompositionMode.CompositionMode_SourceOver)
--- a/eric6/IconEditor/IconEditorWindow.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/IconEditor/IconEditorWindow.py Tue Mar 02 17:17:09 2021 +0100 @@ -69,7 +69,8 @@ self.__editor = IconEditorGrid() self.__scrollArea = QScrollArea() self.__scrollArea.setWidget(self.__editor) - self.__scrollArea.viewport().setBackgroundRole(QPalette.Dark) + self.__scrollArea.viewport().setBackgroundRole( + QPalette.ColorRole.Dark) self.__scrollArea.viewport().setAutoFillBackground(True) self.setCentralWidget(self.__scrollArea) @@ -115,7 +116,7 @@ self.__lastOpenPath = "" self.__lastSavePath = "" - self.grabGesture(Qt.PinchGesture) + self.grabGesture(Qt.GestureType.PinchGesture) def __initFileFilters(self): """ @@ -994,11 +995,17 @@ self.__paletteDock = QDockWidget(self) self.__paletteDock.setObjectName("paletteDock") self.__paletteDock.setFeatures( - QDockWidget.DockWidgetFeatures(QDockWidget.AllDockWidgetFeatures)) + QDockWidget.DockWidgetFeatures( + QDockWidget.DockWidgetFeature.DockWidgetClosable | + QDockWidget.DockWidgetFeature.DockWidgetMovable | + QDockWidget.DockWidgetFeature.DockWidgetFloatable + ) + ) self.__paletteDock.setWindowTitle("Palette") self.__palette = IconEditorPalette() self.__paletteDock.setWidget(self.__palette) - self.addDockWidget(Qt.RightDockWidgetArea, self.__paletteDock) + self.addDockWidget(Qt.DockWidgetArea.RightDockWidgetArea, + self.__paletteDock) def closeEvent(self, evt): """ @@ -1351,7 +1358,7 @@ @param evt reference to the wheel event (QWheelEvent) """ - if evt.modifiers() & Qt.ControlModifier: + if evt.modifiers() & Qt.KeyboardModifier.ControlModifier: delta = evt.angleDelta().y() if delta < 0: self.__zoomOut() @@ -1369,7 +1376,7 @@ @param evt reference to the event (QEvent) @return flag indicating, if the event was handled (boolean) """ - if evt.type() == QEvent.Gesture: + if evt.type() == QEvent.Type.Gesture: self.gestureEvent(evt) return True @@ -1381,11 +1388,11 @@ @param evt reference to the gesture event (QGestureEvent """ - pinch = evt.gesture(Qt.PinchGesture) + pinch = evt.gesture(Qt.GestureType.PinchGesture) if pinch: - if pinch.state() == Qt.GestureStarted: + if pinch.state() == Qt.GestureState.GestureStarted: pinch.setTotalScaleFactor(self.__editor.zoomFactor() / 100.0) - elif pinch.state() == Qt.GestureUpdated: + elif pinch.state() == Qt.GestureState.GestureUpdated: self.__editor.setZoomFactor( int(pinch.totalScaleFactor() * 100)) self.__updateZoom()
--- a/eric6/MicroPython/AddEditDevicesDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/MicroPython/AddEditDevicesDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -67,7 +67,7 @@ self.dataVolumeEdit.setText("") self.flashVolumeEdit.setText("") - self.deviceTypeComboBox.setFocus(Qt.OtherFocusReason) + self.deviceTypeComboBox.setFocus(Qt.FocusReason.OtherFocusReason) msh = self.minimumSizeHint() self.resize(max(self.width(), msh.width()), msh.height()) @@ -81,7 +81,8 @@ @type int """ board = self.deviceTypeComboBox.currentData() - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(bool(board)) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(bool(board)) self.reportButton.setEnabled(bool(board)) @pyqtSlot()
--- a/eric6/MicroPython/ConnectionSelectionDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/MicroPython/ConnectionSelectionDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -21,8 +21,8 @@ Class implementing a dialog to select the port to connect to and the type of the attached device. """ - PortNameRole = Qt.UserRole - VidPidRole = Qt.UserRole + 1 + PortNameRole = Qt.ItemDataRole.UserRole + VidPidRole = Qt.ItemDataRole.UserRole + 1 def __init__(self, ports, currentPort, currentType, parent=None): """ @@ -79,7 +79,7 @@ """ Private method to update the status of the OK button. """ - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( + self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( bool(self.portNameComboBox.currentData(self.PortNameRole)) and bool(self.deviceTypeComboBox.currentData()) )
--- a/eric6/MicroPython/EspBackupRestoreFirmwareDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/MicroPython/EspBackupRestoreFirmwareDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -95,7 +95,8 @@ enable &= bool(self.sizeComboBox.currentText()) else: enable &= os.path.exists(firmwareFile) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enable) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(enable) @pyqtSlot(str) def on_espComboBox_currentTextChanged(self, chip):
--- a/eric6/MicroPython/EspDevices.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/MicroPython/EspDevices.py Tue Mar 02 17:17:09 2021 +0100 @@ -200,7 +200,7 @@ """ from .EspFirmwareSelectionDialog import EspFirmwareSelectionDialog dlg = EspFirmwareSelectionDialog() - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: chip, firmware, flashMode, _ = dlg.getData() if chip == "esp8266": flashAddress = "0x0000" @@ -238,7 +238,7 @@ """ from .EspFirmwareSelectionDialog import EspFirmwareSelectionDialog dlg = EspFirmwareSelectionDialog(addon=True) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: chip, firmware, flashMode, flashAddress = dlg.getData() flashArgs = [ "-u", @@ -271,7 +271,7 @@ EspBackupRestoreFirmwareDialog ) dlg = EspBackupRestoreFirmwareDialog(backupMode=True) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: chip, flashSize, flashMode, firmware = dlg.getData() flashArgs = [ "-u", @@ -298,7 +298,7 @@ EspBackupRestoreFirmwareDialog ) dlg = EspBackupRestoreFirmwareDialog(backupMode=False) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: chip, flashSize, flashMode, firmware = dlg.getData() flashArgs = [ "-u",
--- a/eric6/MicroPython/EspFirmwareSelectionDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/MicroPython/EspFirmwareSelectionDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -76,7 +76,8 @@ bool(firmwareFile) and os.path.exists(firmwareFile)) if self.__addon: enable &= bool(self.addressEdit.text()) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enable) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(enable) @pyqtSlot(str) def on_espComboBox_currentTextChanged(self, chip):
--- a/eric6/MicroPython/MicroPythonCommandsInterface.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/MicroPython/MicroPythonCommandsInterface.py Tue Mar 02 17:17:09 2021 +0100 @@ -165,7 +165,8 @@ if self.__serial.hasTimedOut(): return False - QCoreApplication.processEvents(QEventLoop.ExcludeUserInputEvents) + QCoreApplication.processEvents( + QEventLoop.ProcessEventsFlag.ExcludeUserInputEvents) self.__serial.readAll() # read all data and discard it return True @@ -216,7 +217,7 @@ commandBytes = command.encode("utf-8") self.__serial.write(commandBytes + b"\x04") QCoreApplication.processEvents( - QEventLoop.ExcludeUserInputEvents) + QEventLoop.ProcessEventsFlag.ExcludeUserInputEvents) ok = self.__serial.readUntil(b"OK") if ok != b"OK": return (
--- a/eric6/MicroPython/MicroPythonFileManagerWidget.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/MicroPython/MicroPythonFileManagerWidget.py Tue Mar 02 17:17:09 2021 +0100 @@ -79,9 +79,9 @@ self.getAsButton.setEnabled(False) self.localFileTreeWidget.header().setSortIndicator( - 0, Qt.AscendingOrder) + 0, Qt.SortOrder.AscendingOrder) self.deviceFileTreeWidget.header().setSortIndicator( - 0, Qt.AscendingOrder) + 0, Qt.SortOrder.AscendingOrder) self.__progressInfoDialog = None self.__fileManager = MicroPythonFileManager(commandsInterface, self) @@ -220,10 +220,10 @@ for name, mode, size, dateTime in filesList: itm = QTreeWidgetItem(self.deviceFileTreeWidget, [name, mode, size, dateTime]) - itm.setTextAlignment(1, Qt.AlignHCenter) - itm.setTextAlignment(2, Qt.AlignRight) + itm.setTextAlignment(1, Qt.AlignmentFlag.AlignHCenter) + itm.setTextAlignment(2, Qt.AlignmentFlag.AlignRight) self.deviceFileTreeWidget.header().resizeSections( - QHeaderView.ResizeToContents) + QHeaderView.ResizeMode.ResizeToContents) def __listLocalFiles(self, dirname="", localDevice=False): """ @@ -258,10 +258,10 @@ fileTreeWidget.clear() for item in filesList: itm = QTreeWidgetItem(fileTreeWidget, item) - itm.setTextAlignment(1, Qt.AlignHCenter) - itm.setTextAlignment(2, Qt.AlignRight) + itm.setTextAlignment(1, Qt.AlignmentFlag.AlignHCenter) + itm.setTextAlignment(2, Qt.AlignmentFlag.AlignRight) fileTreeWidget.header().resizeSections( - QHeaderView.ResizeToContents) + QHeaderView.ResizeMode.ResizeToContents) @pyqtSlot(QTreeWidgetItem, int) def on_localFileTreeWidget_itemActivated(self, item, column): @@ -444,7 +444,7 @@ self, self.tr("Put File As"), self.tr("Enter a new name for the file"), - QLineEdit.Normal, + QLineEdit.EchoMode.Normal, filename) if not ok or not filename: return @@ -509,7 +509,7 @@ self, self.tr("Get File As"), self.tr("Enter a new name for the file"), - QLineEdit.Normal, + QLineEdit.EchoMode.Normal, filename) if not ok or not filename: return @@ -694,7 +694,7 @@ self, self.tr("Create Directory"), self.tr("Enter directory name:"), - QLineEdit.Normal) + QLineEdit.EchoMode.Normal) if ok and dirPath: dirPath = os.path.join(cwdWidget.text(), dirPath) try: @@ -734,7 +734,7 @@ self.tr( "Do you really want to delete this directory tree?"), [dirname]) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: try: shutil.rmtree(dirname) self.__listLocalFiles(cwdWidget.text(), @@ -772,7 +772,7 @@ self.tr( "Do you really want to delete this file?"), [filename]) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: try: os.remove(filename) self.__listLocalFiles(cwdWidget.text(), @@ -840,7 +840,7 @@ self, self.tr("Change Directory"), self.tr("Enter the directory path on the device:"), - QLineEdit.Normal, + QLineEdit.EchoMode.Normal, self.deviceCwd.text()) if ok and dirPath: if not dirPath.startswith("/"): @@ -859,7 +859,7 @@ self, self.tr("Create Directory"), self.tr("Enter directory name:"), - QLineEdit.Normal) + QLineEdit.EchoMode.Normal) if ok and dirPath: self.__fileManager.mkdir(dirPath) @@ -887,7 +887,7 @@ self.tr( "Do you really want to delete this directory?"), [dirname]) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: self.__fileManager.rmdir(dirname) @pyqtSlot() @@ -915,7 +915,7 @@ self.tr( "Do you really want to delete this directory tree?"), [dirname]) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: self.__fileManager.rmdir(dirname, recursive=True) @pyqtSlot() @@ -942,7 +942,7 @@ self.tr( "Do you really want to delete this file?"), [filename]) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: self.__fileManager.delete(filename) @pyqtSlot(bool)
--- a/eric6/MicroPython/MicroPythonGraphWidget.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/MicroPython/MicroPythonGraphWidget.py Tue Mar 02 17:17:09 2021 +0100 @@ -51,7 +51,7 @@ self.__chartView = QChartView(self) self.__chartView.setSizePolicy( - QSizePolicy.Expanding, QSizePolicy.Expanding) + QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding) self.__layout.addWidget(self.__chartView) self.__verticalLayout = QVBoxLayout() @@ -63,15 +63,17 @@ self.__saveButton.setToolTip(self.tr("Press to save the raw data")) self.__saveButton.clicked.connect(self.on_saveButton_clicked) self.__verticalLayout.addWidget(self.__saveButton) - self.__verticalLayout.setAlignment(self.__saveButton, Qt.AlignHCenter) + self.__verticalLayout.setAlignment(self.__saveButton, + Qt.AlignmentFlag.AlignHCenter) - spacerItem = QSpacerItem(20, 20, QSizePolicy.Minimum, - QSizePolicy.Expanding) + spacerItem = QSpacerItem(20, 20, QSizePolicy.Policy.Minimum, + QSizePolicy.Policy.Expanding) self.__verticalLayout.addItem(spacerItem) label = QLabel(self.tr("max. X:")) self.__verticalLayout.addWidget(label) - self.__verticalLayout.setAlignment(label, Qt.AlignHCenter) + self.__verticalLayout.setAlignment(label, + Qt.AlignmentFlag.AlignHCenter) self.__maxX = 100 self.__maxXSpinBox = QSpinBox() @@ -81,7 +83,7 @@ self.__maxXSpinBox.setToolTip(self.tr( "Enter the maximum number of data points to be plotted.")) self.__maxXSpinBox.setValue(self.__maxX) - self.__maxXSpinBox.setAlignment(Qt.AlignRight) + self.__maxXSpinBox.setAlignment(Qt.AlignmentFlag.AlignRight) self.__verticalLayout.addWidget(self.__maxXSpinBox) # holds the data to be checked for plotable data @@ -112,7 +114,7 @@ self.__chart.setAxisX(self.__axisX, self.__series[0]) self.__chart.setAxisY(self.__axisY, self.__series[0]) self.__chartView.setChart(self.__chart) - self.__chartView.setRenderHint(QPainter.Antialiasing) + self.__chartView.setRenderHint(QPainter.RenderHint.Antialiasing) self.preferencesChanged() self.__maxXSpinBox.valueChanged.connect(self.__handleMaxXChanged) @@ -127,9 +129,9 @@ # automatic selection of light or dark depending on desktop # color scheme if e5App().usesDarkPalette(): - self.__chart.setTheme(QChart.ChartThemeDark) + self.__chart.setTheme(QChart.ChartTheme.ChartThemeDark) else: - self.__chart.setTheme(QChart.ChartThemeLight) + self.__chart.setTheme(QChart.ChartTheme.ChartThemeLight) else: self.__chart.setTheme(chartColorTheme)
--- a/eric6/MicroPython/MicroPythonProgressInfoDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/MicroPython/MicroPythonProgressInfoDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -37,7 +37,7 @@ @type str """ tc = self.progressEdit.textCursor() - tc.movePosition(QTextCursor.End) + tc.movePosition(QTextCursor.MoveOperation.End) self.progressEdit.setTextCursor(tc) self.progressEdit.appendHtml(message) self.progressEdit.ensureCursorVisible()
--- a/eric6/MicroPython/MicroPythonSerialPort.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/MicroPython/MicroPythonSerialPort.py Tue Mar 02 17:17:09 2021 +0100 @@ -51,13 +51,13 @@ @rtype bool """ self.setPortName(port) - if self.open(QIODevice.ReadWrite): + if self.open(QIODevice.OpenModeFlag.ReadWrite): self.setDataTerminalReady(True) # 115.200 baud, 8N1 self.setBaudRate(115200) - self.setDataBits(QSerialPort.Data8) - self.setParity(QSerialPort.NoParity) - self.setStopBits(QSerialPort.OneStop) + self.setDataBits(QSerialPort.DataBits.Data8) + self.setParity(QSerialPort.Parity.NoParity) + self.setStopBits(QSerialPort.StopBits.OneStop) self.__connected = True return True @@ -109,7 +109,8 @@ t = QTime() t.start() while True: - QCoreApplication.processEvents(QEventLoop.ExcludeUserInputEvents) + QCoreApplication.processEvents( + QEventLoop.ProcessEventsFlag.ExcludeUserInputEvents) c = bytes(self.read(1)) if c: data += c
--- a/eric6/MicroPython/MicroPythonWidget.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/MicroPython/MicroPythonWidget.py Tue Mar 02 17:17:09 2021 +0100 @@ -189,11 +189,11 @@ ZoomMin = -10 ZoomMax = 20 - DeviceTypeRole = Qt.UserRole - DeviceBoardRole = Qt.UserRole + 1 - DevicePortRole = Qt.UserRole + 2 - DeviceVidRole = Qt.UserRole + 3 - DevicePidRole = Qt.UserRole + 4 + DeviceTypeRole = Qt.ItemDataRole.UserRole + DeviceBoardRole = Qt.ItemDataRole.UserRole + 1 + DevicePortRole = Qt.ItemDataRole.UserRole + 2 + DeviceVidRole = Qt.ItemDataRole.UserRole + 3 + DevicePidRole = Qt.ItemDataRole.UserRole + 4 dataReceived = pyqtSignal(bytes) @@ -218,9 +218,11 @@ "micropython_supermenu_button") self.menuButton.setIcon(UI.PixmapCache.getIcon("superMenu")) self.menuButton.setToolTip(self.tr("MicroPython Menu")) - self.menuButton.setPopupMode(QToolButton.InstantPopup) - self.menuButton.setToolButtonStyle(Qt.ToolButtonIconOnly) - self.menuButton.setFocusPolicy(Qt.NoFocus) + self.menuButton.setPopupMode( + QToolButton.ToolButtonPopupMode.InstantPopup) + self.menuButton.setToolButtonStyle( + Qt.ToolButtonStyle.ToolButtonIconOnly) + self.menuButton.setFocusPolicy(Qt.FocusPolicy.NoFocus) self.menuButton.setAutoRaise(True) self.menuButton.setShowMenuInside(True) self.menuButton.setMenu(self.__superMenu) @@ -239,8 +241,8 @@ self.connectButton.setIcon(UI.PixmapCache.getIcon("linkConnect")) self.__zoomLayout = QHBoxLayout() - spacerItem = QSpacerItem(40, 20, QSizePolicy.Expanding, - QSizePolicy.Minimum) + spacerItem = QSpacerItem(40, 20, QSizePolicy.Policy.Expanding, + QSizePolicy.Policy.Minimum) self.__zoomLayout.addSpacerItem(spacerItem) self.__zoom0 = self.replEdit.fontPointSize() @@ -357,7 +359,7 @@ self.deviceInfoLabel.setText(supportedMessage + unknownMessage) index = self.deviceTypeComboBox.findText(currentDevice, - Qt.MatchExactly) + Qt.MatchFlag.MatchExactly) if index == -1: # entry is no longer present index = 0 @@ -427,9 +429,9 @@ self.replEdit.setFontPointSize(self.__font.pointSize()) if Preferences.getMicroPython("ReplLineWrap"): - self.replEdit.setLineWrapMode(QTextEdit.WidgetWidth) + self.replEdit.setLineWrapMode(QTextEdit.LineWrapMode.WidgetWidth) else: - self.replEdit.setLineWrapMode(QTextEdit.NoWrap) + self.replEdit.setLineWrapMode(QTextEdit.LineWrapMode.NoWrap) if self.__chartWidget is not None: self.__chartWidget.preferencesChanged() @@ -523,11 +525,13 @@ @type QPoint """ if Globals.isMacPlatform(): - copyKeys = QKeySequence(Qt.CTRL + Qt.Key_C) - pasteKeys = QKeySequence(Qt.CTRL + Qt.Key_V) + copyKeys = QKeySequence(Qt.Modifier.CTRL + Qt.Key.Key_C) + pasteKeys = QKeySequence(Qt.Modifier.CTRL + Qt.Key.Key_V) else: - copyKeys = QKeySequence(Qt.CTRL + Qt.SHIFT + Qt.Key_C) - pasteKeys = QKeySequence(Qt.CTRL + Qt.SHIFT + Qt.Key_V) + copyKeys = QKeySequence( + Qt.Modifier.CTRL + Qt.Modifier.SHIFT + Qt.Key.Key_C) + pasteKeys = QKeySequence( + Qt.Modifier.CTRL + Qt.Modifier.SHIFT + Qt.Key.Key_V) menu = QMenu(self) menu.addAction(self.tr("Clear"), self.__clear) menu.addSeparator() @@ -621,7 +625,7 @@ self.__interface.write(b'\x03') self.__device.setRepl(True) - self.replEdit.setFocus(Qt.OtherFocusReason) + self.replEdit.setFocus(Qt.FocusReason.OtherFocusReason) else: self.__interface.dataReceived.disconnect(self.__processData) if (not self.chartButton.isChecked() and @@ -687,47 +691,49 @@ @return flag to indicate that the event was handled @rtype bool """ - if obj is self.replEdit and evt.type() == QEvent.KeyPress: + if obj is self.replEdit and evt.type() == QEvent.Type.KeyPress: # handle the key press event on behalve of the REPL pane key = evt.key() msg = bytes(evt.text(), 'utf8') - if key == Qt.Key_Backspace: + if key == Qt.Key.Key_Backspace: msg = b'\b' - elif key == Qt.Key_Delete: + elif key == Qt.Key.Key_Delete: msg = b'\x1B[\x33\x7E' - elif key == Qt.Key_Up: + elif key == Qt.Key.Key_Up: msg = b'\x1B[A' - elif key == Qt.Key_Down: + elif key == Qt.Key.Key_Down: msg = b'\x1B[B' - elif key == Qt.Key_Right: + elif key == Qt.Key.Key_Right: msg = b'\x1B[C' - elif key == Qt.Key_Left: + elif key == Qt.Key.Key_Left: msg = b'\x1B[D' - elif key == Qt.Key_Home: + elif key == Qt.Key.Key_Home: msg = b'\x1B[H' - elif key == Qt.Key_End: + elif key == Qt.Key.Key_End: msg = b'\x1B[F' elif ((Globals.isMacPlatform() and - evt.modifiers() == Qt.MetaModifier) or + evt.modifiers() == Qt.KeyboardModifier.MetaModifier) or (not Globals.isMacPlatform() and - evt.modifiers() == Qt.ControlModifier)): - if Qt.Key_A <= key <= Qt.Key_Z: + evt.modifiers() == Qt.KeyboardModifier.ControlModifier)): + if Qt.Key.Key_A <= key <= Qt.Key.Key_Z: # devices treat an input of \x01 as Ctrl+A, etc. - msg = bytes([1 + key - Qt.Key_A]) + msg = bytes([1 + key - Qt.Key.Key_A]) elif ( - evt.modifiers() == (Qt.ControlModifier | Qt.ShiftModifier) or + evt.modifiers() == ( + Qt.KeyboardModifier.ControlModifier | + Qt.KeyboardModifier.ShiftModifier) or (Globals.isMacPlatform() and - evt.modifiers() == Qt.ControlModifier) + evt.modifiers() == Qt.KeyboardModifier.ControlModifier) ): - if key == Qt.Key_C: + if key == Qt.Key.Key_C: self.replEdit.copy() msg = b'' - elif key == Qt.Key_V: + elif key == Qt.Key.Key_V: self.__paste() msg = b'' - elif key in (Qt.Key_Return, Qt.Key_Enter): + elif key in (Qt.Key.Key_Return, Qt.Key.Key_Enter): tc = self.replEdit.textCursor() - tc.movePosition(QTextCursor.EndOfLine) + tc.movePosition(QTextCursor.MoveOperation.EndOfLine) self.replEdit.setTextCursor(tc) self.__interface.isConnected() and self.__interface.write(msg) return True @@ -740,14 +746,14 @@ Private method handling mouse release events for the replEdit widget. Note: this is a hack because QTextEdit does not allow filtering of - QEvent.MouseButtonRelease. To make middle button paste work, we had - to intercept the protected event method (some kind of reimplementing - it). + QEvent.Type.MouseButtonRelease. To make middle button paste work, we + had to intercept the protected event method (some kind of + reimplementing it). @param evt reference to the event object @type QMouseEvent """ - if evt.button() == Qt.MiddleButton: + if evt.button() == Qt.MouseButton.MiddleButton: self.__paste(mode=QClipboard.Mode.Selection) msg = b'' if self.__interface.isConnected(): @@ -765,7 +771,7 @@ """ tc = self.replEdit.textCursor() # the text cursor must be on the last line - while tc.movePosition(QTextCursor.Down): + while tc.movePosition(QTextCursor.MoveOperation.Down): pass # set the font @@ -777,7 +783,7 @@ index = 0 while index < len(data): if data[index] == 8: # \b - tc.movePosition(QTextCursor.Left) + tc.movePosition(QTextCursor.MoveOperation.Left) self.replEdit.setTextCursor(tc) elif data[index] in (4, 13): # EOT, \r pass @@ -800,35 +806,43 @@ count = int(match.group("count")) if action == "A": # up - tc.movePosition(QTextCursor.Up, n=count) + tc.movePosition(QTextCursor.MoveOperation.Up, + n=count) self.replEdit.setTextCursor(tc) elif action == "B": # down - tc.movePosition(QTextCursor.Down, n=count) + tc.movePosition(QTextCursor.MoveOperation.Down, + n=count) self.replEdit.setTextCursor(tc) elif action == "C": # right - tc.movePosition(QTextCursor.Right, n=count) + tc.movePosition(QTextCursor.MoveOperation.Right, + n=count) self.replEdit.setTextCursor(tc) elif action == "D": # left - tc.movePosition(QTextCursor.Left, n=count) + tc.movePosition(QTextCursor.MoveOperation.Left, + n=count) self.replEdit.setTextCursor(tc) elif action == "K": # delete things if match.group("count") in ("", "0"): # delete to end of line - tc.movePosition(QTextCursor.EndOfLine, - mode=QTextCursor.KeepAnchor) + tc.movePosition( + QTextCursor.MoveOperation.EndOfLine, + mode=QTextCursor.MoveMode.KeepAnchor) tc.removeSelectedText() self.replEdit.setTextCursor(tc) elif match.group("count") == "1": # delete to beinning of line - tc.movePosition(QTextCursor.StartOfLine, - mode=QTextCursor.KeepAnchor) + tc.movePosition( + QTextCursor.MoveOperation.StartOfLine, + mode=QTextCursor.MoveMode.KeepAnchor) tc.removeSelectedText() self.replEdit.setTextCursor(tc) elif match.group("count") == "2": # delete whole line - tc.movePosition(QTextCursor.EndOfLine) - tc.movePosition(QTextCursor.StartOfLine, - mode=QTextCursor.KeepAnchor) + tc.movePosition( + QTextCursor.MoveOperation.EndOfLine) + tc.movePosition( + QTextCursor.MoveOperation.StartOfLine, + mode=QTextCursor.MoveMode.KeepAnchor) tc.removeSelectedText() self.replEdit.setTextCursor(tc) elif action == "m": @@ -1029,7 +1043,7 @@ dlg = ConnectionSelectionDialog( self.__unknownPorts, self.__lastPort, self.__lastDeviceType ) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: vid, pid, port, deviceType = dlg.getData() self.deviceIconLabel.setPixmap( @@ -1742,7 +1756,7 @@ dlg = IgnoredDevicesDialog( Preferences.getMicroPython("IgnoredUnknownDevices"), self) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: ignoredDevices = dlg.getDevices() Preferences.setMicroPython("IgnoredUnknownDevices", ignoredDevices) @@ -1781,7 +1795,7 @@ message=self.tr("Select the devices to be added:"), checkBoxSelection=True ) - if sdlg.exec() == QDialog.Accepted: + if sdlg.exec() == QDialog.DialogCode.Accepted: selectedDevices = sdlg.getSelection() else: selectedDevices = devices[0][2] @@ -1791,7 +1805,7 @@ for vid, pid, description in devices: if description in selectedDevices: dlg = AddEditDevicesDialog(vid, pid, description) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: manualDevices.append(dlg.getDeviceDict()) Preferences.setMicroPython("ManualDevices", manualDevices)
--- a/eric6/MicroPython/MicrobitDevices.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/MicroPython/MicrobitDevices.py Tue Mar 02 17:17:09 2021 +0100 @@ -268,7 +268,7 @@ ) elif len(deviceDirectories) == 1: downloadsPath = QStandardPaths.standardLocations( - QStandardPaths.DownloadLocation)[0] + QStandardPaths.StandardLocation.DownloadLocation)[0] firmware = E5FileDialog.getOpenFileName( self.microPython, self.tr("Flash MicroPython/Firmware"), @@ -334,7 +334,7 @@ self.microPython, title, self.tr("Enter a file name on the device:"), - QLineEdit.Normal, + QLineEdit.EchoMode.Normal, scriptName) if not ok or not bool(scriptName): return
--- a/eric6/MicroPython/PyBoardDevices.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/MicroPython/PyBoardDevices.py Tue Mar 02 17:17:09 2021 +0100 @@ -381,7 +381,7 @@ program = "dfu-util" downloadsPath = QStandardPaths.standardLocations( - QStandardPaths.DownloadLocation)[0] + QStandardPaths.StandardLocation.DownloadLocation)[0] firmware = E5FileDialog.getOpenFileName( self.microPython, self.tr("Flash MicroPython Firmware"),
--- a/eric6/MicroPython/UF2FlashDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/MicroPython/UF2FlashDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -456,8 +456,8 @@ """ Class implementing a dialog to flash any UF2 capable device. """ - DeviceTypeRole = Qt.UserRole - DeviceVidPidRole = Qt.UserRole + 1 + DeviceTypeRole = Qt.ItemDataRole.UserRole + DeviceVidPidRole = Qt.ItemDataRole.UserRole + 1 def __init__(self, boardType="", parent=None): """ @@ -746,7 +746,8 @@ "<p>Flashing the {0} firmware to the device. Please wait" " until the device resets automatically.</p>" ).format(firmwareType)) - QCoreApplication.processEvents(QEventLoop.ExcludeUserInputEvents) + QCoreApplication.processEvents( + QEventLoop.ProcessEventsFlag.ExcludeUserInputEvents) shutil.copy2(firmwarePath, volumePath) QThread.sleep(1) self.on_refreshButton_clicked()
--- a/eric6/MicroPython/UnknownDevicesDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/MicroPython/UnknownDevicesDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -23,8 +23,8 @@ """ Class implementing a dialog to manage the list of unknown devices. """ - DeviceDataRole = Qt.UserRole - ModifiedRole = Qt.UserRole + 1 + DeviceDataRole = Qt.ItemDataRole.UserRole + ModifiedRole = Qt.ItemDataRole.UserRole + 1 def __init__(self, parent=None): """ @@ -83,7 +83,7 @@ from .AddEditDevicesDialog import AddEditDevicesDialog dlg = AddEditDevicesDialog(deviceData=item.data(self.DeviceDataRole)) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: deviceDict = dlg.getDeviceDict() item.setData(self.DeviceDataRole, deviceDict) item.setData(self.ModifiedRole, True)
--- a/eric6/MultiProject/AddProjectDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/MultiProject/AddProjectDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -57,7 +57,8 @@ self.startdir = startdir self.uid = "" - self.__okButton = self.buttonBox.button(QDialogButtonBox.Ok) + self.__okButton = self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok) self.__okButton.setEnabled(False) if project is not None:
--- a/eric6/MultiProject/MultiProject.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/MultiProject/MultiProject.py Tue Mar 02 17:17:09 2021 +0100 @@ -233,7 +233,7 @@ else: # old XML based format f = QFile(fn) - if f.open(QIODevice.ReadOnly): + if f.open(QIODevice.OpenModeFlag.ReadOnly): with E5OverrideCursor(): from E5XML.MultiProjectReader import MultiProjectReader reader = MultiProjectReader(f, self) @@ -285,7 +285,7 @@ else: # old XML based format f = QFile(fn) - if f.open(QIODevice.WriteOnly): + if f.open(QIODevice.OpenModeFlag.WriteOnly): from E5XML.MultiProjectWriter import MultiProjectWriter MultiProjectWriter( f, @@ -338,7 +338,7 @@ startdir = Preferences.getMultiProject("Workspace") dlg = AddProjectDialog(self.ui, startdir=startdir, categories=self.categories, category=category) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: name, filename, isMaster, description, category, uid = ( dlg.getData() ) @@ -517,7 +517,7 @@ from .PropertiesDialog import PropertiesDialog dlg = PropertiesDialog(self, True) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: self.closeMultiProject() dlg.storeData() self.opened = True @@ -534,7 +534,7 @@ """ from .PropertiesDialog import PropertiesDialog dlg = PropertiesDialog(self, False) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: dlg.storeData() self.setDirty(True) self.multiProjectPropertiesChanged.emit()
--- a/eric6/MultiProject/MultiProjectBrowser.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/MultiProject/MultiProjectBrowser.py Tue Mar 02 17:17:09 2021 +0100 @@ -23,8 +23,8 @@ """ Class implementing the multi project browser. """ - ProjectFileNameRole = Qt.UserRole - ProjectUidRole = Qt.UserRole + 1 + ProjectFileNameRole = Qt.ItemDataRole.UserRole + ProjectUidRole = Qt.ItemDataRole.UserRole + 1 def __init__(self, multiProject, project, parent=None): """ @@ -67,7 +67,7 @@ self.project.projectClosed.connect(self.__projectClosed) self.__createPopupMenu() - self.setContextMenuPolicy(Qt.CustomContextMenu) + self.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu) self.customContextMenuRequested.connect(self.__contextMenuRequested) self.itemActivated.connect(self.__openItem) @@ -91,7 +91,7 @@ for project in self.multiProject.getProjects(): self.__addProject(project) - self.sortItems(0, Qt.AscendingOrder) + self.sortItems(0, Qt.SortOrder.AscendingOrder) self.setEnabled(True) @@ -109,7 +109,7 @@ @param project reference to the project data dictionary """ self.__addProject(project) - self.sortItems(0, Qt.AscendingOrder) + self.sortItems(0, Qt.SortOrder.AscendingOrder) def __projectRemoved(self, project): """ @@ -142,7 +142,7 @@ else: self.__setItemData(itm, project) - self.sortItems(0, Qt.AscendingOrder) + self.sortItems(0, Qt.SortOrder.AscendingOrder) def __projectOpened(self): """ @@ -367,7 +367,7 @@ dlg = AddProjectDialog( self, project=project, categories=self.multiProject.getCategories()) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: (name, filename, isMaster, description, category, uid) = dlg.getData() project = {
--- a/eric6/Network/IRC/IrcChannelEditDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Network/IRC/IrcChannelEditDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -38,7 +38,8 @@ self.nameEdit.setReadOnly(edit) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(name != "") + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(name != "") msh = self.minimumSizeHint() self.resize(max(self.width(), msh.width()), msh.height()) @@ -50,7 +51,8 @@ @param txt text of the edit (string) """ - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(txt != "") + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(txt != "") def getData(self): """
--- a/eric6/Network/IRC/IrcChannelWidget.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Network/IRC/IrcChannelWidget.py Tue Mar 02 17:17:09 2021 +0100 @@ -1320,7 +1320,7 @@ txt = txt.replace(self.__markerLine, "") self.messages.setHtml(txt) self.__markerLine = "" - self.messages.moveCursor(QTextCursor.End) + self.messages.moveCursor(QTextCursor.MoveOperation.End) def __clearMessages(self): """ @@ -2036,7 +2036,7 @@ self, self.tr("Edit Channel Topic"), self.tr("Enter the topic for this channel:"), - QLineEdit.Normal, + QLineEdit.EchoMode.Normal, self.topicLabel.text()) if ok and topic != "": self.sendData.emit("TOPIC {0} :{1}".format(
--- a/eric6/Network/IRC/IrcIdentitiesEditDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Network/IRC/IrcIdentitiesEditDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -68,7 +68,7 @@ identityName = self.identitiesCombo.itemText(0) self.identitiesCombo.setCurrentIndex(index) - self.on_identitiesCombo_currentIndexChanged(identityName) + self.on_identitiesCombo_currentIndexChanged(index) self.nicknameEdit.installEventFilter(self) @@ -80,8 +80,8 @@ @param evt reference to the event (QEvent) @return flag indicating that the event should be filtered out (boolean) """ - if obj == self.nicknameEdit and evt.type() == QEvent.KeyPress: - if evt.key() in [Qt.Key_Enter, Qt.Key_Return]: + if obj == self.nicknameEdit and evt.type() == QEvent.Type.KeyPress: + if evt.key() in [Qt.Key.Key_Enter, Qt.Key.Key_Return]: self.on_nicknameAddButton_clicked() return True @@ -96,13 +96,15 @@ self.renameButton.setEnabled(enable) self.deleteButton.setEnabled(enable) - @pyqtSlot(str) - def on_identitiesCombo_currentIndexChanged(self, identity): + @pyqtSlot(int) + def on_identitiesCombo_currentIndexChanged(self, index): """ Private slot to handle the selection of an identity. - @param identity selected identity (string) + @param index index of the selected entry + @type int """ + identity = self.identitiesCombo.itemText(index) if identity == IrcIdentity.DefaultIdentityDisplay: identity = IrcIdentity.DefaultIdentityName self.__updateIdentitiesButtons() @@ -212,7 +214,7 @@ self, self.tr("Add Identity"), self.tr("Identity Name:"), - QLineEdit.Normal) + QLineEdit.EchoMode.Normal) if ok: if name: @@ -250,7 +252,7 @@ self, self.tr("Copy Identity"), self.tr("Identity Name:"), - QLineEdit.Normal, + QLineEdit.EchoMode.Normal, currentIdentity) if ok: @@ -288,7 +290,7 @@ self, self.tr("Rename Identity"), self.tr("Identity Name:"), - QLineEdit.Normal, + QLineEdit.EchoMode.Normal, currentIdentity) if ok and name != currentIdentity: @@ -419,7 +421,8 @@ if nick not in [self.nicknamesList.item(row).text() for row in range(self.nicknamesList.count())]: self.nicknamesList.insertItem(0, nick) - self.nicknamesList.setCurrentRow(0, QItemSelectionModel.Clear) + self.nicknamesList.setCurrentRow( + 0, QItemSelectionModel.SelectionFlag.Clear) self.nicknameEdit.clear() self.__updateNicknameButtons() @@ -465,13 +468,13 @@ @type bool """ if checked: - self.passwordEdit.setEchoMode(QLineEdit.Normal) + self.passwordEdit.setEchoMode(QLineEdit.EchoMode.Normal) self.showPasswordButton.setIcon( UI.PixmapCache.getIcon("hidePassword")) self.showPasswordButton.setToolTip( self.tr("Press to hide the password")) else: - self.passwordEdit.setEchoMode(QLineEdit.Password) + self.passwordEdit.setEchoMode(QLineEdit.EchoMode.Password) self.showPasswordButton.setIcon( UI.PixmapCache.getIcon("showPassword")) self.showPasswordButton.setToolTip(
--- a/eric6/Network/IRC/IrcMessageEdit.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Network/IRC/IrcMessageEdit.py Tue Mar 02 17:17:09 2021 +0100 @@ -52,13 +52,13 @@ @param evt reference to the event (QKeyEvent) """ key = evt.key() - if key == Qt.Key_Up: + if key == Qt.Key.Key_Up: self.__getHistory(True) return - elif key == Qt.Key_Down: + elif key == Qt.Key.Key_Down: self.__getHistory(False) return - elif key in [Qt.Key_Return, Qt.Key_Enter]: + elif key in [Qt.Key.Key_Return, Qt.Key.Key_Enter]: if self.text(): self.__addHistory(self.text()) elif evt.text() == chr(21):
--- a/eric6/Network/IRC/IrcNetworkEditDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Network/IRC/IrcNetworkEditDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -46,7 +46,8 @@ self.addChannelButton.setIcon(UI.PixmapCache.getIcon("plus")) self.deleteChannelButton.setIcon(UI.PixmapCache.getIcon("minus")) - self.__okButton = self.buttonBox.button(QDialogButtonBox.Ok) + self.__okButton = self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok) if networkName: self.__network = copy.deepcopy( @@ -116,14 +117,17 @@ index = 0 self.identityCombo.setCurrentIndex(index) - @pyqtSlot(str) - def on_identityCombo_currentIndexChanged(self, identity): + @pyqtSlot(int) + def on_identityCombo_currentIndexChanged(self, index): """ Private slot to handle the selection of an identity. - @param identity selected entity (string) + @param index index of the selected entry + @type int """ from .IrcNetworkManager import IrcIdentity + + identity = self.identitiesCombo.itemText(index) if identity == IrcIdentity.DefaultIdentityDisplay: identity = IrcIdentity.DefaultIdentityName self.__network.setIdentityName(identity) @@ -155,7 +159,7 @@ """ from .IrcServerEditDialog import IrcServerEditDialog dlg = IrcServerEditDialog(self.__network.getServer()) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: self.__network.setServer(dlg.getServer()) self.serverEdit.setText(self.__network.getServerName()) @@ -237,7 +241,7 @@ from .IrcChannelEditDialog import IrcChannelEditDialog dlg = IrcChannelEditDialog(name, key, autoJoin, itm is not None, self) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: from .IrcNetworkManager import IrcChannel name, key, autoJoin = dlg.getData() channel = IrcChannel(name)
--- a/eric6/Network/IRC/IrcNetworkListDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Network/IRC/IrcNetworkListDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -129,7 +129,7 @@ """ from .IrcNetworkEditDialog import IrcNetworkEditDialog dlg = IrcNetworkEditDialog(self.__manager, "", self) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: network = dlg.getNetwork() self.__manager.addNetwork(network) self.__refreshNetworksList() @@ -144,7 +144,7 @@ from .IrcNetworkEditDialog import IrcNetworkEditDialog networkName = itm.text(0) dlg = IrcNetworkEditDialog(self.__manager, networkName, self) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: network = dlg.getNetwork() self.__manager.setNetwork(network, networkName) if network.getName() != networkName:
--- a/eric6/Network/IRC/IrcNetworkWidget.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Network/IRC/IrcNetworkWidget.py Tue Mar 02 17:17:09 2021 +0100 @@ -221,13 +221,15 @@ channel = self.channelCombo.currentText() self.joinChannel.emit(channel) - @pyqtSlot(str) - def on_networkCombo_currentIndexChanged(self, networkName): + @pyqtSlot(int) + def on_networkCombo_currentIndexChanged(self, index): """ Private slot to handle selections of a network. - @param networkName selected network name (string) + @param index index of the selected entry + @type int """ + networkName = self.networkCombo.itemText(index) network = self.__manager.getNetwork(networkName) self.nickCombo.clear() self.channelCombo.clear() @@ -253,13 +255,13 @@ network = self.__manager.getNetwork(networkName) return network.getChannels() - @pyqtSlot(str) + @pyqtSlot(int) @pyqtSlot() - def on_nickCombo_currentIndexChanged(self, nick=""): + def on_nickCombo_currentIndexChanged(self, nick=0): """ Private slot to use another nick name. - @param nick nick name to use (string) + @param nick index of the selected nick name (unused) """ if self.__connected: self.nickChanged.emit(self.nickCombo.currentText())
--- a/eric6/Network/IRC/IrcServerEditDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Network/IRC/IrcServerEditDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -27,7 +27,8 @@ super(IrcServerEditDialog, self).__init__(parent) self.setupUi(self) - self.__okButton = self.buttonBox.button(QDialogButtonBox.Ok) + self.__okButton = self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok) if server: self.serverEdit.setText(server.getName())
--- a/eric6/Network/IRC/IrcWidget.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Network/IRC/IrcWidget.py Tue Mar 02 17:17:09 2021 +0100 @@ -66,10 +66,10 @@ self.__leaveButton.clicked.connect(self.__leaveChannel) self.__leaveButton.setEnabled(False) self.channelsWidget.setCornerWidget( - self.__leaveButton, Qt.BottomRightCorner) + self.__leaveButton, Qt.Corner.BottomRightCorner) self.channelsWidget.setTabsClosable(False) if not isMacPlatform(): - self.channelsWidget.setTabPosition(QTabWidget.South) + self.channelsWidget.setTabPosition(QTabWidget.TabPosition.South) height = self.height() self.splitter.setSizes([height * 0.6, height * 0.4]) @@ -115,7 +115,8 @@ ircPic = UI.PixmapCache.getPixmap("irc128") self.__emptyLabel = QLabel() self.__emptyLabel.setPixmap(ircPic) - self.__emptyLabel.setAlignment(Qt.AlignVCenter | Qt.AlignHCenter) + self.__emptyLabel.setAlignment( + Qt.AlignmentFlag.AlignVCenter | Qt.AlignmentFlag.AlignHCenter) self.channelsWidget.addTab(self.__emptyLabel, "") # all initialized, do connections now @@ -870,7 +871,7 @@ @param error error code reported by the socket (QAbstractSocket.SocketError) """ - if error == QAbstractSocket.RemoteHostClosedError: + if error == QAbstractSocket.SocketError.RemoteHostClosedError: # ignore this one, it's a disconnect if self.__sslErrorLock: self.networkWidget.addErrorMessage( @@ -880,19 +881,19 @@ """ waiting for user response to an SSL error.""") .format(self.__server.getName(), self.__server.getPort())) self.__connectionState = IrcWidget.ServerDisconnected - elif error == QAbstractSocket.HostNotFoundError: + elif error == QAbstractSocket.SocketError.HostNotFoundError: self.networkWidget.addErrorMessage( self.tr("Socket Error"), self.tr( "The host was not found. Please check the host name" " and port settings.")) - elif error == QAbstractSocket.ConnectionRefusedError: + elif error == QAbstractSocket.SocketError.ConnectionRefusedError: self.networkWidget.addErrorMessage( self.tr("Socket Error"), self.tr( "The connection was refused by the peer. Please check the" " host name and port settings.")) - elif error == QAbstractSocket.SslHandshakeFailedError: + elif error == QAbstractSocket.SocketError.SslHandshakeFailedError: self.networkWidget.addErrorMessage( self.tr("Socket Error"), self.tr("The SSL handshake failed."))
--- a/eric6/PipInterface/Pip.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/PipInterface/Pip.py Tue Mar 02 17:17:09 2021 +0100 @@ -400,7 +400,7 @@ """ from .PipFileSelectionDialog import PipFileSelectionDialog dlg = PipFileSelectionDialog(self, "requirements") - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: requirements, user = dlg.getData() if requirements and os.path.exists(requirements): interpreter = self.getVirtualenvInterpreter(venvName) @@ -442,7 +442,7 @@ self.tr( "Do you really want to uninstall these packages?"), packages) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: interpreter = self.getVirtualenvInterpreter(venvName) if not interpreter: return False @@ -464,7 +464,7 @@ from .PipFileSelectionDialog import PipFileSelectionDialog dlg = PipFileSelectionDialog(self, "requirements", install=False) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: requirements, _user = dlg.getData() if requirements and os.path.exists(requirements): try: @@ -482,7 +482,7 @@ self.tr( "Do you really want to uninstall these packages?"), reqs) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: interpreter = self.getVirtualenvInterpreter(venvName) if not interpreter: return @@ -682,7 +682,7 @@ QCoreApplication.processEvents() reply.deleteLater() - if reply.error() == QNetworkReply.NoError: + if reply.error() == QNetworkReply.NetworkError.NoError: data = str(reply.readAll(), Preferences.getSystem("IOEncoding"), 'replace') @@ -728,7 +728,7 @@ None, self.tr("List Cached Files"), self.tr("Enter a file pattern (empty for all):"), - QLineEdit.Normal) + QLineEdit.EchoMode.Normal) if ok: args = ["-m", "pip", "cache", "list"] @@ -754,7 +754,7 @@ None, self.tr("Remove Cached Files"), self.tr("Enter a file pattern:"), - QLineEdit.Normal) + QLineEdit.EchoMode.Normal) if ok and pattern.strip(): args = ["-m", "pip", "cache", "remove", pattern.strip()]
--- a/eric6/PipInterface/PipDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/PipInterface/PipDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -36,8 +36,10 @@ super(PipDialog, self).__init__(parent) self.setupUi(self) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.proc = None self.__processQueue = [] @@ -65,7 +67,7 @@ """ if ( self.proc is not None and - self.proc.state() != QProcess.NotRunning + self.proc.state() != QProcess.ProcessState.NotRunning ): self.proc.terminate() QTimer.singleShot(2000, self.proc.kill) @@ -78,11 +80,15 @@ self.__addOutput("\n\n") self.startProcess(cmd, args) else: - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) - self.buttonBox.button(QDialogButtonBox.Close).setFocus( - Qt.OtherFocusReason) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setFocus( + Qt.FocusReason.OtherFocusReason) def __cancel(self): """ @@ -99,9 +105,13 @@ @param button button that was clicked @type QAbstractButton """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() - elif button == self.buttonBox.button(QDialogButtonBox.Cancel): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): self.__cancel() def __procFinished(self, exitCode, exitStatus):
--- a/eric6/PipInterface/PipFileSelectionDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/PipInterface/PipFileSelectionDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -66,7 +66,8 @@ self.filePicker.setFilters(self.tr("All Files (*)")) self.filePicker.setDefaultDirectory(os.path.expanduser("~")) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) self.userCheckBox.setVisible(install) @@ -81,7 +82,7 @@ @param txt name of the file @type str """ - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( + self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( bool(txt) and os.path.exists(Utilities.toNativeSeparators(txt)) )
--- a/eric6/PipInterface/PipFreezeDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/PipInterface/PipFreezeDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -39,10 +39,10 @@ """ super(PipFreezeDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) self.__refreshButton = self.buttonBox.addButton( - self.tr("&Refresh"), QDialogButtonBox.ActionRole) + self.tr("&Refresh"), QDialogButtonBox.ButtonRole.ActionRole) self.__environmentName = "" @@ -101,7 +101,9 @@ @param button button that was clicked @type QAbstractButton """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() elif button == self.__refreshButton: self.__refresh()
--- a/eric6/PipInterface/PipPackageDetailsDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/PipInterface/PipPackageDetailsDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -38,16 +38,16 @@ """ super(PipPackageDetailsDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) self.__pipWidget = parent self.__installButton = self.buttonBox.addButton( - self.tr("Install"), QDialogButtonBox.ActionRole) + self.tr("Install"), QDialogButtonBox.ButtonRole.ActionRole) self.__removeButton = self.buttonBox.addButton( - self.tr("Uninstall"), QDialogButtonBox.ActionRole) + self.tr("Uninstall"), QDialogButtonBox.ButtonRole.ActionRole) self.__upgradeButton = self.buttonBox.addButton( - self.tr("Upgrade"), QDialogButtonBox.ActionRole) + self.tr("Upgrade"), QDialogButtonBox.ButtonRole.ActionRole) self.__locale = QLocale() self.__packageTypeMap = { @@ -104,9 +104,11 @@ self.__sanitize(detailsData["docs_url"], forUrl=True))) self.classifiersList.addItems(detailsData["classifiers"]) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) - self.buttonBox.button(QDialogButtonBox.Close).setFocus( - Qt.OtherFocusReason) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setFocus( + Qt.FocusReason.OtherFocusReason) def __populateDownloadUrls(self, downloadsData): """ @@ -138,11 +140,12 @@ urlLabel = QLabel('<a href="{0}#md5={2}">{1}</a>{3}'.format( download["url"], download["filename"], download["md5_digest"], pgpLink)) - urlLabel.setTextInteractionFlags(Qt.LinksAccessibleByMouse) + urlLabel.setTextInteractionFlags( + Qt.TextInteractionFlag.LinksAccessibleByMouse) urlLabel.setOpenExternalLinks(True) self.downloadUrlsList.setItemWidget(itm, 0, urlLabel) header = self.downloadUrlsList.header() - header.resizeSections(QHeaderView.ResizeToContents) + header.resizeSections(QHeaderView.ResizeMode.ResizeToContents) else: self.infoWidget.setTabEnabled(index, False)
--- a/eric6/PipInterface/PipPackagesInputDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/PipInterface/PipPackagesInputDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -35,7 +35,8 @@ self.setWindowTitle(title) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) self.userCheckBox.setVisible(install) @@ -50,7 +51,8 @@ @param txt name of the requirements file @type str """ - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(bool(txt)) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(bool(txt)) def getData(self): """
--- a/eric6/PipInterface/PipPackagesWidget.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/PipInterface/PipPackagesWidget.py Tue Mar 02 17:17:09 2021 +0100 @@ -146,7 +146,7 @@ ShowProcessEntryPointsMode = 2 ShowProcessFilesListMode = 3 - SearchVersionRole = Qt.UserRole + 1 + SearchVersionRole = Qt.ItemDataRole.UserRole + 1 def __init__(self, pip, parent=None): """ @@ -164,9 +164,11 @@ "pip_supermenu_button") self.pipMenuButton.setIcon(UI.PixmapCache.getIcon("superMenu")) self.pipMenuButton.setToolTip(self.tr("pip Menu")) - self.pipMenuButton.setPopupMode(QToolButton.InstantPopup) - self.pipMenuButton.setToolButtonStyle(Qt.ToolButtonIconOnly) - self.pipMenuButton.setFocusPolicy(Qt.NoFocus) + self.pipMenuButton.setPopupMode( + QToolButton.ToolButtonPopupMode.InstantPopup) + self.pipMenuButton.setToolButtonStyle( + Qt.ToolButtonStyle.ToolButtonIconOnly) + self.pipMenuButton.setFocusPolicy(Qt.FocusPolicy.NoFocus) self.pipMenuButton.setAutoRaise(True) self.pipMenuButton.setShowMenuInside(True) @@ -183,7 +185,8 @@ self.__pip = pip - self.packagesList.header().setSortIndicator(0, Qt.AscendingOrder) + self.packagesList.header().setSortIndicator( + 0, Qt.SortOrder.AscendingOrder) self.__infoLabels = { "name": self.tr("Name:"), @@ -256,8 +259,12 @@ venvName = self.environmentsComboBox.currentText() if venvName: - available = len(self.packagesList.findItems( - "pip", Qt.MatchExactly | Qt.MatchCaseSensitive)) == 1 + available = ( + len(self.packagesList.findItems( + "pip", + Qt.MatchFlag.MatchExactly | + Qt.MatchFlag.MatchCaseSensitive)) == 1 + ) return available @@ -273,7 +280,9 @@ venvName = self.environmentsComboBox.currentText() if venvName: pipList = self.packagesList.findItems( - "pip", Qt.MatchExactly | Qt.MatchCaseSensitive) + "pip", + Qt.MatchFlag.MatchExactly | Qt.MatchFlag.MatchCaseSensitive + ) if len(pipList) > 0: pipVersionTuple = Globals.versionToTuple(pipList[0].text(1)) @@ -377,12 +386,15 @@ ) for package, _version, latest in outdatedPackages: items = self.packagesList.findItems( - package, Qt.MatchExactly | Qt.MatchCaseSensitive) + package, + Qt.MatchFlag.MatchExactly | + Qt.MatchFlag.MatchCaseSensitive + ) if items: itm = items[0] itm.setText(2, latest) - self.packagesList.sortItems(0, Qt.AscendingOrder) + self.packagesList.sortItems(0, Qt.SortOrder.AscendingOrder) for col in range(self.packagesList.columnCount()): self.packagesList.resizeColumnToContents(col) self.packagesList.setUpdatesEnabled(True) @@ -490,7 +502,7 @@ header = self.infoWidget.header() header.setStretchLastSection(False) - header.resizeSections(QHeaderView.ResizeToContents) + header.resizeSections(QHeaderView.ResizeMode.ResizeToContents) if ( header.sectionSize(0) + header.sectionSize(1) < header.width() @@ -559,7 +571,9 @@ self.__populateEnvironments() index = self.environmentsComboBox.findText( - currentEnvironment, Qt.MatchExactly | Qt.MatchCaseSensitive) + currentEnvironment, + Qt.MatchFlag.MatchExactly | Qt.MatchFlag.MatchCaseSensitive + ) if index != -1: self.environmentsComboBox.setCurrentIndex(index) @@ -677,7 +691,7 @@ self.searchWidget.setVisible(checked) if checked: - self.searchEditName.setFocus(Qt.OtherFocusReason) + self.searchEditName.setFocus(Qt.FocusReason.OtherFocusReason) self.searchEditName.selectAll() self.__updateSearchActionButtons() @@ -735,8 +749,9 @@ url.setQuery(urlQuery) request = QNetworkRequest(QUrl(url)) - request.setAttribute(QNetworkRequest.CacheLoadControlAttribute, - QNetworkRequest.AlwaysNetwork) + request.setAttribute( + QNetworkRequest.Attribute.CacheLoadControlAttribute, + QNetworkRequest.CacheLoadControl.AlwaysNetwork) reply = self.__pip.getNetworkAccessManager().get(request) reply.finished.connect( lambda: self.__searchResponse(reply)) @@ -755,7 +770,7 @@ urlQuery = QUrlQuery(reply.url()) searchTerm = urlQuery.queryItemValue("q") - if reply.error() != QNetworkReply.NoError: + if reply.error() != QNetworkReply.NetworkError.NoError: E5MessageBox.warning( None, self.tr("Search PyPI"), @@ -805,7 +820,7 @@ header = self.searchResultList.header() header.setStretchLastSection(False) - header.resizeSections(QHeaderView.ResizeToContents) + header.resizeSections(QHeaderView.ResizeMode.ResizeToContents) headerSize = 0 for col in range(header.count()): headerSize += header.sectionSize(col) @@ -821,7 +836,7 @@ self.__updateSearchActionButtons() self.__updateSearchButton() - self.searchEditName.setFocus(Qt.OtherFocusReason) + self.searchEditName.setFocus(Qt.FocusReason.OtherFocusReason) @pyqtSlot() def on_installButton_clicked(self): @@ -1081,7 +1096,7 @@ if venvName: from .PipPackagesInputDialog import PipPackagesInputDialog dlg = PipPackagesInputDialog(self, self.tr("Install Packages")) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: packages, user = dlg.getData() self.executeInstallPackages(packages, userSite=user) @@ -1094,7 +1109,7 @@ if venvName: from .PipFileSelectionDialog import PipFileSelectionDialog dlg = PipFileSelectionDialog(self, "package") - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: package, user = dlg.getData() if package and os.path.exists(package): self.executeInstallPackages([package], userSite=user)
--- a/eric6/PluginManager/PluginDetailsDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/PluginManager/PluginDetailsDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -26,7 +26,7 @@ """ super(PluginDetailsDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) self.__autoactivate = details["autoactivate"] self.__active = details["active"]
--- a/eric6/PluginManager/PluginInfoDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/PluginManager/PluginInfoDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -27,7 +27,7 @@ """ super(PluginInfoDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) self.pm = pluginManager @@ -38,7 +38,7 @@ # populate the list self.__populateList() - self.pluginList.sortByColumn(0, Qt.AscendingOrder) + self.pluginList.sortByColumn(0, Qt.SortOrder.AscendingOrder) self.__menu = QMenu(self) self.__menu.addAction(self.tr('Show details'), self.__showDetails) @@ -46,7 +46,8 @@ self.tr('Activate'), self.__activatePlugin) self.__deactivateAct = self.__menu.addAction( self.tr('Deactivate'), self.__deactivatePlugin) - self.pluginList.setContextMenuPolicy(Qt.CustomContextMenu) + self.pluginList.setContextMenuPolicy( + Qt.ContextMenuPolicy.CustomContextMenu) self.pluginList.customContextMenuRequested.connect( self.__showContextMenu) @@ -81,11 +82,14 @@ if info["error"]: # plugin error for col in range(self.pluginList.columnCount()): - itm.setForeground(col, QBrush(Qt.red)) - itm.setTextAlignment(self.__autoActivateColumn, Qt.AlignHCenter) - itm.setTextAlignment(self.__activeColumn, Qt.AlignHCenter) + itm.setForeground(col, QBrush(Qt.GlobalColor.red)) + itm.setTextAlignment(self.__autoActivateColumn, + Qt.AlignmentFlag.AlignHCenter) + itm.setTextAlignment(self.__activeColumn, + Qt.AlignmentFlag.AlignHCenter) - self.pluginList.header().resizeSections(QHeaderView.ResizeToContents) + self.pluginList.header().resizeSections( + QHeaderView.ResizeMode.ResizeToContents) self.pluginList.header().setStretchLastSection(True) def __showContextMenu(self, coord):
--- a/eric6/PluginManager/PluginInstallDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/PluginManager/PluginInstallDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -61,14 +61,16 @@ self.__external = False self.__backButton = self.buttonBox.addButton( - self.tr("< Back"), QDialogButtonBox.ActionRole) + self.tr("< Back"), QDialogButtonBox.ButtonRole.ActionRole) self.__nextButton = self.buttonBox.addButton( - self.tr("Next >"), QDialogButtonBox.ActionRole) + self.tr("Next >"), QDialogButtonBox.ButtonRole.ActionRole) self.__finishButton = self.buttonBox.addButton( - self.tr("Install"), QDialogButtonBox.ActionRole) + self.tr("Install"), QDialogButtonBox.ButtonRole.ActionRole) - self.__closeButton = self.buttonBox.button(QDialogButtonBox.Close) - self.__cancelButton = self.buttonBox.button(QDialogButtonBox.Cancel) + self.__closeButton = self.buttonBox.button( + QDialogButtonBox.StandardButton.Close) + self.__cancelButton = self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel) userDir = self.__pluginManager.getPluginDir("user") if userDir is not None: @@ -166,9 +168,9 @@ self.tr("Plugin archive (*.zip)")) if archives: - matchflags = Qt.MatchFixedString + matchflags = Qt.MatchFlag.MatchFixedString if not Utilities.isWindowsPlatform(): - matchflags |= Qt.MatchCaseSensitive + matchflags |= Qt.MatchFlag.MatchCaseSensitive for archive in archives: if len(self.archivesList.findItems(archive, matchflags)) == 0: # entry not in list already
--- a/eric6/PluginManager/PluginManager.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/PluginManager/PluginManager.py Tue Mar 02 17:17:09 2021 +0100 @@ -1271,8 +1271,9 @@ request = QNetworkRequest( QUrl(Preferences.getUI("PluginRepositoryUrl6"))) - request.setAttribute(QNetworkRequest.CacheLoadControlAttribute, - QNetworkRequest.AlwaysNetwork) + request.setAttribute( + QNetworkRequest.Attribute.CacheLoadControlAttribute, + QNetworkRequest.CacheLoadControl.AlwaysNetwork) reply = self.__networkManager.get(request) reply.finished.connect( lambda: self.__downloadRepositoryFileDone(reply)) @@ -1288,7 +1289,7 @@ if reply in self.__replies: self.__replies.remove(reply) - if reply.error() != QNetworkReply.NoError: + if reply.error() != QNetworkReply.NetworkError.NoError: E5MessageBox.warning( None, self.tr("Error downloading file"), @@ -1302,7 +1303,7 @@ return ioDevice = QFile(self.pluginRepositoryFile + ".tmp") - ioDevice.open(QIODevice.WriteOnly) + ioDevice.open(QIODevice.OpenModeFlag.WriteOnly) ioDevice.write(reply.readAll()) ioDevice.close() if QFile.exists(self.pluginRepositoryFile): @@ -1312,7 +1313,7 @@ if os.path.exists(self.pluginRepositoryFile): f = QFile(self.pluginRepositoryFile) - if f.open(QIODevice.ReadOnly): + if f.open(QIODevice.OpenModeFlag.ReadOnly): # save current URL url = Preferences.getUI("PluginRepositoryUrl6")
--- 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()
--- a/eric6/PluginManager/PluginUninstallDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/PluginManager/PluginUninstallDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -81,7 +81,7 @@ for pluginName in pluginNames: fname = "{0}.py".format(os.path.join(pluginDirectory, pluginName)) self.pluginNameCombo.addItem(pluginName, fname) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( + self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( self.pluginNameCombo.currentText() != "") @pyqtSlot()
--- a/eric6/Plugins/AboutPlugin/AboutDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/AboutPlugin/AboutDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -748,7 +748,7 @@ """ super(AboutDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) self.ericLabel.setText(titleText) self.ericPixmap.setPixmap(
--- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleAddBuiltinIgnoreDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleAddBuiltinIgnoreDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -41,7 +41,7 @@ """ Private slot to set the state of the OK button. """ - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( + self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( bool(self.leftEdit.text()) and bool(self.rightEdit.text()))
--- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCheckerDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCheckerDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -42,14 +42,14 @@ """ Class implementing a dialog to show the results of the code style check. """ - filenameRole = Qt.UserRole + 1 - lineRole = Qt.UserRole + 2 - positionRole = Qt.UserRole + 3 - messageRole = Qt.UserRole + 4 - fixableRole = Qt.UserRole + 5 - codeRole = Qt.UserRole + 6 - ignoredRole = Qt.UserRole + 7 - argsRole = Qt.UserRole + 8 + filenameRole = Qt.ItemDataRole.UserRole + 1 + lineRole = Qt.ItemDataRole.UserRole + 2 + positionRole = Qt.ItemDataRole.UserRole + 3 + messageRole = Qt.ItemDataRole.UserRole + 4 + fixableRole = Qt.ItemDataRole.UserRole + 5 + codeRole = Qt.ItemDataRole.UserRole + 6 + ignoredRole = Qt.ItemDataRole.UserRole + 7 + argsRole = Qt.ItemDataRole.UserRole + 8 availableFutures = [ 'division', 'absolute_import', 'with_statement', @@ -108,7 +108,7 @@ """ super(CodeStyleCheckerDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) self.__project = project @@ -128,14 +128,14 @@ for category, text in CodeStyleCheckerDialog.checkCategories.items(): itm = QListWidgetItem(text, self.categoriesList) - itm.setData(Qt.UserRole, category) - itm.setFlags(itm.flags() | Qt.ItemIsUserCheckable) - itm.setCheckState(Qt.Unchecked) + itm.setData(Qt.ItemDataRole.UserRole, category) + itm.setFlags(itm.flags() | Qt.ItemFlag.ItemIsUserCheckable) + itm.setCheckState(Qt.CheckState.Unchecked) for future in CodeStyleCheckerDialog.availableFutures: itm = QListWidgetItem(future, self.futuresList) - itm.setFlags(itm.flags() | Qt.ItemIsUserCheckable) - itm.setCheckState(Qt.Unchecked) + itm.setFlags(itm.flags() | Qt.ItemFlag.ItemIsUserCheckable) + itm.setCheckState(Qt.CheckState.Unchecked) self.dsaHighRiskCombo.addItems( CodeStyleCheckerDialog.cryptoBitSelectionsDsaRsa) @@ -153,10 +153,12 @@ self.statisticsButton.setEnabled(False) self.showButton.setEnabled(False) self.cancelButton.setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) self.resultList.headerItem().setText(self.resultList.columnCount(), "") - self.resultList.header().setSortIndicator(0, Qt.AscendingOrder) + self.resultList.header().setSortIndicator( + 0, Qt.SortOrder.AscendingOrder) self.addBuiltinButton.setIcon(UI.PixmapCache.getIcon("plus")) self.deleteBuiltinButton.setIcon(UI.PixmapCache.getIcon("minus")) @@ -217,13 +219,13 @@ self.__errorItem = QTreeWidgetItem(self.resultList, [ self.tr("Errors")]) self.__errorItem.setExpanded(True) - self.__errorItem.setForeground(0, Qt.red) + self.__errorItem.setForeground(0, Qt.GlobalColor.red) msg = "{0} ({1})".format(self.__project.getRelativePath(filename), message) - if not self.resultList.findItems(msg, Qt.MatchExactly): + if not self.resultList.findItems(msg, Qt.MatchFlag.MatchExactly): itm = QTreeWidgetItem(self.__errorItem, [msg]) - itm.setForeground(0, Qt.red) + itm.setForeground(0, Qt.GlobalColor.red) itm.setFirstColumnSpanned(True) def __createFileErrorItem(self, filename, message): @@ -309,12 +311,12 @@ itm.setIcon(0, UI.PixmapCache.getIcon("issueFixable")) fixable = True - itm.setTextAlignment(0, Qt.AlignRight) - itm.setTextAlignment(1, Qt.AlignHCenter) + itm.setTextAlignment(0, Qt.AlignmentFlag.AlignRight) + itm.setTextAlignment(1, Qt.AlignmentFlag.AlignHCenter) - itm.setTextAlignment(0, Qt.AlignVCenter) - itm.setTextAlignment(1, Qt.AlignVCenter) - itm.setTextAlignment(2, Qt.AlignVCenter) + itm.setTextAlignment(0, Qt.AlignmentFlag.AlignVCenter) + itm.setTextAlignment(1, Qt.AlignmentFlag.AlignVCenter) + itm.setTextAlignment(2, Qt.AlignmentFlag.AlignVCenter) itm.setData(0, self.filenameRole, filename) itm.setData(0, self.lineRole, int(result["line"])) @@ -412,8 +414,10 @@ self.__project = project self.__forProject = True - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) self.cancelButton.setEnabled(False) self.__data = self.__project.getData("CHECKERSPARMS", "Pep8Checker") @@ -614,7 +618,8 @@ self.mainWidget.setCurrentWidget(self.progressTab) self.cancelled = False - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) self.cancelButton.setEnabled(True) self.cancelButton.setDefault(True) self.statisticsButton.setEnabled(False) @@ -1008,7 +1013,7 @@ self.checkProgressLabel.setPath(fn) # remove file from the list of jobs to do - fileItems = self.progressList.findItems(fn, Qt.MatchExactly) + fileItems = self.progressList.findItems(fn, Qt.MatchFlag.MatchExactly) if fileItems: row = self.progressList.row(fileItems[0]) self.progressList.takeItem(row) @@ -1024,8 +1029,10 @@ self.__finished = True self.cancelled = True - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) self.cancelButton.setEnabled(False) self.statisticsButton.setEnabled(True) self.showButton.setEnabled(True) @@ -1045,7 +1052,7 @@ else: self.showButton.setEnabled(True) self.resultList.header().resizeSections( - QHeaderView.ResizeToContents) + QHeaderView.ResizeMode.ResizeToContents) self.resultList.header().setStretchLastSection(True) self.checkProgress.setVisible(False) @@ -1177,7 +1184,7 @@ from .CodeStyleCodeSelectionDialog import CodeStyleCodeSelectionDialog dlg = CodeStyleCodeSelectionDialog(edit.text(), categories, showFixCodes, self) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: edit.setText(dlg.getSelectedCodes()) @pyqtSlot() @@ -1668,7 +1675,9 @@ @param button button that was clicked @type QAbstractButton """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() def __clearErrors(self, files): @@ -1774,9 +1783,9 @@ for row in range(self.futuresList.count()): itm = self.futuresList.item(row) if itm.text() in expectedImports: - itm.setCheckState(Qt.Checked) + itm.setCheckState(Qt.CheckState.Checked) else: - itm.setCheckState(Qt.Unchecked) + itm.setCheckState(Qt.CheckState.Unchecked) def __getSelectedFutureImports(self): """ @@ -1788,7 +1797,7 @@ selectedFutures = [] for row in range(self.futuresList.count()): itm = self.futuresList.item(row) - if itm.checkState() == Qt.Checked: + if itm.checkState() == Qt.CheckState.Checked: selectedFutures.append(itm.text()) return ", ".join(selectedFutures) @@ -1842,7 +1851,7 @@ CodeStyleAddBuiltinIgnoreDialog ) dlg = CodeStyleAddBuiltinIgnoreDialog(self) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: left, right = dlg.getData() QTreeWidgetItem(self.builtinsAssignmentList, [left, right]) @@ -1873,10 +1882,10 @@ CodeStyleCheckerDialog.checkCategories.keys()) for row in range(self.categoriesList.count()): itm = self.categoriesList.item(row) - if itm.data(Qt.UserRole) in enabledCategoriesList: - itm.setCheckState(Qt.Checked) + if itm.data(Qt.ItemDataRole.UserRole) in enabledCategoriesList: + itm.setCheckState(Qt.CheckState.Checked) else: - itm.setCheckState(Qt.Unchecked) + itm.setCheckState(Qt.CheckState.Unchecked) def __getCategories(self, enabled, asList=False): """ @@ -1890,13 +1899,13 @@ @return checker categories as a list or comma separated string @rtype str or list of str """ - state = Qt.Checked if enabled else Qt.Unchecked + state = Qt.CheckState.Checked if enabled else Qt.CheckState.Unchecked checkerList = [] for row in range(self.categoriesList.count()): itm = self.categoriesList.item(row) if itm.checkState() == state: - checkerList.append(itm.data(Qt.UserRole)) + checkerList.append(itm.data(Qt.ItemDataRole.UserRole)) if asList: return checkerList else: @@ -1996,7 +2005,7 @@ self, self.tr("Commented Code Whitelist Pattern"), self.tr("Enter a Commented Code Whitelist Pattern"), - QLineEdit.Normal) + QLineEdit.EchoMode.Normal) if ok and pattern: QListWidgetItem(pattern, self.whitelistWidget)
--- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCodeSelectionDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCodeSelectionDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -84,12 +84,12 @@ else: # unknown category prefix => warning itm.setIcon(0, UI.PixmapCache.getIcon("warning")) - itm.setFlags(itm.flags() | Qt.ItemIsUserCheckable) + itm.setFlags(itm.flags() | Qt.ItemFlag.ItemIsUserCheckable) if code in codeList: - itm.setCheckState(0, Qt.Checked) + itm.setCheckState(0, Qt.CheckState.Checked) codeList.remove(code) else: - itm.setCheckState(0, Qt.Unchecked) + itm.setCheckState(0, Qt.CheckState.Unchecked) self.codeTable.resizeColumnToContents(0) self.codeTable.resizeColumnToContents(1) self.codeTable.header().setStretchLastSection(True) @@ -107,7 +107,7 @@ for index in range(self.codeTable.topLevelItemCount()): itm = self.codeTable.topLevelItem(index) - if itm.checkState(0) == Qt.Checked: + if itm.checkState(0) == Qt.CheckState.Checked: selectedCodes.append(itm.text(0)) return ", ".join(self.__extraCodes + selectedCodes)
--- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleStatisticsDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleStatisticsDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -97,5 +97,7 @@ elif code.startswith("S"): itm.setIcon(1, UI.PixmapCache.getIcon("securityLow")) - itm.setTextAlignment(0, Qt.AlignRight | Qt.AlignVCenter) - itm.setTextAlignment(1, Qt.AlignHCenter | Qt.AlignVCenter) + itm.setTextAlignment( + 0, Qt.AlignmentFlag.AlignRight | Qt.AlignmentFlag.AlignVCenter) + itm.setTextAlignment( + 1, Qt.AlignmentFlag.AlignHCenter | Qt.AlignmentFlag.AlignVCenter)
--- a/eric6/Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheckerDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheckerDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -27,11 +27,11 @@ """ Class implementing a dialog to display the results of a syntax check run. """ - filenameRole = Qt.UserRole + 1 - lineRole = Qt.UserRole + 2 - indexRole = Qt.UserRole + 3 - errorRole = Qt.UserRole + 4 - warningRole = Qt.UserRole + 5 + filenameRole = Qt.ItemDataRole.UserRole + 1 + lineRole = Qt.ItemDataRole.UserRole + 2 + indexRole = Qt.ItemDataRole.UserRole + 3 + errorRole = Qt.ItemDataRole.UserRole + 4 + warningRole = Qt.ItemDataRole.UserRole + 5 def __init__(self, parent=None): """ @@ -41,17 +41,20 @@ """ super(SyntaxCheckerDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) self.showButton = self.buttonBox.addButton( - self.tr("Show"), QDialogButtonBox.ActionRole) + self.tr("Show"), QDialogButtonBox.ButtonRole.ActionRole) self.showButton.setToolTip( self.tr("Press to show all files containing an issue")) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.resultList.headerItem().setText(self.resultList.columnCount(), "") - self.resultList.header().setSortIndicator(0, Qt.AscendingOrder) + self.resultList.header().setSortIndicator( + 0, Qt.SortOrder.AscendingOrder) self.noResults = True self.cancelled = False @@ -98,13 +101,13 @@ self.__errorItem = QTreeWidgetItem(self.resultList, [ self.tr("Errors")]) self.__errorItem.setExpanded(True) - self.__errorItem.setForeground(0, Qt.red) + self.__errorItem.setForeground(0, Qt.GlobalColor.red) msg = "{0} ({1})".format(self.__project.getRelativePath(filename), message) - if not self.resultList.findItems(msg, Qt.MatchExactly): + if not self.resultList.findItems(msg, Qt.MatchFlag.MatchExactly): itm = QTreeWidgetItem(self.__errorItem, [msg]) - itm.setForeground(0, Qt.red) + itm.setForeground(0, Qt.GlobalColor.red) itm.setFirstColumnSpanned(True) def __createResultItem(self, filename, line, index, error, sourcecode, @@ -135,9 +138,9 @@ itm.setIcon(0, UI.PixmapCache.getIcon("warning")) else: itm.setIcon(0, UI.PixmapCache.getIcon("syntaxError")) - itm.setData(0, Qt.DisplayRole, line) - itm.setData(1, Qt.DisplayRole, error) - itm.setData(2, Qt.DisplayRole, sourcecode) + itm.setData(0, Qt.ItemDataRole.DisplayRole, line) + itm.setData(1, Qt.ItemDataRole.DisplayRole, error) + itm.setData(2, Qt.ItemDataRole.DisplayRole, sourcecode) itm.setData(0, self.filenameRole, filename) itm.setData(0, self.lineRole, int(line)) itm.setData(0, self.indexRole, index) @@ -154,9 +157,12 @@ self.__fileList = fileList[:] self.__project = project - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) self.filterFrame.setVisible(True) @@ -181,9 +187,12 @@ self.__project = e5App().getObject("Project") self.cancelled = False - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.showButton.setEnabled(False) self.checkProgress.setVisible(True) QApplication.processEvents() @@ -389,9 +398,12 @@ self.__finished = True self.cancelled = True - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) if self.noResults: QTreeWidgetItem(self.resultList, [self.tr('No issues found.')]) @@ -400,7 +412,7 @@ else: self.showButton.setEnabled(True) self.resultList.header().resizeSections( - QHeaderView.ResizeToContents) + QHeaderView.ResizeMode.ResizeToContents) self.resultList.header().setStretchLastSection(True) self.checkProgress.setVisible(False) @@ -412,9 +424,13 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() - elif button == self.buttonBox.button(QDialogButtonBox.Cancel): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): if self.__batch: self.syntaxCheckService.cancelSyntaxBatchCheck() QTimer.singleShot(1000, self.__finish)
--- a/eric6/Plugins/DocumentationPlugins/Ericapi/EricapiConfigDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/DocumentationPlugins/Ericapi/EricapiConfigDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -46,7 +46,8 @@ self.ignoreDirPicker.setMode(E5PathPickerModes.DirectoryMode) self.ignoreDirPicker.setDefaultDirectory(project.getProjectPath()) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) for language in sorted( DocumentationTools.supportedExtensionsDictForApis.keys()): self.languagesList.addItem(language) @@ -82,7 +83,7 @@ # convert Python to the more specific Python3 language = "Python3" items = self.languagesList.findItems( - language, Qt.MatchFlags(Qt.MatchExactly)) + language, Qt.MatchFlags(Qt.MatchFlag.MatchExactly)) items and items[0].setSelected(True) def __initializeDefaults(self): @@ -215,7 +216,8 @@ @param filename name of the file (string) """ - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(filename != "") + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(filename != "") @pyqtSlot(str) def on_ignoreDirPicker_pathSelected(self, path):
--- a/eric6/Plugins/DocumentationPlugins/Ericapi/EricapiExecDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/DocumentationPlugins/Ericapi/EricapiExecDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -37,8 +37,10 @@ self.setModal(True) self.setupUi(self) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.process = None self.cmdname = cmdname @@ -99,9 +101,13 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.accept() - elif button == self.buttonBox.button(QDialogButtonBox.Cancel): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): self.__finish() def __finish(self): @@ -113,15 +119,18 @@ """ if ( self.process is not None and - self.process.state() != QProcess.NotRunning + self.process.state() != QProcess.ProcessState.NotRunning ): self.process.terminate() QTimer.singleShot(2000, self.process.kill) self.process.waitForFinished(3000) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) self.process = None @@ -136,7 +145,7 @@ It reads the output of the process, formats it and inserts it into the contents pane. """ - self.process.setReadChannel(QProcess.StandardOutput) + self.process.setReadChannel(QProcess.ProcessChannel.StandardOutput) while self.process.canReadLine(): s = str(self.process.readLine(), @@ -152,7 +161,7 @@ It reads the error output of the process and inserts it into the error pane. """ - self.process.setReadChannel(QProcess.StandardError) + self.process.setReadChannel(QProcess.ProcessChannel.StandardError) while self.process.canReadLine(): self.errorGroup.show()
--- a/eric6/Plugins/DocumentationPlugins/Ericdoc/EricdocConfigDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/DocumentationPlugins/Ericdoc/EricdocConfigDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -55,7 +55,8 @@ self.qtHelpDirPicker.setMode(E5PathPickerModes.DirectoryMode) self.qtHelpDirPicker.setDefaultDirectory(project.getProjectPath()) - self.__okButton = self.buttonBox.button(QDialogButtonBox.Ok) + self.__okButton = self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok) self.__initializeDefaults()
--- a/eric6/Plugins/DocumentationPlugins/Ericdoc/EricdocExecDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/DocumentationPlugins/Ericdoc/EricdocExecDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -37,8 +37,10 @@ self.setModal(True) self.setupUi(self) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.process = None self.cmdname = cmdname @@ -99,9 +101,13 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.accept() - elif button == self.buttonBox.button(QDialogButtonBox.Cancel): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): self.__finish() def __finish(self): @@ -112,17 +118,20 @@ the user pressed the button. """ if self.process is not None: - if self.process.state() != QProcess.NotRunning: + if self.process.state() != QProcess.ProcessState.NotRunning: self.process.terminate() QTimer.singleShot(2000, self.process.kill) self.process.waitForFinished(3000) - if self.process.exitStatus() == QProcess.CrashExit: + if self.process.exitStatus() == QProcess.ExitStatus.CrashExit: self.contents.insertPlainText( self.tr('\n{0} crashed.\n').format(self.cmdname)) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) self.process = None @@ -137,7 +146,7 @@ It reads the output of the process, formats it and inserts it into the contents pane. """ - self.process.setReadChannel(QProcess.StandardOutput) + self.process.setReadChannel(QProcess.ProcessChannel.StandardOutput) while self.process.canReadLine(): s = str(self.process.readLine(), @@ -153,7 +162,7 @@ It reads the error output of the process and inserts it into the error pane. """ - self.process.setReadChannel(QProcess.StandardError) + self.process.setReadChannel(QProcess.ProcessChannel.StandardError) while self.process.canReadLine(): self.errorGroup.show()
--- a/eric6/Plugins/PluginAbout.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/PluginAbout.py Tue Mar 02 17:17:09 2021 +0100 @@ -87,7 +87,7 @@ """<p>Display some information about this software.</p>""" ).format(UI.Info.Program)) self.aboutAct.triggered.connect(self.__about) - self.aboutAct.setMenuRole(QAction.AboutRole) + self.aboutAct.setMenuRole(QAction.MenuRole.AboutRole) acts.append(self.aboutAct) self.aboutQtAct = E5Action( @@ -101,7 +101,7 @@ """<p>Display some information about the Qt toolkit.</p>""" )) self.aboutQtAct.triggered.connect(self.__aboutQt) - self.aboutQtAct.setMenuRole(QAction.AboutQtRole) + self.aboutQtAct.setMenuRole(QAction.MenuRole.AboutQtRole) acts.append(self.aboutQtAct) self.__ui.addE5Actions(acts, 'ui')
--- a/eric6/Plugins/PluginEricapi.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/PluginEricapi.py Tue Mar 02 17:17:09 2021 +0100 @@ -159,7 +159,7 @@ project = e5App().getObject("Project") parms = project.getData('DOCUMENTATIONPARMS', "ERIC4API") dlg = EricapiConfigDialog(project, parms) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: args, parms = dlg.generateParameters() project.setData('DOCUMENTATIONPARMS', "ERIC4API", parms)
--- a/eric6/Plugins/PluginEricdoc.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/PluginEricdoc.py Tue Mar 02 17:17:09 2021 +0100 @@ -180,7 +180,7 @@ project = e5App().getObject("Project") parms = project.getData('DOCUMENTATIONPARMS', "ERIC4DOC") dlg = EricdocConfigDialog(project, parms) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: args, parms = dlg.generateParameters() project.setData('DOCUMENTATIONPARMS', "ERIC4DOC", parms)
--- a/eric6/Plugins/PluginTranslator.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/PluginTranslator.py Tue Mar 02 17:17:09 2021 +0100 @@ -191,7 +191,7 @@ # old value, replace with default value = self.__defaults[key] else: - value = QDateTime.fromString(value, Qt.ISODate) + value = QDateTime.fromString(value, Qt.DateFormat.ISODate) return value else: return Preferences.Prefs.settings.value( @@ -206,7 +206,8 @@ """ if key in ["MsAuthTokenExpire"]: Preferences.Prefs.settings.setValue( - self.PreferencesKey + "/" + key, value.toString(Qt.ISODate)) + self.PreferencesKey + "/" + key, + value.toString(Qt.DateFormat.ISODate)) else: Preferences.Prefs.settings.setValue( self.PreferencesKey + "/" + key, value)
--- a/eric6/Plugins/PluginWizardDotDesktop.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/PluginWizardDotDesktop.py Tue Mar 02 17:17:09 2021 +0100 @@ -132,7 +132,7 @@ DotDesktopWizardDialog ) dlg = DotDesktopWizardDialog(None) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: code = dlg.getCode() if code: editor.selectAll()
--- a/eric6/Plugins/PluginWizardE5MessageBox.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/PluginWizardE5MessageBox.py Tue Mar 02 17:17:09 2021 +0100 @@ -103,7 +103,7 @@ E5MessageBoxWizardDialog ) dlg = E5MessageBoxWizardDialog(None) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: line, index = editor.getCursorPosition() indLevel = editor.indentation(line) // editor.indentationWidth() if editor.indentationsUseTabs():
--- a/eric6/Plugins/PluginWizardEricPlugin.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/PluginWizardEricPlugin.py Tue Mar 02 17:17:09 2021 +0100 @@ -119,7 +119,7 @@ PluginWizardDialog ) dlg = PluginWizardDialog(None) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: return (dlg.getCode(), dlg.packageName(), True) else: return (None, "", False)
--- a/eric6/Plugins/PluginWizardPyRegExp.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/PluginWizardPyRegExp.py Tue Mar 02 17:17:09 2021 +0100 @@ -103,7 +103,7 @@ PyRegExpWizardDialog ) dlg = PyRegExpWizardDialog(None, True) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: line, index = editor.getCursorPosition() indLevel = editor.indentation(line) // editor.indentationWidth() if editor.indentationsUseTabs():
--- a/eric6/Plugins/PluginWizardQColorDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/PluginWizardQColorDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -103,7 +103,7 @@ ColorDialogWizardDialog ) dlg = ColorDialogWizardDialog(None) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: line, index = editor.getCursorPosition() indLevel = editor.indentation(line) // editor.indentationWidth() if editor.indentationsUseTabs():
--- a/eric6/Plugins/PluginWizardQFileDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/PluginWizardQFileDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -131,7 +131,7 @@ FileDialogWizardDialog ) dlg = FileDialogWizardDialog(variant, None) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: line, index = editor.getCursorPosition() indLevel = editor.indentation(line) // editor.indentationWidth() if editor.indentationsUseTabs():
--- a/eric6/Plugins/PluginWizardQFontDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/PluginWizardQFontDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -103,7 +103,7 @@ FontDialogWizardDialog ) dlg = FontDialogWizardDialog(None) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: line, index = editor.getCursorPosition() indLevel = editor.indentation(line) // editor.indentationWidth() if editor.indentationsUseTabs():
--- a/eric6/Plugins/PluginWizardQInputDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/PluginWizardQInputDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -103,7 +103,7 @@ InputDialogWizardDialog ) dlg = InputDialogWizardDialog(None) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: line, index = editor.getCursorPosition() indLevel = editor.indentation(line) // editor.indentationWidth() if editor.indentationsUseTabs():
--- a/eric6/Plugins/PluginWizardQMessageBox.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/PluginWizardQMessageBox.py Tue Mar 02 17:17:09 2021 +0100 @@ -103,7 +103,7 @@ MessageBoxWizardDialog ) dlg = MessageBoxWizardDialog(None) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: line, index = editor.getCursorPosition() indLevel = editor.indentation(line) // editor.indentationWidth() if editor.indentationsUseTabs():
--- a/eric6/Plugins/PluginWizardQRegularExpression.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/PluginWizardQRegularExpression.py Tue Mar 02 17:17:09 2021 +0100 @@ -104,7 +104,7 @@ ) dlg = QRegularExpressionWizardDialog.QRegularExpressionWizardDialog( None, True) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: line, index = editor.getCursorPosition() indLevel = editor.indentation(line) // editor.indentationWidth() if editor.indentationsUseTabs():
--- a/eric6/Plugins/PluginWizardSetup.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/PluginWizardSetup.py Tue Mar 02 17:17:09 2021 +0100 @@ -117,7 +117,7 @@ SetupWizardDialog ) dlg = SetupWizardDialog(None) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: line, index = editor.getCursorPosition() indLevel = editor.indentation(line) // editor.indentationWidth() if editor.indentationsUseTabs():
--- a/eric6/Plugins/UiExtensionPlugins/Translator/ConfigurationPage/TranslatorPage.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/UiExtensionPlugins/Translator/ConfigurationPage/TranslatorPage.py Tue Mar 02 17:17:09 2021 +0100 @@ -71,11 +71,11 @@ itm = QListWidgetItem() itm.setText(languages.getLanguage(languageCode)) itm.setIcon(languages.getLanguageIcon(languageCode)) - itm.setData(Qt.UserRole, languageCode) + itm.setData(Qt.ItemDataRole.UserRole, languageCode) if languageCode in enabledLanguages or not enabledLanguages: - itm.setCheckState(Qt.Checked) + itm.setCheckState(Qt.CheckState.Checked) else: - itm.setCheckState(Qt.Unchecked) + itm.setCheckState(Qt.CheckState.Unchecked) self.languagesList.addItem(itm) self.languagesList.sortItems() @@ -109,7 +109,7 @@ Public slot to save the Pyramid configuration. """ enabledLanguages = [ - itm.data(Qt.UserRole) + itm.data(Qt.ItemDataRole.UserRole) for itm in self.__checkedLanguageItems() ] self.__plugin.setPreferences( @@ -147,7 +147,7 @@ items = [] for index in range(self.languagesList.count()): itm = self.languagesList.item(index) - if itm.checkState() == Qt.Checked: + if itm.checkState() == Qt.CheckState.Checked: items.append(itm) return items @@ -163,9 +163,9 @@ for index in range(self.languagesList.count()): itm = self.languagesList.item(index) if unset: - itm.setCheckState(Qt.Unchecked) + itm.setCheckState(Qt.CheckState.Unchecked) else: - itm.setCheckState(Qt.Checked) + itm.setCheckState(Qt.CheckState.Checked) self.__enableLanguageWarning = True @@ -179,10 +179,10 @@ defaults = self.__plugin.getPreferencesDefault("EnabledLanguages") for index in range(self.languagesList.count()): itm = self.languagesList.item(index) - if itm.data(Qt.UserRole) in defaults: - itm.setCheckState(Qt.Checked) + if itm.data(Qt.ItemDataRole.UserRole) in defaults: + itm.setCheckState(Qt.CheckState.Checked) else: - itm.setCheckState(Qt.Unchecked) + itm.setCheckState(Qt.CheckState.Unchecked) self.__enableLanguageWarning = True
--- a/eric6/Plugins/UiExtensionPlugins/Translator/Translator.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/UiExtensionPlugins/Translator/Translator.py Tue Mar 02 17:17:09 2021 +0100 @@ -112,4 +112,4 @@ self.__ui.bottomSidebar.setCurrentWidget(self.__widget) else: self.__widget.show() - self.__widget.setFocus(Qt.ActiveWindowFocusReason) + self.__widget.setFocus(Qt.FocusReason.ActiveWindowFocusReason)
--- a/eric6/Plugins/UiExtensionPlugins/Translator/TranslatorEngines/IbmWatsonEngine.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/UiExtensionPlugins/Translator/TranslatorEngines/IbmWatsonEngine.py Tue Mar 02 17:17:09 2021 +0100 @@ -206,7 +206,8 @@ ] request = QNetworkRequest(url) - request.setAttribute(QNetworkRequest.FollowRedirectsAttribute, True) + request.setAttribute( + QNetworkRequest.Attribute.FollowRedirectsAttribute, True) if extraHeaders: for name, value in extraHeaders: request.setRawHeader(name, value) @@ -226,7 +227,7 @@ self.__replies.remove(reply) reply.deleteLater() - if reply.error() != QNetworkReply.NoError: + if reply.error() != QNetworkReply.NetworkError.NoError: errorStr = reply.errorString() E5MessageBox.critical( self.__ui,
--- a/eric6/Plugins/UiExtensionPlugins/Translator/TranslatorRequest.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/UiExtensionPlugins/Translator/TranslatorRequest.py Tue Mar 02 17:17:09 2021 +0100 @@ -51,14 +51,15 @@ @return server response (QByteArray) or error message (string) """ request = QNetworkRequest(requestUrl) - request.setAttribute(QNetworkRequest.FollowRedirectsAttribute, True) + request.setAttribute( + QNetworkRequest.Attribute.FollowRedirectsAttribute, True) if extraHeaders: for name, value in extraHeaders: request.setRawHeader(name, value) reply = self.__networkManager.get(request) if not self.__loop.isRunning(): self.__loop.exec() - if reply.error() != QNetworkReply.NoError: + if reply.error() != QNetworkReply.NetworkError.NoError: return reply.errorString(), False else: return reply.readAll(), True @@ -83,7 +84,8 @@ self.__contentTypes[dataType]) request.setRawHeader(b"Content-Length", QByteArray.number(requestData.size())) - request.setAttribute(QNetworkRequest.FollowRedirectsAttribute, True) + request.setAttribute( + QNetworkRequest.Attribute.FollowRedirectsAttribute, True) if extraHeaders: for name, value in extraHeaders: request.setRawHeader(name, value) @@ -91,7 +93,7 @@ reply = self.__networkManager.post(request, requestData) if not self.__loop.isRunning(): self.__loop.exec() - if reply.error() != QNetworkReply.NoError: + if reply.error() != QNetworkReply.NetworkError.NoError: return reply.errorString(), False else: return str(reply.readAll(), "utf-8", "replace"), True
--- a/eric6/Plugins/UiExtensionPlugins/Translator/TranslatorWidget.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/UiExtensionPlugins/Translator/TranslatorWidget.py Tue Mar 02 17:17:09 2021 +0100 @@ -410,7 +410,7 @@ self.__mediaPlayer.stateChanged.connect( self.__mediaPlayerStateChanged) - if self.__mediaPlayer.state() == QMediaPlayer.PlayingState: + if self.__mediaPlayer.state() == QMediaPlayer.State.PlayingState: return self.__ensureTranslationEngineReady() @@ -445,7 +445,7 @@ @param state media player state (QAudio.State) """ - if state == QMediaPlayer.StoppedState: + if state == QMediaPlayer.State.StoppedState: self.__mediaFile.close() self.__mediaFile.remove() self.__mediaFile = None
--- a/eric6/Plugins/VcsPlugins/vcsGit/ConfigurationPage/GitPage.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsGit/ConfigurationPage/GitPage.py Tue Mar 02 17:17:09 2021 +0100 @@ -88,7 +88,7 @@ if not os.path.exists(cfgFile): from ..GitUserConfigDataDialog import GitUserConfigDataDialog dlg = GitUserConfigDataDialog() - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: firstName, lastName, email = dlg.getData() else: firstName, lastName, email = (
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitAddRemoteDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsGit/GitAddRemoteDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -36,7 +36,7 @@ """ Private method to update the status of the OK button. """ - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( + self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( self.nameEdit.text() != "" and self.urlEdit.text() != "")
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitArchiveDataDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsGit/GitArchiveDataDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -39,7 +39,8 @@ self.fileButton.setIcon(UI.PixmapCache.getIcon("open")) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) self.tagCombo.addItems(sorted(tagsList)) self.branchCombo.addItems(["master"] + sorted(branchesList)) @@ -64,7 +65,8 @@ enabled &= bool(self.fileEdit.text()) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enabled) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(enabled) @pyqtSlot(str) def on_fileEdit_textChanged(self, txt):
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitBisectLogBrowserDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsGit/GitBisectLogBrowserDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -44,13 +44,15 @@ self.__position = QPoint() - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.logTree.headerItem().setText(self.logTree.columnCount(), "") self.refreshButton = self.buttonBox.addButton( - self.tr("&Refresh"), QDialogButtonBox.ActionRole) + self.tr("&Refresh"), QDialogButtonBox.ButtonRole.ActionRole) self.refreshButton.setToolTip( self.tr("Press to refresh the list of commits")) self.refreshButton.setEnabled(False) @@ -82,7 +84,7 @@ """ if ( self.__process is not None and - self.__process.state() != QProcess.NotRunning + self.__process.state() != QProcess.ProcessState.NotRunning ): self.__process.terminate() QTimer.singleShot(2000, self.__process.kill) @@ -112,7 +114,8 @@ """ Private method to resize the log tree columns. """ - self.logTree.header().resizeSections(QHeaderView.ResizeToContents) + self.logTree.header().resizeSections( + QHeaderView.ResizeMode.ResizeToContents) self.logTree.header().setStretchLastSection(True) def __generateLogItem(self, commitId, operation, subject): @@ -136,9 +139,12 @@ """ Private method to retrieve bisect log entries from the repository. """ - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.inputGroup.setEnabled(True) self.inputGroup.show() @@ -213,15 +219,18 @@ """ if ( self.__process is not None and - self.__process.state() != QProcess.NotRunning + self.__process.state() != QProcess.ProcessState.NotRunning ): self.__process.terminate() QTimer.singleShot(2000, self.__process.kill) self.__process.waitForFinished(3000) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) self.inputGroup.setEnabled(False) self.inputGroup.hide() @@ -248,7 +257,8 @@ # restore current item if self.__currentCommitId: items = self.logTree.findItems( - self.__currentCommitId, Qt.MatchExactly, self.CommitIdColumn) + self.__currentCommitId, Qt.MatchFlag.MatchExactly, + self.CommitIdColumn) if items: self.logTree.setCurrentItem(items[0]) self.__currentCommitId = "" @@ -259,7 +269,7 @@ It reads the output of the process and inserts it into a buffer. """ - self.__process.setReadChannel(QProcess.StandardOutput) + self.__process.setReadChannel(QProcess.ProcessChannel.StandardOutput) while self.__process.canReadLine(): line = str(self.__process.readLine(), @@ -296,9 +306,13 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() - elif button == self.buttonBox.button(QDialogButtonBox.Cancel): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): self.cancelled = True self.__finish() elif button == self.refreshButton: @@ -325,9 +339,9 @@ @param isOn flag indicating the status of the check box (boolean) """ if isOn: - self.input.setEchoMode(QLineEdit.Password) + self.input.setEchoMode(QLineEdit.EchoMode.Password) else: - self.input.setEchoMode(QLineEdit.Normal) + self.input.setEchoMode(QLineEdit.EchoMode.Normal) @pyqtSlot() def on_sendButton_clicked(self):
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitBisectStartDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsGit/GitBisectStartDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -26,7 +26,8 @@ super(GitBisectStartDialog, self).__init__(parent) self.setupUi(self) - self.okButton = self.buttonBox.button(QDialogButtonBox.Ok) + self.okButton = self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok) self.okButton.setEnabled(False) msh = self.minimumSizeHint()
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitBlameDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsGit/GitBlameDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -36,10 +36,12 @@ """ super(GitBlameDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.vcs = vcs @@ -69,7 +71,7 @@ """ if ( self.process is not None and - self.process.state() != QProcess.NotRunning + self.process.state() != QProcess.ProcessState.NotRunning ): self.process.terminate() QTimer.singleShot(2000, self.process.kill) @@ -130,7 +132,7 @@ """ if ( self.process is not None and - self.process.state() != QProcess.NotRunning + self.process.state() != QProcess.ProcessState.NotRunning ): self.process.terminate() QTimer.singleShot(2000, self.process.kill) @@ -139,11 +141,15 @@ self.inputGroup.setEnabled(False) self.inputGroup.hide() - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) - self.buttonBox.button(QDialogButtonBox.Close).setFocus( - Qt.OtherFocusReason) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setFocus( + Qt.FocusReason.OtherFocusReason) self.__resizeColumns() @@ -153,9 +159,13 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() - elif button == self.buttonBox.button(QDialogButtonBox.Cancel): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): self.__finish() def __procFinished(self, exitCode, exitStatus): @@ -171,7 +181,8 @@ """ Private method to resize the list columns. """ - self.blameList.header().resizeSections(QHeaderView.ResizeToContents) + self.blameList.header().resizeSections( + QHeaderView.ResizeMode.ResizeToContents) def __generateItem(self, commitId, author, date, time, lineno, text): """ @@ -187,8 +198,8 @@ itm = QTreeWidgetItem( self.blameList, [commitId, author, date, time, lineno, text]) - itm.setTextAlignment(0, Qt.AlignRight) - itm.setTextAlignment(4, Qt.AlignRight) + itm.setTextAlignment(0, Qt.AlignmentFlag.AlignRight) + itm.setTextAlignment(4, Qt.AlignmentFlag.AlignRight) def __readStdout(self): """ @@ -197,7 +208,7 @@ It reads the output of the process, formats it and inserts it into the annotation list. """ - self.process.setReadChannel(QProcess.StandardOutput) + self.process.setReadChannel(QProcess.ProcessChannel.StandardOutput) while self.process.canReadLine(): line = str(self.process.readLine(), @@ -259,9 +270,9 @@ @param checked flag indicating the status of the check box (boolean) """ if checked: - self.input.setEchoMode(QLineEdit.Password) + self.input.setEchoMode(QLineEdit.EchoMode.Password) else: - self.input.setEchoMode(QLineEdit.Normal) + self.input.setEchoMode(QLineEdit.EchoMode.Normal) def keyPressEvent(self, evt): """
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitBranchDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsGit/GitBranchDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -39,7 +39,8 @@ super(GitBranchDialog, self).__init__(parent) self.setupUi(self) - self.okButton = self.buttonBox.button(QDialogButtonBox.Ok) + self.okButton = self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok) self.okButton.setEnabled(False) self.__remoteBranches = [b for b in branchlist
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitBranchPushDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsGit/GitBranchPushDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -29,7 +29,8 @@ super(GitBranchPushDialog, self).__init__(parent) self.setupUi(self) - self.__okButton = self.buttonBox.button(QDialogButtonBox.Ok) + self.__okButton = self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok) self.__allBranches = self.tr("<all branches>")
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitBundleDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsGit/GitBundleDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -28,7 +28,8 @@ super(GitBundleDialog, self).__init__(parent) self.setupUi(self) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) self.tagCombo.addItems(sorted(tagsList)) self.branchCombo.addItems(["master"] + sorted(branchesList)) @@ -45,7 +46,8 @@ elif self.branchButton.isChecked(): enabled = self.branchCombo.currentText() != "" - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enabled) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(enabled) @pyqtSlot(bool) def on_revisionsButton_toggled(self, checked):
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitChangeRemoteUrlDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsGit/GitChangeRemoteUrlDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -35,11 +35,12 @@ self.__userInfo = url.userInfo() self.nameEdit.setText(remoteName) - self.urlEdit.setText(url.toString(QUrl.RemoveUserInfo)) + self.urlEdit.setText( + url.toString(QUrl.UrlFormattingOption.RemoveUserInfo)) self.__updateOK() - self.newUrlEdit.setFocus(Qt.OtherFocusReason) + self.newUrlEdit.setFocus(Qt.FocusReason.OtherFocusReason) msh = self.minimumSizeHint() self.resize(max(self.width(), msh.width()), msh.height()) @@ -48,7 +49,7 @@ """ Private method to update the status of the OK button. """ - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( + self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( bool(self.newUrlEdit.text()) )
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitCherryPickDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsGit/GitCherryPickDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -38,7 +38,7 @@ """ Private slot to react upon changes of commits. """ - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( + self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( self.commitsEdit.toPlainText() != "") def getData(self):
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitCommandDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsGit/GitCommandDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -34,7 +34,8 @@ super(GitCommandDialog, self).__init__(parent) self.setupUi(self) - self.okButton = self.buttonBox.button(QDialogButtonBox.Ok) + self.okButton = self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok) self.okButton.setEnabled(False) self.commandCombo.clear()
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitCommitDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsGit/GitCommitDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -34,7 +34,7 @@ @param parent parent widget (QWidget) """ super(GitCommitDialog, self).__init__( - parent, Qt.WindowFlags(Qt.Window)) + parent, Qt.WindowFlags(Qt.WindowType.Window)) self.setupUi(self) self.__vcs = vcs @@ -58,7 +58,7 @@ abbrMsg += "..." self.recentComboBox.addItem(abbrMsg, message) - self.logEdit.setFocus(Qt.OtherFocusReason) + self.logEdit.setFocus(Qt.FocusReason.OtherFocusReason) def logMessage(self): """ @@ -109,7 +109,9 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Cancel): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): self.logEdit.clear() def on_buttonBox_accepted(self):
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitCopyDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsGit/GitCopyDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -52,7 +52,8 @@ self.sourceEdit.setText(source) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) msh = self.minimumSizeHint() self.resize(max(self.width(), msh.width()), msh.height()) @@ -103,5 +104,5 @@ @param txt contents of the target edit (string) """ - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( + self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( os.path.isabs(txt) or os.path.dirname(txt) == "")
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitDescribeDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsGit/GitDescribeDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -35,16 +35,18 @@ """ super(GitDescribeDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.process = QProcess() self.vcs = vcs self.tagList.headerItem().setText(self.tagList.columnCount(), "") - self.tagList.header().setSortIndicator(1, Qt.AscendingOrder) + self.tagList.header().setSortIndicator(1, Qt.SortOrder.AscendingOrder) self.process.finished.connect(self.__procFinished) self.process.readyReadStandardOutput.connect(self.__readStdout) @@ -61,7 +63,7 @@ """ if ( self.process is not None and - self.process.state() != QProcess.NotRunning + self.process.state() != QProcess.ProcessState.NotRunning ): self.process.terminate() QTimer.singleShot(2000, self.process.kill) @@ -128,7 +130,7 @@ """ if ( self.process is not None and - self.process.state() != QProcess.NotRunning + self.process.state() != QProcess.ProcessState.NotRunning ): self.process.terminate() QTimer.singleShot(2000, self.process.kill) @@ -137,11 +139,15 @@ self.inputGroup.setEnabled(False) self.inputGroup.hide() - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) - self.buttonBox.button(QDialogButtonBox.Close).setFocus( - Qt.OtherFocusReason) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setFocus( + Qt.FocusReason.OtherFocusReason) self.__resizeColumns() self.__resort() @@ -152,9 +158,13 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() - elif button == self.buttonBox.button(QDialogButtonBox.Cancel): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): self.__finish() def __procFinished(self, exitCode, exitStatus): @@ -187,7 +197,8 @@ """ Private method to resize the list columns. """ - self.tagList.header().resizeSections(QHeaderView.ResizeToContents) + self.tagList.header().resizeSections( + QHeaderView.ResizeMode.ResizeToContents) self.tagList.header().setStretchLastSection(True) def __readStdout(self): @@ -197,7 +208,7 @@ It reads the output of the process, formats it and inserts it into the contents pane. """ - self.process.setReadChannel(QProcess.StandardOutput) + self.process.setReadChannel(QProcess.ProcessChannel.StandardOutput) while self.process.canReadLine(): s = str(self.process.readLine(), @@ -227,9 +238,9 @@ @param isOn flag indicating the status of the check box (boolean) """ if isOn: - self.input.setEchoMode(QLineEdit.Password) + self.input.setEchoMode(QLineEdit.EchoMode.Password) else: - self.input.setEchoMode(QLineEdit.Normal) + self.input.setEchoMode(QLineEdit.EchoMode.Normal) @pyqtSlot() def on_sendButton_clicked(self):
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsGit/GitDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -41,8 +41,10 @@ super(GitDialog, self).__init__(parent) self.setupUi(self) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.process = None self.username = '' @@ -61,7 +63,7 @@ """ if ( self.process is not None and - self.process.state() != QProcess.NotRunning + self.process.state() != QProcess.ProcessState.NotRunning ): self.process.terminate() QTimer.singleShot(2000, self.process.kill) @@ -72,11 +74,15 @@ self.process = None - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) - self.buttonBox.button(QDialogButtonBox.Close).setFocus( - Qt.OtherFocusReason) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setFocus( + Qt.FocusReason.OtherFocusReason) if self.normal and self.errors.toPlainText(): self.errorGroup.setTitle(self.tr("Additional Output")) @@ -94,9 +100,13 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() - elif button == self.buttonBox.button(QDialogButtonBox.Cancel): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): self.statusLabel.setText(self.tr("Process canceled.")) self.__finish() @@ -107,10 +117,13 @@ @param exitCode exit code of the process (integer) @param exitStatus exit status of the process (QProcess.ExitStatus) """ - self.normal = (exitStatus == QProcess.NormalExit) and (exitCode == 0) + self.normal = ( + (exitStatus == QProcess.ExitStatus.NormalExit) and + (exitCode == 0) + ) if self.normal: self.statusLabel.setText(self.tr("Process finished successfully.")) - elif exitStatus == QProcess.CrashExit: + elif exitStatus == QProcess.ExitStatus.CrashExit: self.statusLabel.setText(self.tr("Process crashed.")) else: self.statusLabel.setText( @@ -261,9 +274,9 @@ @param isOn flag indicating the status of the check box (boolean) """ if isOn: - self.input.setEchoMode(QLineEdit.Password) + self.input.setEchoMode(QLineEdit.EchoMode.Password) else: - self.input.setEchoMode(QLineEdit.Normal) + self.input.setEchoMode(QLineEdit.EchoMode.Normal) @pyqtSlot() def on_sendButton_clicked(self):
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitDiffDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsGit/GitDiffDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -40,24 +40,26 @@ self.setupUi(self) self.refreshButton = self.buttonBox.addButton( - self.tr("Refresh"), QDialogButtonBox.ActionRole) + self.tr("Refresh"), QDialogButtonBox.ButtonRole.ActionRole) self.refreshButton.setToolTip( self.tr("Press to refresh the display")) self.refreshButton.setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Save).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Save).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) try: # insert the search widget if it is available from E5Gui.E5TextEditSearchWidget import E5TextEditSearchWidget self.searchWidget = E5TextEditSearchWidget(self.contentsGroup) - self.searchWidget.setFocusPolicy(Qt.WheelFocus) + self.searchWidget.setFocusPolicy(Qt.FocusPolicy.WheelFocus) self.searchWidget.setObjectName("searchWidget") self.contentsGroup.layout().insertWidget(1, self.searchWidget) self.searchWidget.attachTextEdit(self.contents) self.searchWidget2 = E5TextEditSearchWidget(self.contentsGroup) - self.searchWidget2.setFocusPolicy(Qt.WheelFocus) + self.searchWidget2.setFocusPolicy(Qt.FocusPolicy.WheelFocus) self.searchWidget2.setObjectName("searchWidget2") self.contentsGroup.layout().addWidget(self.searchWidget2) self.searchWidget2.attachTextEdit(self.contents2) @@ -203,15 +205,19 @@ self.errors.setPlainText(errors) self.errors.ensureCursorVisible() - self.buttonBox.button(QDialogButtonBox.Save).setEnabled(bool(diff2)) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) - self.buttonBox.button(QDialogButtonBox.Close).setFocus( - Qt.OtherFocusReason) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Save).setEnabled(bool(diff2)) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setFocus( + Qt.FocusReason.OtherFocusReason) for contents in [self.contents, self.contents2]: tc = contents.textCursor() - tc.movePosition(QTextCursor.Start) + tc.movePosition(QTextCursor.MoveOperation.Start) contents.setTextCursor(tc) contents.ensureCursorVisible() @@ -249,7 +255,9 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Save): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Save + ): self.on_saveButton_clicked() elif button == self.refreshButton: self.on_refreshButton_clicked() @@ -267,26 +275,26 @@ (para2, self.contents2)]: if para == 0: tc = contents.textCursor() - tc.movePosition(QTextCursor.Start) + tc.movePosition(QTextCursor.MoveOperation.Start) contents.setTextCursor(tc) contents.ensureCursorVisible() elif para == -1: tc = contents.textCursor() - tc.movePosition(QTextCursor.End) + tc.movePosition(QTextCursor.MoveOperation.End) contents.setTextCursor(tc) contents.ensureCursorVisible() else: # step 1: move cursor to end tc = contents.textCursor() - tc.movePosition(QTextCursor.End) + tc.movePosition(QTextCursor.MoveOperation.End) contents.setTextCursor(tc) contents.ensureCursorVisible() # step 2: move cursor to desired line tc = contents.textCursor() delta = tc.blockNumber() - para - tc.movePosition(QTextCursor.PreviousBlock, - QTextCursor.MoveAnchor, + tc.movePosition(QTextCursor.MoveOperation.PreviousBlock, + QTextCursor.MoveMode.MoveAnchor, delta) contents.setTextCursor(tc) contents.ensureCursorVisible() @@ -356,9 +364,11 @@ """ Private slot to refresh the display. """ - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Save).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Save).setEnabled(False) self.refreshButton.setEnabled(False) self.start(self.__filename, diffMode=self.__diffMode, refreshable=True)
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitDiffGenerator.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsGit/GitDiffGenerator.py Tue Mar 02 17:17:09 2021 +0100 @@ -57,7 +57,7 @@ for process in [self.__process, self.__process2]: if ( process is not None and - process.state() != QProcess.NotRunning + process.state() != QProcess.ProcessState.NotRunning ): process.terminate() QTimer.singleShot(2000, process.kill) @@ -165,8 +165,8 @@ @param exitStatus exit status of the process (QProcess.ExitStatus) """ if ( - self.__process.state() == QProcess.NotRunning and - self.__process2.state() == QProcess.NotRunning + self.__process.state() == QProcess.ProcessState.NotRunning and + self.__process2.state() == QProcess.ProcessState.NotRunning ): self.finished.emit() @@ -225,7 +225,7 @@ @param process reference to the process providing output @type QProcess """ - process.setReadChannel(QProcess.StandardOutput) + process.setReadChannel(QProcess.ProcessChannel.StandardOutput) isTopDiff = process == self.__process
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitFetchDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsGit/GitFetchDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -37,7 +37,8 @@ remoteUrlsList = self.__vcs.gitGetRemoteUrlsList(self.__repodir) self.__repos = {name: url for name, url in remoteUrlsList} - self.__okButton = self.buttonBox.button(QDialogButtonBox.Ok) + self.__okButton = self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok) self.remotesComboBox.addItems(sorted(self.__repos.keys())) self.remotesComboBox.addItem(self.__all)
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitLogBrowserDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsGit/GitLogBrowserDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -73,7 +73,7 @@ self.setupUi(self) windowFlags = self.windowFlags() - windowFlags |= Qt.WindowContextHelpButtonHint + windowFlags |= Qt.WindowType.WindowContextHelpButtonHint self.setWindowFlags(windowFlags) self.mainSplitter.setSizes([300, 400]) @@ -82,17 +82,20 @@ self.diffSplitter.setStretchFactor(0, 1) self.diffSplitter.setStretchFactor(1, 2) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.filesTree.headerItem().setText(self.filesTree.columnCount(), "") - self.filesTree.header().setSortIndicator(1, Qt.AscendingOrder) + self.filesTree.header().setSortIndicator( + 1, Qt.SortOrder.AscendingOrder) self.upButton.setIcon(UI.PixmapCache.getIcon("1uparrow")) self.downButton.setIcon(UI.PixmapCache.getIcon("1downarrow")) self.refreshButton = self.buttonBox.addButton( - self.tr("&Refresh"), QDialogButtonBox.ActionRole) + self.tr("&Refresh"), QDialogButtonBox.ButtonRole.ActionRole) self.refreshButton.setToolTip( self.tr("Press to refresh the list of commits")) self.refreshButton.setEnabled(False) @@ -182,17 +185,17 @@ self.__resetUI() # roles used in the log tree - self.__subjectRole = Qt.UserRole - self.__messageRole = Qt.UserRole + 1 - self.__changesRole = Qt.UserRole + 2 - self.__edgesRole = Qt.UserRole + 3 - self.__parentsRole = Qt.UserRole + 4 - self.__branchesRole = Qt.UserRole + 5 - self.__authorMailRole = Qt.UserRole + 6 - self.__committerMailRole = Qt.UserRole + 7 + self.__subjectRole = Qt.ItemDataRole.UserRole + self.__messageRole = Qt.ItemDataRole.UserRole + 1 + self.__changesRole = Qt.ItemDataRole.UserRole + 2 + self.__edgesRole = Qt.ItemDataRole.UserRole + 3 + self.__parentsRole = Qt.ItemDataRole.UserRole + 4 + self.__branchesRole = Qt.ItemDataRole.UserRole + 5 + self.__authorMailRole = Qt.ItemDataRole.UserRole + 6 + self.__committerMailRole = Qt.ItemDataRole.UserRole + 7 # roles used in the file tree - self.__diffFileLineRole = Qt.UserRole + self.__diffFileLineRole = Qt.ItemDataRole.UserRole self.__process = E5OverrideCursorProcess() self.__process.finished.connect(self.__procFinished) @@ -384,7 +387,7 @@ """ if ( self.__process is not None and - self.__process.state() != QProcess.NotRunning + self.__process.state() != QProcess.ProcessState.NotRunning ): self.__process.terminate() QTimer.singleShot(2000, self.__process.kill) @@ -453,14 +456,16 @@ """ Private method to resize the log tree columns. """ - self.logTree.header().resizeSections(QHeaderView.ResizeToContents) + self.logTree.header().resizeSections( + QHeaderView.ResizeMode.ResizeToContents) self.logTree.header().setStretchLastSection(True) def __resizeColumnsFiles(self): """ Private method to resize the changed files tree columns. """ - self.filesTree.header().resizeSections(QHeaderView.ResizeToContents) + self.filesTree.header().resizeSections( + QHeaderView.ResizeMode.ResizeToContents) self.filesTree.header().setStretchLastSection(True) def __resortFiles(self): @@ -468,7 +473,7 @@ Private method to resort the changed files tree. """ self.filesTree.setSortingEnabled(True) - self.filesTree.sortItems(1, Qt.AscendingOrder) + self.filesTree.sortItems(1, Qt.SortOrder.AscendingOrder) self.filesTree.setSortingEnabled(False) def __getColor(self, n): @@ -571,7 +576,7 @@ pix = QPixmap(w, h) pix.fill(QColor(0, 0, 0, 0)) # draw transparent background painter = QPainter(pix) - painter.setRenderHint(QPainter.Antialiasing) + painter.setRenderHint(QPainter.RenderHint.Antialiasing) # draw the revision history lines for y1, y2, lines in ((0, h, bottomedges), @@ -586,7 +591,7 @@ painter.drawLine(x1, dot_y + y1, x2, dot_y + y2) penradius = 1 - pencolor = self.logTree.palette().color(QPalette.Text) + pencolor = self.logTree.palette().color(QPalette.ColorRole.Text) dot_y = (h // 2) - radius // 2 @@ -765,8 +770,8 @@ copyfrom, ]) - itm.setTextAlignment(2, Qt.AlignRight) - itm.setTextAlignment(3, Qt.AlignRight) + itm.setTextAlignment(2, Qt.AlignmentFlag.AlignRight) + itm.setTextAlignment(3, Qt.AlignmentFlag.AlignRight) return itm @@ -777,9 +782,12 @@ @param skip number of log entries to skip (integer) @param noEntries number of entries to get (0 = default) (int) """ - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) QApplication.processEvents() self.buf = [] @@ -879,15 +887,18 @@ """ if ( self.__process is not None and - self.__process.state() != QProcess.NotRunning + self.__process.state() != QProcess.ProcessState.NotRunning ): self.__process.terminate() QTimer.singleShot(2000, self.__process.kill) self.__process.waitForFinished(3000) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) self.inputGroup.setEnabled(False) self.inputGroup.hide() @@ -911,7 +922,7 @@ logEntry["authormail"], logEntry["committermail"] ) for date in [logEntry["authordate"], logEntry["committerdate"]]: - dt = QDate.fromString(date, Qt.ISODate) + dt = QDate.fromString(date, Qt.DateFormat.ISODate) if ( not self.__maxDate.isValid() and not self.__minDate.isValid() @@ -1003,7 +1014,7 @@ if self.__started: if self.__selectedCommitIDs: self.logTree.setCurrentItem(self.logTree.findItems( - self.__selectedCommitIDs[0], Qt.MatchExactly, + self.__selectedCommitIDs[0], Qt.MatchFlag.MatchExactly, self.CommitIdColumn)[0]) else: self.logTree.setCurrentItem(self.logTree.topLevelItem(0)) @@ -1036,7 +1047,7 @@ if self.__selectedCommitIDs: for commitID in self.__selectedCommitIDs: items = self.logTree.findItems( - commitID, Qt.MatchExactly, self.CommitIdColumn) + commitID, Qt.MatchFlag.MatchExactly, self.CommitIdColumn) if items: items[0].setSelected(True) self.__selectedCommitIDs = [] @@ -1047,7 +1058,7 @@ It reads the output of the process and inserts it into a buffer. """ - self.__process.setReadChannel(QProcess.StandardOutput) + self.__process.setReadChannel(QProcess.ProcessChannel.StandardOutput) while self.__process.canReadLine(): line = str(self.__process.readLine(), @@ -1088,9 +1099,13 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() - elif button == self.buttonBox.button(QDialogButtonBox.Cancel): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): self.cancelled = True self.__finish() elif button == self.refreshButton: @@ -1101,9 +1116,12 @@ """ Private slot to refresh the log. """ - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.refreshButton.setEnabled(False) @@ -1122,9 +1140,9 @@ @param isOn flag indicating the status of the check box (boolean) """ if isOn: - self.input.setEchoMode(QLineEdit.Password) + self.input.setEchoMode(QLineEdit.EchoMode.Password) else: - self.input.setEchoMode(QLineEdit.Normal) + self.input.setEchoMode(QLineEdit.EchoMode.Normal) @pyqtSlot() def on_sendButton_clicked(self): @@ -2066,8 +2084,8 @@ if url.scheme() == "rev": # a commit ID was clicked, show the respective item commitId = url.path() - items = self.logTree.findItems(commitId, Qt.MatchStartsWith, - self.CommitIdColumn) + items = self.logTree.findItems( + commitId, Qt.MatchFlag.MatchStartsWith, self.CommitIdColumn) if items: itm = items[0] if itm.isHidden(): @@ -2169,13 +2187,13 @@ for fileName in (oldFileName, newFileName): if fileName != "/dev/null": items = self.filesTree.findItems( - fileName, Qt.MatchExactly, 1) + fileName, Qt.MatchFlag.MatchExactly, 1) for item in items: item.setData(0, self.__diffFileLineRole, lineNumber) tc = self.diffEdit.textCursor() - tc.movePosition(QTextCursor.Start) + tc.movePosition(QTextCursor.MoveOperation.Start) self.diffEdit.setTextCursor(tc) self.diffEdit.ensureCursorVisible() @@ -2210,26 +2228,26 @@ if para is not None: if para == 0: tc = self.diffEdit.textCursor() - tc.movePosition(QTextCursor.Start) + tc.movePosition(QTextCursor.MoveOperation.Start) self.diffEdit.setTextCursor(tc) self.diffEdit.ensureCursorVisible() elif para == -1: tc = self.diffEdit.textCursor() - tc.movePosition(QTextCursor.End) + tc.movePosition(QTextCursor.MoveOperation.End) self.diffEdit.setTextCursor(tc) self.diffEdit.ensureCursorVisible() else: # step 1: move cursor to end tc = self.diffEdit.textCursor() - tc.movePosition(QTextCursor.End) + tc.movePosition(QTextCursor.MoveOperation.End) self.diffEdit.setTextCursor(tc) self.diffEdit.ensureCursorVisible() # step 2: move cursor to desired line tc = self.diffEdit.textCursor() delta = tc.blockNumber() - para - tc.movePosition(QTextCursor.PreviousBlock, - QTextCursor.MoveAnchor, delta) + tc.movePosition(QTextCursor.MoveOperation.PreviousBlock, + QTextCursor.MoveMode.MoveAnchor, delta) self.diffEdit.setTextCursor(tc) self.diffEdit.ensureCursorVisible()
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitMergeDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsGit/GitMergeDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -31,7 +31,8 @@ super(GitMergeDialog, self).__init__(parent) self.setupUi(self) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) self.__currentBranch = currentBranch @@ -61,7 +62,8 @@ enabled &= (self.commitGroupBox.isChecked() and self.commitMessageEdit.toPlainText() != "") - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enabled) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(enabled) def __generateDefaultCommitMessage(self): """
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitNewProjectOptionsDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsGit/GitNewProjectOptionsDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -63,7 +63,8 @@ self.vcsProjectDirEdit.setText( Utilities.toNativeSeparators(self.__initPaths[0])) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) msh = self.minimumSizeHint() self.resize(max(self.width(), msh.width()), msh.height()) @@ -75,7 +76,7 @@ @param txt name of the project directory (string) """ - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( + self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( bool(txt) and Utilities.fromNativeSeparators(txt) not in self.__initPaths) @@ -132,7 +133,8 @@ else: vcsUrlEnable = True - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enable) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(enable) self.vcsUrlButton.setEnabled(vcsUrlEnable) @pyqtSlot()
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitNewProjectOptionsDialog.ui Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsGit/GitNewProjectOptionsDialog.ui Tue Mar 02 17:17:09 2021 +0100 @@ -50,7 +50,7 @@ <enum>QComboBox::InsertAtTop</enum> </property> <property name="sizeAdjustPolicy"> - <enum>QComboBox::AdjustToMinimumContentsLength</enum> + <enum>QComboBox::AdjustToContents</enum> </property> </widget> </item>
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitPatchFilesDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsGit/GitPatchFilesDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -46,7 +46,8 @@ self.upButton.setIcon(UI.PixmapCache.getIcon("1uparrow")) self.downButton.setIcon(UI.PixmapCache.getIcon("1downarrow")) - self.__okButton = self.buttonBox.button(QDialogButtonBox.Ok) + self.__okButton = self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok) self.__okButton.setEnabled(len(self.__getPatchFilesList()) > 0) self.deleteButton.setEnabled(False)
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitPatchStatisticsDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsGit/GitPatchStatisticsDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -32,13 +32,14 @@ """ super(GitPatchStatisticsDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) self.__vcs = vcs self.changesTreeWidget.headerItem().setText( self.changesTreeWidget.columnCount(), "") - self.changesTreeWidget.header().setSortIndicator(2, Qt.AscendingOrder) + self.changesTreeWidget.header().setSortIndicator( + 2, Qt.SortOrder.AscendingOrder) def start(self, projectDir, patchCheckData): """ @@ -62,7 +63,7 @@ from .GitPatchFilesDialog import GitPatchFilesDialog dlg = GitPatchFilesDialog(repodir, patchCheckData) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: patchFilesList, stripCount, inaccurateEof, recount = dlg.getData() self.__patchCheckData = (patchFilesList, stripCount, inaccurateEof, recount) @@ -139,15 +140,15 @@ insertions, deletions, filename = line.strip().split(None, 2) itm = QTreeWidgetItem(self.changesTreeWidget, [insertions, deletions, filename]) - itm.setTextAlignment(0, Qt.AlignRight) - itm.setTextAlignment(1, Qt.AlignRight) + itm.setTextAlignment(0, Qt.AlignmentFlag.AlignRight) + itm.setTextAlignment(1, Qt.AlignmentFlag.AlignRight) def __resizeColumns(self): """ Private method to resize the list columns. """ self.changesTreeWidget.header().resizeSections( - QHeaderView.ResizeToContents) + QHeaderView.ResizeMode.ResizeToContents) self.changesTreeWidget.header().setStretchLastSection(True) def getData(self):
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitPullDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsGit/GitPullDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -37,7 +37,8 @@ remoteUrlsList = self.__vcs.gitGetRemoteUrlsList(self.__repodir) self.__repos = {name: url for name, url in remoteUrlsList} - self.__okButton = self.buttonBox.button(QDialogButtonBox.Ok) + self.__okButton = self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok) self.remotesComboBox.addItems(sorted(self.__repos.keys())) self.remotesComboBox.addItem(self.__all)
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitPushDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsGit/GitPushDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -57,14 +57,15 @@ itm = QTreeWidgetItem(self.branchesTree, ["", localBranch, "", ""]) combo = QComboBox() combo.setEditable(True) - combo.setSizeAdjustPolicy(QComboBox.AdjustToContents) + combo.setSizeAdjustPolicy( + QComboBox.SizeAdjustPolicy.AdjustToContents) self.branchesTree.setItemWidget( itm, GitPushDialog.RemoteBranchColumn, combo) self.__resizeColumns() self.branchesTree.header().setSortIndicator( - GitPushDialog.LocalBranchColumn, Qt.AscendingOrder) + GitPushDialog.LocalBranchColumn, Qt.SortOrder.AscendingOrder) self.forceWarningLabel.setVisible(False) @@ -99,10 +100,13 @@ index = combo.findText(localBranch) if index != -1: combo.setCurrentIndex(index) - itm.setCheckState(GitPushDialog.PushColumn, Qt.Checked) + itm.setCheckState(GitPushDialog.PushColumn, + Qt.CheckState.Checked) else: - itm.setCheckState(GitPushDialog.PushColumn, Qt.Unchecked) - itm.setCheckState(GitPushDialog.ForceColumn, Qt.Unchecked) + itm.setCheckState(GitPushDialog.PushColumn, + Qt.CheckState.Unchecked) + itm.setCheckState(GitPushDialog.ForceColumn, + Qt.CheckState.Unchecked) self.__resizeColumns() @@ -117,7 +121,8 @@ if column == GitPushDialog.PushColumn: # step 1: set the item's remote branch, if it is empty if ( - item.checkState(GitPushDialog.PushColumn) == Qt.Checked and + item.checkState(GitPushDialog.PushColumn) == + Qt.CheckState.Checked and (self.branchesTree.itemWidget( item, GitPushDialog.RemoteBranchColumn @@ -131,20 +136,27 @@ checkedItemsCount = 0 for row in range(self.branchesTree.topLevelItemCount()): itm = self.branchesTree.topLevelItem(row) - if itm.checkState(GitPushDialog.PushColumn) == Qt.Checked: + if ( + itm.checkState(GitPushDialog.PushColumn) == + Qt.CheckState.Checked + ): checkedItemsCount += 1 if checkedItemsCount == len(self.__localBranches): - self.selectAllCheckBox.setCheckState(Qt.Checked) + self.selectAllCheckBox.setCheckState(Qt.CheckState.Checked) elif checkedItemsCount == 0: - self.selectAllCheckBox.setCheckState(Qt.Unchecked) + self.selectAllCheckBox.setCheckState(Qt.CheckState.Unchecked) else: - self.selectAllCheckBox.setCheckState(Qt.PartiallyChecked) + self.selectAllCheckBox.setCheckState( + Qt.CheckState.PartiallyChecked) elif column == GitPushDialog.ForceColumn: forceItemsCount = 0 for row in range(self.branchesTree.topLevelItemCount()): itm = self.branchesTree.topLevelItem(row) - if itm.checkState(GitPushDialog.ForceColumn) == Qt.Checked: + if ( + itm.checkState(GitPushDialog.ForceColumn) == + Qt.CheckState.Checked + ): forceItemsCount += 1 self.forceWarningLabel.setVisible(forceItemsCount > 0) @@ -155,7 +167,7 @@ @param state check state of the check box (Qt.CheckState) """ - if state != Qt.PartiallyChecked: + if state != Qt.CheckState.PartiallyChecked: for row in range(self.branchesTree.topLevelItemCount()): itm = self.branchesTree.topLevelItem(row) if itm.checkState(GitPushDialog.PushColumn) != state: @@ -173,8 +185,14 @@ refspecs = [] for row in range(self.branchesTree.topLevelItemCount()): itm = self.branchesTree.topLevelItem(row) - force = itm.checkState(GitPushDialog.ForceColumn) == Qt.Checked - if itm.checkState(GitPushDialog.PushColumn) == Qt.Checked: + force = ( + itm.checkState(GitPushDialog.ForceColumn) == + Qt.CheckState.Checked + ) + if ( + itm.checkState(GitPushDialog.PushColumn) == + Qt.CheckState.Checked + ): localBranch = itm.text(GitPushDialog.LocalBranchColumn) remoteBranch = self.branchesTree.itemWidget( itm, GitPushDialog.RemoteBranchColumn).currentText()
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitReflogBrowserDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsGit/GitReflogBrowserDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -46,13 +46,15 @@ self.__position = QPoint() - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.logTree.headerItem().setText(self.logTree.columnCount(), "") self.refreshButton = self.buttonBox.addButton( - self.tr("&Refresh"), QDialogButtonBox.ActionRole) + self.tr("&Refresh"), QDialogButtonBox.ButtonRole.ActionRole) self.refreshButton.setToolTip( self.tr("Press to refresh the list of commits")) self.refreshButton.setEnabled(False) @@ -95,7 +97,7 @@ """ if ( self.__process is not None and - self.__process.state() != QProcess.NotRunning + self.__process.state() != QProcess.ProcessState.NotRunning ): self.__process.terminate() QTimer.singleShot(2000, self.__process.kill) @@ -128,7 +130,8 @@ """ Private method to resize the log tree columns. """ - self.logTree.header().resizeSections(QHeaderView.ResizeToContents) + self.logTree.header().resizeSections( + QHeaderView.ResizeMode.ResizeToContents) self.logTree.header().setStretchLastSection(True) def __generateReflogItem(self, commitId, selector, name, subject): @@ -159,9 +162,12 @@ @param skip number of reflog entries to skip (integer) """ self.refreshButton.setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) QApplication.processEvents() self.buf = [] @@ -239,15 +245,18 @@ """ if ( self.__process is not None and - self.__process.state() != QProcess.NotRunning + self.__process.state() != QProcess.ProcessState.NotRunning ): self.__process.terminate() QTimer.singleShot(2000, self.__process.kill) self.__process.waitForFinished(3000) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) self.inputGroup.setEnabled(False) self.inputGroup.hide() @@ -296,7 +305,8 @@ # restore current item if self.__currentCommitId: items = self.logTree.findItems( - self.__currentCommitId, Qt.MatchExactly, self.CommitIdColumn) + self.__currentCommitId, Qt.MatchFlag.MatchExactly, + self.CommitIdColumn) if items: self.logTree.setCurrentItem(items[0]) self.__currentCommitId = "" @@ -307,7 +317,7 @@ It reads the output of the process and inserts it into a buffer. """ - self.__process.setReadChannel(QProcess.StandardOutput) + self.__process.setReadChannel(QProcess.ProcessChannel.StandardOutput) while self.__process.canReadLine(): line = str(self.__process.readLine(), @@ -344,9 +354,13 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() - elif button == self.buttonBox.button(QDialogButtonBox.Cancel): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): self.cancelled = True self.__finish() elif button == self.refreshButton: @@ -373,9 +387,9 @@ @param isOn flag indicating the status of the check box (boolean) """ if isOn: - self.input.setEchoMode(QLineEdit.Password) + self.input.setEchoMode(QLineEdit.EchoMode.Password) else: - self.input.setEchoMode(QLineEdit.Normal) + self.input.setEchoMode(QLineEdit.EchoMode.Normal) @pyqtSlot() def on_sendButton_clicked(self):
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitRemoteCredentialsDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsGit/GitRemoteCredentialsDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -34,11 +34,12 @@ url = QUrl(remoteUrl) self.nameEdit.setText(remoteName) - self.urlEdit.setText(url.toString(QUrl.RemoveUserInfo)) + self.urlEdit.setText( + url.toString(QUrl.UrlFormattingOption.RemoveUserInfo)) self.userEdit.setText(url.userName()) self.passwordEdit.setText(url.password()) - self.userEdit.setFocus(Qt.OtherFocusReason) + self.userEdit.setFocus(Qt.FocusReason.OtherFocusReason) msh = self.minimumSizeHint() self.resize(max(self.width(), msh.width()), msh.height())
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitRemoteRepositoriesDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsGit/GitRemoteRepositoriesDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -43,17 +43,19 @@ self.process.readyReadStandardError.connect(self.__readStderr) self.refreshButton = self.buttonBox.addButton( - self.tr("Refresh"), QDialogButtonBox.ActionRole) + self.tr("Refresh"), QDialogButtonBox.ButtonRole.ActionRole) self.refreshButton.setToolTip( self.tr("Press to refresh the repositories display")) self.refreshButton.setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.__lastColumn = self.repolist.columnCount() self.repolist.headerItem().setText(self.__lastColumn, "") - self.repolist.header().setSortIndicator(0, Qt.AscendingOrder) + self.repolist.header().setSortIndicator(0, Qt.SortOrder.AscendingOrder) self.__ioEncoding = Preferences.getSystem("IOEncoding") @@ -69,7 +71,8 @@ """ Private method to resize the list columns. """ - self.repolist.header().resizeSections(QHeaderView.ResizeToContents) + self.repolist.header().resizeSections( + QHeaderView.ResizeMode.ResizeToContents) self.repolist.header().setStretchLastSection(True) def __generateItem(self, name, url, oper): @@ -80,7 +83,8 @@ @param url URL of the remote repository (string) @param oper operation the remote repository may be used for (string) """ - foundItems = self.repolist.findItems(name, Qt.MatchExactly, 0) + foundItems = self.repolist.findItems( + name, Qt.MatchFlag.MatchExactly, 0) if foundItems: # modify the operations column only foundItems[0].setText( @@ -96,7 +100,7 @@ """ if ( self.process is not None and - self.process.state() != QProcess.NotRunning + self.process.state() != QProcess.ProcessState.NotRunning ): self.process.terminate() QTimer.singleShot(2000, self.process.kill) @@ -149,9 +153,12 @@ 'Ensure, that it is in the search path.' ).format('git')) else: - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.inputGroup.setEnabled(True) self.inputGroup.show() @@ -164,7 +171,7 @@ """ if ( self.process is not None and - self.process.state() != QProcess.NotRunning + self.process.state() != QProcess.ProcessState.NotRunning ): self.process.terminate() QTimer.singleShot(2000, self.process.kill) @@ -174,11 +181,15 @@ self.inputGroup.hide() self.refreshButton.setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) - self.buttonBox.button(QDialogButtonBox.Close).setFocus( - Qt.OtherFocusReason) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setFocus( + Qt.FocusReason.OtherFocusReason) self.__resort() self.__resizeColumns() @@ -191,9 +202,13 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() - elif button == self.buttonBox.button(QDialogButtonBox.Cancel): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): self.__finish() elif button == self.refreshButton: self.on_refreshButton_clicked() @@ -215,7 +230,7 @@ the contents pane. """ if self.process is not None: - self.process.setReadChannel(QProcess.StandardOutput) + self.process.setReadChannel(QProcess.ProcessChannel.StandardOutput) while self.process.canReadLine(): line = str(self.process.readLine(), self.__ioEncoding, @@ -247,9 +262,9 @@ @param isOn flag indicating the status of the check box (boolean) """ if isOn: - self.input.setEchoMode(QLineEdit.Password) + self.input.setEchoMode(QLineEdit.EchoMode.Password) else: - self.input.setEchoMode(QLineEdit.Normal) + self.input.setEchoMode(QLineEdit.EchoMode.Normal) @pyqtSlot() def on_sendButton_clicked(self):
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitRevisionSelectionDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsGit/GitRevisionSelectionDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -34,7 +34,8 @@ super(GitRevisionSelectionDialog, self).__init__(parent) self.setupUi(self) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) self.tagCombo.addItems(sorted(tagsList)) self.branchCombo.addItems(["master"] + sorted(branchesList)) @@ -69,7 +70,8 @@ elif self.remoteBranchButton.isChecked(): enabled = self.remoteBranchCombo.currentText() != "" - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enabled) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(enabled) @pyqtSlot(bool) def on_revButton_toggled(self, checked):
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitRevisionsSelectionDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsGit/GitRevisionsSelectionDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -29,7 +29,8 @@ super(GitRevisionsSelectionDialog, self).__init__(parent) self.setupUi(self) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) self.tag1Combo.addItems(sorted(tagsList)) self.tag2Combo.addItems(sorted(tagsList)) @@ -58,7 +59,8 @@ elif self.branch2Button.isChecked(): enabled = enabled and self.branch2Combo.currentText() != "" - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enabled) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(enabled) @pyqtSlot(bool) def on_rev1Button_toggled(self, checked):
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitStashBrowserDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsGit/GitStashBrowserDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -34,8 +34,8 @@ Separator = "@@||@@" - TotalStatisticsRole = Qt.UserRole - FileStatisticsRole = Qt.UserRole + 1 + TotalStatisticsRole = Qt.ItemDataRole.UserRole + FileStatisticsRole = Qt.ItemDataRole.UserRole + 1 def __init__(self, vcs, parent=None): """ @@ -47,18 +47,21 @@ super(GitStashBrowserDialog, self).__init__(parent) self.setupUi(self) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.__position = QPoint() - self.__fileStatisticsRole = Qt.UserRole - self.__totalStatisticsRole = Qt.UserRole + 1 + self.__fileStatisticsRole = Qt.ItemDataRole.UserRole + self.__totalStatisticsRole = Qt.ItemDataRole.UserRole + 1 - self.stashList.header().setSortIndicator(0, Qt.AscendingOrder) + self.stashList.header().setSortIndicator( + 0, Qt.SortOrder.AscendingOrder) self.refreshButton = self.buttonBox.addButton( - self.tr("&Refresh"), QDialogButtonBox.ActionRole) + self.tr("&Refresh"), QDialogButtonBox.ButtonRole.ActionRole) self.refreshButton.setToolTip( self.tr("Press to refresh the list of stashes")) self.refreshButton.setEnabled(False) @@ -98,7 +101,7 @@ """ if ( self.__process is not None and - self.__process.state() != QProcess.NotRunning + self.__process.state() != QProcess.ProcessState.NotRunning ): self.__process.terminate() QTimer.singleShot(2000, self.__process.kill) @@ -128,7 +131,8 @@ """ Private method to resize the shelve list columns. """ - self.stashList.header().resizeSections(QHeaderView.ResizeToContents) + self.stashList.header().resizeSections( + QHeaderView.ResizeMode.ResizeToContents) self.stashList.header().setStretchLastSection(True) def __generateStashEntry(self, name, date, message): @@ -145,9 +149,12 @@ """ Private method to retrieve the list of stashes. """ - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.inputGroup.setEnabled(True) self.inputGroup.show() @@ -223,15 +230,18 @@ """ if ( self.__process is not None and - self.__process.state() != QProcess.NotRunning + self.__process.state() != QProcess.ProcessState.NotRunning ): self.__process.terminate() QTimer.singleShot(2000, self.__process.kill) self.__process.waitForFinished(3000) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) self.inputGroup.setEnabled(False) self.inputGroup.hide() @@ -258,7 +268,7 @@ It reads the output of the process and inserts it into a buffer. """ - self.__process.setReadChannel(QProcess.StandardOutput) + self.__process.setReadChannel(QProcess.ProcessChannel.StandardOutput) while self.__process.canReadLine(): line = str(self.__process.readLine(), self.__ioEncoding, @@ -287,9 +297,13 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() - elif button == self.buttonBox.button(QDialogButtonBox.Cancel): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): self.cancelled = True self.__finish() elif button == self.refreshButton: @@ -356,7 +370,7 @@ dataDict["file"], dataDict["total"], dataDict["added"], dataDict["deleted"]]) self.statisticsList.header().resizeSections( - QHeaderView.ResizeToContents) + QHeaderView.ResizeMode.ResizeToContents) self.statisticsList.header().setStretchLastSection(True) totals = current.data(0, self.TotalStatisticsRole) @@ -428,9 +442,9 @@ @param checked flag indicating the status of the check box (boolean) """ if checked: - self.input.setEchoMode(QLineEdit.Password) + self.input.setEchoMode(QLineEdit.EchoMode.Password) else: - self.input.setEchoMode(QLineEdit.Normal) + self.input.setEchoMode(QLineEdit.EchoMode.Normal) def keyPressEvent(self, evt): """
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitStatusDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsGit/GitStatusDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -41,7 +41,7 @@ """ ConflictStates = ["AA", "AU", "DD", "DU", "UA", "UD", "UU"] - ConflictRole = Qt.UserRole + ConflictRole = Qt.ItemDataRole.UserRole def __init__(self, vcs, parent=None): """ @@ -60,12 +60,14 @@ self.__lastColumn = self.statusList.columnCount() self.refreshButton = self.buttonBox.addButton( - self.tr("Refresh"), QDialogButtonBox.ActionRole) + self.tr("Refresh"), QDialogButtonBox.ButtonRole.ActionRole) self.refreshButton.setToolTip( self.tr("Press to refresh the status display")) self.refreshButton.setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.diff = None self.vcs = vcs @@ -86,7 +88,7 @@ self.statusList.headerItem().setText(self.__lastColumn, "") self.statusList.header().setSortIndicator( - self.__pathColumn, Qt.AscendingOrder) + self.__pathColumn, Qt.SortOrder.AscendingOrder) font = Preferences.getEditorOtherFonts("MonospacedFont") self.lDiffEdit.document().setDefaultFont(font) @@ -265,7 +267,7 @@ """ if ( self.process is not None and - self.process.state() != QProcess.NotRunning + self.process.state() != QProcess.ProcessState.NotRunning ): self.process.terminate() QTimer.singleShot(2000, self.process.kill) @@ -315,7 +317,8 @@ """ Private method to resize the list columns. """ - self.statusList.header().resizeSections(QHeaderView.ResizeToContents) + self.statusList.header().resizeSections( + QHeaderView.ResizeMode.ResizeToContents) self.statusList.header().setStretchLastSection(True) def __generateItem(self, status, path): @@ -334,18 +337,22 @@ path, ]) - itm.setTextAlignment(self.__statusWorkColumn, Qt.AlignHCenter) - itm.setTextAlignment(self.__statusIndexColumn, Qt.AlignHCenter) - itm.setTextAlignment(self.__pathColumn, Qt.AlignLeft) + itm.setTextAlignment(self.__statusWorkColumn, + Qt.AlignmentFlag.AlignHCenter) + itm.setTextAlignment(self.__statusIndexColumn, + Qt.AlignmentFlag.AlignHCenter) + itm.setTextAlignment(self.__pathColumn, + Qt.AlignmentFlag.AlignLeft) if ( status not in self.ConflictStates + ["??", "!!"] and statusIndexText in self.modifiedIndicators ): - itm.setFlags(itm.flags() | Qt.ItemIsUserCheckable) - itm.setCheckState(self.__toBeCommittedColumn, Qt.Checked) + itm.setFlags(itm.flags() | Qt.ItemFlag.ItemIsUserCheckable) + itm.setCheckState(self.__toBeCommittedColumn, + Qt.CheckState.Checked) else: - itm.setFlags(itm.flags() & ~Qt.ItemIsUserCheckable) + itm.setFlags(itm.flags() & ~Qt.ItemFlag.ItemIsUserCheckable) if statusWorkText not in self.__statusFilters: self.__statusFilters.append(statusWorkText) @@ -412,9 +419,12 @@ 'Ensure, that it is in the search path.' ).format('git')) else: - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.refreshButton.setEnabled(False) @@ -425,7 +435,7 @@ """ if ( self.process is not None and - self.process.state() != QProcess.NotRunning + self.process.state() != QProcess.ProcessState.NotRunning ): self.process.terminate() QTimer.singleShot(2000, self.process.kill) @@ -435,11 +445,15 @@ self.inputGroup.hide() self.refreshButton.setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) - self.buttonBox.button(QDialogButtonBox.Close).setFocus( - Qt.OtherFocusReason) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setFocus( + Qt.FocusReason.OtherFocusReason) self.__statusFilters.sort() self.__statusFilters.insert(0, "<{0}>".format(self.tr("all"))) @@ -456,9 +470,13 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() - elif button == self.buttonBox.button(QDialogButtonBox.Cancel): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): self.__finish() elif button == self.refreshButton: self.on_refreshButton_clicked() @@ -480,7 +498,7 @@ the contents pane. """ if self.process is not None: - self.process.setReadChannel(QProcess.StandardOutput) + self.process.setReadChannel(QProcess.ProcessChannel.StandardOutput) while self.process.canReadLine(): line = str(self.process.readLine(), self.__ioEncoding, @@ -515,9 +533,9 @@ @param isOn flag indicating the status of the check box (boolean) """ if isOn: - self.input.setEchoMode(QLineEdit.Password) + self.input.setEchoMode(QLineEdit.EchoMode.Password) else: - self.input.setEchoMode(QLineEdit.Normal) + self.input.setEchoMode(QLineEdit.EchoMode.Normal) @pyqtSlot() def on_sendButton_clicked(self): @@ -903,7 +921,10 @@ commitableItems = [] for index in range(self.statusList.topLevelItemCount()): itm = self.statusList.topLevelItem(index) - if itm.checkState(self.__toBeCommittedColumn) == Qt.Checked: + if ( + itm.checkState(self.__toBeCommittedColumn) == + Qt.CheckState.Checked + ): commitableItems.append(itm) return commitableItems @@ -918,8 +939,9 @@ for index in range(self.statusList.topLevelItemCount()): itm = self.statusList.topLevelItem(index) if ( - itm.flags() & Qt.ItemIsUserCheckable and - itm.checkState(self.__toBeCommittedColumn) == Qt.Unchecked + itm.flags() & Qt.ItemFlag.ItemIsUserCheckable and + itm.checkState(self.__toBeCommittedColumn) == + Qt.CheckState.Unchecked ): items.append(itm) return items @@ -1028,11 +1050,13 @@ """ for index in range(self.statusList.topLevelItemCount()): itm = self.statusList.topLevelItem(index) - if itm.flags() & Qt.ItemIsUserCheckable: + if itm.flags() & Qt.ItemFlag.ItemIsUserCheckable: if selected: - itm.setCheckState(self.__toBeCommittedColumn, Qt.Checked) + itm.setCheckState(self.__toBeCommittedColumn, + Qt.CheckState.Checked) else: - itm.setCheckState(self.__toBeCommittedColumn, Qt.Unchecked) + itm.setCheckState(self.__toBeCommittedColumn, + Qt.CheckState.Unchecked) ########################################################################### ## Diff handling methods below @@ -1087,7 +1111,7 @@ for diffEdit in [self.lDiffEdit, self.rDiffEdit]: tc = diffEdit.textCursor() - tc.movePosition(QTextCursor.Start) + tc.movePosition(QTextCursor.MoveOperation.Start) diffEdit.setTextCursor(tc) diffEdit.ensureCursorVisible()
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitSubmoduleAddDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsGit/GitSubmoduleAddDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -64,7 +64,8 @@ Utilities.fromNativeSeparators(ipath) + "/", ] - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) msh = self.minimumSizeHint() self.resize(max(self.width(), msh.width()), msh.height()) @@ -92,7 +93,8 @@ else: vcsUrlEnable = True - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enable) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(enable) self.submoduleUrlButton.setEnabled(vcsUrlEnable) @pyqtSlot()
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitSubmoduleAddDialog.ui Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsGit/GitSubmoduleAddDialog.ui Tue Mar 02 17:17:09 2021 +0100 @@ -45,7 +45,7 @@ <enum>QComboBox::InsertAtTop</enum> </property> <property name="sizeAdjustPolicy"> - <enum>QComboBox::AdjustToMinimumContentsLength</enum> + <enum>QComboBox::AdjustToContents</enum> </property> </widget> </item>
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitSubmodulesDeinitDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsGit/GitSubmodulesDeinitDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -32,7 +32,8 @@ self.submodulesList.addItems(sorted(submodulePaths)) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) def __updateOK(self): """ @@ -42,7 +43,8 @@ self.allCheckBox.isChecked() or len(self.submodulesList.selectedItems()) > 0 ) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enable) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(enable) @pyqtSlot(bool) def on_allCheckBox_toggled(self, checked):
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitSubmodulesListDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsGit/GitSubmodulesListDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -37,9 +37,9 @@ submodule["branch"] ]) self.submodulesList.header().resizeSections( - QHeaderView.ResizeToContents) + QHeaderView.ResizeMode.ResizeToContents) self.submodulesList.header().setStretchLastSection(True) self.submodulesList.setSortingEnabled(True) - self.submodulesList.sortItems(0, Qt.AscendingOrder) + self.submodulesList.sortItems(0, Qt.SortOrder.AscendingOrder) self.submodulesList.setSortingEnabled(False)
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitSubmodulesStatusDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsGit/GitSubmodulesStatusDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -48,7 +48,7 @@ self.__repodir = None self.refreshButton = self.buttonBox.addButton( - self.tr("Refresh"), QDialogButtonBox.ActionRole) + self.tr("Refresh"), QDialogButtonBox.ButtonRole.ActionRole) self.refreshButton.setToolTip( self.tr("Press to refresh the status display")) @@ -139,10 +139,10 @@ ]) self.statusList.header().resizeSections( - QHeaderView.ResizeToContents) + QHeaderView.ResizeMode.ResizeToContents) self.statusList.setSortingEnabled(True) - self.statusList.sortItems(0, Qt.AscendingOrder) + self.statusList.sortItems(0, Qt.SortOrder.AscendingOrder) self.statusList.setSortingEnabled(False) @pyqtSlot(QAbstractButton) @@ -152,7 +152,9 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() elif button == self.refreshButton: self.on_refreshButton_clicked()
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitTagBranchListDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsGit/GitTagBranchListDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -35,16 +35,18 @@ """ super(GitTagBranchListDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.process = QProcess() self.vcs = vcs self.tagList.headerItem().setText(self.tagList.columnCount(), "") - self.tagList.header().setSortIndicator(1, Qt.AscendingOrder) + self.tagList.header().setSortIndicator(1, Qt.SortOrder.AscendingOrder) self.process.finished.connect(self.__procFinished) self.process.readyReadStandardOutput.connect(self.__readStdout) @@ -61,7 +63,7 @@ """ if ( self.process is not None and - self.process.state() != QProcess.NotRunning + self.process.state() != QProcess.ProcessState.NotRunning ): self.process.terminate() QTimer.singleShot(2000, self.process.kill) @@ -146,7 +148,7 @@ """ if ( self.process is not None and - self.process.state() != QProcess.NotRunning + self.process.state() != QProcess.ProcessState.NotRunning ): self.process.terminate() QTimer.singleShot(2000, self.process.kill) @@ -155,11 +157,15 @@ self.inputGroup.setEnabled(False) self.inputGroup.hide() - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) - self.buttonBox.button(QDialogButtonBox.Close).setFocus( - Qt.OtherFocusReason) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setFocus( + Qt.FocusReason.OtherFocusReason) self.__resizeColumns() self.__resort() @@ -170,9 +176,13 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() - elif button == self.buttonBox.button(QDialogButtonBox.Cancel): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): self.__finish() def __procFinished(self, exitCode, exitStatus): @@ -196,7 +206,8 @@ """ Private method to resize the list columns. """ - self.tagList.header().resizeSections(QHeaderView.ResizeToContents) + self.tagList.header().resizeSections( + QHeaderView.ResizeMode.ResizeToContents) self.tagList.header().setStretchLastSection(True) def __generateItem(self, commit, name, msg="", bold=False, italic=False): @@ -210,11 +221,11 @@ @param italic flag indicating to show the entry in italic (boolean) """ itm = QTreeWidgetItem(self.tagList) - itm.setData(0, Qt.DisplayRole, commit) - itm.setData(1, Qt.DisplayRole, name) + itm.setData(0, Qt.ItemDataRole.DisplayRole, commit) + itm.setData(1, Qt.ItemDataRole.DisplayRole, name) if msg: - itm.setData(2, Qt.DisplayRole, msg) - itm.setTextAlignment(0, Qt.AlignRight) + itm.setData(2, Qt.ItemDataRole.DisplayRole, msg) + itm.setTextAlignment(0, Qt.AlignmentFlag.AlignRight) if bold or italic: font = itm.font(1) if bold: @@ -264,7 +275,7 @@ It reads the output of the process, formats it and inserts it into the contents pane. """ - self.process.setReadChannel(QProcess.StandardOutput) + self.process.setReadChannel(QProcess.ProcessChannel.StandardOutput) while self.process.canReadLine(): s = str(self.process.readLine(), @@ -329,9 +340,9 @@ @param isOn flag indicating the status of the check box (boolean) """ if isOn: - self.input.setEchoMode(QLineEdit.Password) + self.input.setEchoMode(QLineEdit.EchoMode.Password) else: - self.input.setEchoMode(QLineEdit.Normal) + self.input.setEchoMode(QLineEdit.EchoMode.Normal) @pyqtSlot() def on_sendButton_clicked(self):
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitTagDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsGit/GitTagDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -37,7 +37,8 @@ super(GitTagDialog, self).__init__(parent) self.setupUi(self) - self.okButton = self.buttonBox.button(QDialogButtonBox.Ok) + self.okButton = self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok) self.okButton.setEnabled(False) self.tagCombo.clear()
--- a/eric6/Plugins/VcsPlugins/vcsGit/ProjectBrowserHelper.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsGit/ProjectBrowserHelper.py Tue Mar 02 17:17:09 2021 +0100 @@ -589,7 +589,7 @@ " from the repository?"), files) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: self.vcs.vcsRemove(names, stageOnly=True) for fn in names:
--- a/eric6/Plugins/VcsPlugins/vcsGit/git.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsGit/git.py Tue Mar 02 17:17:09 2021 +0100 @@ -689,7 +689,7 @@ else: from .GitCopyDialog import GitCopyDialog dlg = GitCopyDialog(name, None, True) - accepted = dlg.exec() == QDialog.Accepted + accepted = dlg.exec() == QDialog.DialogCode.Accepted if accepted: target, force = dlg.getData() @@ -886,7 +886,7 @@ "Do you really want to revert all changes to these files" " or directories?"), names) - yes = dlg.exec() == QDialog.Accepted + yes = dlg.exec() == QDialog.DialogCode.Accepted else: yes = E5MessageBox.yesNo( None, @@ -925,7 +925,7 @@ self.gitGetBranchesList(repodir, withMaster=True), self.gitGetCurrentBranch(repodir), self.gitGetBranchesList(repodir, remotes=True)) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: commit, doCommit, commitMessage, addLog, diffStat = ( dlg.getParameters() ) @@ -978,7 +978,7 @@ trackingBranchesList=self.gitGetBranchesList( repodir, remotes=True), noneLabel=self.tr("Master branch head")) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: rev = dlg.getRevision() return self.vcsUpdate(name, revision=rev) @@ -1183,7 +1183,7 @@ """ from .GitCommandDialog import GitCommandDialog dlg = GitCommandDialog(self.commandHistory, name) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: command = dlg.getData() commandList = Utilities.parseOptionString(command) @@ -1424,7 +1424,7 @@ """ from .GitCopyDialog import GitCopyDialog dlg = GitCopyDialog(name) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: target, force = dlg.getData() # step 1: copy the file/directory: @@ -1513,7 +1513,7 @@ from .GitRevisionsSelectionDialog import GitRevisionsSelectionDialog dlg = GitRevisionsSelectionDialog(self.gitGetTagsList(repodir), self.gitGetBranchesList(repodir)) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: revisions = dlg.getRevisions() if self.diff is None: from .GitDiffDialog import GitDiffDialog @@ -1597,7 +1597,7 @@ ) dlg = GitRevisionsSelectionDialog(self.gitGetTagsList(repodir), self.gitGetBranchesList(repodir)) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: rev1, rev2 = dlg.getRevisions() elif revisions: rev1, rev2 = revisions[0], revisions[1] @@ -1661,7 +1661,7 @@ from .GitFetchDialog import GitFetchDialog dlg = GitFetchDialog(self, repodir) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: (remote, url, remoteBranches, localBranch, fetchAll, prune, includeTags) = dlg.getData() @@ -1704,7 +1704,7 @@ from .GitPullDialog import GitPullDialog dlg = GitPullDialog(self, repodir) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: remote, url, branches, pullAll, prune = dlg.getData() args = self.initCommand('pull') @@ -1744,7 +1744,7 @@ from .GitPushDialog import GitPushDialog dlg = GitPushDialog(self, repodir) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: remote, refspecs, tags, tracking, submodule = dlg.getData() args = self.initCommand("push") @@ -1871,7 +1871,7 @@ from .GitPatchFilesDialog import GitPatchFilesDialog dlg = GitPatchFilesDialog(repodir, self.__patchCheckData) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: patchFilesList, stripCount, inaccurateEof, recount = dlg.getData() if patchFilesList: args = self.initCommand("apply") @@ -1938,7 +1938,7 @@ from .GitTagDialog import GitTagDialog dlg = GitTagDialog(self.gitGetTagsList(repodir), revision, tagName) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: tag, revision, tagOp, tagType, force = dlg.getParameters() else: return False @@ -2134,7 +2134,7 @@ dlg = GitBranchDialog( self.gitGetBranchesList(repodir, allBranches=True), revision, branchName, branchOp) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: branchOp, branch, revision, newBranch, remoteBranch, force = ( dlg.getParameters() ) @@ -2224,7 +2224,7 @@ dlg = GitBranchPushDialog(self.gitGetBranchesList(repodir), self.gitGetRemotesList(repodir), delete=True) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: branchName, remoteName = dlg.getData()[:2] args = self.initCommand("push") @@ -2278,7 +2278,7 @@ from .GitBundleDialog import GitBundleDialog dlg = GitBundleDialog(self.gitGetTagsList(repodir), self.gitGetBranchesList(repodir)) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: revs = dlg.getData() fname, selectedFilter = E5FileDialog.getSaveFileNameAndFilter( @@ -2439,7 +2439,7 @@ dlg = GitApplyBundleDataDialog( self.gitGetBundleHeads(repodir, fname), self.gitGetBranchesList(repodir)) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: bundleHead, branch = dlg.getData() args = self.initCommand("fetch") @@ -2487,7 +2487,7 @@ dlg = GitApplyBundleDataDialog( self.gitGetBundleHeads(repodir, fname), self.gitGetBranchesList(repodir)) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: bundleHead, branch = dlg.getData() args = self.initCommand("pull") @@ -2546,7 +2546,7 @@ self.gitGetBranchesList(repodir), showBranches=showBranches, showHead=showHead) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: rev = dlg.getRevision() else: return False @@ -2555,7 +2555,7 @@ if subcommand == "start_extended": from .GitBisectStartDialog import GitBisectStartDialog dlg = GitBisectStartDialog() - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: bad, good, noCheckout = dlg.getData() args.append("start") if noCheckout: @@ -2919,7 +2919,7 @@ from .GitAddRemoteDialog import GitAddRemoteDialog dlg = GitAddRemoteDialog() - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: name, url = dlg.getData() args = self.initCommand("remote") args.append("add") @@ -2947,7 +2947,7 @@ None, self.tr("Rename Remote Repository"), self.tr("Enter new name for remote repository:"), - QLineEdit.Normal) + QLineEdit.EchoMode.Normal) if ok and newName and newName != remoteName: args = self.initCommand("remote") args.append("rename") @@ -2980,7 +2980,7 @@ from .GitChangeRemoteUrlDialog import GitChangeRemoteUrlDialog dlg = GitChangeRemoteUrlDialog(remoteName, remoteUrl) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: name, url = dlg.getData() if url != remoteUrl: args = self.initCommand("remote") @@ -3014,7 +3014,7 @@ from .GitRemoteCredentialsDialog import GitRemoteCredentialsDialog dlg = GitRemoteCredentialsDialog(remoteName, remoteUrl) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: name, url = dlg.getData() if url != remoteUrl: args = self.initCommand("remote") @@ -3132,7 +3132,7 @@ from .GitCherryPickDialog import GitCherryPickDialog dlg = GitCherryPickDialog(commits) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: commits, cherrypickInfo, signoff, nocommit = ( dlg.getData() ) @@ -3294,7 +3294,7 @@ res = False from .GitStashDataDialog import GitStashDataDialog dlg = GitStashDataDialog() - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: message, keepIndex, untracked = dlg.getData() args = self.initCommand("stash") args.append("save") @@ -3460,7 +3460,7 @@ None, self.tr("Create Branch"), self.tr("Enter a branch name to restore a stash to:"), - QLineEdit.Normal) + QLineEdit.EchoMode.Normal) if not ok or branchName == "": return False @@ -3593,7 +3593,7 @@ if not os.path.exists(cfgFile): from .GitUserConfigDataDialog import GitUserConfigDataDialog dlg = GitUserConfigDataDialog() - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: firstName, lastName, email = dlg.getData() else: firstName, lastName, email = ( @@ -3807,7 +3807,7 @@ self.gitGetBranchesList(repodir, withMaster=True), self.gitGetArchiveFormats(repodir) ) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: commit, archiveFormat, fileName, prefix = dlg.getData() args = self.initCommand("archive") args.append("--format={0}".format(archiveFormat)) @@ -3846,7 +3846,7 @@ from .GitSubmoduleAddDialog import GitSubmoduleAddDialog dlg = GitSubmoduleAddDialog(self, repodir) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: repo, branch, name, path, force = dlg.getData() args = self.initCommand("submodule") args.append("add") @@ -3973,7 +3973,7 @@ from .GitListDialog import GitListDialog dlg = GitListDialog(sorted(paths)) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: selectedPaths = dlg.getSelection() return selectedPaths, True else: @@ -4025,7 +4025,7 @@ from .GitSubmodulesDeinitDialog import GitSubmodulesDeinitDialog dlg = GitSubmodulesDeinitDialog(paths) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: deinitAll, submodulePaths, force = dlg.getData() args = self.initCommand("submodule") args.append("deinit") @@ -4100,7 +4100,7 @@ GitSubmodulesUpdateOptionsDialog ) dlg = GitSubmodulesUpdateOptionsDialog(paths) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: procedure, init, remote, noFetch, force, submodulePaths = ( dlg.getData() ) @@ -4144,7 +4144,7 @@ from .GitSubmodulesSyncDialog import GitSubmodulesSyncDialog dlg = GitSubmodulesSyncDialog(paths) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: submodulePaths, recursive = dlg.getData() args = self.initCommand("submodule") args.append("sync") @@ -4194,7 +4194,7 @@ GitSubmodulesSummaryOptionsDialog ) dlg = GitSubmodulesSummaryOptionsDialog(paths) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: submodulePaths, superProject, index, commit, limit = dlg.getData() args = self.initCommand("submodule") args.append("summary")
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/CloseheadExtension/HgCloseHeadSelectionDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/CloseheadExtension/HgCloseHeadSelectionDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -29,8 +29,10 @@ super(HgCloseHeadSelectionDialog, self).__init__(parent) self.setupUi(self) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) heads = self.__getHeads(vcs) for revision, branch in heads: @@ -69,7 +71,7 @@ """ Private slot handling changes of the selection. """ - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( + self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( len(self.headsList.selectedItems()) > 0 )
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/CloseheadExtension/closehead.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/CloseheadExtension/closehead.py Tue Mar 02 17:17:09 2021 +0100 @@ -37,7 +37,7 @@ if not revisions: from .HgCloseHeadSelectionDialog import HgCloseHeadSelectionDialog dlg = HgCloseHeadSelectionDialog(self.vcs) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: revisions, message = dlg.getData() if not revisions:
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/GpgExtension/HgGpgSignDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/GpgExtension/HgGpgSignDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -30,7 +30,8 @@ super(HgGpgSignDialog, self).__init__(parent) self.setupUi(self) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) self.tagCombo.addItems(sorted(tagsList)) self.branchCombo.addItems(["default"] + sorted(branchesList)) @@ -54,7 +55,8 @@ elif self.bookmarkButton.isChecked(): enabled = enabled and self.bookmarkCombo.currentText() != "" - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enabled) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(enabled) @pyqtSlot(bool) def on_idButton_toggled(self, checked):
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/GpgExtension/HgGpgSignaturesDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/GpgExtension/HgGpgSignaturesDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -30,10 +30,12 @@ """ super(HgGpgSignaturesDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.vcs = vcs self.__hgClient = vcs.getClient() @@ -78,11 +80,15 @@ Private slot called when the process finished or the user pressed the button. """ - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) - self.buttonBox.button(QDialogButtonBox.Close).setFocus( - Qt.OtherFocusReason) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setFocus( + Qt.FocusReason.OtherFocusReason) if self.signaturesList.topLevelItemCount() == 0: # no patches present @@ -96,9 +102,13 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() - elif button == self.buttonBox.button(QDialogButtonBox.Cancel): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): self.__hgClient.cancel() def __resort(self): @@ -114,7 +124,7 @@ Private method to resize the list columns. """ self.signaturesList.header().resizeSections( - QHeaderView.ResizeToContents) + QHeaderView.ResizeMode.ResizeToContents) self.signaturesList.header().setStretchLastSection(True) def __generateItem(self, revision, changeset, signature): @@ -130,7 +140,7 @@ else: revString = "{0:>7}:{1}".format(revision, changeset) topItems = self.signaturesList.findItems( - revString, Qt.MatchExactly) + revString, Qt.MatchFlag.MatchExactly) if len(topItems) == 0: # first signature for this changeset topItm = QTreeWidgetItem(self.signaturesList, [
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/GpgExtension/gpg.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/GpgExtension/gpg.py Tue Mar 02 17:17:09 2021 +0100 @@ -55,7 +55,7 @@ self.vcs.hgGetTagsList(), self.vcs.hgGetBranchesList(), self.vcs.hgGetBookmarksList()) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: rev = dlg.getRevision(revset=False) if rev is not None: @@ -81,7 +81,7 @@ dlg = HgGpgSignDialog(self.vcs.hgGetTagsList(), self.vcs.hgGetBranchesList(), self.vcs.hgGetBookmarksList()) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: revision, noCommit, message, keyId, local, force = ( dlg.getData() )
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgAddSubrepositoryDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgAddSubrepositoryDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -37,7 +37,7 @@ self.pathPicker.setMode(E5PathPickerModes.DirectoryMode) self.pathPicker.setDefaultDirectory(projectPath) - self.__ok = self.buttonBox.button(QDialogButtonBox.Ok) + self.__ok = self.buttonBox.button(QDialogButtonBox.StandardButton.Ok) self.__ok.setEnabled(False) self.__projectPath = Utilities.toNativeSeparators(projectPath)
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgAnnotateDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgAnnotateDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -32,10 +32,12 @@ """ super(HgAnnotateDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.vcs = vcs self.__hgClient = vcs.getClient() @@ -98,11 +100,15 @@ Private slot called when the process finished or the user pressed the button. """ - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) - self.buttonBox.button(QDialogButtonBox.Close).setFocus( - Qt.OtherFocusReason) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setFocus( + Qt.FocusReason.OtherFocusReason) self.__resizeColumns() @@ -112,9 +118,13 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() - elif button == self.buttonBox.button(QDialogButtonBox.Cancel): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): if self.__hgClient: self.__hgClient.cancel() else: @@ -124,7 +134,8 @@ """ Private method to resize the list columns. """ - self.annotateList.header().resizeSections(QHeaderView.ResizeToContents) + self.annotateList.header().resizeSections( + QHeaderView.ResizeMode.ResizeToContents) def __generateItem(self, revision, changeset, author, date, text): """ @@ -141,8 +152,8 @@ [revision, changeset, author, date, "{0:d}".format(self.lineno), text]) self.lineno += 1 - itm.setTextAlignment(0, Qt.AlignRight) - itm.setTextAlignment(4, Qt.AlignRight) + itm.setTextAlignment(0, Qt.AlignmentFlag.AlignRight) + itm.setTextAlignment(4, Qt.AlignmentFlag.AlignRight) def __processOutputLine(self, line): """
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgArchiveDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgArchiveDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -78,7 +78,8 @@ self.subReposCheckBox.setEnabled(vcs.hasSubrepositories()) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) self.__projectPath = ( vcs.getPlugin().getProjectHelper().getProject().getProjectPath() @@ -94,7 +95,8 @@ @param archive name of the archive (string) """ - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(archive != "") + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(archive != "") @pyqtSlot(int) def on_typeComboBox_activated(self, index):
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgBackoutDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgBackoutDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -30,7 +30,8 @@ super(HgBackoutDialog, self).__init__(parent) self.setupUi(self) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) self.tagCombo.addItems(sorted(tagsList)) self.branchCombo.addItems(["default"] + sorted(branchesList)) @@ -59,7 +60,8 @@ elif self.bookmarkButton.isChecked(): enabled = self.bookmarkCombo.currentText() != "" - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enabled) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(enabled) @pyqtSlot(bool) def on_idButton_toggled(self, checked):
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgBookmarkDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgBookmarkDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -34,7 +34,8 @@ super(HgBookmarkDialog, self).__init__(parent) self.setupUi(self) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) self.__mode = mode if mode == self.MOVE_MODE: @@ -71,7 +72,8 @@ elif self.bookmarkButton.isChecked(): enabled = enabled and self.bookmarkCombo.currentText() != "" - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enabled) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(enabled) def __updateBookmarksCombo(self): """
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgBookmarkRenameDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgBookmarkRenameDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -27,7 +27,8 @@ super(HgBookmarkRenameDialog, self).__init__(parent) self.setupUi(self) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) self.bookmarkCombo.addItems(sorted(bookmarksList)) @@ -38,7 +39,7 @@ """ Private slot to update the UI. """ - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( + self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( self.nameEdit.text() != "" and self.bookmarkCombo.currentText() != "" )
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgBookmarksInOutDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgBookmarksInOutDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -35,10 +35,12 @@ """ super(HgBookmarksInOutDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) if mode not in [self.INCOMING, self.OUTGOING]: raise ValueError("Bad value for mode") @@ -53,7 +55,8 @@ self.bookmarksList.headerItem().setText( self.bookmarksList.columnCount(), "") - self.bookmarksList.header().setSortIndicator(3, Qt.AscendingOrder) + self.bookmarksList.header().setSortIndicator( + 3, Qt.SortOrder.AscendingOrder) self.show() QCoreApplication.processEvents() @@ -103,11 +106,15 @@ Private slot called when the process finished or the user pressed the button. """ - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) - self.buttonBox.button(QDialogButtonBox.Close).setFocus( - Qt.OtherFocusReason) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setFocus( + Qt.FocusReason.OtherFocusReason) if self.bookmarksList.topLevelItemCount() == 0: # no bookmarks defined @@ -121,9 +128,13 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() - elif button == self.buttonBox.button(QDialogButtonBox.Cancel): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): if self.__hgClient: self.__hgClient.cancel() else: @@ -142,7 +153,7 @@ Private method to resize the list columns. """ self.bookmarksList.header().resizeSections( - QHeaderView.ResizeToContents) + QHeaderView.ResizeMode.ResizeToContents) self.bookmarksList.header().setStretchLastSection(True) def __generateItem(self, changeset, name):
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgBookmarksListDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgBookmarksListDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -34,15 +34,17 @@ """ super(HgBookmarksListDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) self.refreshButton = self.buttonBox.addButton( - self.tr("Refresh"), QDialogButtonBox.ActionRole) + self.tr("Refresh"), QDialogButtonBox.ButtonRole.ActionRole) self.refreshButton.setToolTip( self.tr("Press to refresh the bookmarks display")) self.refreshButton.setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.vcs = vcs self.__bookmarksList = None @@ -52,7 +54,8 @@ self.bookmarksList.headerItem().setText( self.bookmarksList.columnCount(), "") - self.bookmarksList.header().setSortIndicator(3, Qt.AscendingOrder) + self.bookmarksList.header().setSortIndicator( + 3, Qt.SortOrder.AscendingOrder) self.show() QCoreApplication.processEvents() @@ -107,11 +110,15 @@ """ self.refreshButton.setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) - self.buttonBox.button(QDialogButtonBox.Close).setFocus( - Qt.OtherFocusReason) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setFocus( + Qt.FocusReason.OtherFocusReason) if self.bookmarksList.topLevelItemCount() == 0: # no bookmarks defined @@ -127,11 +134,11 @@ # restore current item if self.__currentRevision: items = self.bookmarksList.findItems( - self.__currentRevision, Qt.MatchExactly, 0) + self.__currentRevision, Qt.MatchFlag.MatchExactly, 0) if items: self.bookmarksList.setCurrentItem(items[0]) self.__currentRevision = "" - self.bookmarksList.setFocus(Qt.OtherFocusReason) + self.bookmarksList.setFocus(Qt.FocusReason.OtherFocusReason) def on_buttonBox_clicked(self, button): """ @@ -139,9 +146,13 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() - elif button == self.buttonBox.button(QDialogButtonBox.Cancel): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): if self.__hgClient: self.__hgClient.cancel() else: @@ -162,7 +173,7 @@ Private method to resize the list columns. """ self.bookmarksList.header().resizeSections( - QHeaderView.ResizeToContents) + QHeaderView.ResizeMode.ResizeToContents) self.bookmarksList.header().setStretchLastSection(True) def __generateItem(self, revision, changeset, status, name): @@ -177,16 +188,16 @@ itm = QTreeWidgetItem(self.bookmarksList) if revision[0].isdecimal(): # valid bookmark entry - itm.setData(0, Qt.DisplayRole, int(revision)) - itm.setData(1, Qt.DisplayRole, changeset) - itm.setData(2, Qt.DisplayRole, status) - itm.setData(3, Qt.DisplayRole, name) - itm.setTextAlignment(0, Qt.AlignRight) - itm.setTextAlignment(1, Qt.AlignRight) - itm.setTextAlignment(2, Qt.AlignHCenter) + itm.setData(0, Qt.ItemDataRole.DisplayRole, int(revision)) + itm.setData(1, Qt.ItemDataRole.DisplayRole, changeset) + itm.setData(2, Qt.ItemDataRole.DisplayRole, status) + itm.setData(3, Qt.ItemDataRole.DisplayRole, name) + itm.setTextAlignment(0, Qt.AlignmentFlag.AlignRight) + itm.setTextAlignment(1, Qt.AlignmentFlag.AlignRight) + itm.setTextAlignment(2, Qt.AlignmentFlag.AlignHCenter) else: # error message - itm.setData(0, Qt.DisplayRole, revision) + itm.setData(0, Qt.ItemDataRole.DisplayRole, revision) def __processOutputLine(self, line): """ @@ -325,7 +336,7 @@ self.tr("Rename Bookmark"), self.tr("<p>Enter the new name for bookmark <b>{0}</b>:</p>") .format(bookmark), - QLineEdit.Normal) + QLineEdit.EchoMode.Normal) if ok and bool(newName): self.vcs.hgBookmarkRename((bookmark, newName)) self.on_refreshButton_clicked()
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgBranchInputDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgBranchInputDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -31,7 +31,8 @@ self.branchComboBox.addItems(sorted(branches)) self.branchComboBox.setEditText("") - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) msh = self.minimumSizeHint() self.resize(max(self.width(), msh.width()), msh.height()) @@ -43,7 +44,8 @@ @param txt contents of the branch combo box (string) """ - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(bool(txt)) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(bool(txt)) def getData(self): """
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgBundleDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgBundleDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -36,7 +36,8 @@ super(HgBundleDialog, self).__init__(parent) self.setupUi(self) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) self.__version = version @@ -66,7 +67,8 @@ elif self.bookmarkButton.isChecked(): enabled = self.bookmarkCombo.currentText() != "" - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enabled) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(enabled) @pyqtSlot(bool) def on_multipleButton_toggled(self, checked):
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgClient.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgClient.py Tue Mar 02 17:17:09 2021 +0100 @@ -93,7 +93,7 @@ 'Ensure, that it is in the search path.' ).format('hg') - self.__server.setReadChannel(QProcess.StandardOutput) + self.__server.setReadChannel(QProcess.ProcessChannel.StandardOutput) ok, error = self.__readHello() self.__started = ok return ok, error @@ -312,7 +312,7 @@ inputData = "" isPassword = False dlg = HgClientPromptDialog(size, message) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: inputData = dlg.getInput() + '\n' isPassword = dlg.isPassword() return inputData, isPassword
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgClientPromptDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgClientPromptDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -29,17 +29,18 @@ super(HgClientPromptDialog, self).__init__(parent) self.setupUi(self) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) self.inputEdit.setMaxLength(size) self.messageEdit.setPlainText(message) tc = self.messageEdit.textCursor() - tc.movePosition(QTextCursor.End) + tc.movePosition(QTextCursor.MoveOperation.End) self.messageEdit.setTextCursor(tc) self.messageEdit.ensureCursorVisible() - self.inputEdit.setFocus(Qt.OtherFocusReason) + self.inputEdit.setFocus(Qt.FocusReason.OtherFocusReason) @pyqtSlot(str) def on_inputEdit_textChanged(self, txt): @@ -48,7 +49,8 @@ @param txt text entered by the user (string) """ - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(bool(txt)) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(bool(txt)) @pyqtSlot(bool) def on_passwordCheckBox_toggled(self, isOn): @@ -58,9 +60,9 @@ @param isOn flag indicating the status of the check box (boolean) """ if isOn: - self.inputEdit.setEchoMode(QLineEdit.Password) + self.inputEdit.setEchoMode(QLineEdit.EchoMode.Password) else: - self.inputEdit.setEchoMode(QLineEdit.Normal) + self.inputEdit.setEchoMode(QLineEdit.EchoMode.Normal) def getInput(self): """
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgCommandDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgCommandDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -34,7 +34,8 @@ super(HgCommandDialog, self).__init__(parent) self.setupUi(self) - self.okButton = self.buttonBox.button(QDialogButtonBox.Ok) + self.okButton = self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok) self.okButton.setEnabled(False) self.commandCombo.clear()
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgCommitDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgCommitDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -33,7 +33,8 @@ @param merge flag indicating a merge commit (boolean) @param parent parent widget (QWidget) """ - super(HgCommitDialog, self).__init__(parent, Qt.WindowFlags(Qt.Window)) + super(HgCommitDialog, self).__init__( + parent, Qt.WindowFlags(Qt.WindowType.Window)) self.setupUi(self) self.__vcs = vcs @@ -68,7 +69,7 @@ self.dateTimeEdit.setDateTime(QDateTime.currentDateTime()) - self.logEdit.setFocus(Qt.OtherFocusReason) + self.logEdit.setFocus(Qt.FocusReason.OtherFocusReason) def on_buttonBox_clicked(self, button): """ @@ -76,7 +77,9 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Cancel): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): self.logEdit.clear() def on_buttonBox_accepted(self):
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgConflictsListDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgConflictsListDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -26,8 +26,8 @@ Class implementing a dialog to show a list of files which had or still have conflicts. """ - StatusRole = Qt.UserRole + 1 - FilenameRole = Qt.UserRole + 2 + StatusRole = Qt.ItemDataRole.UserRole + 1 + FilenameRole = Qt.ItemDataRole.UserRole + 2 def __init__(self, vcs, parent=None): """ @@ -41,15 +41,18 @@ self.__position = QPoint() - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.conflictsList.headerItem().setText( self.conflictsList.columnCount(), "") - self.conflictsList.header().setSortIndicator(0, Qt.AscendingOrder) + self.conflictsList.header().setSortIndicator( + 0, Qt.SortOrder.AscendingOrder) self.refreshButton = self.buttonBox.addButton( - self.tr("&Refresh"), QDialogButtonBox.ActionRole) + self.tr("&Refresh"), QDialogButtonBox.ButtonRole.ActionRole) self.refreshButton.setToolTip( self.tr("Press to refresh the list of conflicts")) self.refreshButton.setEnabled(False) @@ -119,9 +122,12 @@ Private slot called when the process finished or the user pressed the button. """ - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) self.refreshButton.setEnabled(True) @@ -136,9 +142,13 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() - elif button == self.buttonBox.button(QDialogButtonBox.Cancel): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): self.__hgClient.cancel() elif button == self.refreshButton: self.on_refreshButton_clicked() @@ -156,7 +166,7 @@ Private method to resize the list columns. """ self.conflictsList.header().resizeSections( - QHeaderView.ResizeToContents) + QHeaderView.ResizeMode.ResizeToContents) self.conflictsList.header().setStretchLastSection(True) def __generateItem(self, status, name): @@ -202,9 +212,12 @@ """ Private slot to refresh the log. """ - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.refreshButton.setEnabled(False) self.start()
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgCopyDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgCopyDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -46,7 +46,8 @@ self.sourceEdit.setText(source) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) msh = self.minimumSizeHint() self.resize(max(self.width(), msh.width()), msh.height()) @@ -71,5 +72,5 @@ @param txt contents of the target edit (string) """ - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( + self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( os.path.isabs(txt) or os.path.dirname(txt) == "")
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -36,10 +36,12 @@ """ super(HgDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.username = '' self.password = '' @@ -55,11 +57,15 @@ Private slot called when the process finished or the user pressed the button. """ - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) - self.buttonBox.button(QDialogButtonBox.Close).setFocus( - Qt.OtherFocusReason) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setFocus( + Qt.FocusReason.OtherFocusReason) if ( Preferences.getVCS("AutoClose") and @@ -74,9 +80,13 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() - elif button == self.buttonBox.button(QDialogButtonBox.Cancel): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): self.vcs.getClient().cancel() def startProcess(self, args, showArgs=True, environment=None, client=None): @@ -207,7 +217,7 @@ """ self.inputGroup.show() self.input.setMaxLength(size) - self.input.setFocus(Qt.OtherFocusReason) + self.input.setFocus(Qt.FocusReason.OtherFocusReason) self.resultbox.ensureCursorVisible() self.errors.ensureCursorVisible()
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgDiffDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgDiffDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -38,12 +38,14 @@ self.setupUi(self) self.refreshButton = self.buttonBox.addButton( - self.tr("Refresh"), QDialogButtonBox.ActionRole) + self.tr("Refresh"), QDialogButtonBox.ButtonRole.ActionRole) self.refreshButton.setToolTip( self.tr("Press to refresh the display")) self.refreshButton.setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Save).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Save).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) self.searchWidget.attachTextEdit(self.contents) @@ -123,14 +125,18 @@ self.errors.setPlainText("".join(errors)) self.errors.ensureCursorVisible() - self.buttonBox.button(QDialogButtonBox.Save).setEnabled(bool(diff)) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) - self.buttonBox.button(QDialogButtonBox.Close).setFocus( - Qt.OtherFocusReason) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Save).setEnabled(bool(diff)) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setFocus( + Qt.FocusReason.OtherFocusReason) tc = self.contents.textCursor() - tc.movePosition(QTextCursor.Start) + tc.movePosition(QTextCursor.MoveOperation.Start) self.contents.setTextCursor(tc) self.contents.ensureCursorVisible() @@ -151,7 +157,9 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Save): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Save + ): self.on_saveButton_clicked() elif button == self.refreshButton: self.on_refreshButton_clicked() @@ -167,25 +175,26 @@ if para == 0: tc = self.contents.textCursor() - tc.movePosition(QTextCursor.Start) + tc.movePosition(QTextCursor.MoveOperation.Start) self.contents.setTextCursor(tc) self.contents.ensureCursorVisible() elif para == -1: tc = self.contents.textCursor() - tc.movePosition(QTextCursor.End) + tc.movePosition(QTextCursor.MoveOperation.End) self.contents.setTextCursor(tc) self.contents.ensureCursorVisible() else: # step 1: move cursor to end tc = self.contents.textCursor() - tc.movePosition(QTextCursor.End) + tc.movePosition(QTextCursor.MoveOperation.End) self.contents.setTextCursor(tc) self.contents.ensureCursorVisible() # step 2: move cursor to desired line tc = self.contents.textCursor() delta = tc.blockNumber() - para - tc.movePosition(QTextCursor.PreviousBlock, QTextCursor.MoveAnchor, + tc.movePosition(QTextCursor.MoveOperation.PreviousBlock, + QTextCursor.MoveMode.MoveAnchor, delta) self.contents.setTextCursor(tc) self.contents.ensureCursorVisible() @@ -254,9 +263,11 @@ """ Private slot to refresh the display. """ - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Save).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Save).setEnabled(False) self.refreshButton.setEnabled(False) self.start(self.filename, refreshable=True)
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgExportDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgExportDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -38,7 +38,8 @@ self.directoryPicker.setMode(E5PathPickerModes.DirectoryMode) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) # set default values for directory and pattern self.patternEdit.setText("%b_%r_%h_%n_of_%N.diff") @@ -64,7 +65,8 @@ ): enabled = False - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enabled) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(enabled) @pyqtSlot(str) def on_directoryPicker_textChanged(self, txt):
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgGraftDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgGraftDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -52,7 +52,8 @@ self.userEdit.text() != "") ) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enable) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(enable) @pyqtSlot() def on_revisionsEdit_textChanged(self):
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgImportDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgImportDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -37,7 +37,8 @@ self.secretCheckBox.setEnabled(vcs.version >= (5, 3, 0)) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) self.__initDateTime = QDateTime.currentDateTime() self.dateEdit.setDateTime(self.__initDateTime) @@ -50,7 +51,8 @@ if self.patchFilePicker.text() == "": enabled = False - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enabled) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(enabled) @pyqtSlot(str) def on_patchFilePicker_textChanged(self, txt):
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -79,7 +79,7 @@ self.setupUi(self) windowFlags = self.windowFlags() - windowFlags |= Qt.WindowContextHelpButtonHint + windowFlags |= Qt.WindowType.WindowContextHelpButtonHint self.setWindowFlags(windowFlags) self.mainSplitter.setSizes([300, 400]) @@ -103,17 +103,20 @@ elif mode == "full_log": self.setWindowTitle(self.tr("Mercurial Full Log")) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.filesTree.headerItem().setText(self.filesTree.columnCount(), "") - self.filesTree.header().setSortIndicator(0, Qt.AscendingOrder) + self.filesTree.header().setSortIndicator( + 0, Qt.SortOrder.AscendingOrder) self.upButton.setIcon(UI.PixmapCache.getIcon("1uparrow")) self.downButton.setIcon(UI.PixmapCache.getIcon("1downarrow")) self.refreshButton = self.buttonBox.addButton( - self.tr("&Refresh"), QDialogButtonBox.ActionRole) + self.tr("&Refresh"), QDialogButtonBox.ButtonRole.ActionRole) self.refreshButton.setToolTip( self.tr("Press to refresh the list of changesets")) self.refreshButton.setEnabled(False) @@ -191,15 +194,15 @@ self.__resetUI() # roles used in the log tree - self.__messageRole = Qt.UserRole - self.__changesRole = Qt.UserRole + 1 - self.__edgesRole = Qt.UserRole + 2 - self.__parentsRole = Qt.UserRole + 3 - self.__latestTagRole = Qt.UserRole + 4 - self.__incomingRole = Qt.UserRole + 5 + self.__messageRole = Qt.ItemDataRole.UserRole + self.__changesRole = Qt.ItemDataRole.UserRole + 1 + self.__edgesRole = Qt.ItemDataRole.UserRole + 2 + self.__parentsRole = Qt.ItemDataRole.UserRole + 3 + self.__latestTagRole = Qt.ItemDataRole.UserRole + 4 + self.__incomingRole = Qt.ItemDataRole.UserRole + 5 # roles used in the file tree - self.__diffFileLineRole = Qt.UserRole + self.__diffFileLineRole = Qt.ItemDataRole.UserRole self.flags = { 'A': self.tr('Added'), @@ -499,14 +502,16 @@ """ Private method to resize the log tree columns. """ - self.logTree.header().resizeSections(QHeaderView.ResizeToContents) + self.logTree.header().resizeSections( + QHeaderView.ResizeMode.ResizeToContents) self.logTree.header().setStretchLastSection(True) def __resizeColumnsFiles(self): """ Private method to resize the changed files tree columns. """ - self.filesTree.header().resizeSections(QHeaderView.ResizeToContents) + self.filesTree.header().resizeSections( + QHeaderView.ResizeMode.ResizeToContents) self.filesTree.header().setStretchLastSection(True) def __resortFiles(self): @@ -630,7 +635,7 @@ """ return int(1.2 * radius) * col + radius // 2 + 3 - textColor = self.logTree.palette().color(QPalette.Text) + textColor = self.logTree.palette().color(QPalette.ColorRole.Text) radius = self.__dotRadius w = len(bottomedges) * radius + 20 @@ -642,7 +647,7 @@ pix = QPixmap(w, h) pix.fill(QColor(0, 0, 0, 0)) # draw transparent background painter = QPainter(pix) - painter.setRenderHint(QPainter.Antialiasing) + painter.setRenderHint(QPainter.RenderHint.Antialiasing) # draw the revision history lines for y1, y2, lines in ((0, h, bottomedges), @@ -977,9 +982,12 @@ @param startRev revision number to start from (integer, string) @param noEntries number of entries to get (0 = default) (int) """ - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) QApplication.processEvents() with E5OverrideCursor(): @@ -1115,9 +1123,12 @@ Private slot called when the process finished or the user pressed the button. """ - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) self.refreshButton.setEnabled(True) @@ -1238,7 +1249,7 @@ log["parents"], log["branches"], log["tags"], log["phase"], log["bookmarks"], log["latesttag"], canPush=canPush) - dt = QDate.fromString(log["date"], Qt.ISODate) + dt = QDate.fromString(log["date"], Qt.DateFormat.ISODate) if ( not self.__maxDate.isValid() and not self.__minDate.isValid() @@ -1262,7 +1273,7 @@ # we are really done if self.__selectedRevisions: foundItems = self.logTree.findItems( - self.__selectedRevisions[0], Qt.MatchExactly, + self.__selectedRevisions[0], Qt.MatchFlag.MatchExactly, self.RevisionColumn) if foundItems: self.logTree.setCurrentItem(foundItems[0]) @@ -1274,7 +1285,8 @@ # rev string format must match with the format of the # __generateLogItem() method items = self.logTree.findItems( - "{0:>7}:".format(rev), Qt.MatchStartsWith, + "{0:>7}:".format(rev), + Qt.MatchFlag.MatchStartsWith, self.RevisionColumn) if items: self.logTree.setCurrentItem(items[0]) @@ -1324,7 +1336,7 @@ # we are really done for revision in self.__selectedRevisions: items = self.logTree.findItems( - revision, Qt.MatchExactly, self.RevisionColumn) + revision, Qt.MatchFlag.MatchExactly, self.RevisionColumn) if items: items[0].setSelected(True) self.__selectedRevisions = [] @@ -1345,9 +1357,13 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() - elif button == self.buttonBox.button(QDialogButtonBox.Cancel): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): self.cancelled = True self.__hgClient.cancel() elif button == self.refreshButton: @@ -1920,9 +1936,12 @@ well @type bool """ - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.refreshButton.setEnabled(False) @@ -2093,7 +2112,7 @@ self.tr("Define Bookmark"), self.tr('Enter bookmark name for changeset "{0}":').format( changeset), - QLineEdit.Normal) + QLineEdit.EchoMode.Normal) if ok and bool(bookmark): self.vcs.hgBookmarkDefine( revision="rev({0})".format(rev), @@ -2458,8 +2477,8 @@ rev = url.path() searchStr = "{0:>7}:".format(rev) # format must be in sync with item generation format - items = self.logTree.findItems(searchStr, Qt.MatchStartsWith, - self.RevisionColumn) + items = self.logTree.findItems( + searchStr, Qt.MatchFlag.MatchStartsWith, self.RevisionColumn) if items: itm = items[0] if itm.isHidden(): @@ -2556,13 +2575,13 @@ for fileName in (oldFileName, newFileName): if fileName != "__NULL__": items = self.filesTree.findItems( - fileName, Qt.MatchExactly, 1) + fileName, Qt.MatchFlag.MatchExactly, 1) for item in items: item.setData(0, self.__diffFileLineRole, lineNumber) tc = self.diffEdit.textCursor() - tc.movePosition(QTextCursor.Start) + tc.movePosition(QTextCursor.MoveOperation.Start) self.diffEdit.setTextCursor(tc) self.diffEdit.ensureCursorVisible() @@ -2579,26 +2598,26 @@ if para is not None: if para == 0: tc = self.diffEdit.textCursor() - tc.movePosition(QTextCursor.Start) + tc.movePosition(QTextCursor.MoveOperation.Start) self.diffEdit.setTextCursor(tc) self.diffEdit.ensureCursorVisible() elif para == -1: tc = self.diffEdit.textCursor() - tc.movePosition(QTextCursor.End) + tc.movePosition(QTextCursor.MoveOperation.End) self.diffEdit.setTextCursor(tc) self.diffEdit.ensureCursorVisible() else: # step 1: move cursor to end tc = self.diffEdit.textCursor() - tc.movePosition(QTextCursor.End) + tc.movePosition(QTextCursor.MoveOperation.End) self.diffEdit.setTextCursor(tc) self.diffEdit.ensureCursorVisible() # step 2: move cursor to desired line tc = self.diffEdit.textCursor() delta = tc.blockNumber() - para - tc.movePosition(QTextCursor.PreviousBlock, - QTextCursor.MoveAnchor, delta) + tc.movePosition(QTextCursor.MoveOperation.PreviousBlock, + QTextCursor.MoveMode.MoveAnchor, delta) self.diffEdit.setTextCursor(tc) self.diffEdit.ensureCursorVisible()
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgMergeDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgMergeDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -30,7 +30,8 @@ super(HgMergeDialog, self).__init__(parent) self.setupUi(self) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) self.tagCombo.addItems(sorted(tagsList)) self.branchCombo.addItems(["default"] + sorted(branchesList)) @@ -57,7 +58,8 @@ elif self.bookmarkButton.isChecked(): enabled = self.bookmarkCombo.currentText() != "" - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enabled) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(enabled) @pyqtSlot(bool) def on_idButton_toggled(self, checked):
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgNewProjectOptionsDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgNewProjectOptionsDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -43,9 +43,9 @@ vcsUrlHistory = self.__vcs.getPlugin().getPreferences( "RepositoryUrlHistory") self.vcsUrlPicker.setMode(E5PathPickerModes.DirectoryMode) - self.vcsUrlPicker.setInsertPolicy(QComboBox.InsertAtTop) + self.vcsUrlPicker.setInsertPolicy(QComboBox.InsertPolicy.InsertAtTop) self.vcsUrlPicker.setSizeAdjustPolicy( - QComboBox.AdjustToMinimumContentsLength) + QComboBox.SizeAdjustPolicy.AdjustToContents) self.vcsUrlPicker.setPathsList(vcsUrlHistory) self.vcsUrlClearHistoryButton.setIcon( UI.PixmapCache.getIcon("editDelete")) @@ -66,7 +66,8 @@ self.largeCheckBox.setVisible( self.__vcs.isExtensionActive("largefiles")) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) msh = self.minimumSizeHint() self.resize(max(self.width(), msh.width()), msh.height()) @@ -78,7 +79,7 @@ @param txt name of the project directory (string) """ - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( + self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( bool(txt) and Utilities.fromNativeSeparators(txt) not in self.__initPaths) @@ -91,7 +92,8 @@ """ url = QUrl.fromUserInput(txt) enable = url.isValid() and url.scheme() in ConfigHgSchemes - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enable) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(enable) self.vcsUrlPicker.setPickerEnabled(url.scheme() == "file" or len(txt) == 0) @@ -119,7 +121,7 @@ url = QUrl.fromUserInput(self.vcsUrlPicker.text().replace("\\", "/")) vcsdatadict = { - "url": url.toString(QUrl.None_), + "url": url.toString(QUrl.UrlFormattingOption.None_), "revision": self.vcsRevisionEdit.text(), "largefiles": self.largeCheckBox.isChecked(), }
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgPhaseDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgPhaseDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -32,13 +32,14 @@ self.phaseCombo.addItem(self.tr("Draft"), "d") self.phaseCombo.addItem(self.tr("Secret"), "s") - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) def __updateOk(self): """ Private slot to update the state of the OK button. """ - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( + self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( self.revisionsEdit.toPlainText().strip() != "" and self.phaseCombo.currentText().strip() != "")
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgRepoConfigDataDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgRepoConfigDataDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -62,9 +62,9 @@ @param checked state of the push button (boolean) """ if checked: - self.defaultPasswordEdit.setEchoMode(QLineEdit.Normal) + self.defaultPasswordEdit.setEchoMode(QLineEdit.EchoMode.Normal) else: - self.defaultPasswordEdit.setEchoMode(QLineEdit.Password) + self.defaultPasswordEdit.setEchoMode(QLineEdit.EchoMode.Password) @pyqtSlot(bool) def on_defaultPushShowPasswordButton_clicked(self, checked): @@ -75,9 +75,11 @@ @param checked state of the push button (boolean) """ if checked: - self.defaultPushPasswordEdit.setEchoMode(QLineEdit.Normal) + self.defaultPushPasswordEdit.setEchoMode( + QLineEdit.EchoMode.Normal) else: - self.defaultPushPasswordEdit.setEchoMode(QLineEdit.Password) + self.defaultPushPasswordEdit.setEchoMode( + QLineEdit.EchoMode.Password) def getData(self): """
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgRevisionSelectionDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgRevisionSelectionDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -31,7 +31,8 @@ super(HgRevisionSelectionDialog, self).__init__(parent) self.setupUi(self) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) self.tagCombo.addItems(sorted(tagsList)) self.branchCombo.addItems(["default"] + sorted(branchesList)) @@ -61,7 +62,8 @@ elif self.bookmarkButton.isChecked(): enabled = self.bookmarkCombo.currentText() != "" - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enabled) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(enabled) @pyqtSlot(bool) def on_idButton_toggled(self, checked):
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgRevisionsSelectionDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgRevisionsSelectionDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -30,7 +30,8 @@ super(HgRevisionsSelectionDialog, self).__init__(parent) self.setupUi(self) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) self.tag1Combo.addItems(sorted(tagsList)) self.tag2Combo.addItems(sorted(tagsList)) @@ -71,7 +72,8 @@ elif self.bookmark2Button.isChecked(): enabled = enabled and self.bookmark2Combo.currentText() != "" - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enabled) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(enabled) @pyqtSlot(bool) def on_id1Button_toggled(self, checked):
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgServeDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgServeDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -93,8 +93,8 @@ self.__browserToolbar = QToolBar(self.tr("Browser"), self) self.__browserToolbar.addAction(self.__browserAct) - self.addToolBar(Qt.TopToolBarArea, self.__serverToolbar) - self.addToolBar(Qt.TopToolBarArea, self.__browserToolbar) + self.addToolBar(Qt.ToolBarArea.TopToolBarArea, self.__serverToolbar) + self.addToolBar(Qt.ToolBarArea.TopToolBarArea, self.__browserToolbar) self.__log = QPlainTextEdit(self) self.setCentralWidget(self.__log) @@ -158,11 +158,11 @@ """ if ( self.process is not None and - self.process.state() != QProcess.NotRunning + self.process.state() != QProcess.ProcessState.NotRunning ): self.process.terminate() self.process.waitForFinished(5000) - if self.process.state() != QProcess.NotRunning: + if self.process.state() != QProcess.ProcessState.NotRunning: self.process.kill() self.__startAct.setEnabled(True) @@ -231,7 +231,7 @@ @type bool """ tc = self.__log.textCursor() - tc.movePosition(QTextCursor.End) + tc.movePosition(QTextCursor.MoveOperation.End) self.__log.setTextCursor(tc) if error: self.__log.setCurrentCharFormat(self.cErrorFormat)
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgStatusDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgStatusDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -50,12 +50,14 @@ self.__lastColumn = self.statusList.columnCount() self.refreshButton = self.buttonBox.addButton( - self.tr("Refresh"), QDialogButtonBox.ActionRole) + self.tr("Refresh"), QDialogButtonBox.ButtonRole.ActionRole) self.refreshButton.setToolTip( self.tr("Press to refresh the status display")) self.refreshButton.setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.diff = None self.vcs = vcs @@ -65,7 +67,7 @@ self.statusList.headerItem().setText(self.__lastColumn, "") self.statusList.header().setSortIndicator( - self.__pathColumn, Qt.AscendingOrder) + self.__pathColumn, Qt.SortOrder.AscendingOrder) font = Preferences.getEditorOtherFonts("MonospacedFont") self.diffEdit.document().setDefaultFont(font) @@ -257,7 +259,8 @@ """ Private method to resize the list columns. """ - self.statusList.header().resizeSections(QHeaderView.ResizeToContents) + self.statusList.header().resizeSections( + QHeaderView.ResizeMode.ResizeToContents) self.statusList.header().setStretchLastSection(True) def __generateItem(self, status, path): @@ -274,14 +277,15 @@ path, ]) - itm.setTextAlignment(1, Qt.AlignHCenter) - itm.setTextAlignment(2, Qt.AlignLeft) + itm.setTextAlignment(1, Qt.AlignmentFlag.AlignHCenter) + itm.setTextAlignment(2, Qt.AlignmentFlag.AlignLeft) if status in "AMR": - itm.setFlags(itm.flags() | Qt.ItemIsUserCheckable) - itm.setCheckState(self.__toBeCommittedColumn, Qt.Checked) + itm.setFlags(itm.flags() | Qt.ItemFlag.ItemIsUserCheckable) + itm.setCheckState(self.__toBeCommittedColumn, + Qt.CheckState.Checked) else: - itm.setFlags(itm.flags() & ~Qt.ItemIsUserCheckable) + itm.setFlags(itm.flags() & ~Qt.ItemFlag.ItemIsUserCheckable) if statusText not in self.__statusFilters: self.__statusFilters.append(statusText) @@ -342,11 +346,15 @@ """ self.refreshButton.setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) - self.buttonBox.button(QDialogButtonBox.Close).setFocus( - Qt.OtherFocusReason) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setFocus( + Qt.FocusReason.OtherFocusReason) self.__statusFilters.sort() self.__statusFilters.insert(0, "<{0}>".format(self.tr("all"))) @@ -366,9 +374,13 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() - elif button == self.buttonBox.button(QDialogButtonBox.Cancel): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): self.__hgClient.cancel() elif button == self.refreshButton: self.on_refreshButton_clicked() @@ -682,7 +694,10 @@ commitableItems = [] for index in range(self.statusList.topLevelItemCount()): itm = self.statusList.topLevelItem(index) - if itm.checkState(self.__toBeCommittedColumn) == Qt.Checked: + if ( + itm.checkState(self.__toBeCommittedColumn) == + Qt.CheckState.Checked + ): commitableItems.append(itm) return commitableItems @@ -697,8 +712,9 @@ for index in range(self.statusList.topLevelItemCount()): itm = self.statusList.topLevelItem(index) if ( - itm.flags() & Qt.ItemIsUserCheckable and - itm.checkState(self.__toBeCommittedColumn) == Qt.Unchecked + itm.flags() & Qt.ItemFlag.ItemIsUserCheckable and + itm.checkState(self.__toBeCommittedColumn) == + Qt.CheckState.Unchecked ): items.append(itm) return items @@ -748,11 +764,13 @@ """ for index in range(self.statusList.topLevelItemCount()): itm = self.statusList.topLevelItem(index) - if itm.flags() & Qt.ItemIsUserCheckable: + if itm.flags() & Qt.ItemFlag.ItemIsUserCheckable: if selected: - itm.setCheckState(self.__toBeCommittedColumn, Qt.Checked) + itm.setCheckState(self.__toBeCommittedColumn, + Qt.CheckState.Checked) else: - itm.setCheckState(self.__toBeCommittedColumn, Qt.Unchecked) + itm.setCheckState(self.__toBeCommittedColumn, + Qt.CheckState.Unchecked) def __commitMerge(self): """ @@ -801,7 +819,7 @@ self.diffEdit.setPlainText("".join(diff)) tc = self.diffEdit.textCursor() - tc.movePosition(QTextCursor.Start) + tc.movePosition(QTextCursor.MoveOperation.Start) self.diffEdit.setTextCursor(tc) self.diffEdit.ensureCursorVisible()
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgSummaryDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgSummaryDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -30,7 +30,7 @@ self.setupUi(self) self.refreshButton = self.buttonBox.addButton( - self.tr("Refresh"), QDialogButtonBox.ActionRole) + self.tr("Refresh"), QDialogButtonBox.ButtonRole.ActionRole) self.refreshButton.setToolTip( self.tr("Press to refresh the summary display")) self.refreshButton.setEnabled(False) @@ -76,7 +76,9 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() elif button == self.refreshButton: self.on_refreshButton_clicked()
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgTagBranchListDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgTagBranchListDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -34,13 +34,15 @@ """ super(HgTagBranchListDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.refreshButton = self.buttonBox.addButton( - self.tr("&Refresh"), QDialogButtonBox.ActionRole) + self.tr("&Refresh"), QDialogButtonBox.ButtonRole.ActionRole) self.refreshButton.setToolTip( self.tr("Press to refresh the list")) self.refreshButton.setEnabled(False) @@ -53,7 +55,7 @@ self.__currentBranch = "" self.tagList.headerItem().setText(self.tagList.columnCount(), "") - self.tagList.header().setSortIndicator(3, Qt.AscendingOrder) + self.tagList.header().setSortIndicator(3, Qt.SortOrder.AscendingOrder) self.show() QCoreApplication.processEvents() @@ -89,7 +91,7 @@ self.tagList.headerItem().setText(2, self.tr("Status")) if self.vcs.isExtensionActive("closehead"): self.tagList.setSelectionMode( - QAbstractItemView.ExtendedSelection) + QAbstractItemView.SelectionMode.ExtendedSelection) self.activateWindow() self.tagsList = tagsList @@ -119,11 +121,15 @@ """ self.refreshButton.setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) - self.buttonBox.button(QDialogButtonBox.Close).setFocus( - Qt.OtherFocusReason) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setFocus( + Qt.FocusReason.OtherFocusReason) if not self.tagsMode: self.__highlightCurrentBranch() @@ -133,11 +139,11 @@ # restore current item if self.__currentRevision: items = self.tagList.findItems( - self.__currentRevision, Qt.MatchExactly, 0) + self.__currentRevision, Qt.MatchFlag.MatchExactly, 0) if items: self.tagList.setCurrentItem(items[0]) self.__currentRevision = "" - self.tagList.setFocus(Qt.OtherFocusReason) + self.tagList.setFocus(Qt.FocusReason.OtherFocusReason) def on_buttonBox_clicked(self, button): """ @@ -145,9 +151,13 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() - elif button == self.buttonBox.button(QDialogButtonBox.Cancel): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): self.__hgClient.cancel() elif button == self.refreshButton: self.on_refreshButton_clicked() @@ -164,7 +174,8 @@ """ Private method to resize the list columns. """ - self.tagList.header().resizeSections(QHeaderView.ResizeToContents) + self.tagList.header().resizeSections( + QHeaderView.ResizeMode.ResizeToContents) self.tagList.header().setStretchLastSection(True) def __generateItem(self, revision, changeset, status, name): @@ -177,13 +188,13 @@ @param name name of the tag/branch (string) """ itm = QTreeWidgetItem(self.tagList) - itm.setData(0, Qt.DisplayRole, int(revision)) - itm.setData(1, Qt.DisplayRole, changeset) - itm.setData(2, Qt.DisplayRole, status) - itm.setData(3, Qt.DisplayRole, name) - itm.setTextAlignment(0, Qt.AlignRight) - itm.setTextAlignment(1, Qt.AlignRight) - itm.setTextAlignment(2, Qt.AlignHCenter) + itm.setData(0, Qt.ItemDataRole.DisplayRole, int(revision)) + itm.setData(1, Qt.ItemDataRole.DisplayRole, changeset) + itm.setData(2, Qt.ItemDataRole.DisplayRole, status) + itm.setData(3, Qt.ItemDataRole.DisplayRole, name) + itm.setTextAlignment(0, Qt.AlignmentFlag.AlignRight) + itm.setTextAlignment(1, Qt.AlignmentFlag.AlignRight) + itm.setTextAlignment(2, Qt.AlignmentFlag.AlignHCenter) def __processOutputLine(self, line): """ @@ -232,7 +243,7 @@ self.__currentBranch = self.vcs.hgGetCurrentBranch() if self.__currentBranch: items = self.tagList.findItems( - self.__currentBranch, Qt.MatchCaseSensitive, 3) + self.__currentBranch, Qt.MatchFlag.MatchCaseSensitive, 3) if len(items) == 1: font = items[0].font(3) font.setBold(True) @@ -244,9 +255,12 @@ """ Private slot to refresh the log. """ - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.refreshButton.setEnabled(False) @@ -369,6 +383,6 @@ self.tr( "Do you really want to close all listed branches?"), branches) - yes = dlg.exec() == QDialog.Accepted + yes = dlg.exec() == QDialog.DialogCode.Accepted if yes: self.vcs.getExtensionObject("closehead").hgCloseheads(branches)
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgTagDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgTagDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -36,7 +36,8 @@ super(HgTagDialog, self).__init__(parent) self.setupUi(self) - self.okButton = self.buttonBox.button(QDialogButtonBox.Ok) + self.okButton = self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok) self.okButton.setEnabled(False) self.tagCombo.clear()
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgUserConfigDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgUserConfigDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -429,7 +429,7 @@ host, self.__minimumProtocols[protocol] ]) - itm.setData(1, Qt.UserRole, protocol) + itm.setData(1, Qt.ItemDataRole.UserRole, protocol) self.__finalizeFingerprintsColumns() self.__finalizeProtocolsColumns() @@ -523,7 +523,7 @@ Private slot to add a fingerprints entry. """ dlg = HgUserConfigHostFingerprintDialog(self, version=self.__version) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: host, fingerprint = dlg.getData() itm = QTreeWidgetItem(self.fingerprintsList, [host, fingerprint]) self.__finalizeFingerprintsColumns() @@ -560,7 +560,7 @@ fingerprint = itm.text(1) dlg = HgUserConfigHostFingerprintDialog(self, host, fingerprint, version=self.__version) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: host, fingerprint = dlg.getData() itm.setText(0, host) itm.setText(1, fingerprint) @@ -573,7 +573,7 @@ """ for col in range(self.fingerprintsList.columnCount()): self.fingerprintsList.resizeColumnToContents(col) - self.fingerprintsList.sortItems(0, Qt.AscendingOrder) + self.fingerprintsList.sortItems(0, Qt.SortOrder.AscendingOrder) def __updateFingerprintsButtons(self): """ @@ -608,7 +608,7 @@ for row in range(self.protocolsList.topLevelItemCount()): itm = self.protocolsList.topLevelItem(row) host = itm.text(0) - minimumProtocol = itm.data(1, Qt.UserRole) + minimumProtocol = itm.data(1, Qt.ItemDataRole.UserRole) minimumProtocols[host] = minimumProtocol return minimumProtocols @@ -631,13 +631,13 @@ """ dlg = HgUserConfigHostMinimumProtocolDialog(self.__minimumProtocols, self) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: host, protocol = dlg.getData() itm = QTreeWidgetItem(self.protocolsList, [ host, self.__minimumProtocols[protocol] ]) - itm.setData(1, Qt.UserRole, protocol) + itm.setData(1, Qt.ItemDataRole.UserRole, protocol) self.__finalizeProtocolsColumns() self.protocolsList.setCurrentItem(itm) self.protocolsList.scrollToItem(itm) @@ -669,14 +669,14 @@ itm = self.protocolsList.currentItem() if itm is not None: host = itm.text(0) - protocol = itm.data(1, Qt.UserRole) + protocol = itm.data(1, Qt.ItemDataRole.UserRole) dlg = HgUserConfigHostMinimumProtocolDialog( self.__minimumProtocols, self, host, protocol) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: host, protocol = dlg.getData() itm.setText(0, host) itm.setText(1, self.__minimumProtocols[protocol]) - itm.setData(1, Qt.UserRole, protocol) + itm.setData(1, Qt.ItemDataRole.UserRole, protocol) self.__finalizeProtocolsColumns() self.protocolsList.scrollToItem(itm) @@ -686,7 +686,7 @@ """ for col in range(self.protocolsList.columnCount()): self.protocolsList.resizeColumnToContents(col) - self.protocolsList.sortItems(0, Qt.AscendingOrder) + self.protocolsList.sortItems(0, Qt.SortOrder.AscendingOrder) def __updateProtocolsButtons(self): """ @@ -719,7 +719,7 @@ self.writeUserConfig() self.__editor = MiniEditor(cfgFile, "Properties", self) - self.__editor.setWindowModality(Qt.WindowModal) + self.__editor.setWindowModality(Qt.WindowModality.WindowModal) self.__editor.installEventFilter(self) self.__editor.show() @@ -734,7 +734,7 @@ @return flag indicating, if we handled the event @rtype bool """ - if watched is self.__editor and event.type() == QEvent.Close: + if watched is self.__editor and event.type() == QEvent.Type.Close: self.__editor.closeEvent(event) if event.isAccepted(): self.__clearDialog()
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgUserConfigHostFingerprintDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgUserConfigHostFingerprintDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -86,7 +86,8 @@ HgUserConfigHostFingerprintDialog.fingerprintLength[ hashType]) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enabled) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(enabled) @pyqtSlot(str) def on_hostEdit_textChanged(self, txt): @@ -98,13 +99,13 @@ """ self.__updateOkButton() - @pyqtSlot(str) - def on_hashComboBox_currentIndexChanged(self, txt): + @pyqtSlot(int) + def on_hashComboBox_currentIndexChanged(self, index): """ Private slot to handle changes of the hash combo. - @param txt current text - @type str + @param index current index + @type int """ self.__updateOkButton()
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgUserConfigHostMinimumProtocolDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgUserConfigHostMinimumProtocolDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -61,7 +61,8 @@ bool(self.hostEdit.text()) and self.minimumProtocolComboBox.currentIndex() > 0 ) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enabled) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(enabled) @pyqtSlot(str) def on_hostEdit_textChanged(self, txt):
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HisteditExtension/HgHisteditConfigDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HisteditExtension/HgHisteditConfigDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -73,7 +73,8 @@ elif self.bookmarkButton.isChecked(): enabled = enabled and bool(self.bookmarkCombo.currentText()) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enabled) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(enabled) @pyqtSlot(bool) def on_defaultButton_toggled(self, checked):
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HisteditExtension/HgHisteditEditor.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HisteditExtension/HgHisteditEditor.py Tue Mar 02 17:17:09 2021 +0100 @@ -29,8 +29,8 @@ settingsDir = os.path.expanduser(arg.replace("--settings=", "")) if not os.path.isdir(settingsDir): os.makedirs(settingsDir) - QSettings.setPath(QSettings.IniFormat, QSettings.UserScope, - settingsDir) + QSettings.setPath( + QSettings.Format.IniFormat, QSettings.Scope.UserScope, settingsDir) sys.argv.remove(arg) from Globals import AppInfo
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HisteditExtension/histedit.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HisteditExtension/histedit.py Tue Mar 02 17:17:09 2021 +0100 @@ -44,7 +44,7 @@ self.vcs.hgGetBranchesList(), self.vcs.hgGetBookmarksList(), rev) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: rev, force, keep = dlg.getData() args = self.vcs.initCommand("histedit")
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/LargefilesExtension/LfConvertDataDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/LargefilesExtension/LfConvertDataDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -61,7 +61,7 @@ @param txt new project directory name (string) """ - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( + self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( txt and Utilities.toNativeSeparators(txt) != os.path.dirname( self.__currentPath))
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/LargefilesExtension/LfRevisionsInputDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/LargefilesExtension/LfRevisionsInputDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -26,14 +26,15 @@ super(LfRevisionsInputDialog, self).__init__(parent) self.setupUi(self) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) @pyqtSlot() def on_revisionsEdit_textChanged(self): """ Private slot handling a change of revisions. """ - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( + self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( bool(self.revisionsEdit.toPlainText())) def getRevisions(self):
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/LargefilesExtension/largefiles.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/LargefilesExtension/largefiles.py Tue Mar 02 17:17:09 2021 +0100 @@ -49,7 +49,7 @@ from .LfConvertDataDialog import LfConvertDataDialog dlg = LfConvertDataDialog(projectDir, direction) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: newName, minSize, patterns = dlg.getData() newProjectFile = os.path.join( newName, os.path.basename(projectFile)) @@ -155,7 +155,7 @@ else: from .LfRevisionsInputDialog import LfRevisionsInputDialog dlg = LfRevisionsInputDialog() - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: revs = dlg.getRevisions() if revs:
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/ProjectBrowserHelper.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/ProjectBrowserHelper.py Tue Mar 02 17:17:09 2021 +0100 @@ -839,7 +839,7 @@ " from the repository?"), files) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: self.vcs.hgForget(names) for fn in names:
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/PurgeExtension/HgPurgeListDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/PurgeExtension/HgPurgeListDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -26,6 +26,6 @@ """ super(HgPurgeListDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) self.purgeList.addItems(sorted(entries))
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/PurgeExtension/purge.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/PurgeExtension/purge.py Tue Mar 02 17:17:09 2021 +0100 @@ -80,7 +80,7 @@ DeleteFilesConfirmationDialog ) dlg = DeleteFilesConfirmationDialog(None, title, message, entries) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: args = self.vcs.initCommand("purge") if deleteAll: args.append("--all")
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/QueuesExtension/HgQueuesDefineGuardsDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/QueuesExtension/HgQueuesDefineGuardsDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -34,7 +34,7 @@ """ super(HgQueuesDefineGuardsDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) self.vcs = vcs self.extension = extension @@ -137,7 +137,7 @@ else: continue itm = QListWidgetItem(icon, guard, self.guardsList) - itm.setData(Qt.UserRole, sign) + itm.setData(Qt.ItemDataRole.UserRole, sign) self.on_guardsList_itemSelectionChanged() @@ -156,7 +156,8 @@ @param guard name of the guard (string) @return reference to the guard item (QListWidgetItem) """ - items = self.guardsList.findItems(guard, Qt.MatchCaseSensitive) + items = self.guardsList.findItems( + guard, Qt.MatchFlag.MatchCaseSensitive) if items: return items[0] else: @@ -192,7 +193,7 @@ del itm itm = QListWidgetItem(icon, guard, self.guardsList) - itm.setData(Qt.UserRole, sign) + itm.setData(Qt.ItemDataRole.UserRole, sign) self.guardsList.sortItems() self.__dirtyList = True @@ -222,9 +223,13 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Apply): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Apply + ): self.__applyGuards() - elif button == self.buttonBox.button(QDialogButtonBox.Close): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() @pyqtSlot() @@ -236,7 +241,7 @@ guardsList = [] for row in range(self.guardsList.count()): itm = self.guardsList.item(row) - guard = itm.data(Qt.UserRole) + itm.text() + guard = itm.data(Qt.ItemDataRole.UserRole) + itm.text() guardsList.append(guard) args = self.vcs.initCommand("qguard")
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/QueuesExtension/HgQueuesFoldDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/QueuesExtension/HgQueuesFoldDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -38,13 +38,14 @@ name, summary = patch.split("@@") QTreeWidgetItem(self.sourcePatches, [name, summary]) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) def __updateOkButton(self): """ Private slot to update the status of the OK button. """ - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( + self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( self.selectedPatches.topLevelItemCount() != 0) @pyqtSlot() @@ -74,7 +75,7 @@ self.selectedPatches.currentItem()) itm = self.selectedPatches.takeTopLevelItem(row) self.sourcePatches.addTopLevelItem(itm) - self.sourcePatches.sortItems(0, Qt.AscendingOrder) + self.sourcePatches.sortItems(0, Qt.SortOrder.AscendingOrder) self.__updateOkButton()
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/QueuesExtension/HgQueuesGuardsSelectionDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/QueuesExtension/HgQueuesGuardsSelectionDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -39,8 +39,10 @@ self.guardsList.sortItems() if listOnly: - self.buttonBox.button(QDialogButtonBox.Cancel).hide() - self.guardsList.setSelectionMode(QAbstractItemView.NoSelection) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).hide() + self.guardsList.setSelectionMode( + QAbstractItemView.SelectionMode.NoSelection) self.setWindowTitle(self.tr("Active Guards")) def getData(self):
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/QueuesExtension/HgQueuesHeaderDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/QueuesExtension/HgQueuesHeaderDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -30,8 +30,10 @@ super(HgQueuesHeaderDialog, self).__init__(parent) self.setupUi(self) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.vcs = vcs self.__hgClient = vcs.getClient() @@ -71,11 +73,15 @@ Private slot called when the process finished or the user pressed the button. """ - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) - self.buttonBox.button(QDialogButtonBox.Close).setFocus( - Qt.OtherFocusReason) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setFocus( + Qt.FocusReason.OtherFocusReason) def on_buttonBox_clicked(self, button): """ @@ -83,9 +89,13 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() - elif button == self.buttonBox.button(QDialogButtonBox.Cancel): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): if self.__hgClient: self.__hgClient.cancel() else:
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/QueuesExtension/HgQueuesListAllGuardsDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/QueuesExtension/HgQueuesListAllGuardsDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -28,7 +28,7 @@ """ super(HgQueuesListAllGuardsDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) self.vcs = vcs self.__hgClient = vcs.getClient()
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/QueuesExtension/HgQueuesListDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/QueuesExtension/HgQueuesListDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -29,15 +29,18 @@ """ super(HgQueuesListDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.vcs = vcs self.__hgClient = vcs.getClient() - self.patchesList.header().setSortIndicator(0, Qt.AscendingOrder) + self.patchesList.header().setSortIndicator( + 0, Qt.SortOrder.AscendingOrder) self.__statusDict = { "A": self.tr("applied"), @@ -127,11 +130,15 @@ Private slot called when the process finished or the user pressed the button. """ - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) - self.buttonBox.button(QDialogButtonBox.Close).setFocus( - Qt.OtherFocusReason) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setFocus( + Qt.FocusReason.OtherFocusReason) if self.patchesList.topLevelItemCount() == 0: # no patches present @@ -146,9 +153,13 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() - elif button == self.buttonBox.button(QDialogButtonBox.Cancel): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): self.__mode = "" self.__hgClient.cancel() @@ -164,7 +175,8 @@ """ Private method to resize the list columns. """ - self.patchesList.header().resizeSections(QHeaderView.ResizeToContents) + self.patchesList.header().resizeSections( + QHeaderView.ResizeMode.ResizeToContents) self.patchesList.header().setStretchLastSection(True) def __generateItem(self, index, status, name, summary, error=False): @@ -192,21 +204,21 @@ except KeyError: statusStr = self.tr("unknown") itm = QTreeWidgetItem(self.patchesList) - itm.setData(0, Qt.DisplayRole, index) - itm.setData(1, Qt.DisplayRole, name) - itm.setData(2, Qt.DisplayRole, statusStr) - itm.setData(3, Qt.DisplayRole, summary) + itm.setData(0, Qt.ItemDataRole.DisplayRole, index) + itm.setData(1, Qt.ItemDataRole.DisplayRole, name) + itm.setData(2, Qt.ItemDataRole.DisplayRole, statusStr) + itm.setData(3, Qt.ItemDataRole.DisplayRole, summary) if status == "A": # applied for column in range(itm.columnCount()): - itm.setForeground(column, Qt.blue) + itm.setForeground(column, Qt.GlobalColor.blue) elif status == "D": # missing for column in range(itm.columnCount()): - itm.setForeground(column, Qt.red) + itm.setForeground(column, Qt.GlobalColor.red) - itm.setTextAlignment(0, Qt.AlignRight) - itm.setTextAlignment(2, Qt.AlignHCenter) + itm.setTextAlignment(0, Qt.AlignmentFlag.AlignRight) + itm.setTextAlignment(2, Qt.AlignmentFlag.AlignHCenter) def __markTopItem(self, name): """ @@ -214,7 +226,8 @@ @param name name of the patch (string) """ - items = self.patchesList.findItems(name, Qt.MatchCaseSensitive, 1) + items = self.patchesList.findItems( + name, Qt.MatchFlag.MatchCaseSensitive, 1) if items: itm = items[0] for column in range(itm.columnCount()):
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/QueuesExtension/HgQueuesListGuardsDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/QueuesExtension/HgQueuesListGuardsDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -29,7 +29,7 @@ """ super(HgQueuesListGuardsDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) self.vcs = vcs self.__hgClient = vcs.getClient()
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/QueuesExtension/HgQueuesNewPatchDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/QueuesExtension/HgQueuesNewPatchDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -68,7 +68,8 @@ self.userEdit.text() != "") ) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enable) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(enable) @pyqtSlot(str) def on_nameEdit_textChanged(self, txt):
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/QueuesExtension/HgQueuesQueueManagementDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/QueuesExtension/HgQueuesQueueManagementDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -40,7 +40,7 @@ """ super(HgQueuesQueueManagementDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) if mode not in (HgQueuesQueueManagementDialog.NO_INPUT, HgQueuesQueueManagementDialog.NAME_INPUT, @@ -57,22 +57,25 @@ self.selectLabel.setHidden( mode != HgQueuesQueueManagementDialog.QUEUE_INPUT) if mode != HgQueuesQueueManagementDialog.QUEUE_INPUT: - self.queuesList.setSelectionMode(QAbstractItemView.NoSelection) + self.queuesList.setSelectionMode( + QAbstractItemView.SelectionMode.NoSelection) if mode == HgQueuesQueueManagementDialog.NO_INPUT: self.buttonBox.removeButton( - self.buttonBox.button(QDialogButtonBox.Ok)) + self.buttonBox.button(QDialogButtonBox.StandardButton.Ok)) self.buttonBox.removeButton( - self.buttonBox.button(QDialogButtonBox.Cancel)) + self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel)) self.refreshButton = self.buttonBox.addButton( - self.tr("Refresh"), QDialogButtonBox.ActionRole) + self.tr("Refresh"), QDialogButtonBox.ButtonRole.ActionRole) self.refreshButton.setToolTip( self.tr("Press to refresh the queues list")) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) else: self.buttonBox.removeButton( - self.buttonBox.button(QDialogButtonBox.Close)) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) + self.buttonBox.button(QDialogButtonBox.StandardButton.Close)) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) self.refreshButton = None self.setWindowTitle(title) @@ -119,7 +122,8 @@ @param txt text of the edit (string) """ if self.__mode == HgQueuesQueueManagementDialog.NAME_INPUT: - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(txt != "") + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(txt != "") @pyqtSlot() def on_queuesList_itemSelectionChanged(self): @@ -127,8 +131,9 @@ Private slot to handle changes of selected queue names. """ if self.__mode == HgQueuesQueueManagementDialog.QUEUE_INPUT: - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( - len(self.queuesList.selectedItems()) > 0) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled( + len(self.queuesList.selectedItems()) > 0) @pyqtSlot(QAbstractButton) def on_buttonBox_clicked(self, button): @@ -139,7 +144,9 @@ """ if button == self.refreshButton: self.refresh() - elif button == self.buttonBox.button(QDialogButtonBox.Close): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() def refresh(self):
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/QueuesExtension/HgQueuesRenamePatchDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/QueuesExtension/HgQueuesRenamePatchDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -32,7 +32,8 @@ self.tr("Current Patch ({0})").format(currentPatch)) self.nameCombo.addItems([""] + patchesList) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) msh = self.minimumSizeHint() self.resize(max(self.width(), msh.width()), msh.height()) @@ -45,7 +46,8 @@ if self.namedButton.isChecked(): enable = enable and self.nameCombo.currentText() != "" - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enable) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(enable) @pyqtSlot(str) def on_nameEdit_textChanged(self, txt): @@ -65,12 +67,13 @@ """ self.__updateUI() - @pyqtSlot(str) - def on_nameCombo_currentIndexChanged(self, txt): + @pyqtSlot(int) + def on_nameCombo_currentIndexChanged(self, index): """ Private slot to handle changes of the selected patch name. - @param txt selected patch name (string) + @param index current index + @type int """ self.__updateUI()
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/QueuesExtension/queues.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/QueuesExtension/queues.py Tue Mar 02 17:17:09 2021 +0100 @@ -169,7 +169,7 @@ """ from .HgQueuesNewPatchDialog import HgQueuesNewPatchDialog dlg = HgQueuesNewPatchDialog(HgQueuesNewPatchDialog.NEW_MODE) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: (name, message, (userData, currentUser, userName), (dateData, currentDate, dateStr)) = dlg.getData() @@ -212,7 +212,7 @@ from .HgQueuesNewPatchDialog import HgQueuesNewPatchDialog dlg = HgQueuesNewPatchDialog(HgQueuesNewPatchDialog.REFRESH_MODE, currentMessage) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: (name, message, (userData, currentUser, userName), (dateData, currentDate, dateStr)) = dlg.getData() @@ -359,7 +359,7 @@ HgQueuesRenamePatchDialog ) dlg = HgQueuesRenamePatchDialog(currentPatch, patchnames) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: newName, selectedPatch = dlg.getData() if selectedPatch: args.append(selectedPatch) @@ -406,7 +406,7 @@ if patchnames: from .HgQueuesFoldDialog import HgQueuesFoldDialog dlg = HgQueuesFoldDialog(patchnames) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: message, patchesList = dlg.getData() if message: args.append("--message") @@ -512,7 +512,7 @@ ) dlg = HgQueuesGuardsSelectionDialog( guardsList, activeGuards=activeGuardsList, listOnly=False) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: guards = dlg.getData() if guards: args = self.vcs.initCommand("qselect") @@ -569,7 +569,7 @@ dlg = HgQueuesQueueManagementDialog( HgQueuesQueueManagementDialog.NAME_INPUT, title, False, self.vcs) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: queueName = dlg.getData() if queueName: args = self.vcs.initCommand("qqueue") @@ -624,7 +624,7 @@ dlg = HgQueuesQueueManagementDialog( HgQueuesQueueManagementDialog.QUEUE_INPUT, title, True, self.vcs) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: queueName = dlg.getData() if queueName: args = self.vcs.initCommand("qqueue")
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/RebaseExtension/HgRebaseDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/RebaseExtension/HgRebaseDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -77,7 +77,8 @@ elif self.bookmark2Button.isChecked(): enabled = enabled and self.bookmark2Combo.currentText() != "" - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enabled) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(enabled) @pyqtSlot(bool) def on_id1Button_toggled(self, checked):
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/RebaseExtension/rebase.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/RebaseExtension/rebase.py Tue Mar 02 17:17:09 2021 +0100 @@ -37,7 +37,7 @@ self.vcs.hgGetBranchesList(), self.vcs.hgGetBookmarksList(), self.vcs.version) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: (indicator, sourceRev, destRev, collapse, keep, keepBranches, detach, dryRunOnly, dryRunConfirm) = dlg.getData()
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/ShelveExtension/HgShelveBrowserDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/ShelveExtension/HgShelveBrowserDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -36,18 +36,21 @@ super(HgShelveBrowserDialog, self).__init__(parent) self.setupUi(self) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.__position = QPoint() - self.__fileStatisticsRole = Qt.UserRole - self.__totalStatisticsRole = Qt.UserRole + 1 + self.__fileStatisticsRole = Qt.ItemDataRole.UserRole + self.__totalStatisticsRole = Qt.ItemDataRole.UserRole + 1 - self.shelveList.header().setSortIndicator(0, Qt.AscendingOrder) + self.shelveList.header().setSortIndicator( + 0, Qt.SortOrder.AscendingOrder) self.refreshButton = self.buttonBox.addButton( - self.tr("&Refresh"), QDialogButtonBox.ActionRole) + self.tr("&Refresh"), QDialogButtonBox.ButtonRole.ActionRole) self.refreshButton.setToolTip( self.tr("Press to refresh the list of shelves")) self.refreshButton.setEnabled(False) @@ -97,7 +100,8 @@ """ Private method to resize the shelve list columns. """ - self.shelveList.header().resizeSections(QHeaderView.ResizeToContents) + self.shelveList.header().resizeSections( + QHeaderView.ResizeMode.ResizeToContents) self.shelveList.header().setStretchLastSection(True) def __generateShelveEntry(self, name, age, message, fileStatistics, @@ -123,9 +127,12 @@ """ Private method to retrieve the list of shelves. """ - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) QApplication.processEvents() self.buf = [] @@ -163,9 +170,12 @@ Private slot called when the process finished or the user pressed the button. """ - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) self.refreshButton.setEnabled(True) @@ -238,9 +248,13 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() - elif button == self.buttonBox.button(QDialogButtonBox.Cancel): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): self.cancelled = True self.__hgClient.cancel() elif button == self.refreshButton: @@ -259,7 +273,7 @@ for dataSet in current.data(0, self.__fileStatisticsRole): QTreeWidgetItem(self.statisticsList, list(dataSet)) self.statisticsList.header().resizeSections( - QHeaderView.ResizeToContents) + QHeaderView.ResizeMode.ResizeToContents) self.statisticsList.header().setStretchLastSection(True) totals = current.data(0, self.__totalStatisticsRole) @@ -292,9 +306,12 @@ """ Private slot to refresh the list of shelves. """ - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.refreshButton.setEnabled(False)
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/ShelveExtension/HgShelvesSelectionDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/ShelveExtension/HgShelvesSelectionDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -31,14 +31,15 @@ self.message.setText(message) self.shelvesList.addItems(shelveNames) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) @pyqtSlot() def on_shelvesList_itemSelectionChanged(self): """ Private slot to enabled the OK button if items have been selected. """ - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( + self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( len(self.shelvesList.selectedItems()) > 0) def getSelectedShelves(self):
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/ShelveExtension/shelve.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/ShelveExtension/shelve.py Tue Mar 02 17:17:09 2021 +0100 @@ -68,7 +68,7 @@ res = False from .HgShelveDataDialog import HgShelveDataDialog dlg = HgShelveDataDialog(self.vcs.version) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: shelveName, dateTime, message, addRemove, keep = dlg.getData() args = self.vcs.initCommand("shelve") @@ -122,7 +122,7 @@ from .HgUnshelveDataDialog import HgUnshelveDataDialog dlg = HgUnshelveDataDialog(self.__hgGetShelveNamesList(), shelveName=shelveName) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: shelveName, keep = dlg.getData() self.__unshelveKeep = keep # store for potential continue @@ -187,7 +187,7 @@ dlg = HgShelvesSelectionDialog( self.tr("Select the shelves to be deleted:"), self.__hgGetShelveNamesList()) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: shelveNames = dlg.getSelectedShelves() else: return @@ -200,7 +200,7 @@ self.tr("Delete shelves"), self.tr("Do you really want to delete these shelves?"), shelveNames) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: args = self.vcs.initCommand("shelve") args.append("--delete") args.extend(shelveNames)
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/StripExtension/HgStripDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/StripExtension/HgStripDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -63,7 +63,8 @@ elif self.branchButton.isChecked(): enabled = enabled and self.branchCombo.currentText() != "" - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enabled) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(enabled) @pyqtSlot(bool) def on_numberButton_toggled(self, checked):
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/StripExtension/strip.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/StripExtension/strip.py Tue Mar 02 17:17:09 2021 +0100 @@ -41,7 +41,7 @@ self.vcs.hgGetBranchesList(), self.vcs.hgGetBookmarksList(), rev) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: rev, bookmark, force, noBackup, keep = dlg.getData() args = self.vcs.initCommand("strip")
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/hg.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/hg.py Tue Mar 02 17:17:09 2021 +0100 @@ -701,7 +701,7 @@ else: from .HgCopyDialog import HgCopyDialog dlg = HgCopyDialog(name, None, True) - accepted = dlg.exec() == QDialog.Accepted + accepted = dlg.exec() == QDialog.DialogCode.Accepted if accepted: target, force = dlg.getData() @@ -812,7 +812,7 @@ from .HgTagDialog import HgTagDialog dlg = HgTagDialog(self.hgGetTagsList(withType=True), revision, tagName) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: tag, revision, tagOp, force = dlg.getParameters() else: return False @@ -880,7 +880,7 @@ "Do you really want to revert all changes to these files" " or directories?"), names) - yes = dlg.exec() == QDialog.Accepted + yes = dlg.exec() == QDialog.DialogCode.Accepted else: yes = E5MessageBox.yesNo( None, @@ -913,7 +913,7 @@ dlg = HgMergeDialog(self.hgGetTagsList(), self.hgGetBranchesList(), self.hgGetBookmarksList()) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: rev, force = dlg.getParameters() else: return @@ -966,7 +966,7 @@ "Do you really want to re-merge these files" " or directories?"), names) - yes = dlg.exec() == QDialog.Accepted + yes = dlg.exec() == QDialog.DialogCode.Accepted else: yes = E5MessageBox.yesNo( None, @@ -993,7 +993,7 @@ self.hgGetBranchesList(), self.hgGetBookmarksList(), self.tr("Current branch tip")) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: rev = dlg.getRevision() return self.vcsUpdate(name, revision=rev) @@ -1154,7 +1154,7 @@ """ from .HgCommandDialog import HgCommandDialog dlg = HgCommandDialog(self.commandHistory, name) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: command = dlg.getData() commandList = Utilities.parseOptionString(command) @@ -1312,7 +1312,7 @@ from .HgCopyDialog import HgCopyDialog dlg = HgCopyDialog(name) res = False - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: target, force = dlg.getData() args = self.initCommand("copy") @@ -1475,7 +1475,7 @@ dlg = HgRevisionsSelectionDialog(self.hgGetTagsList(), self.hgGetBranchesList(), self.hgGetBookmarksList()) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: revisions = dlg.getRevisions() if self.diff is None: from .HgDiffDialog import HgDiffDialog @@ -1522,7 +1522,7 @@ dlg = HgRevisionsSelectionDialog(self.hgGetTagsList(), self.hgGetBranchesList(), self.hgGetBookmarksList()) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: rev1, rev2 = dlg.getRevisions() else: return @@ -1833,7 +1833,7 @@ """ from .HgBranchInputDialog import HgBranchInputDialog dlg = HgBranchInputDialog(self.hgGetBranchesList()) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: name, commit = dlg.getData() name = name.strip().replace(" ", "_") args = self.initCommand("branch") @@ -1908,7 +1908,7 @@ from .HgRepoConfigDataDialog import HgRepoConfigDataDialog dlg = HgRepoConfigDataDialog(withLargefiles=withLargefiles, largefilesData=largefilesData) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: createContents = True defaultUrl, defaultPushUrl = dlg.getData() if withLargefiles: @@ -2072,7 +2072,7 @@ self.hgGetBranchesList(), self.hgGetBookmarksList(), version=self.version) - if dlg.exec() != QDialog.Accepted: + if dlg.exec() != QDialog.DialogCode.Accepted: return revs, baseRevs, compression, bundleAll = dlg.getParameters() @@ -2216,7 +2216,7 @@ dlg = HgRevisionSelectionDialog(self.hgGetTagsList(), self.hgGetBranchesList(), self.hgGetBookmarksList()) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: rev = dlg.getRevision() else: return @@ -2269,7 +2269,7 @@ dlg = HgBackoutDialog(self.hgGetTagsList(), self.hgGetBranchesList(), self.hgGetBookmarksList()) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: rev, merge, date, user, message = dlg.getParameters() if not rev: E5MessageBox.warning( @@ -2333,7 +2333,7 @@ """ from .HgImportDialog import HgImportDialog dlg = HgImportDialog(self) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: (patchFile, noCommit, message, date, user, withSecret, stripCount, force) = dlg.getParameters() @@ -2378,7 +2378,7 @@ from .HgExportDialog import HgExportDialog dlg = HgExportDialog(self.hgGetBookmarksList(), self.version >= (4, 7, 0)) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: (filePattern, revisions, bookmark, switchParent, allText, noDates, git) = dlg.getParameters() @@ -2418,7 +2418,7 @@ if data is None: from .HgPhaseDialog import HgPhaseDialog dlg = HgPhaseDialog() - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: data = dlg.getData() if data: @@ -2459,7 +2459,7 @@ from .HgGraftDialog import HgGraftDialog res = False dlg = HgGraftDialog(self, revs) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: (revs, (userData, currentUser, userName), (dateData, currentDate, dateStr), @@ -2561,7 +2561,7 @@ """ from .HgArchiveDialog import HgArchiveDialog dlg = HgArchiveDialog(self) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: archive, type_, prefix, subrepos = dlg.getData() args = self.initCommand("archive") @@ -2626,7 +2626,7 @@ ppath = self.__projectHelper.getProject().getProjectPath() hgsub = self.getHgSubPath() dlg = HgAddSubrepositoryDialog(ppath) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: relPath, subrepoType, subrepoUrl = dlg.getData() if subrepoType == "hg": url = subrepoUrl @@ -2714,7 +2714,7 @@ HgRemoveSubrepositoriesDialog ) dlg = HgRemoveSubrepositoriesDialog(subrepositories) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: subrepositories, removedSubrepos, deleteSubrepos = dlg.getData() contents = "\n".join(subrepositories) + "\n" try: @@ -3043,7 +3043,7 @@ self.hgGetTagsList(), self.hgGetBranchesList(), self.hgGetBookmarksList()) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: revision, bookmark = dlg.getData() ok = True else: @@ -3096,7 +3096,7 @@ if not renameInfo: from .HgBookmarkRenameDialog import HgBookmarkRenameDialog dlg = HgBookmarkRenameDialog(self.hgGetBookmarksList()) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: renameInfo = dlg.getData() if renameInfo: @@ -3125,7 +3125,7 @@ self.hgGetTagsList(), self.hgGetBranchesList(), self.hgGetBookmarksList()) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: revision, bookmark = dlg.getData() ok = True else:
--- a/eric6/Plugins/VcsPlugins/vcsPySvn/SvnBlameDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsPySvn/SvnBlameDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -38,10 +38,12 @@ super(SvnBlameDialog, self).__init__(parent) self.setupUi(self) SvnDialogMixin.__init__(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.vcs = vcs @@ -89,9 +91,12 @@ Private slot called when the process finished or the user pressed the button. """ - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) self.__resizeColumns() @@ -103,16 +108,21 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() - elif button == self.buttonBox.button(QDialogButtonBox.Cancel): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): self.__finish() def __resizeColumns(self): """ Private method to resize the list columns. """ - self.blameList.header().resizeSections(QHeaderView.ResizeToContents) + self.blameList.header().resizeSections( + QHeaderView.ResizeMode.ResizeToContents) def __generateItem(self, revision, author, lineno, text): """ @@ -126,8 +136,8 @@ itm = QTreeWidgetItem( self.blameList, ["{0:d}".format(revision), author, "{0:d}".format(lineno), text]) - itm.setTextAlignment(0, Qt.AlignRight) - itm.setTextAlignment(2, Qt.AlignRight) + itm.setTextAlignment(0, Qt.AlignmentFlag.AlignRight) + itm.setTextAlignment(2, Qt.AlignmentFlag.AlignRight) def __showError(self, msg): """
--- a/eric6/Plugins/VcsPlugins/vcsPySvn/SvnChangeListsDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsPySvn/SvnChangeListsDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -37,10 +37,12 @@ super(SvnChangeListsDialog, self).__init__(parent) self.setupUi(self) SvnDialogMixin.__init__(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.vcs = vcs @@ -101,17 +103,21 @@ """ self.changeLists.addItems(sorted(self.changeListsDict.keys())) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) if len(self.changeListsDict) == 0: self.changeLists.addItem(self.tr("No changelists found")) - self.buttonBox.button(QDialogButtonBox.Close).setFocus( - Qt.OtherFocusReason) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setFocus( + Qt.FocusReason.OtherFocusReason) else: self.changeLists.setCurrentRow(0) - self.changeLists.setFocus(Qt.OtherFocusReason) + self.changeLists.setFocus(Qt.FocusReason.OtherFocusReason) def on_buttonBox_clicked(self, button): """ @@ -119,8 +125,12 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() - elif button == self.buttonBox.button(QDialogButtonBox.Cancel): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): self.cancelled = True self.__finish()
--- a/eric6/Plugins/VcsPlugins/vcsPySvn/SvnCommandDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsPySvn/SvnCommandDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -38,7 +38,8 @@ self.workdirPicker.setMode(E5PathPickerModes.DirectoryMode) - self.okButton = self.buttonBox.button(QDialogButtonBox.Ok) + self.okButton = self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok) self.okButton.setEnabled(False) self.commandCombo.clear()
--- a/eric6/Plugins/VcsPlugins/vcsPySvn/SvnCommitDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsPySvn/SvnCommitDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -35,7 +35,7 @@ @param parent parent widget (QWidget) """ super(SvnCommitDialog, self).__init__( - parent, Qt.WindowFlags(Qt.Window)) + parent, Qt.WindowFlags(Qt.WindowType.Window)) self.setupUi(self) if pysvn.svn_version < (1, 5, 0) or pysvn.version < (1, 6, 0): @@ -55,7 +55,7 @@ self.recentComboBox.addItem("") self.recentComboBox.addItems(self.recentCommitMessages) - self.logEdit.setFocus(Qt.OtherFocusReason) + self.logEdit.setFocus(Qt.FocusReason.OtherFocusReason) def logMessage(self): """ @@ -108,7 +108,9 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Cancel): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): self.logEdit.clear() def on_buttonBox_accepted(self):
--- a/eric6/Plugins/VcsPlugins/vcsPySvn/SvnCopyDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsPySvn/SvnCopyDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -48,7 +48,8 @@ self.sourceEdit.setText(source) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) msh = self.minimumSizeHint() self.resize(max(self.width(), msh.width()), msh.height()) @@ -73,5 +74,5 @@ @param txt contents of the target edit (string) """ - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( + self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( os.path.isabs(txt) or os.path.dirname(txt) == "")
--- a/eric6/Plugins/VcsPlugins/vcsPySvn/SvnDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsPySvn/SvnDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -38,10 +38,12 @@ super(SvnDialog, self).__init__(parent) self.setupUi(self) SvnDialogMixin.__init__(self, log) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.outputGroup.setTitle(text) self.errorGroup.hide() @@ -128,9 +130,12 @@ Public slot called when the process finished or the user pressed the button. """ - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) self._cancel() @@ -143,9 +148,13 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() - elif button == self.buttonBox.button(QDialogButtonBox.Cancel): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): self.finish() def hasAddOrDelete(self):
--- a/eric6/Plugins/VcsPlugins/vcsPySvn/SvnDialogMixin.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsPySvn/SvnDialogMixin.py Tue Mar 02 17:17:09 2021 +0100 @@ -69,7 +69,7 @@ dlg = SvnLoginDialog(realm, username, may_save, parent) res = dlg.exec() - if res == QDialog.Accepted: + if res == QDialog.DialogCode.Accepted: loginData = dlg.getData() return (True, loginData[0], loginData[1], loginData[2]) else: @@ -135,7 +135,7 @@ else: # call CommitDialog and get message from there dlg = SvnCommitDialog(self) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: msg = dlg.logMessage() if msg: return True, msg
--- a/eric6/Plugins/VcsPlugins/vcsPySvn/SvnDiffDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsPySvn/SvnDiffDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -46,13 +46,16 @@ SvnDialogMixin.__init__(self) self.refreshButton = self.buttonBox.addButton( - self.tr("Refresh"), QDialogButtonBox.ActionRole) + self.tr("Refresh"), QDialogButtonBox.ButtonRole.ActionRole) self.refreshButton.setToolTip( self.tr("Press to refresh the display")) self.refreshButton.setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Save).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Save).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.searchWidget.attachTextEdit(self.contents) @@ -82,7 +85,8 @@ return pysvn.Revision(pysvn.opt_revision_kind.number, version) elif version.startswith("{"): dateStr = version[1:-1] - secs = QDateTime.fromString(dateStr, Qt.ISODate).toTime_t() + secs = QDateTime.fromString( + dateStr, Qt.DateFormat.ISODate).toTime_t() return pysvn.Revision(pysvn.opt_revision_kind.date, secs) elif version == "HEAD": return pysvn.Revision(pysvn.opt_revision_kind.head) @@ -131,10 +135,14 @@ """ self.refreshButton.setVisible(refreshable) - self.buttonBox.button(QDialogButtonBox.Save).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Save).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self._reset() self.errorGroup.hide() @@ -270,7 +278,8 @@ if self.paras == 0: self.contents.setPlainText(self.tr('There is no difference.')) - self.buttonBox.button(QDialogButtonBox.Save).setEnabled(self.paras > 0) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Save).setEnabled(self.paras > 0) def __appendText(self, line): """ @@ -279,7 +288,7 @@ @param line line of text to insert (string) """ tc = self.contents.textCursor() - tc.movePosition(QTextCursor.End) + tc.movePosition(QTextCursor.MoveOperation.End) self.contents.setTextCursor(tc) self.contents.insertPlainText(line) self.paras += 1 @@ -314,13 +323,17 @@ Private slot called when the user pressed the button. """ self.refreshButton.setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) tc = self.contents.textCursor() - tc.movePosition(QTextCursor.Start) + tc.movePosition(QTextCursor.MoveOperation.Start) self.contents.setTextCursor(tc) self.contents.ensureCursorVisible() @@ -341,11 +354,17 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() - elif button == self.buttonBox.button(QDialogButtonBox.Cancel): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): self.__finish() - elif button == self.buttonBox.button(QDialogButtonBox.Save): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Save + ): self.on_saveButton_clicked() elif button == self.refreshButton: self.on_refreshButton_clicked() @@ -361,26 +380,28 @@ if para == 0: tc = self.contents.textCursor() - tc.movePosition(QTextCursor.Start) + tc.movePosition(QTextCursor.MoveOperation.Start) self.contents.setTextCursor(tc) self.contents.ensureCursorVisible() elif para == -1: tc = self.contents.textCursor() - tc.movePosition(QTextCursor.End) + tc.movePosition(QTextCursor.MoveOperation.End) self.contents.setTextCursor(tc) self.contents.ensureCursorVisible() else: # step 1: move cursor to end tc = self.contents.textCursor() - tc.movePosition(QTextCursor.End) + tc.movePosition(QTextCursor.MoveOperation.End) self.contents.setTextCursor(tc) self.contents.ensureCursorVisible() # step 2: move cursor to desired line tc = self.contents.textCursor() delta = tc.blockNumber() - para - tc.movePosition(QTextCursor.PreviousBlock, QTextCursor.MoveAnchor, - delta) + tc.movePosition( + QTextCursor.MoveOperation.PreviousBlock, + QTextCursor.MoveMode.MoveAnchor, + delta) self.contents.setTextCursor(tc) self.contents.ensureCursorVisible() @@ -448,9 +469,11 @@ """ Private slot to refresh the display. """ - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Save).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Save).setEnabled(False) self.refreshButton.setEnabled(False) self.start(self.filename, refreshable=True)
--- a/eric6/Plugins/VcsPlugins/vcsPySvn/SvnInfoDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsPySvn/SvnInfoDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -37,7 +37,7 @@ super(SvnInfoDialog, self).__init__(parent) self.setupUi(self) SvnDialogMixin.__init__(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) self.vcs = vcs
--- a/eric6/Plugins/VcsPlugins/vcsPySvn/SvnLogBrowserDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsPySvn/SvnLogBrowserDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -47,14 +47,17 @@ self.__position = QPoint() - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.upButton.setIcon(UI.PixmapCache.getIcon("1uparrow")) self.downButton.setIcon(UI.PixmapCache.getIcon("1downarrow")) self.filesTree.headerItem().setText(self.filesTree.columnCount(), "") - self.filesTree.header().setSortIndicator(0, Qt.AscendingOrder) + self.filesTree.header().setSortIndicator( + 0, Qt.SortOrder.AscendingOrder) self.vcs = vcs @@ -64,8 +67,8 @@ self.toDate.setDisplayFormat("yyyy-MM-dd") self.__resetUI() - self.__messageRole = Qt.UserRole - self.__changesRole = Qt.UserRole + 1 + self.__messageRole = Qt.ItemDataRole.UserRole + self.__changesRole = Qt.ItemDataRole.UserRole + 1 self.flags = { 'A': self.tr('Added'), @@ -143,16 +146,20 @@ self.cancelled = False - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) QApplication.processEvents() def __resizeColumnsLog(self): """ Private method to resize the log tree columns. """ - self.logTree.header().resizeSections(QHeaderView.ResizeToContents) + self.logTree.header().resizeSections( + QHeaderView.ResizeMode.ResizeToContents) self.logTree.header().setStretchLastSection(True) def __resortLog(self): @@ -167,7 +174,8 @@ """ Private method to resize the changed files tree columns. """ - self.filesTree.header().resizeSections(QHeaderView.ResizeToContents) + self.filesTree.header().resizeSections( + QHeaderView.ResizeMode.ResizeToContents) self.filesTree.header().setStretchLastSection(True) def __resortFiles(self): @@ -204,10 +212,11 @@ dt = formatTime(date) itm = QTreeWidgetItem(self.logTree) - itm.setData(0, Qt.DisplayRole, rev) - itm.setData(1, Qt.DisplayRole, author) - itm.setData(2, Qt.DisplayRole, dt) - itm.setData(3, Qt.DisplayRole, " ".join(message.splitlines())) + itm.setData(0, Qt.ItemDataRole.DisplayRole, rev) + itm.setData(1, Qt.ItemDataRole.DisplayRole, author) + itm.setData(2, Qt.ItemDataRole.DisplayRole, dt) + itm.setData(3, Qt.ItemDataRole.DisplayRole, + " ".join(message.splitlines())) changes = [] for changedPath in changedPaths: @@ -230,11 +239,11 @@ itm.setData(0, self.__messageRole, message) itm.setData(0, self.__changesRole, changes) - itm.setTextAlignment(0, Qt.AlignRight) - itm.setTextAlignment(1, Qt.AlignLeft) - itm.setTextAlignment(2, Qt.AlignLeft) - itm.setTextAlignment(3, Qt.AlignLeft) - itm.setTextAlignment(4, Qt.AlignLeft) + itm.setTextAlignment(0, Qt.AlignmentFlag.AlignRight) + itm.setTextAlignment(1, Qt.AlignmentFlag.AlignLeft) + itm.setTextAlignment(2, Qt.AlignmentFlag.AlignLeft) + itm.setTextAlignment(3, Qt.AlignmentFlag.AlignLeft) + itm.setTextAlignment(4, Qt.AlignmentFlag.AlignLeft) return itm @@ -253,7 +262,7 @@ [self.flags[action], path, copyFrom, copyRev] ) - itm.setTextAlignment(3, Qt.AlignRight) + itm.setTextAlignment(3, Qt.AlignmentFlag.AlignRight) return itm @@ -371,9 +380,12 @@ """ Private slot called when the user pressed the button. """ - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) self._cancel() @@ -403,9 +415,13 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() - elif button == self.buttonBox.button(QDialogButtonBox.Cancel): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): self.cancelled = True self.__finish()
--- a/eric6/Plugins/VcsPlugins/vcsPySvn/SvnMergeDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsPySvn/SvnMergeDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -36,7 +36,8 @@ self.forceCheckBox.setChecked(force) - self.okButton = self.buttonBox.button(QDialogButtonBox.Ok) + self.okButton = self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok) self.okButton.setEnabled(False) self.rx_url = re.compile('(?:file:|svn:|svn+ssh:|http:|https:)//.+')
--- a/eric6/Plugins/VcsPlugins/vcsPySvn/SvnNewProjectOptionsDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsPySvn/SvnNewProjectOptionsDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -64,7 +64,8 @@ self.resize(self.width(), self.minimumSizeHint().height()) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) msh = self.minimumSizeHint() self.resize(max(self.width(), msh.width()), msh.height()) @@ -76,7 +77,7 @@ @param txt name of the project directory (string) """ - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( + self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( bool(txt) and Utilities.fromNativeSeparators(txt) not in self.__initPaths) @@ -89,7 +90,7 @@ dlg = SvnRepoBrowserDialog(self.vcs, mode="select", parent=self) dlg.start( self.protocolCombo.currentText() + self.vcsUrlPicker.text()) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: url = dlg.getSelectedUrl() if url: protocol = url.split("://")[0] @@ -138,7 +139,8 @@ @param txt current text of the line edit (string) """ enable = "://" not in txt - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enable) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(enable) def getData(self): """
--- a/eric6/Plugins/VcsPlugins/vcsPySvn/SvnOptionsDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsPySvn/SvnOptionsDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -65,7 +65,7 @@ dlg = SvnRepoBrowserDialog(self.vcs, mode="select", parent=self) dlg.start( self.protocolCombo.currentText() + self.vcsUrlPicker.text()) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: url = dlg.getSelectedUrl() if url: protocol = url.split("://")[0] @@ -101,7 +101,8 @@ @param txt current text of the line edit (string) """ enable = "://" not in txt - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enable) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(enable) def getData(self): """
--- a/eric6/Plugins/VcsPlugins/vcsPySvn/SvnPropDelDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsPySvn/SvnPropDelDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -26,7 +26,8 @@ super(SvnPropDelDialog, self).__init__(parent) self.setupUi(self) - self.okButton = self.buttonBox.button(QDialogButtonBox.Ok) + self.okButton = self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok) self.okButton.setEnabled(False) self.recurseCheckBox.setChecked(recursive)
--- a/eric6/Plugins/VcsPlugins/vcsPySvn/SvnPropListDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsPySvn/SvnPropListDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -40,17 +40,20 @@ SvnDialogMixin.__init__(self) self.refreshButton = self.buttonBox.addButton( - self.tr("Refresh"), QDialogButtonBox.ActionRole) + self.tr("Refresh"), QDialogButtonBox.ButtonRole.ActionRole) self.refreshButton.setToolTip( self.tr("Press to refresh the properties display")) self.refreshButton.setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.vcs = vcs self.propsList.headerItem().setText(self.propsList.columnCount(), "") - self.propsList.header().setSortIndicator(0, Qt.AscendingOrder) + self.propsList.header().setSortIndicator( + 0, Qt.SortOrder.AscendingOrder) self.client = self.vcs.getClient() self.client.callback_cancel = self._clientCancelCallback @@ -71,7 +74,8 @@ """ Private method to resize the list columns. """ - self.propsList.header().resizeSections(QHeaderView.ResizeToContents) + self.propsList.header().resizeSections( + QHeaderView.ResizeMode.ResizeToContents) self.propsList.header().setStretchLastSection(True) def __generateItem(self, path, propName, propValue): @@ -98,9 +102,12 @@ self.__args = fn self.__recursive = recursive - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.refreshButton.setEnabled(False) QApplication.processEvents() @@ -147,9 +154,12 @@ self.__resort() self.__resizeColumns() - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) self.refreshButton.setEnabled(True) @@ -161,9 +171,13 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() - elif button == self.buttonBox.button(QDialogButtonBox.Cancel): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): self.__finish() elif button == self.refreshButton: self.on_refreshButton_clicked()
--- a/eric6/Plugins/VcsPlugins/vcsPySvn/SvnRepoBrowserDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsPySvn/SvnRepoBrowserDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -42,25 +42,27 @@ super(SvnRepoBrowserDialog, self).__init__(parent) self.setupUi(self) SvnDialogMixin.__init__(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) self.repoTree.headerItem().setText(self.repoTree.columnCount(), "") - self.repoTree.header().setSortIndicator(0, Qt.AscendingOrder) + self.repoTree.header().setSortIndicator(0, Qt.SortOrder.AscendingOrder) self.vcs = vcs self.mode = mode if self.mode == "select": - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).hide() + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) + self.buttonBox.button(QDialogButtonBox.StandardButton.Close).hide() else: - self.buttonBox.button(QDialogButtonBox.Ok).hide() - self.buttonBox.button(QDialogButtonBox.Cancel).hide() + self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).hide() + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).hide() self.__dirIcon = UI.PixmapCache.getIcon("dirClosed") self.__fileIcon = UI.PixmapCache.getIcon("fileMisc") - self.__urlRole = Qt.UserRole + self.__urlRole = Qt.ItemDataRole.UserRole self.__ignoreExpand = False self.client = self.vcs.getClient() @@ -85,7 +87,8 @@ """ Private method to resize the tree columns. """ - self.repoTree.header().resizeSections(QHeaderView.ResizeToContents) + self.repoTree.header().resizeSections( + QHeaderView.ResizeMode.ResizeToContents) self.repoTree.header().setStretchLastSection(True) def __generateItem(self, parent, repopath, revision, author, size, date, @@ -121,25 +124,26 @@ author = "" itm = QTreeWidgetItem(parent) - itm.setData(0, Qt.DisplayRole, path) - itm.setData(1, Qt.DisplayRole, rev) - itm.setData(2, Qt.DisplayRole, author) - itm.setData(3, Qt.DisplayRole, size) - itm.setData(4, Qt.DisplayRole, dt) + itm.setData(0, Qt.ItemDataRole.DisplayRole, path) + itm.setData(1, Qt.ItemDataRole.DisplayRole, rev) + itm.setData(2, Qt.ItemDataRole.DisplayRole, author) + itm.setData(3, Qt.ItemDataRole.DisplayRole, size) + itm.setData(4, Qt.ItemDataRole.DisplayRole, dt) if nodekind == pysvn.node_kind.dir: itm.setIcon(0, self.__dirIcon) - itm.setChildIndicatorPolicy(QTreeWidgetItem.ShowIndicator) + itm.setChildIndicatorPolicy( + QTreeWidgetItem.ChildIndicatorPolicy.ShowIndicator) elif nodekind == pysvn.node_kind.file: itm.setIcon(0, self.__fileIcon) itm.setData(0, self.__urlRole, url) - itm.setTextAlignment(0, Qt.AlignLeft) - itm.setTextAlignment(1, Qt.AlignRight) - itm.setTextAlignment(2, Qt.AlignLeft) - itm.setTextAlignment(3, Qt.AlignRight) - itm.setTextAlignment(4, Qt.AlignLeft) + itm.setTextAlignment(0, Qt.AlignmentFlag.AlignLeft) + itm.setTextAlignment(1, Qt.AlignmentFlag.AlignRight) + itm.setTextAlignment(2, Qt.AlignmentFlag.AlignLeft) + itm.setTextAlignment(3, Qt.AlignmentFlag.AlignRight) + itm.setTextAlignment(4, Qt.AlignmentFlag.AlignLeft) return itm @@ -230,13 +234,15 @@ if self.urlCombo.findText(url) == -1: self.urlCombo.addItem(url) - @pyqtSlot(str) - def on_urlCombo_currentIndexChanged(self, text): + @pyqtSlot(int) + def on_urlCombo_currentIndexChanged(self, index): """ Private slot called, when a new repository URL is entered or selected. - @param text the text of the current item (string) + @param index of the current item + @type int """ + text = self.urlCombo.itemText(index) url = self.__normalizeUrl(text) if url != self.url: self.url = url @@ -270,7 +276,8 @@ Private slot called when the selection changes. """ if self.mode == "select": - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(True) def __showError(self, msg): """
--- a/eric6/Plugins/VcsPlugins/vcsPySvn/SvnRevisionSelectionDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsPySvn/SvnRevisionSelectionDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -68,7 +68,7 @@ elif dateButton.isChecked(): return "{{{0}}}".format( QDateTime(dateEdit.date(), timeEdit.time()) - .toString(Qt.ISODate)) + .toString(Qt.DateFormat.ISODate)) elif headButton.isChecked(): return "HEAD" elif workingButton.isChecked():
--- a/eric6/Plugins/VcsPlugins/vcsPySvn/SvnStatusDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsPySvn/SvnStatusDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -62,12 +62,14 @@ self.__lastColumn = self.statusList.columnCount() self.refreshButton = self.buttonBox.addButton( - self.tr("Refresh"), QDialogButtonBox.ActionRole) + self.tr("Refresh"), QDialogButtonBox.ButtonRole.ActionRole) self.refreshButton.setToolTip( self.tr("Press to refresh the status display")) self.refreshButton.setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.diff = None self.vcs = vcs @@ -75,7 +77,7 @@ self.statusList.headerItem().setText(self.__lastColumn, "") self.statusList.header().setSortIndicator(self.__pathColumn, - Qt.AscendingOrder) + Qt.SortOrder.AscendingOrder) if pysvn.svn_version < (1, 5, 0) or pysvn.version < (1, 6, 0): self.statusList.header().hideSection(self.__changelistColumn) @@ -124,7 +126,8 @@ for act in self.menuactions: act.setEnabled(False) - self.statusList.setContextMenuPolicy(Qt.CustomContextMenu) + self.statusList.setContextMenuPolicy( + Qt.ContextMenuPolicy.CustomContextMenu) self.statusList.customContextMenuRequested.connect( self.__showContextMenu) @@ -190,7 +193,8 @@ """ Private method to resize the list columns. """ - self.statusList.header().resizeSections(QHeaderView.ResizeToContents) + self.statusList.header().resizeSections( + QHeaderView.ResizeMode.ResizeToContents) self.statusList.header().setStretchLastSection(True) def __generateItem(self, changelist, status, propStatus, locked, history, @@ -214,32 +218,33 @@ """ statusText = self.tr(svnStatusMap[status]) itm = QTreeWidgetItem(self.statusList) - itm.setData(0, Qt.DisplayRole, "") - itm.setData(1, Qt.DisplayRole, changelist) - itm.setData(2, Qt.DisplayRole, statusText) - itm.setData(3, Qt.DisplayRole, self.tr(svnStatusMap[propStatus])) - itm.setData(4, Qt.DisplayRole, self.yesno[locked]) - itm.setData(5, Qt.DisplayRole, self.yesno[history]) - itm.setData(6, Qt.DisplayRole, self.yesno[switched]) - itm.setData(7, Qt.DisplayRole, self.lockinfo[lockinfo]) - itm.setData(8, Qt.DisplayRole, self.yesno[uptodate]) - itm.setData(9, Qt.DisplayRole, revision) - itm.setData(10, Qt.DisplayRole, change) - itm.setData(11, Qt.DisplayRole, author) - itm.setData(12, Qt.DisplayRole, path) + itm.setData(0, Qt.ItemDataRole.DisplayRole, "") + itm.setData(1, Qt.ItemDataRole.DisplayRole, changelist) + itm.setData(2, Qt.ItemDataRole.DisplayRole, statusText) + itm.setData(3, Qt.ItemDataRole.DisplayRole, + self.tr(svnStatusMap[propStatus])) + itm.setData(4, Qt.ItemDataRole.DisplayRole, self.yesno[locked]) + itm.setData(5, Qt.ItemDataRole.DisplayRole, self.yesno[history]) + itm.setData(6, Qt.ItemDataRole.DisplayRole, self.yesno[switched]) + itm.setData(7, Qt.ItemDataRole.DisplayRole, self.lockinfo[lockinfo]) + itm.setData(8, Qt.ItemDataRole.DisplayRole, self.yesno[uptodate]) + itm.setData(9, Qt.ItemDataRole.DisplayRole, revision) + itm.setData(10, Qt.ItemDataRole.DisplayRole, change) + itm.setData(11, Qt.ItemDataRole.DisplayRole, author) + itm.setData(12, Qt.ItemDataRole.DisplayRole, path) - itm.setTextAlignment(1, Qt.AlignLeft) - itm.setTextAlignment(2, Qt.AlignHCenter) - itm.setTextAlignment(3, Qt.AlignHCenter) - itm.setTextAlignment(4, Qt.AlignHCenter) - itm.setTextAlignment(5, Qt.AlignHCenter) - itm.setTextAlignment(6, Qt.AlignHCenter) - itm.setTextAlignment(7, Qt.AlignHCenter) - itm.setTextAlignment(8, Qt.AlignHCenter) - itm.setTextAlignment(9, Qt.AlignRight) - itm.setTextAlignment(10, Qt.AlignRight) - itm.setTextAlignment(11, Qt.AlignLeft) - itm.setTextAlignment(12, Qt.AlignLeft) + itm.setTextAlignment(1, Qt.AlignmentFlag.AlignLeft) + itm.setTextAlignment(2, Qt.AlignmentFlag.AlignHCenter) + itm.setTextAlignment(3, Qt.AlignmentFlag.AlignHCenter) + itm.setTextAlignment(4, Qt.AlignmentFlag.AlignHCenter) + itm.setTextAlignment(5, Qt.AlignmentFlag.AlignHCenter) + itm.setTextAlignment(6, Qt.AlignmentFlag.AlignHCenter) + itm.setTextAlignment(7, Qt.AlignmentFlag.AlignHCenter) + itm.setTextAlignment(8, Qt.AlignmentFlag.AlignHCenter) + itm.setTextAlignment(9, Qt.AlignmentFlag.AlignRight) + itm.setTextAlignment(10, Qt.AlignmentFlag.AlignRight) + itm.setTextAlignment(11, Qt.AlignmentFlag.AlignLeft) + itm.setTextAlignment(12, Qt.AlignmentFlag.AlignLeft) if ( status in [pysvn.wc_status_kind.added, @@ -249,10 +254,11 @@ pysvn.wc_status_kind.deleted, pysvn.wc_status_kind.modified] ): - itm.setFlags(itm.flags() | Qt.ItemIsUserCheckable) - itm.setCheckState(self.__toBeCommittedColumn, Qt.Checked) + itm.setFlags(itm.flags() | Qt.ItemFlag.ItemIsUserCheckable) + itm.setCheckState(self.__toBeCommittedColumn, + Qt.CheckState.Checked) else: - itm.setFlags(itm.flags() & ~Qt.ItemIsUserCheckable) + itm.setFlags(itm.flags() & ~Qt.ItemFlag.ItemIsUserCheckable) if statusText not in self.__statusFilters: self.__statusFilters.append(statusText) @@ -281,9 +287,12 @@ self.statusList.clear() self.shouldCancel = False - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.refreshButton.setEnabled(False) self.args = fn @@ -464,9 +473,12 @@ Private slot called when the process finished or the user pressed the button. """ - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) self.refreshButton.setEnabled(True) self.__updateButtons() @@ -490,9 +502,13 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() - elif button == self.buttonBox.button(QDialogButtonBox.Cancel): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): self.__finish() elif button == self.refreshButton: self.on_refreshButton_clicked() @@ -888,7 +904,10 @@ commitableItems = [] for index in range(self.statusList.topLevelItemCount()): itm = self.statusList.topLevelItem(index) - if itm.checkState(self.__toBeCommittedColumn) == Qt.Checked: + if ( + itm.checkState(self.__toBeCommittedColumn) == + Qt.CheckState.Checked + ): commitableItems.append(itm) return commitableItems @@ -979,8 +998,10 @@ """ for index in range(self.statusList.topLevelItemCount()): itm = self.statusList.topLevelItem(index) - if itm.flags() & Qt.ItemIsUserCheckable: + if itm.flags() & Qt.ItemFlag.ItemIsUserCheckable: if selected: - itm.setCheckState(self.__toBeCommittedColumn, Qt.Checked) + itm.setCheckState( + self.__toBeCommittedColumn, Qt.CheckState.Checked) else: - itm.setCheckState(self.__toBeCommittedColumn, Qt.Unchecked) + itm.setCheckState( + self.__toBeCommittedColumn, Qt.CheckState.Unchecked)
--- a/eric6/Plugins/VcsPlugins/vcsPySvn/SvnTagBranchListDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsPySvn/SvnTagBranchListDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -43,15 +43,17 @@ super(SvnTagBranchListDialog, self).__init__(parent) self.setupUi(self) SvnDialogMixin.__init__(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.vcs = vcs self.tagList.headerItem().setText(self.tagList.columnCount(), "") - self.tagList.header().setSortIndicator(3, Qt.AscendingOrder) + self.tagList.header().setSortIndicator(3, Qt.SortOrder.AscendingOrder) self.client = self.vcs.getClient() self.client.callback_cancel = self._clientCancelCallback @@ -118,7 +120,7 @@ self.tr("Subversion List"), self.tr("Enter the repository URL containing the" " tags or branches"), - QLineEdit.Normal, + QLineEdit.EchoMode.Normal, self.vcs.svnNormalizeURL(reposURL)) if not ok: self.close() @@ -170,9 +172,12 @@ Private slot called when the process finished or the user pressed the button. """ - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) self.__resizeColumns() self.__resort() @@ -185,9 +190,13 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() - elif button == self.buttonBox.button(QDialogButtonBox.Cancel): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): self.__finish() def __showError(self, msg): @@ -212,7 +221,8 @@ """ Private method to resize the list columns. """ - self.tagList.header().resizeSections(QHeaderView.ResizeToContents) + self.tagList.header().resizeSections( + QHeaderView.ResizeMode.ResizeToContents) self.tagList.header().setStretchLastSection(True) def __generateItem(self, revision, author, date, name): @@ -225,11 +235,11 @@ @param name name (path) of the tag (string) """ itm = QTreeWidgetItem(self.tagList) - itm.setData(0, Qt.DisplayRole, revision) - itm.setData(1, Qt.DisplayRole, author) - itm.setData(2, Qt.DisplayRole, date) - itm.setData(3, Qt.DisplayRole, name) - itm.setTextAlignment(0, Qt.AlignRight) + itm.setData(0, Qt.ItemDataRole.DisplayRole, revision) + itm.setData(1, Qt.ItemDataRole.DisplayRole, author) + itm.setData(2, Qt.ItemDataRole.DisplayRole, date) + itm.setData(3, Qt.ItemDataRole.DisplayRole, name) + itm.setTextAlignment(0, Qt.AlignmentFlag.AlignRight) def getTagList(self): """
--- a/eric6/Plugins/VcsPlugins/vcsPySvn/SvnTagDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsPySvn/SvnTagDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -30,7 +30,8 @@ super(SvnTagDialog, self).__init__(parent) self.setupUi(self) - self.okButton = self.buttonBox.button(QDialogButtonBox.Ok) + self.okButton = self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok) self.okButton.setEnabled(False) self.tagCombo.clear()
--- a/eric6/Plugins/VcsPlugins/vcsPySvn/SvnUrlSelectionDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsPySvn/SvnUrlSelectionDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -123,22 +123,26 @@ labelCombo.addItems(sorted(self.branchesList)) labelCombo.setEnabled(True) - @pyqtSlot(str) - def on_typeCombo1_currentIndexChanged(self, type_): + @pyqtSlot(int) + def on_typeCombo1_currentIndexChanged(self, index): """ Private slot called when the selected type was changed. - @param type_ selected type (string) + @param index index of the current item + @type int """ + type_ = self.typeCombo1.itemText(index) self.__changeLabelCombo(self.labelCombo1, type_) - @pyqtSlot(str) - def on_typeCombo2_currentIndexChanged(self, type_): + @pyqtSlot(int) + def on_typeCombo2_currentIndexChanged(self, index): """ Private slot called when the selected type was changed. - @param type_ selected type (string) + @param index index of the current item + @type int """ + type_ = self.typeCombo2.itemText(index) self.__changeLabelCombo(self.labelCombo2, type_) def getURLs(self):
--- a/eric6/Plugins/VcsPlugins/vcsPySvn/SvnUtilities.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsPySvn/SvnUtilities.py Tue Mar 02 17:17:09 2021 +0100 @@ -25,7 +25,7 @@ """ return ( QDateTime.fromTime_t(int(seconds)) - .toTimeSpec(Qt.LocalTime) + .toTimeSpec(Qt.TimeSpec.LocalTime) .toString("yyyy-MM-dd hh:mm:ss") ) @@ -37,7 +37,8 @@ @param seconds time in seconds since epoch to be formatted (float or long) @return date (QDate) """ - return QDateTime.fromTime_t(int(seconds)).toTimeSpec(Qt.LocalTime).date() + return QDateTime.fromTime_t(int(seconds)).toTimeSpec( + Qt.TimeSpec.LocalTime).date() def getServersPath():
--- a/eric6/Plugins/VcsPlugins/vcsPySvn/subversion.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsPySvn/subversion.py Tue Mar 02 17:17:09 2021 +0100 @@ -928,7 +928,7 @@ else: from .SvnCopyDialog import SvnCopyDialog dlg = SvnCopyDialog(name, None, True, "--force" in opts) - accepted = (dlg.exec() == QDialog.Accepted) + accepted = (dlg.exec() == QDialog.DialogCode.Accepted) if accepted: target, force = dlg.getData() if not target: @@ -1056,7 +1056,7 @@ from .SvnTagDialog import SvnTagDialog dlg = SvnTagDialog(self.allTagsBranchesList, url, self.otherData["standardLayout"]) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: tag, tagOp = dlg.getParameters() if tag in self.allTagsBranchesList: self.allTagsBranchesList.remove(tag) @@ -1145,7 +1145,7 @@ "Do you really want to revert all changes to these files" " or directories?"), name) - yes = dia.exec() == QDialog.Accepted + yes = dia.exec() == QDialog.DialogCode.Accepted else: yes = E5MessageBox.yesNo( None, @@ -1198,7 +1198,7 @@ from .SvnSwitchDialog import SvnSwitchDialog dlg = SvnSwitchDialog(self.allTagsBranchesList, url, self.otherData["standardLayout"]) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: tag, tagType = dlg.getParameters() if tag in self.allTagsBranchesList: self.allTagsBranchesList.remove(tag) @@ -1261,7 +1261,7 @@ from .SvnMergeDialog import SvnMergeDialog dlg = SvnMergeDialog(self.mergeList[0], self.mergeList[1], self.mergeList[2], "--force" in opts) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: urlrev1, urlrev2, target, force = dlg.getParameters() else: return @@ -1657,7 +1657,7 @@ """ from .SvnCommandDialog import SvnCommandDialog dlg = SvnCommandDialog(self.commandHistory, self.wdHistory, name) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: command, wd = dlg.getData() commandList = Utilities.parseOptionString(command) @@ -1821,7 +1821,7 @@ rx_prot = re.compile('(file:|svn:|svn+ssh:|http:|https:).+') dlg = SvnCopyDialog(name) res = False - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: target, force = dlg.getData() client = self.getClient() @@ -1882,7 +1882,7 @@ """ from .SvnPropSetDialog import SvnPropSetDialog dlg = SvnPropSetDialog(recursive) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: propName, propValue, recurse = dlg.getData() if not propName: E5MessageBox.critical( @@ -1933,7 +1933,7 @@ """ from .SvnPropDelDialog import SvnPropDelDialog dlg = SvnPropDelDialog(recursive) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: propName, recurse = dlg.getData() if not propName: @@ -2051,7 +2051,7 @@ return from .SvnRevisionSelectionDialog import SvnRevisionSelectionDialog dlg = SvnRevisionSelectionDialog() - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: revisions = dlg.getRevisions() if self.diff is None: from .SvnDiffDialog import SvnDiffDialog @@ -2094,7 +2094,7 @@ from .SvnUrlSelectionDialog import SvnUrlSelectionDialog dlg = SvnUrlSelectionDialog(self, self.tagsList, self.branchesList, dname) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: urls, summary = dlg.getURLs() if self.diff is None: from .SvnDiffDialog import SvnDiffDialog @@ -2124,7 +2124,8 @@ pysvn.opt_revision_kind.number, int(rev)) elif rev.startswith("{"): dateStr = rev[1:-1] - secs = QDateTime.fromString(dateStr, Qt.ISODate).toTime_t() + secs = QDateTime.fromString( + dateStr, Qt.DateFormat.ISODate).toTime_t() rev = pysvn.Revision(pysvn.opt_revision_kind.date, secs) elif rev == "HEAD": rev = pysvn.Revision(pysvn.opt_revision_kind.head) @@ -2163,7 +2164,7 @@ if extended: from .SvnRevisionSelectionDialog import SvnRevisionSelectionDialog dlg = SvnRevisionSelectionDialog() - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: rev1, rev2 = dlg.getRevisions() if rev1 == "WORKING": rev1 = "" @@ -2245,7 +2246,7 @@ None, self.tr("Subversion Lock"), self.tr("Enter lock comment"), - QLineEdit.Normal) + QLineEdit.EchoMode.Normal) if not ok: return @@ -2335,7 +2336,7 @@ from .SvnRelocateDialog import SvnRelocateDialog currUrl = self.svnGetReposName(projectPath) dlg = SvnRelocateDialog(currUrl) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: newUrl, inside = dlg.getData() if inside: msg = "switch {0} {1}".format(newUrl, projectPath) @@ -2373,7 +2374,7 @@ None, self.tr("Repository Browser"), self.tr("Enter the repository URL."), - QLineEdit.Normal) + QLineEdit.EchoMode.Normal) if not ok or not url: return
--- a/eric6/Plugins/VcsPlugins/vcsSubversion/SvnBlameDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsSubversion/SvnBlameDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -35,10 +35,12 @@ """ super(SvnBlameDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.vcs = vcs @@ -61,7 +63,7 @@ """ if ( self.process is not None and - self.process.state() != QProcess.NotRunning + self.process.state() != QProcess.ProcessState.NotRunning ): self.process.terminate() QTimer.singleShot(2000, self.process.kill) @@ -115,17 +117,21 @@ """ if ( self.process is not None and - self.process.state() != QProcess.NotRunning + self.process.state() != QProcess.ProcessState.NotRunning ): self.process.terminate() QTimer.singleShot(2000, self.process.kill) self.process.waitForFinished(3000) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) - self.buttonBox.button(QDialogButtonBox.Close).setFocus( - Qt.OtherFocusReason) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setFocus( + Qt.FocusReason.OtherFocusReason) self.inputGroup.setEnabled(False) self.inputGroup.hide() @@ -138,9 +144,13 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() - elif button == self.buttonBox.button(QDialogButtonBox.Cancel): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): self.__finish() def __procFinished(self, exitCode, exitStatus): @@ -156,7 +166,8 @@ """ Private method to resize the list columns. """ - self.blameList.header().resizeSections(QHeaderView.ResizeToContents) + self.blameList.header().resizeSections( + QHeaderView.ResizeMode.ResizeToContents) def __generateItem(self, revision, author, text): """ @@ -170,8 +181,8 @@ self.blameList, [revision, author, "{0:d}".format(self.lineno), text]) self.lineno += 1 - itm.setTextAlignment(0, Qt.AlignRight) - itm.setTextAlignment(2, Qt.AlignRight) + itm.setTextAlignment(0, Qt.AlignmentFlag.AlignRight) + itm.setTextAlignment(2, Qt.AlignmentFlag.AlignRight) def __readStdout(self): """ @@ -180,7 +191,7 @@ It reads the output of the process, formats it and inserts it into the contents pane. """ - self.process.setReadChannel(QProcess.StandardOutput) + self.process.setReadChannel(QProcess.ProcessChannel.StandardOutput) while self.process.canReadLine(): s = str( @@ -215,9 +226,9 @@ @param isOn flag indicating the status of the check box (boolean) """ if isOn: - self.input.setEchoMode(QLineEdit.Password) + self.input.setEchoMode(QLineEdit.EchoMode.Password) else: - self.input.setEchoMode(QLineEdit.Normal) + self.input.setEchoMode(QLineEdit.EchoMode.Normal) @pyqtSlot() def on_sendButton_clicked(self):
--- a/eric6/Plugins/VcsPlugins/vcsSubversion/SvnChangeListsDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsSubversion/SvnChangeListsDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -36,10 +36,12 @@ """ super(SvnChangeListsDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.vcs = vcs @@ -130,27 +132,31 @@ """ if ( self.process is not None and - self.process.state() != QProcess.NotRunning + self.process.state() != QProcess.ProcessState.NotRunning ): self.process.terminate() QTimer.singleShot(2000, self.process.kill) self.process.waitForFinished(3000) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) self.inputGroup.setEnabled(False) self.inputGroup.hide() if len(self.changeListsDict) == 0: self.changeLists.addItem(self.tr("No changelists found")) - self.buttonBox.button(QDialogButtonBox.Close).setFocus( - Qt.OtherFocusReason) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setFocus( + Qt.FocusReason.OtherFocusReason) else: self.changeLists.addItems(sorted(self.changeListsDict.keys())) self.changeLists.setCurrentRow(0) - self.changeLists.setFocus(Qt.OtherFocusReason) + self.changeLists.setFocus(Qt.FocusReason.OtherFocusReason) def on_buttonBox_clicked(self, button): """ @@ -158,9 +164,13 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() - elif button == self.buttonBox.button(QDialogButtonBox.Cancel): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): self.__finish() def __procFinished(self, exitCode, exitStatus): @@ -180,7 +190,7 @@ the contents pane. """ if self.process is not None: - self.process.setReadChannel(QProcess.StandardOutput) + self.process.setReadChannel(QProcess.ProcessChannel.StandardOutput) while self.process.canReadLine(): s = str(self.process.readLine(), @@ -236,9 +246,9 @@ @param isOn flag indicating the status of the check box (boolean) """ if isOn: - self.input.setEchoMode(QLineEdit.Password) + self.input.setEchoMode(QLineEdit.EchoMode.Password) else: - self.input.setEchoMode(QLineEdit.Normal) + self.input.setEchoMode(QLineEdit.EchoMode.Normal) @pyqtSlot() def on_sendButton_clicked(self):
--- a/eric6/Plugins/VcsPlugins/vcsSubversion/SvnCommandDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsSubversion/SvnCommandDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -38,7 +38,8 @@ self.workdirPicker.setMode(E5PathPickerModes.DirectoryMode) - self.okButton = self.buttonBox.button(QDialogButtonBox.Ok) + self.okButton = self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok) self.okButton.setEnabled(False) self.commandCombo.clear()
--- a/eric6/Plugins/VcsPlugins/vcsSubversion/SvnCommitDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsSubversion/SvnCommitDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -33,7 +33,7 @@ @param parent parent widget (QWidget) """ super(SvnCommitDialog, self).__init__( - parent, Qt.WindowFlags(Qt.Window)) + parent, Qt.WindowFlags(Qt.WindowType.Window)) self.setupUi(self) if vcs.version < (1, 5, 0): @@ -53,7 +53,7 @@ self.recentComboBox.addItem("") self.recentComboBox.addItems(self.recentCommitMessages) - self.logEdit.setFocus(Qt.OtherFocusReason) + self.logEdit.setFocus(Qt.FocusReason.OtherFocusReason) def logMessage(self): """ @@ -103,7 +103,9 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Cancel): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): self.logEdit.clear() def on_buttonBox_accepted(self):
--- a/eric6/Plugins/VcsPlugins/vcsSubversion/SvnCopyDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsSubversion/SvnCopyDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -48,7 +48,8 @@ self.sourceEdit.setText(source) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) msh = self.minimumSizeHint() self.resize(max(self.width(), msh.width()), msh.height()) @@ -73,5 +74,5 @@ @param txt contents of the target edit (string) """ - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( + self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( os.path.isabs(txt) or os.path.dirname(txt) == "")
--- a/eric6/Plugins/VcsPlugins/vcsSubversion/SvnDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsSubversion/SvnDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -37,10 +37,12 @@ """ super(SvnDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.process = None self.username = '' @@ -55,26 +57,33 @@ """ if ( self.process is not None and - self.process.state() != QProcess.NotRunning + self.process.state() != QProcess.ProcessState.NotRunning ): self.process.terminate() QTimer.singleShot(2000, self.process.kill) self.process.waitForFinished(3000) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) self.inputGroup.setEnabled(False) self.inputGroup.hide() self.process = None - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) - self.buttonBox.button(QDialogButtonBox.Close).setFocus( - Qt.OtherFocusReason) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setFocus( + Qt.FocusReason.OtherFocusReason) if ( Preferences.getVCS("AutoClose") and @@ -89,9 +98,13 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() - elif button == self.buttonBox.button(QDialogButtonBox.Cancel): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): self.__finish() def __procFinished(self, exitCode, exitStatus): @@ -101,7 +114,10 @@ @param exitCode exit code of the process (integer) @param exitStatus exit status of the process (QProcess.ExitStatus) """ - self.normal = (exitStatus == QProcess.NormalExit) and (exitCode == 0) + self.normal = ( + exitStatus == QProcess.ExitStatus.NormalExit and + exitCode == 0 + ) self.__finish() def startProcess(self, args, workingDir=None, setLanguage=False): @@ -218,9 +234,9 @@ @param isOn flag indicating the status of the check box (boolean) """ if isOn: - self.input.setEchoMode(QLineEdit.Password) + self.input.setEchoMode(QLineEdit.EchoMode.Password) else: - self.input.setEchoMode(QLineEdit.Normal) + self.input.setEchoMode(QLineEdit.EchoMode.Normal) @pyqtSlot() def on_sendButton_clicked(self):
--- a/eric6/Plugins/VcsPlugins/vcsSubversion/SvnDiffDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsSubversion/SvnDiffDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -41,12 +41,14 @@ self.setupUi(self) self.refreshButton = self.buttonBox.addButton( - self.tr("Refresh"), QDialogButtonBox.ActionRole) + self.tr("Refresh"), QDialogButtonBox.ButtonRole.ActionRole) self.refreshButton.setToolTip( self.tr("Press to refresh the display")) self.refreshButton.setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Save).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Save).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) self.searchWidget.attachTextEdit(self.contents) @@ -70,7 +72,7 @@ """ if ( self.process is not None and - self.process.state() != QProcess.NotRunning + self.process.state() != QProcess.ProcessState.NotRunning ): self.process.terminate() QTimer.singleShot(2000, self.process.kill) @@ -128,7 +130,7 @@ self.vcs.addArguments(args, self.vcs.options['global']) self.vcs.addArguments(args, self.vcs.options['diff']) if '--diff-cmd' in self.vcs.options['diff']: - self.buttonBox.button(QDialogButtonBox.Save).hide() + self.buttonBox.button(QDialogButtonBox.StandardButton.Save).hide() if versions is not None: self.raise_() @@ -206,14 +208,18 @@ if self.paras == 0: self.contents.setPlainText(self.tr('There is no difference.')) - self.buttonBox.button(QDialogButtonBox.Save).setEnabled(self.paras > 0) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) - self.buttonBox.button(QDialogButtonBox.Close).setFocus( - Qt.OtherFocusReason) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Save).setEnabled(self.paras > 0) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setFocus( + Qt.FocusReason.OtherFocusReason) tc = self.contents.textCursor() - tc.movePosition(QTextCursor.Start) + tc.movePosition(QTextCursor.MoveOperation.Start) self.contents.setTextCursor(tc) self.contents.ensureCursorVisible() @@ -233,7 +239,7 @@ @param txt text to insert (string) """ tc = self.contents.textCursor() - tc.movePosition(QTextCursor.End) + tc.movePosition(QTextCursor.MoveOperation.End) self.contents.setTextCursor(tc) self.contents.insertPlainText(txt) @@ -269,7 +275,7 @@ It reads the output of the process, formats it and inserts it into the contents pane. """ - self.process.setReadChannel(QProcess.StandardOutput) + self.process.setReadChannel(QProcess.ProcessChannel.StandardOutput) while self.process.canReadLine(): line = str(self.process.readLine(), @@ -305,7 +311,9 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Save): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Save + ): self.on_saveButton_clicked() elif button == self.refreshButton: self.on_refreshButton_clicked() @@ -321,26 +329,28 @@ if para == 0: tc = self.contents.textCursor() - tc.movePosition(QTextCursor.Start) + tc.movePosition(QTextCursor.MoveOperation.Start) self.contents.setTextCursor(tc) self.contents.ensureCursorVisible() elif para == -1: tc = self.contents.textCursor() - tc.movePosition(QTextCursor.End) + tc.movePosition(QTextCursor.MoveOperation.End) self.contents.setTextCursor(tc) self.contents.ensureCursorVisible() else: # step 1: move cursor to end tc = self.contents.textCursor() - tc.movePosition(QTextCursor.End) + tc.movePosition(QTextCursor.MoveOperation.End) self.contents.setTextCursor(tc) self.contents.ensureCursorVisible() # step 2: move cursor to desired line tc = self.contents.textCursor() delta = tc.blockNumber() - para - tc.movePosition(QTextCursor.PreviousBlock, QTextCursor.MoveAnchor, - delta) + tc.movePosition( + QTextCursor.MoveOperation.PreviousBlock, + QTextCursor.MoveMode.MoveAnchor, + delta) self.contents.setTextCursor(tc) self.contents.ensureCursorVisible() @@ -408,9 +418,11 @@ """ Private slot to refresh the display. """ - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Save).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Save).setEnabled(False) self.refreshButton.setEnabled(False) self.start(self.filename, refreshable=True) @@ -422,9 +434,9 @@ @param isOn flag indicating the status of the check box (boolean) """ if isOn: - self.input.setEchoMode(QLineEdit.Password) + self.input.setEchoMode(QLineEdit.EchoMode.Password) else: - self.input.setEchoMode(QLineEdit.Normal) + self.input.setEchoMode(QLineEdit.EchoMode.Normal) @pyqtSlot() def on_sendButton_clicked(self):
--- a/eric6/Plugins/VcsPlugins/vcsSubversion/SvnLogBrowserDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsSubversion/SvnLogBrowserDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -42,14 +42,17 @@ self.__position = QPoint() - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.upButton.setIcon(UI.PixmapCache.getIcon("1uparrow")) self.downButton.setIcon(UI.PixmapCache.getIcon("1downarrow")) self.filesTree.headerItem().setText(self.filesTree.columnCount(), "") - self.filesTree.header().setSortIndicator(0, Qt.AscendingOrder) + self.filesTree.header().setSortIndicator( + 0, Qt.SortOrder.AscendingOrder) self.vcs = vcs @@ -59,8 +62,8 @@ self.toDate.setDisplayFormat("yyyy-MM-dd") self.__resetUI() - self.__messageRole = Qt.UserRole - self.__changesRole = Qt.UserRole + 1 + self.__messageRole = Qt.ItemDataRole.UserRole + self.__changesRole = Qt.ItemDataRole.UserRole + 1 self.__process = E5OverrideCursorProcess() self.__process.finished.connect(self.__procFinished) @@ -135,7 +138,7 @@ """ if ( self.__process is not None and - self.__process.state() != QProcess.NotRunning + self.__process.state() != QProcess.ProcessState.NotRunning ): self.__process.terminate() QTimer.singleShot(2000, self.__process.kill) @@ -177,7 +180,8 @@ """ Private method to resize the log tree columns. """ - self.logTree.header().resizeSections(QHeaderView.ResizeToContents) + self.logTree.header().resizeSections( + QHeaderView.ResizeMode.ResizeToContents) self.logTree.header().setStretchLastSection(True) def __resortLog(self): @@ -192,7 +196,8 @@ """ Private method to resize the changed files tree columns. """ - self.filesTree.header().resizeSections(QHeaderView.ResizeToContents) + self.filesTree.header().resizeSections( + QHeaderView.ResizeMode.ResizeToContents) self.filesTree.header().setStretchLastSection(True) def __resortFiles(self): @@ -222,19 +227,19 @@ msg.append(line.strip()) itm = QTreeWidgetItem(self.logTree) - itm.setData(0, Qt.DisplayRole, int(revision)) - itm.setData(1, Qt.DisplayRole, author) - itm.setData(2, Qt.DisplayRole, date) - itm.setData(3, Qt.DisplayRole, " ".join(msg)) + itm.setData(0, Qt.ItemDataRole.DisplayRole, int(revision)) + itm.setData(1, Qt.ItemDataRole.DisplayRole, author) + itm.setData(2, Qt.ItemDataRole.DisplayRole, date) + itm.setData(3, Qt.ItemDataRole.DisplayRole, " ".join(msg)) itm.setData(0, self.__messageRole, message) itm.setData(0, self.__changesRole, changedPaths) - itm.setTextAlignment(0, Qt.AlignRight) - itm.setTextAlignment(1, Qt.AlignLeft) - itm.setTextAlignment(2, Qt.AlignLeft) - itm.setTextAlignment(3, Qt.AlignLeft) - itm.setTextAlignment(4, Qt.AlignLeft) + itm.setTextAlignment(0, Qt.AlignmentFlag.AlignRight) + itm.setTextAlignment(1, Qt.AlignmentFlag.AlignLeft) + itm.setTextAlignment(2, Qt.AlignmentFlag.AlignLeft) + itm.setTextAlignment(3, Qt.AlignmentFlag.AlignLeft) + itm.setTextAlignment(4, Qt.AlignmentFlag.AlignLeft) try: self.__lastRev = int(revision) @@ -260,7 +265,7 @@ copyRev, ]) - itm.setTextAlignment(3, Qt.AlignRight) + itm.setTextAlignment(3, Qt.AlignmentFlag.AlignRight) return itm @@ -270,9 +275,12 @@ @param startRev revision number to start from (integer, string) """ - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) QApplication.processEvents() self.intercept = False @@ -357,15 +365,18 @@ """ if ( self.__process is not None and - self.__process.state() != QProcess.NotRunning + self.__process.state() != QProcess.ProcessState.NotRunning ): self.__process.terminate() QTimer.singleShot(2000, self.__process.kill) self.__process.waitForFinished(3000) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) self.inputGroup.setEnabled(False) self.inputGroup.hide() @@ -426,7 +437,7 @@ self.__generateLogItem( log["author"], log["date"], log["message"], log["revision"], changedPaths) - dt = QDate.fromString(log["date"], Qt.ISODate) + dt = QDate.fromString(log["date"], Qt.DateFormat.ISODate) if ( not self.__maxDate.isValid() and not self.__minDate.isValid() @@ -469,7 +480,7 @@ It reads the output of the process and inserts it into a buffer. """ - self.__process.setReadChannel(QProcess.StandardOutput) + self.__process.setReadChannel(QProcess.ProcessChannel.StandardOutput) while self.__process.canReadLine(): line = str(self.__process.readLine(), @@ -516,9 +527,13 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() - elif button == self.buttonBox.button(QDialogButtonBox.Cancel): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): self.cancelled = True self.__finish() @@ -731,9 +746,9 @@ @param isOn flag indicating the status of the check box (boolean) """ if isOn: - self.input.setEchoMode(QLineEdit.Password) + self.input.setEchoMode(QLineEdit.EchoMode.Password) else: - self.input.setEchoMode(QLineEdit.Normal) + self.input.setEchoMode(QLineEdit.EchoMode.Normal) @pyqtSlot() def on_sendButton_clicked(self):
--- a/eric6/Plugins/VcsPlugins/vcsSubversion/SvnMergeDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsSubversion/SvnMergeDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -46,7 +46,8 @@ self.targetCombo.clear() self.targetCombo.addItems(targetlist) - self.okButton = self.buttonBox.button(QDialogButtonBox.Ok) + self.okButton = self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok) self.okButton.setEnabled(False) msh = self.minimumSizeHint()
--- a/eric6/Plugins/VcsPlugins/vcsSubversion/SvnNewProjectOptionsDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsSubversion/SvnNewProjectOptionsDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -64,7 +64,8 @@ self.resize(self.width(), self.minimumSizeHint().height()) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) msh = self.minimumSizeHint() self.resize(max(self.width(), msh.width()), msh.height()) @@ -76,7 +77,7 @@ @param txt name of the project directory (string) """ - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( + self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( bool(txt) and Utilities.fromNativeSeparators(txt) not in self.__initPaths) @@ -88,7 +89,7 @@ dlg = SvnRepoBrowserDialog(self.vcs, mode="select", parent=self) dlg.start( self.protocolCombo.currentText() + self.vcsUrlPicker.text()) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: url = dlg.getSelectedUrl() if url: protocol = url.split("://")[0] @@ -137,7 +138,8 @@ @param txt current text of the line edit (string) """ enable = "://" not in txt - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enable) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(enable) def getData(self): """
--- a/eric6/Plugins/VcsPlugins/vcsSubversion/SvnOptionsDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsSubversion/SvnOptionsDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -65,7 +65,7 @@ dlg = SvnRepoBrowserDialog(self.vcs, mode="select", parent=self) dlg.start( self.protocolCombo.currentText() + self.vcsUrlPicker.text()) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: url = dlg.getSelectedUrl() if url: protocol = url.split("://")[0] @@ -101,7 +101,8 @@ @param txt current text of the line edit (string) """ enable = "://" not in txt - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enable) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(enable) def getData(self): """
--- a/eric6/Plugins/VcsPlugins/vcsSubversion/SvnPropListDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsSubversion/SvnPropListDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -38,12 +38,14 @@ self.setupUi(self) self.refreshButton = self.buttonBox.addButton( - self.tr("Refresh"), QDialogButtonBox.ActionRole) + self.tr("Refresh"), QDialogButtonBox.ButtonRole.ActionRole) self.refreshButton.setToolTip( self.tr("Press to refresh the properties display")) self.refreshButton.setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.process = QProcess() env = QProcessEnvironment.systemEnvironment() @@ -52,7 +54,8 @@ self.vcs = vcs self.propsList.headerItem().setText(self.propsList.columnCount(), "") - self.propsList.header().setSortIndicator(0, Qt.AscendingOrder) + self.propsList.header().setSortIndicator( + 0, Qt.SortOrder.AscendingOrder) self.process.finished.connect(self.__procFinished) self.process.readyReadStandardOutput.connect(self.__readStdout) @@ -73,7 +76,8 @@ """ Private method to resize the list columns. """ - self.propsList.header().resizeSections(QHeaderView.ResizeToContents) + self.propsList.header().resizeSections( + QHeaderView.ResizeMode.ResizeToContents) self.propsList.header().setStretchLastSection(True) def __generateItem(self, path, propName, propValue): @@ -94,7 +98,7 @@ """ if ( self.process is not None and - self.process.state() != QProcess.NotRunning + self.process.state() != QProcess.ProcessState.NotRunning ): self.process.terminate() QTimer.singleShot(2000, self.process.kill) @@ -119,9 +123,12 @@ self.__args = fn self.__recursive = recursive - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.refreshButton.setEnabled(False) self.process.kill() @@ -159,15 +166,18 @@ """ if ( self.process is not None and - self.process.state() != QProcess.NotRunning + self.process.state() != QProcess.ProcessState.NotRunning ): self.process.terminate() QTimer.singleShot(2000, self.process.kill) self.process.waitForFinished(3000) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) self.refreshButton.setEnabled(True) @@ -183,9 +193,13 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() - elif button == self.buttonBox.button(QDialogButtonBox.Cancel): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): self.__finish() elif button == self.refreshButton: self.on_refreshButton_clicked() @@ -216,7 +230,7 @@ It reads the output of the process, formats it and inserts it into the contents pane. """ - self.process.setReadChannel(QProcess.StandardOutput) + self.process.setReadChannel(QProcess.ProcessChannel.StandardOutput) while self.process.canReadLine(): s = str(self.process.readLine(),
--- a/eric6/Plugins/VcsPlugins/vcsSubversion/SvnRepoBrowserDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsSubversion/SvnRepoBrowserDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -40,10 +40,10 @@ """ super(SvnRepoBrowserDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) self.repoTree.headerItem().setText(self.repoTree.columnCount(), "") - self.repoTree.header().setSortIndicator(0, Qt.AscendingOrder) + self.repoTree.header().setSortIndicator(0, Qt.SortOrder.AscendingOrder) self.vcs = vcs self.mode = mode @@ -54,16 +54,18 @@ self.__process.readyReadStandardError.connect(self.__readStderr) if self.mode == "select": - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).hide() + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) + self.buttonBox.button(QDialogButtonBox.StandardButton.Close).hide() else: - self.buttonBox.button(QDialogButtonBox.Ok).hide() - self.buttonBox.button(QDialogButtonBox.Cancel).hide() + self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).hide() + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).hide() self.__dirIcon = UI.PixmapCache.getIcon("dirClosed") self.__fileIcon = UI.PixmapCache.getIcon("fileMisc") - self.__urlRole = Qt.UserRole + self.__urlRole = Qt.ItemDataRole.UserRole self.__ignoreExpand = False self.intercept = False @@ -82,7 +84,7 @@ """ if ( self.__process is not None and - self.__process.state() != QProcess.NotRunning + self.__process.state() != QProcess.ProcessState.NotRunning ): self.__process.terminate() QTimer.singleShot(2000, self.__process.kill) @@ -102,7 +104,8 @@ """ Private method to resize the tree columns. """ - self.repoTree.header().resizeSections(QHeaderView.ResizeToContents) + self.repoTree.header().resizeSections( + QHeaderView.ResizeMode.ResizeToContents) self.repoTree.header().setStretchLastSection(True) def __generateItem(self, repopath, revision, author, size, date, @@ -131,25 +134,26 @@ sz = int(size) itm = QTreeWidgetItem(self.parentItem) - itm.setData(0, Qt.DisplayRole, path) - itm.setData(1, Qt.DisplayRole, rev) - itm.setData(2, Qt.DisplayRole, author) - itm.setData(3, Qt.DisplayRole, sz) - itm.setData(4, Qt.DisplayRole, date) + itm.setData(0, Qt.ItemDataRole.DisplayRole, path) + itm.setData(1, Qt.ItemDataRole.DisplayRole, rev) + itm.setData(2, Qt.ItemDataRole.DisplayRole, author) + itm.setData(3, Qt.ItemDataRole.DisplayRole, sz) + itm.setData(4, Qt.ItemDataRole.DisplayRole, date) if nodekind == "dir": itm.setIcon(0, self.__dirIcon) - itm.setChildIndicatorPolicy(QTreeWidgetItem.ShowIndicator) + itm.setChildIndicatorPolicy( + QTreeWidgetItem.ChildIndicatorPolicy.ShowIndicator) elif nodekind == "file": itm.setIcon(0, self.__fileIcon) itm.setData(0, self.__urlRole, url) - itm.setTextAlignment(0, Qt.AlignLeft) - itm.setTextAlignment(1, Qt.AlignRight) - itm.setTextAlignment(2, Qt.AlignLeft) - itm.setTextAlignment(3, Qt.AlignRight) - itm.setTextAlignment(4, Qt.AlignLeft) + itm.setTextAlignment(0, Qt.AlignmentFlag.AlignLeft) + itm.setTextAlignment(1, Qt.AlignmentFlag.AlignRight) + itm.setTextAlignment(2, Qt.AlignmentFlag.AlignLeft) + itm.setTextAlignment(3, Qt.AlignmentFlag.AlignRight) + itm.setTextAlignment(4, Qt.AlignmentFlag.AlignLeft) return itm @@ -296,13 +300,15 @@ if self.urlCombo.findText(url) == -1: self.urlCombo.addItem(url) - @pyqtSlot(str) - def on_urlCombo_currentIndexChanged(self, text): + @pyqtSlot(int) + def on_urlCombo_currentIndexChanged(self, index): """ Private slot called, when a new repository URL is entered or selected. - @param text the text of the current item (string) + @param index index of the current item + @type int """ + text = self.urlCombo.itemText(index) url = self.__normalizeUrl(text) if url != self.url: self.url = url @@ -336,7 +342,8 @@ Private slot called when the selection changes. """ if self.mode == "select": - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(True) def accept(self): """ @@ -366,7 +373,7 @@ """ if ( self.__process is not None and - self.__process.state() != QProcess.NotRunning + self.__process.state() != QProcess.ProcessState.NotRunning ): self.__process.terminate() QTimer.singleShot(2000, self.__process.kill) @@ -395,7 +402,8 @@ the contents pane. """ if self.__process is not None: - self.__process.setReadChannel(QProcess.StandardOutput) + self.__process.setReadChannel( + QProcess.ProcessChannel.StandardOutput) while self.__process.canReadLine(): s = str(self.__process.readLine(), @@ -452,9 +460,9 @@ @param isOn flag indicating the status of the check box (boolean) """ if isOn: - self.input.setEchoMode(QLineEdit.Password) + self.input.setEchoMode(QLineEdit.EchoMode.Password) else: - self.input.setEchoMode(QLineEdit.Normal) + self.input.setEchoMode(QLineEdit.EchoMode.Normal) @pyqtSlot() def on_sendButton_clicked(self):
--- a/eric6/Plugins/VcsPlugins/vcsSubversion/SvnRevisionSelectionDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsSubversion/SvnRevisionSelectionDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -68,7 +68,7 @@ elif dateButton.isChecked(): return "{{{0}}}".format( QDateTime(dateEdit.date(), timeEdit.time()) - .toString(Qt.ISODate)) + .toString(Qt.DateFormat.ISODate)) elif headButton.isChecked(): return "HEAD" elif workingButton.isChecked():
--- a/eric6/Plugins/VcsPlugins/vcsSubversion/SvnStatusDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsSubversion/SvnStatusDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -54,12 +54,14 @@ self.__lastColumn = self.statusList.columnCount() self.refreshButton = self.buttonBox.addButton( - self.tr("Refresh"), QDialogButtonBox.ActionRole) + self.tr("Refresh"), QDialogButtonBox.ButtonRole.ActionRole) self.refreshButton.setToolTip( self.tr("Press to refresh the status display")) self.refreshButton.setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.diff = None self.vcs = vcs @@ -72,7 +74,7 @@ self.statusList.headerItem().setText(self.__lastColumn, "") self.statusList.header().setSortIndicator(self.__pathColumn, - Qt.AscendingOrder) + Qt.SortOrder.AscendingOrder) if self.vcs.version < (1, 5, 0): self.statusList.header().hideSection(self.__changelistColumn) @@ -121,7 +123,8 @@ for act in self.menuactions: act.setEnabled(False) - self.statusList.setContextMenuPolicy(Qt.CustomContextMenu) + self.statusList.setContextMenuPolicy( + Qt.ContextMenuPolicy.CustomContextMenu) self.statusList.customContextMenuRequested.connect( self.__showContextMenu) @@ -219,7 +222,8 @@ """ Private method to resize the list columns. """ - self.statusList.header().resizeSections(QHeaderView.ResizeToContents) + self.statusList.header().resizeSections( + QHeaderView.ResizeMode.ResizeToContents) self.statusList.header().setStretchLastSection(True) def __generateItem(self, status, propStatus, locked, history, switched, @@ -269,38 +273,40 @@ statusText = self.status[status] itm = QTreeWidgetItem(self.statusList) - itm.setData(0, Qt.DisplayRole, "") - itm.setData(1, Qt.DisplayRole, self.currentChangelist) - itm.setData(2, Qt.DisplayRole, statusText) - itm.setData(3, Qt.DisplayRole, self.propStatus[propStatus]) - itm.setData(4, Qt.DisplayRole, self.locked[locked]) - itm.setData(5, Qt.DisplayRole, self.history[history]) - itm.setData(6, Qt.DisplayRole, self.switched[switched]) - itm.setData(7, Qt.DisplayRole, self.lockinfo[lockinfo]) - itm.setData(8, Qt.DisplayRole, self.uptodate[uptodate]) - itm.setData(9, Qt.DisplayRole, rev) - itm.setData(10, Qt.DisplayRole, chg) - itm.setData(11, Qt.DisplayRole, author) - itm.setData(12, Qt.DisplayRole, path) + itm.setData(0, Qt.ItemDataRole.DisplayRole, "") + itm.setData(1, Qt.ItemDataRole.DisplayRole, self.currentChangelist) + itm.setData(2, Qt.ItemDataRole.DisplayRole, statusText) + itm.setData(3, Qt.ItemDataRole.DisplayRole, + self.propStatus[propStatus]) + itm.setData(4, Qt.ItemDataRole.DisplayRole, self.locked[locked]) + itm.setData(5, Qt.ItemDataRole.DisplayRole, self.history[history]) + itm.setData(6, Qt.ItemDataRole.DisplayRole, self.switched[switched]) + itm.setData(7, Qt.ItemDataRole.DisplayRole, self.lockinfo[lockinfo]) + itm.setData(8, Qt.ItemDataRole.DisplayRole, self.uptodate[uptodate]) + itm.setData(9, Qt.ItemDataRole.DisplayRole, rev) + itm.setData(10, Qt.ItemDataRole.DisplayRole, chg) + itm.setData(11, Qt.ItemDataRole.DisplayRole, author) + itm.setData(12, Qt.ItemDataRole.DisplayRole, path) - itm.setTextAlignment(1, Qt.AlignLeft) - itm.setTextAlignment(2, Qt.AlignHCenter) - itm.setTextAlignment(3, Qt.AlignHCenter) - itm.setTextAlignment(4, Qt.AlignHCenter) - itm.setTextAlignment(5, Qt.AlignHCenter) - itm.setTextAlignment(6, Qt.AlignHCenter) - itm.setTextAlignment(7, Qt.AlignHCenter) - itm.setTextAlignment(8, Qt.AlignHCenter) - itm.setTextAlignment(9, Qt.AlignRight) - itm.setTextAlignment(10, Qt.AlignRight) - itm.setTextAlignment(11, Qt.AlignLeft) - itm.setTextAlignment(12, Qt.AlignLeft) + itm.setTextAlignment(1, Qt.AlignmentFlag.AlignLeft) + itm.setTextAlignment(2, Qt.AlignmentFlag.AlignHCenter) + itm.setTextAlignment(3, Qt.AlignmentFlag.AlignHCenter) + itm.setTextAlignment(4, Qt.AlignmentFlag.AlignHCenter) + itm.setTextAlignment(5, Qt.AlignmentFlag.AlignHCenter) + itm.setTextAlignment(6, Qt.AlignmentFlag.AlignHCenter) + itm.setTextAlignment(7, Qt.AlignmentFlag.AlignHCenter) + itm.setTextAlignment(8, Qt.AlignmentFlag.AlignHCenter) + itm.setTextAlignment(9, Qt.AlignmentFlag.AlignRight) + itm.setTextAlignment(10, Qt.AlignmentFlag.AlignRight) + itm.setTextAlignment(11, Qt.AlignmentFlag.AlignLeft) + itm.setTextAlignment(12, Qt.AlignmentFlag.AlignLeft) if status in "ADM" or propStatus in "M": - itm.setFlags(itm.flags() | Qt.ItemIsUserCheckable) - itm.setCheckState(self.__toBeCommittedColumn, Qt.Checked) + itm.setFlags(itm.flags() | Qt.ItemFlag.ItemIsUserCheckable) + itm.setCheckState(self.__toBeCommittedColumn, + Qt.CheckState.Checked) else: - itm.setFlags(itm.flags() & ~Qt.ItemIsUserCheckable) + itm.setFlags(itm.flags() & ~Qt.ItemFlag.ItemIsUserCheckable) self.hidePropertyStatusColumn = ( self.hidePropertyStatusColumn and @@ -326,7 +332,7 @@ """ if ( self.process is not None and - self.process.state() != QProcess.NotRunning + self.process.state() != QProcess.ProcessState.NotRunning ): self.process.terminate() QTimer.singleShot(2000, self.process.kill) @@ -412,9 +418,12 @@ 'Ensure, that it is in the search path.' ).format('svn')) else: - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.inputGroup.setEnabled(True) self.inputGroup.show() @@ -427,17 +436,21 @@ """ if ( self.process is not None and - self.process.state() != QProcess.NotRunning + self.process.state() != QProcess.ProcessState.NotRunning ): self.process.terminate() QTimer.singleShot(2000, self.process.kill) self.process.waitForFinished(3000) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) - self.buttonBox.button(QDialogButtonBox.Close).setFocus( - Qt.OtherFocusReason) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setFocus( + Qt.FocusReason.OtherFocusReason) self.inputGroup.setEnabled(False) self.inputGroup.hide() @@ -477,9 +490,13 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() - elif button == self.buttonBox.button(QDialogButtonBox.Cancel): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): self.__finish() elif button == self.refreshButton: self.on_refreshButton_clicked() @@ -501,7 +518,7 @@ the contents pane. """ if self.process is not None: - self.process.setReadChannel(QProcess.StandardOutput) + self.process.setReadChannel(QProcess.ProcessChannel.StandardOutput) while self.process.canReadLine(): s = str(self.process.readLine(), @@ -556,9 +573,9 @@ @param isOn flag indicating the status of the check box (boolean) """ if isOn: - self.input.setEchoMode(QLineEdit.Password) + self.input.setEchoMode(QLineEdit.EchoMode.Password) else: - self.input.setEchoMode(QLineEdit.Normal) + self.input.setEchoMode(QLineEdit.EchoMode.Normal) @pyqtSlot() def on_sendButton_clicked(self): @@ -980,7 +997,10 @@ commitableItems = [] for index in range(self.statusList.topLevelItemCount()): itm = self.statusList.topLevelItem(index) - if itm.checkState(self.__toBeCommittedColumn) == Qt.Checked: + if ( + itm.checkState(self.__toBeCommittedColumn) == + Qt.CheckState.Checked + ): commitableItems.append(itm) return commitableItems @@ -1071,8 +1091,10 @@ """ for index in range(self.statusList.topLevelItemCount()): itm = self.statusList.topLevelItem(index) - if itm.flags() & Qt.ItemIsUserCheckable: + if itm.flags() & Qt.ItemFlag.ItemIsUserCheckable: if selected: - itm.setCheckState(self.__toBeCommittedColumn, Qt.Checked) + itm.setCheckState(self.__toBeCommittedColumn, + Qt.CheckState.Checked) else: - itm.setCheckState(self.__toBeCommittedColumn, Qt.Unchecked) + itm.setCheckState(self.__toBeCommittedColumn, + Qt.CheckState.Unchecked)
--- a/eric6/Plugins/VcsPlugins/vcsSubversion/SvnTagBranchListDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsSubversion/SvnTagBranchListDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -37,17 +37,19 @@ """ super(SvnTagBranchListDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.vcs = vcs self.tagsList = None self.allTagsList = None self.tagList.headerItem().setText(self.tagList.columnCount(), "") - self.tagList.header().setSortIndicator(3, Qt.AscendingOrder) + self.tagList.header().setSortIndicator(3, Qt.SortOrder.AscendingOrder) self.process = QProcess() self.process.finished.connect(self.__procFinished) @@ -66,7 +68,7 @@ """ if ( self.process is not None and - self.process.state() != QProcess.NotRunning + self.process.state() != QProcess.ProcessState.NotRunning ): self.process.terminate() QTimer.singleShot(2000, self.process.kill) @@ -144,7 +146,7 @@ self.tr("Subversion List"), self.tr("Enter the repository URL containing the tags" " or branches"), - QLineEdit.Normal, + QLineEdit.EchoMode.Normal, self.vcs.svnNormalizeURL(reposURL)) if not ok: self.close() @@ -185,17 +187,21 @@ """ if ( self.process is not None and - self.process.state() != QProcess.NotRunning + self.process.state() != QProcess.ProcessState.NotRunning ): self.process.terminate() QTimer.singleShot(2000, self.process.kill) self.process.waitForFinished(3000) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) - self.buttonBox.button(QDialogButtonBox.Close).setFocus( - Qt.OtherFocusReason) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setFocus( + Qt.FocusReason.OtherFocusReason) self.inputGroup.setEnabled(False) self.inputGroup.hide() @@ -209,9 +215,13 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() - elif button == self.buttonBox.button(QDialogButtonBox.Cancel): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): self.__finish() def __procFinished(self, exitCode, exitStatus): @@ -235,7 +245,8 @@ """ Private method to resize the list columns. """ - self.tagList.header().resizeSections(QHeaderView.ResizeToContents) + self.tagList.header().resizeSections( + QHeaderView.ResizeMode.ResizeToContents) self.tagList.header().setStretchLastSection(True) def __generateItem(self, revision, author, date, name): @@ -248,11 +259,11 @@ @param name name (path) of the tag (string) """ itm = QTreeWidgetItem(self.tagList) - itm.setData(0, Qt.DisplayRole, int(revision)) - itm.setData(1, Qt.DisplayRole, author) - itm.setData(2, Qt.DisplayRole, date) - itm.setData(3, Qt.DisplayRole, name) - itm.setTextAlignment(0, Qt.AlignRight) + itm.setData(0, Qt.ItemDataRole.DisplayRole, int(revision)) + itm.setData(1, Qt.ItemDataRole.DisplayRole, author) + itm.setData(2, Qt.ItemDataRole.DisplayRole, date) + itm.setData(3, Qt.ItemDataRole.DisplayRole, name) + itm.setTextAlignment(0, Qt.AlignmentFlag.AlignRight) def __readStdout(self): """ @@ -261,7 +272,7 @@ It reads the output of the process, formats it and inserts it into the contents pane. """ - self.process.setReadChannel(QProcess.StandardOutput) + self.process.setReadChannel(QProcess.ProcessChannel.StandardOutput) while self.process.canReadLine(): s = str(self.process.readLine(), @@ -305,9 +316,9 @@ @param isOn flag indicating the status of the check box (boolean) """ if isOn: - self.input.setEchoMode(QLineEdit.Password) + self.input.setEchoMode(QLineEdit.EchoMode.Password) else: - self.input.setEchoMode(QLineEdit.Normal) + self.input.setEchoMode(QLineEdit.EchoMode.Normal) @pyqtSlot() def on_sendButton_clicked(self):
--- a/eric6/Plugins/VcsPlugins/vcsSubversion/SvnTagDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsSubversion/SvnTagDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -29,7 +29,8 @@ super(SvnTagDialog, self).__init__(parent) self.setupUi(self) - self.okButton = self.buttonBox.button(QDialogButtonBox.Ok) + self.okButton = self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok) self.okButton.setEnabled(False) self.tagCombo.clear()
--- a/eric6/Plugins/VcsPlugins/vcsSubversion/SvnUrlSelectionDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsSubversion/SvnUrlSelectionDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -121,22 +121,26 @@ labelCombo.addItems(sorted(self.branchesList)) labelCombo.setEnabled(True) - @pyqtSlot(str) - def on_typeCombo1_currentIndexChanged(self, type_): + @pyqtSlot(int) + def on_typeCombo1_currentIndexChanged(self, index): """ Private slot called when the selected type was changed. - @param type_ selected type (string) + @param index index of the current item + @type int """ + type_ = self.typeCombo1.itemText(index) self.__changeLabelCombo(self.labelCombo1, type_) - @pyqtSlot(str) - def on_typeCombo2_currentIndexChanged(self, type_): + @pyqtSlot(int) + def on_typeCombo2_currentIndexChanged(self, index): """ Private slot called when the selected type was changed. - @param type_ selected type (string) + @param index index of the current item + @type int """ + type_ = self.typeCombo2.itemText(index) self.__changeLabelCombo(self.labelCombo2, type_) def getURLs(self):
--- a/eric6/Plugins/VcsPlugins/vcsSubversion/subversion.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsSubversion/subversion.py Tue Mar 02 17:17:09 2021 +0100 @@ -861,7 +861,7 @@ else: from .SvnCopyDialog import SvnCopyDialog dlg = SvnCopyDialog(name, None, True, force) - accepted = (dlg.exec() == QDialog.Accepted) + accepted = (dlg.exec() == QDialog.DialogCode.Accepted) if accepted: target, force = dlg.getData() if not target: @@ -982,7 +982,7 @@ from .SvnTagDialog import SvnTagDialog dlg = SvnTagDialog(self.allTagsBranchesList, url, self.otherData["standardLayout"]) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: tag, tagOp = dlg.getParameters() if tag in self.allTagsBranchesList: self.allTagsBranchesList.remove(tag) @@ -1064,7 +1064,7 @@ self.tr("Do you really want to revert all changes to" " these files or directories?"), names) - yes = dlg.exec() == QDialog.Accepted + yes = dlg.exec() == QDialog.DialogCode.Accepted else: yes = E5MessageBox.yesNo( None, @@ -1105,7 +1105,7 @@ from .SvnSwitchDialog import SvnSwitchDialog dlg = SvnSwitchDialog(self.allTagsBranchesList, url, self.otherData["standardLayout"]) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: tag, tagType = dlg.getParameters() if tag in self.allTagsBranchesList: self.allTagsBranchesList.remove(tag) @@ -1172,7 +1172,7 @@ from .SvnMergeDialog import SvnMergeDialog dlg = SvnMergeDialog( self.mergeList[0], self.mergeList[1], self.mergeList[2], force) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: urlrev1, urlrev2, target, force = dlg.getParameters() else: return @@ -1498,7 +1498,7 @@ """ from .SvnCommandDialog import SvnCommandDialog dlg = SvnCommandDialog(self.commandHistory, self.wdHistory, name) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: command, wd = dlg.getData() commandList = Utilities.parseOptionString(command) @@ -1707,7 +1707,7 @@ rx_prot = re.compile('(file:|svn:|svn+ssh:|http:|https:).+') dlg = SvnCopyDialog(name) res = False - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: target, force = dlg.getData() args = [] @@ -1761,7 +1761,7 @@ """ from .SvnPropSetDialog import SvnPropSetDialog dlg = SvnPropSetDialog() - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: propName, fileFlag, propValue = dlg.getData() if not propName: E5MessageBox.critical( @@ -1803,7 +1803,7 @@ None, self.tr("Subversion Delete Property"), self.tr("Enter property name"), - QLineEdit.Normal) + QLineEdit.EchoMode.Normal) if not ok: return @@ -1908,7 +1908,7 @@ return from .SvnRevisionSelectionDialog import SvnRevisionSelectionDialog dlg = SvnRevisionSelectionDialog() - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: revisions = dlg.getRevisions() from .SvnDiffDialog import SvnDiffDialog self.diff = SvnDiffDialog(self) @@ -1948,7 +1948,7 @@ from .SvnUrlSelectionDialog import SvnUrlSelectionDialog dlg = SvnUrlSelectionDialog(self, self.tagsList, self.branchesList, dname) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: urls, summary = dlg.getURLs() from .SvnDiffDialog import SvnDiffDialog self.diff = SvnDiffDialog(self) @@ -2015,7 +2015,7 @@ if extended: from .SvnRevisionSelectionDialog import SvnRevisionSelectionDialog dlg = SvnRevisionSelectionDialog() - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: rev1, rev2 = dlg.getRevisions() if rev1 == "WORKING": rev1 = "" @@ -2147,7 +2147,7 @@ from .SvnRelocateDialog import SvnRelocateDialog currUrl = self.svnGetReposName(projectPath) dlg = SvnRelocateDialog(currUrl) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: newUrl, inside = dlg.getData() args = [] args.append('switch') @@ -2178,7 +2178,7 @@ None, self.tr("Repository Browser"), self.tr("Enter the repository URL."), - QLineEdit.Normal) + QLineEdit.EchoMode.Normal) if not ok or not url: return
--- a/eric6/Plugins/ViewManagerPlugins/Listspace/Listspace.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/ViewManagerPlugins/Listspace/Listspace.py Tue Mar 02 17:17:09 2021 +0100 @@ -223,17 +223,18 @@ self.viewlist = QListWidget(self) policy = self.viewlist.sizePolicy() - policy.setHorizontalPolicy(QSizePolicy.Ignored) + policy.setHorizontalPolicy(QSizePolicy.Policy.Ignored) self.viewlist.setSizePolicy(policy) self.__splitter.addWidget(self.viewlist) - self.viewlist.setContextMenuPolicy(Qt.CustomContextMenu) + self.viewlist.setContextMenuPolicy( + Qt.ContextMenuPolicy.CustomContextMenu) self.viewlist.currentRowChanged.connect(self.__showSelectedView) self.viewlist.customContextMenuRequested.connect(self.__showMenu) self.stackArea = QSplitter(self) self.stackArea.setChildrenCollapsible(False) self.__splitter.addWidget(self.stackArea) - self.stackArea.setOrientation(Qt.Vertical) + self.stackArea.setOrientation(Qt.Orientation.Vertical) stack = StackedWidget(self.stackArea) self.stackArea.addWidget(stack) self.stacks.append(stack) @@ -648,7 +649,7 @@ self.currentStack = stack stack.currentChanged.connect(self.__currentChanged) stack.installEventFilter(self) - if self.stackArea.orientation() == Qt.Horizontal: + if self.stackArea.orientation() == Qt.Orientation.Horizontal: size = self.stackArea.width() else: size = self.stackArea.height() @@ -729,7 +730,7 @@ Public method to get the orientation of the split view. @return orientation of the split - @rtype Qt.Horizontal or Qt.Vertical + @rtype Qt.Orientation.Horizontal or Qt.Orientation.Vertical """ return self.stackArea.orientation() @@ -738,7 +739,7 @@ Public method used to set the orientation of the split view. @param orientation orientation of the split - @type Qt.Horizontal or Qt.Vertical + @type Qt.Orientation.Horizontal or Qt.Orientation.Vertical """ self.stackArea.setOrientation(orientation) @@ -903,8 +904,8 @@ @rtype bool """ if ( - event.type() == QEvent.MouseButtonPress and - not event.button() == Qt.RightButton + event.type() == QEvent.Type.MouseButtonPress and + not event.button() == Qt.MouseButton.RightButton ): switched = True if isinstance(watched, QStackedWidget):
--- a/eric6/Plugins/ViewManagerPlugins/Tabview/Tabview.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/ViewManagerPlugins/Tabview/Tabview.py Tue Mar 02 17:17:09 2021 +0100 @@ -76,7 +76,7 @@ @param event reference to the mouse press event @type QMouseEvent """ - if event.button() == Qt.LeftButton: + if event.button() == Qt.MouseButton.LeftButton: self.__dragStartPos = QPoint(event.pos()) super(TabBar, self).mousePressEvent(event) @@ -88,7 +88,7 @@ @type QMouseEvent """ if ( - event.buttons() == Qt.MouseButtons(Qt.LeftButton) and + event.buttons() == Qt.MouseButtons(Qt.MouseButton.LeftButton) and (event.pos() - self.__dragStartPos).manhattanLength() > QApplication.startDragDistance() ): @@ -105,10 +105,14 @@ "tabwidget-id", str(id(self.parentWidget())).encode("utf-8")) drag.setMimeData(mimeData) - if event.modifiers() == Qt.KeyboardModifiers(Qt.ShiftModifier): - drag.exec(Qt.DropActions(Qt.CopyAction)) - elif event.modifiers() == Qt.KeyboardModifiers(Qt.NoModifier): - drag.exec(Qt.DropActions(Qt.MoveAction)) + if event.modifiers() == Qt.KeyboardModifiers( + Qt.KeyboardModifier.ShiftModifier + ): + drag.exec(Qt.DropActions(Qt.DropAction.CopyAction)) + elif event.modifiers() == Qt.KeyboardModifiers( + Qt.KeyboardModifier.NoModifier + ): + drag.exec(Qt.DropActions(Qt.DropAction.MoveAction)) super(TabBar, self).mouseMoveEvent(event) def dragEnterEvent(self, event): @@ -143,20 +147,20 @@ toIndex = self.tabAt(event.pos()) if oldID != id(self): parentID = int(mimeData.data("tabwidget-id")) - if event.proposedAction() == Qt.MoveAction: + if event.proposedAction() == Qt.DropAction.MoveAction: self.tabRelocateRequested.emit( str(parentID), fromIndex, toIndex) event.acceptProposedAction() - elif event.proposedAction() == Qt.CopyAction: + elif event.proposedAction() == Qt.DropAction.CopyAction: self.tabCopyRequested[str, int, int].emit( str(parentID), fromIndex, toIndex) event.acceptProposedAction() else: if fromIndex != toIndex: - if event.proposedAction() == Qt.MoveAction: + if event.proposedAction() == Qt.DropAction.MoveAction: self.tabMoveRequested.emit(fromIndex, toIndex) event.acceptProposedAction() - elif event.proposedAction() == Qt.CopyAction: + elif event.proposedAction() == Qt.DropAction.CopyAction: self.tabCopyRequested[int, int].emit(fromIndex, toIndex) event.acceptProposedAction() super(TabBar, self).dropEvent(event) @@ -182,7 +186,7 @@ QSize(2 * iconSize.width(), iconSize.height())) self.setUsesScrollButtons(True) - self.setElideMode(Qt.ElideNone) + self.setElideMode(Qt.TextElideMode.ElideNone) if isMacPlatform(): self.setDocumentMode(True) @@ -196,7 +200,7 @@ self.editors = [] self.indicator = E5Led(self) - self.setCornerWidget(self.indicator, Qt.TopLeftCorner) + self.setCornerWidget(self.indicator, Qt.Corner.TopLeftCorner) self.rightCornerWidget = QWidget(self) self.rightCornerWidgetLayout = QHBoxLayout(self.rightCornerWidget) @@ -210,27 +214,29 @@ self.navigationButton = QToolButton(self) self.navigationButton.setIcon(UI.PixmapCache.getIcon("1downarrow")) self.navigationButton.setToolTip(self.tr("Show a navigation menu")) - self.navigationButton.setPopupMode(QToolButton.InstantPopup) + self.navigationButton.setPopupMode( + QToolButton.ToolButtonPopupMode.InstantPopup) self.navigationButton.setMenu(self.__navigationMenu) self.navigationButton.setEnabled(False) self.rightCornerWidgetLayout.addWidget(self.navigationButton) self.tabCloseRequested.connect(self.__closeRequested) - self.setCornerWidget(self.rightCornerWidget, Qt.TopRightCorner) + self.setCornerWidget(self.rightCornerWidget, Qt.Corner.TopRightCorner) self.__initMenu() self.contextMenuEditor = None self.contextMenuIndex = -1 - self.setTabContextMenuPolicy(Qt.CustomContextMenu) + self.setTabContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu) self.customTabContextMenuRequested.connect(self.__showContextMenu) ericPic = QPixmap( os.path.join(getConfig('ericPixDir'), 'eric_small.png')) self.emptyLabel = QLabel() self.emptyLabel.setPixmap(ericPic) - self.emptyLabel.setAlignment(Qt.AlignVCenter | Qt.AlignHCenter) + self.emptyLabel.setAlignment( + Qt.AlignmentFlag.AlignVCenter | Qt.AlignmentFlag.AlignHCenter) super(TabWidget, self).addTab( self.emptyLabel, UI.PixmapCache.getIcon("empty"), "") @@ -811,7 +817,7 @@ tw.currentChanged.connect(self.__currentChanged) tw.installEventFilter(self) tw.tabBar().installEventFilter(self) - self.__splitter.setOrientation(Qt.Vertical) + self.__splitter.setOrientation(Qt.Orientation.Vertical) self.__inRemoveView = False self.maxFileNameChars = Preferences.getUI( @@ -1160,7 +1166,7 @@ tw.currentChanged.connect(self.__currentChanged) tw.installEventFilter(self) tw.tabBar().installEventFilter(self) - if self.__splitter.orientation() == Qt.Horizontal: + if self.__splitter.orientation() == Qt.Orientation.Horizontal: size = self.width() else: size = self.height() @@ -1211,7 +1217,7 @@ if assembly is not None: editor = assembly.getEditor() if editor is not None: - editor.setFocus(Qt.OtherFocusReason) + editor.setFocus(Qt.FocusReason.OtherFocusReason) if len(self.tabWidgets) == 1: self.splitRemoveAct.setEnabled(False) self.nextSplitAct.setEnabled(False) @@ -1249,7 +1255,7 @@ Public method to get the orientation of the split view. @return orientation of the split - @rtype Qt.Horizontal or Qt.Vertical + @rtype Qt.Orientation.Horizontal or Qt.Orientation.Vertical """ return self.__splitter.orientation() @@ -1258,7 +1264,7 @@ Public method used to set the orientation of the split view. @param orientation orientation of the split - @type Qt.Horizontal or Qt.Vertical + @type Qt.Orientation.Horizontal or Qt.Orientation.Vertical """ self.__splitter.setOrientation(orientation) @@ -1337,8 +1343,8 @@ @rtype bool """ if ( - event.type() == QEvent.MouseButtonPress and - not event.button() == Qt.RightButton + event.type() == QEvent.Type.MouseButtonPress and + not event.button() == Qt.MouseButton.RightButton ): switched = True self.currentTabWidget.showIndicator(False)
--- a/eric6/Plugins/WizardPlugins/ColorDialogWizard/ColorDialogWizardDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/WizardPlugins/ColorDialogWizard/ColorDialogWizardDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -35,7 +35,7 @@ self.setupUi(self) self.bTest = self.buttonBox.addButton( - self.tr("Test"), QDialogButtonBox.ActionRole) + self.tr("Test"), QDialogButtonBox.ButtonRole.ActionRole) msh = self.minimumSizeHint() self.resize(max(self.width(), msh.width()), msh.height()) @@ -80,7 +80,8 @@ QColor(self.sRed.value(), self.sGreen.value(), self.sBlue.value(), self.sAlpha.value()), None, self.eTitle.text(), - QColorDialog.ColorDialogOptions(QColorDialog.ShowAlphaChannel)) + QColorDialog.ColorDialogOptions( + QColorDialog.ColorDialogOption.ShowAlphaChannel)) def on_eRGB_textChanged(self, text): """ @@ -150,13 +151,15 @@ code += '{0}QColor({1}),{2}'.format( istring, col, os.linesep) else: - code += '{0}QColor(Qt.white),{1}'.format(istring, os.linesep) + code += '{0}QColor(Qt.GlobalColor.white),{1}'.format( + istring, os.linesep) code += '{0}{1},{2}'.format(istring, parent, os.linesep) code += '{0}self.tr("{1}"),{2}'.format( istring, self.eTitle.text(), os.linesep) code += ( '{0}QColorDialog.ColorDialogOptions(' - 'QColorDialog.ShowAlphaChannel)'.format(istring) + 'QColorDialog.ColorDialogOption.ShowAlphaChannel)' + .format(istring) ) code += '){0}'.format(estring) elif self.rRGBA.isChecked(): @@ -173,7 +176,8 @@ istring, self.eTitle.text(), os.linesep) code += ( '{0}QColorDialog.ColorDialogOptions(' - 'QColorDialog.ShowAlphaChannel)'.format(istring) + 'QColorDialog.ColorDialogOption.ShowAlphaChannel)' + .format(istring) ) code += '){0}'.format(estring)
--- a/eric6/Plugins/WizardPlugins/DotDesktopWizard/DotDesktopListSelectionDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/WizardPlugins/DotDesktopWizard/DotDesktopListSelectionDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -40,10 +40,10 @@ if not allowMultiMain: self.entriesList.setSelectionMode( - QAbstractItemView.SingleSelection) + QAbstractItemView.SelectionMode.SingleSelection) if not allowMultiSub: self.subList.setSelectionMode( - QAbstractItemView.SingleSelection) + QAbstractItemView.SelectionMode.SingleSelection) for entry in entries: itm = QListWidgetItem(entry, self.entriesList)
--- a/eric6/Plugins/WizardPlugins/DotDesktopWizard/DotDesktopWizardDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/WizardPlugins/DotDesktopWizard/DotDesktopWizardDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -34,7 +34,8 @@ super(DotDesktopWizardDialog, self).__init__(parent) self.setupUi(self) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) self.__mainCategories = [ 'AudioVideo', 'Audio', 'Video', 'Development', 'Education', @@ -215,7 +216,8 @@ enable = bool(self.nameEdit.text()) and bool(self.typeEdit.text()) if bool(self.onlyShowEdit.text()) and bool(self.notShowEdit.text()): enable = False - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enable) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(enable) @pyqtSlot(int) def on_typeComboBox_currentIndexChanged(self, index): @@ -268,7 +270,7 @@ self.categoriesEdit.text(), ";", subEntries=self.__subCategories, allowMultiMain=False) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: categories = dlg.getData(";", True) self.categoriesEdit.setText(categories) @@ -298,7 +300,7 @@ dlg = DotDesktopListSelectionDialog( self.__showinEnvironments, self.onlyShowEdit.text(), ";") - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: environments = dlg.getData(";", True) self.onlyShowEdit.setText(environments) @@ -328,7 +330,7 @@ dlg = DotDesktopListSelectionDialog( self.__showinEnvironments, self.notShowEdit.text(), ";") - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: environments = dlg.getData(";", True) self.notShowEdit.setText(environments)
--- a/eric6/Plugins/WizardPlugins/E5MessageBoxWizard/E5MessageBoxWizardDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/WizardPlugins/E5MessageBoxWizard/E5MessageBoxWizardDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -101,7 +101,7 @@ self.defaultCombo.addItems(self.buttonsList) self.bTest = self.buttonBox.addButton( - self.tr("Test"), QDialogButtonBox.ActionRole) + self.tr("Test"), QDialogButtonBox.ButtonRole.ActionRole) self.__enabledGroups()
--- a/eric6/Plugins/WizardPlugins/EricPluginWizard/PluginWizardDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/WizardPlugins/EricPluginWizard/PluginWizardDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -37,7 +37,8 @@ self.dataTabWidget.setCurrentIndex(0) - self.__okButton = self.buttonBox.button(QDialogButtonBox.Ok) + self.__okButton = self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok) self.__okButton.setEnabled(False) projectOpen = e5App().getObject("Project").isOpen()
--- a/eric6/Plugins/WizardPlugins/FileDialogWizard/FileDialogWizardDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/WizardPlugins/FileDialogWizard/FileDialogWizardDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -87,7 +87,7 @@ self.cFilters.toggled[bool].connect(self.__toggleGroupsAndTest) self.bTest = self.buttonBox.addButton( - self.tr("Test"), QDialogButtonBox.ActionRole) + self.tr("Test"), QDialogButtonBox.ButtonRole.ActionRole) msh = self.minimumSizeHint() self.resize(max(self.width(), msh.width()), msh.height()) @@ -100,16 +100,18 @@ @return modified options (QFileDialog.Options) """ if Globals.isLinuxPlatform(): - options |= QFileDialog.DontUseNativeDialog + options |= QFileDialog.Option.DontUseNativeDialog return options - @pyqtSlot(str) - def on_pyqtComboBox_currentIndexChanged(self, txt): + @pyqtSlot(int) + def on_pyqtComboBox_currentIndexChanged(self, index): """ Private slot to setup the dialog for the selected PyQt variant. - @param txt text of the selected combo box entry (string) + @param index index of the current item + @type int """ + txt = self.pyqtComboBox.itemText(index) self.rfOpenFile.setEnabled(txt == "eric") self.rfOpenFiles.setEnabled(txt == "eric") self.rfSaveFile.setEnabled(txt == "eric") @@ -165,7 +167,8 @@ """ if self.rOpenFile.isChecked() or self.rfOpenFile.isChecked(): if not self.cSymlinks.isChecked(): - options = QFileDialog.Options(QFileDialog.DontResolveSymlinks) + options = QFileDialog.Options( + QFileDialog.Option.DontResolveSymlinks) else: options = QFileDialog.Options() options = self.__adjustOptions(options) @@ -178,7 +181,8 @@ options) elif self.rOpenFileUrl.isChecked(): if not self.cSymlinks.isChecked(): - options = QFileDialog.Options(QFileDialog.DontResolveSymlinks) + options = QFileDialog.Options( + QFileDialog.Option.DontResolveSymlinks) else: options = QFileDialog.Options() options = self.__adjustOptions(options) @@ -203,7 +207,8 @@ self.schemesEdit.text().split()) elif self.rOpenFiles.isChecked() or self.rfOpenFiles.isChecked(): if not self.cSymlinks.isChecked(): - options = QFileDialog.Options(QFileDialog.DontResolveSymlinks) + options = QFileDialog.Options( + QFileDialog.Option.DontResolveSymlinks) else: options = QFileDialog.Options() options = self.__adjustOptions(options) @@ -216,7 +221,8 @@ options) elif self.rOpenFileUrls.isChecked(): if not self.cSymlinks.isChecked(): - options = QFileDialog.Options(QFileDialog.DontResolveSymlinks) + options = QFileDialog.Options( + QFileDialog.Option.DontResolveSymlinks) else: options = QFileDialog.Options() options = self.__adjustOptions(options) @@ -241,7 +247,8 @@ self.schemesEdit.text().split()) elif self.rSaveFile.isChecked() or self.rfSaveFile.isChecked(): if not self.cSymlinks.isChecked(): - options = QFileDialog.Options(QFileDialog.DontResolveSymlinks) + options = QFileDialog.Options( + QFileDialog.Option.DontResolveSymlinks) else: options = QFileDialog.Options() options = self.__adjustOptions(options) @@ -254,7 +261,8 @@ options) elif self.rSaveFileUrl.isChecked(): if not self.cSymlinks.isChecked(): - options = QFileDialog.Options(QFileDialog.DontResolveSymlinks) + options = QFileDialog.Options( + QFileDialog.Option.DontResolveSymlinks) else: options = QFileDialog.Options() options = self.__adjustOptions(options) @@ -280,9 +288,10 @@ elif self.rDirectory.isChecked(): options = QFileDialog.Options() if not self.cSymlinks.isChecked(): - options |= QFileDialog.Options(QFileDialog.DontResolveSymlinks) + options |= QFileDialog.Options( + QFileDialog.Option.DontResolveSymlinks) if self.cDirOnly.isChecked(): - options |= QFileDialog.Options(QFileDialog.ShowDirsOnly) + options |= QFileDialog.Options(QFileDialog.Option.ShowDirsOnly) else: options |= QFileDialog.Options(QFileDialog.Option(0)) options = self.__adjustOptions(options) @@ -294,9 +303,10 @@ elif self.rDirectoryUrl.isChecked(): options = QFileDialog.Options() if not self.cSymlinks.isChecked(): - options |= QFileDialog.Options(QFileDialog.DontResolveSymlinks) + options |= QFileDialog.Options( + QFileDialog.Option.DontResolveSymlinks) if self.cDirOnly.isChecked(): - options |= QFileDialog.Options(QFileDialog.ShowDirsOnly) + options |= QFileDialog.Options(QFileDialog.Option.ShowDirsOnly) else: options |= QFileDialog.Options(QFileDialog.Option(0)) options = self.__adjustOptions(options) @@ -415,8 +425,10 @@ if self.__dialogVariant == -1: dialogType = "E5FileDialog" + optionStr = "" else: dialogType = "QFileDialog" + optionStr = ".Option" code = '{0}{1} = {2}.'.format(nameVariable, filterVariable, dialogType) if ( @@ -476,8 +488,10 @@ initialFilter = fmt.format(self.eInitialFilter.text()) code += ',{0}{1}{2}'.format(os.linesep, istring, initialFilter) if not self.cSymlinks.isChecked(): - code += ',{0}{1}{2}.Options({2}.DontResolveSymlinks)'.format( - os.linesep, istring, dialogType) + code += ( + ',{0}{1}{2}.Options({2}{3}.DontResolveSymlinks)' + .format(os.linesep, istring, dialogType, optionStr) + ) if self.rOpenFileUrl.isChecked() and bool(self.schemesEdit.text()): code += ',{0}{1}{2}'.format( os.linesep, istring, self.__prepareSchemesList()) @@ -539,8 +553,10 @@ initialFilter = fmt.format(self.eInitialFilter.text()) code += ',{0}{1}{2}'.format(os.linesep, istring, initialFilter) if not self.cSymlinks.isChecked(): - code += ',{0}{1}{2}.Options({2}.DontResolveSymlinks)'.format( - os.linesep, istring, dialogType) + code += ( + ',{0}{1}{2}.Options({2}{3}.DontResolveSymlinks)' + .format(os.linesep, istring, dialogType, optionStr) + ) if ( self.rOpenFileUrls.isChecked() and bool(self.schemesEdit.text()) @@ -611,14 +627,16 @@ code += ',{0}{1}{2}.Options('.format( os.linesep, istring, dialogType) if not self.cSymlinks.isChecked(): - code += '{0}.DontResolveSymlinks'.format(dialogType) + code += '{0}{1}.DontResolveSymlinks'.format( + dialogType, optionStr) if ( (not self.cSymlinks.isChecked()) and (not self.cConfirmOverwrite.isChecked()) ): code += ' | ' if not self.cConfirmOverwrite.isChecked(): - code += '{0}.DontConfirmOverwrite'.format(dialogType) + code += '{0}{1}.DontConfirmOverwrite'.format( + dialogType, optionStr) code += ')' if ( self.rSaveFileUrl.isChecked() and @@ -662,9 +680,11 @@ code += ',{0}{1}{2}.Options('.format(os.linesep, istring, dialogType) if not self.cSymlinks.isChecked(): - code += '{0}.DontResolveSymlinks | '.format(dialogType) + code += '{0}{1}.DontResolveSymlinks | '.format( + dialogType, optionStr) if self.cDirOnly.isChecked(): - code += '{0}.ShowDirsOnly'.format(dialogType) + code += '{0}{1}.ShowDirsOnly'.format( + dialogType, optionStr) else: code += '{0}.Option(0)'.format(dialogType) code += ')'
--- a/eric6/Plugins/WizardPlugins/FontDialogWizard/FontDialogWizardDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/WizardPlugins/FontDialogWizard/FontDialogWizardDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -32,7 +32,7 @@ self.setupUi(self) self.bTest = self.buttonBox.addButton( - self.tr("Test"), QDialogButtonBox.ActionRole) + self.tr("Test"), QDialogButtonBox.ButtonRole.ActionRole) self.font = None
--- a/eric6/Plugins/WizardPlugins/InputDialogWizard/InputDialogWizardDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/WizardPlugins/InputDialogWizard/InputDialogWizardDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -41,7 +41,7 @@ QDoubleValidator(-2147483647, 2147483647, 99, self.eDoubleTo)) self.bTest = self.buttonBox.addButton( - self.tr("Test"), QDialogButtonBox.ActionRole) + self.tr("Test"), QDialogButtonBox.ButtonRole.ActionRole) msh = self.minimumSizeHint() self.resize(max(self.width(), msh.width()), msh.height()) @@ -71,11 +71,11 @@ """ if self.rText.isChecked(): if self.rEchoNormal.isChecked(): - echomode = QLineEdit.Normal + echomode = QLineEdit.EchoMode.Normal elif self.rEchoNoEcho.isChecked(): - echomode = QLineEdit.NoEcho + echomode = QLineEdit.EchoMode.NoEcho else: - echomode = QLineEdit.Password + echomode = QLineEdit.EchoMode.Password QInputDialog.getText( None, self.eCaption.text(), @@ -148,11 +148,11 @@ code += 'self.tr("{0}"),{1}{2}'.format( self.eLabel.text(), os.linesep, istring) if self.rEchoNormal.isChecked(): - code += 'QLineEdit.Normal' + code += 'QLineEdit.EchoMode.Normal' elif self.rEchoNoEcho.isChecked(): - code += 'QLineEdit.NoEcho' + code += 'QLineEdit.EchoMode.NoEcho' else: - code += 'QLineEdit.Password' + code += 'QLineEdit.EchoMode.Password' if self.eTextDefault.text(): code += ',{0}{1}self.tr("{2}")'.format( os.linesep, istring, self.eTextDefault.text())
--- a/eric6/Plugins/WizardPlugins/MessageBoxWizard/MessageBoxWizardDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/WizardPlugins/MessageBoxWizard/MessageBoxWizardDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -54,96 +54,96 @@ self.tr("Yes to all"), ] self.buttonsCodeListBinary = [ - QMessageBox.NoButton, - QMessageBox.Abort, - QMessageBox.Apply, - QMessageBox.Cancel, - QMessageBox.Close, - QMessageBox.Discard, - QMessageBox.Help, - QMessageBox.Ignore, - QMessageBox.No, - QMessageBox.NoToAll, - QMessageBox.Ok, - QMessageBox.Open, - QMessageBox.Reset, - QMessageBox.RestoreDefaults, - QMessageBox.Retry, - QMessageBox.Save, - QMessageBox.SaveAll, - QMessageBox.Yes, - QMessageBox.YesToAll, + QMessageBox.StandardButton.NoButton, + QMessageBox.StandardButton.Abort, + QMessageBox.StandardButton.Apply, + QMessageBox.StandardButton.Cancel, + QMessageBox.StandardButton.Close, + QMessageBox.StandardButton.Discard, + QMessageBox.StandardButton.Help, + QMessageBox.StandardButton.Ignore, + QMessageBox.StandardButton.No, + QMessageBox.StandardButton.NoToAll, + QMessageBox.StandardButton.Ok, + QMessageBox.StandardButton.Open, + QMessageBox.StandardButton.Reset, + QMessageBox.StandardButton.RestoreDefaults, + QMessageBox.StandardButton.Retry, + QMessageBox.StandardButton.Save, + QMessageBox.StandardButton.SaveAll, + QMessageBox.StandardButton.Yes, + QMessageBox.StandardButton.YesToAll, ] self.buttonsCodeListText = [ - "QMessageBox.NoButton", - "QMessageBox.Abort", - "QMessageBox.Apply", - "QMessageBox.Cancel", - "QMessageBox.Close", - "QMessageBox.Discard", - "QMessageBox.Help", - "QMessageBox.Ignore", - "QMessageBox.No", - "QMessageBox.NoToAll", - "QMessageBox.Ok", - "QMessageBox.Open", - "QMessageBox.Reset", - "QMessageBox.RestoreDefaults", - "QMessageBox.Retry", - "QMessageBox.Save", - "QMessageBox.SaveAll", - "QMessageBox.Yes", - "QMessageBox.YesToAll", + "QMessageBox.StandardButton.NoButton", + "QMessageBox.StandardButton.Abort", + "QMessageBox.StandardButton.Apply", + "QMessageBox.StandardButton.Cancel", + "QMessageBox.StandardButton.Close", + "QMessageBox.StandardButton.Discard", + "QMessageBox.StandardButton.Help", + "QMessageBox.StandardButton.Ignore", + "QMessageBox.StandardButton.No", + "QMessageBox.StandardButton.NoToAll", + "QMessageBox.StandardButton.Ok", + "QMessageBox.StandardButton.Open", + "QMessageBox.StandardButton.Reset", + "QMessageBox.StandardButton.RestoreDefaults", + "QMessageBox.StandardButton.Retry", + "QMessageBox.StandardButton.Save", + "QMessageBox.StandardButton.SaveAll", + "QMessageBox.StandardButton.Yes", + "QMessageBox.StandardButton.YesToAll", ] self.defaultCombo.addItems(self.buttonsList) self.bTest = self.buttonBox.addButton( - self.tr("Test"), QDialogButtonBox.ActionRole) + self.tr("Test"), QDialogButtonBox.ButtonRole.ActionRole) def __testSelectedOptions(self): """ Private method to test the selected options. """ - buttons = QMessageBox.NoButton + buttons = QMessageBox.StandardButton.NoButton if self.abortCheck.isChecked(): - buttons |= QMessageBox.Abort + buttons |= QMessageBox.StandardButton.Abort if self.applyCheck.isChecked(): - buttons |= QMessageBox.Apply + buttons |= QMessageBox.StandardButton.Apply if self.cancelCheck.isChecked(): - buttons |= QMessageBox.Cancel + buttons |= QMessageBox.StandardButton.Cancel if self.closeCheck.isChecked(): - buttons |= QMessageBox.Close + buttons |= QMessageBox.StandardButton.Close if self.discardCheck.isChecked(): - buttons |= QMessageBox.Discard + buttons |= QMessageBox.StandardButton.Discard if self.helpCheck.isChecked(): - buttons |= QMessageBox.Help + buttons |= QMessageBox.StandardButton.Help if self.ignoreCheck.isChecked(): - buttons |= QMessageBox.Ignore + buttons |= QMessageBox.StandardButton.Ignore if self.noCheck.isChecked(): - buttons |= QMessageBox.No + buttons |= QMessageBox.StandardButton.No if self.notoallCheck.isChecked(): - buttons |= QMessageBox.NoToAll + buttons |= QMessageBox.StandardButton.NoToAll if self.okCheck.isChecked(): - buttons |= QMessageBox.Ok + buttons |= QMessageBox.StandardButton.Ok if self.openCheck.isChecked(): - buttons |= QMessageBox.Open + buttons |= QMessageBox.StandardButton.Open if self.resetCheck.isChecked(): - buttons |= QMessageBox.Reset + buttons |= QMessageBox.StandardButton.Reset if self.restoreCheck.isChecked(): - buttons |= QMessageBox.RestoreDefaults + buttons |= QMessageBox.StandardButton.RestoreDefaults if self.retryCheck.isChecked(): - buttons |= QMessageBox.Retry + buttons |= QMessageBox.StandardButton.Retry if self.saveCheck.isChecked(): - buttons |= QMessageBox.Save + buttons |= QMessageBox.StandardButton.Save if self.saveallCheck.isChecked(): - buttons |= QMessageBox.SaveAll + buttons |= QMessageBox.StandardButton.SaveAll if self.yesCheck.isChecked(): - buttons |= QMessageBox.Yes + buttons |= QMessageBox.StandardButton.Yes if self.yestoallCheck.isChecked(): - buttons |= QMessageBox.YesToAll - if buttons == QMessageBox.NoButton: - buttons = QMessageBox.Ok + buttons |= QMessageBox.StandardButton.YesToAll + if buttons == QMessageBox.StandardButton.NoButton: + buttons = QMessageBox.StandardButton.Ok defaultButton = self.buttonsCodeListBinary[ self.defaultCombo.currentIndex()] @@ -246,41 +246,41 @@ """ buttons = [] if self.abortCheck.isChecked(): - buttons.append("QMessageBox.Abort") + buttons.append("QMessageBox.StandardButton.Abort") if self.applyCheck.isChecked(): - buttons.append("QMessageBox.Apply") + buttons.append("QMessageBox.StandardButton.Apply") if self.cancelCheck.isChecked(): - buttons.append("QMessageBox.Cancel") + buttons.append("QMessageBox.StandardButton.Cancel") if self.closeCheck.isChecked(): - buttons.append("QMessageBox.Close") + buttons.append("QMessageBox.StandardButton.Close") if self.discardCheck.isChecked(): - buttons.append("QMessageBox.Discard") + buttons.append("QMessageBox.StandardButton.Discard") if self.helpCheck.isChecked(): - buttons.append("QMessageBox.Help") + buttons.append("QMessageBox.StandardButton.Help") if self.ignoreCheck.isChecked(): - buttons.append("QMessageBox.Ignore") + buttons.append("QMessageBox.StandardButton.Ignore") if self.noCheck.isChecked(): - buttons.append("QMessageBox.No") + buttons.append("QMessageBox.StandardButton.No") if self.notoallCheck.isChecked(): - buttons.append("QMessageBox.NoToAll") + buttons.append("QMessageBox.StandardButton.NoToAll") if self.okCheck.isChecked(): - buttons.append("QMessageBox.Ok") + buttons.append("QMessageBox.StandardButton.Ok") if self.openCheck.isChecked(): - buttons.append("QMessageBox.Open") + buttons.append("QMessageBox.StandardButton.Open") if self.resetCheck.isChecked(): - buttons.append("QMessageBox.Reset") + buttons.append("QMessageBox.StandardButton.Reset") if self.restoreCheck.isChecked(): - buttons.append("QMessageBox.RestoreDefaults") + buttons.append("QMessageBox.StandardButton.RestoreDefaults") if self.retryCheck.isChecked(): - buttons.append("QMessageBox.Retry") + buttons.append("QMessageBox.StandardButton.Retry") if self.saveCheck.isChecked(): - buttons.append("QMessageBox.Save") + buttons.append("QMessageBox.StandardButton.Save") if self.saveallCheck.isChecked(): - buttons.append("QMessageBox.SaveAll") + buttons.append("QMessageBox.StandardButton.SaveAll") if self.yesCheck.isChecked(): - buttons.append("QMessageBox.Yes") + buttons.append("QMessageBox.StandardButton.Yes") if self.yestoallCheck.isChecked(): - buttons.append("QMessageBox.YesToAll") + buttons.append("QMessageBox.StandardButton.YesToAll") if len(buttons) == 0: return ""
--- a/eric6/Plugins/WizardPlugins/PyRegExpWizard/PyRegExpWizardCharactersDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/WizardPlugins/PyRegExpWizard/PyRegExpWizardCharactersDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -95,7 +95,7 @@ self.moreSinglesButton.setObjectName("moreSinglesButton") hlayout0.addWidget(self.moreSinglesButton) hspacer0 = QSpacerItem( - 30, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) + 30, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum) hlayout0.addItem(hspacer0) self.singlesBoxLayout.addLayout(hlayout0) self.moreSinglesButton.clicked.connect(self.__addSinglesLine) @@ -129,7 +129,7 @@ self.moreSinglesButton.setObjectName("moreRangesButton") hlayout1.addWidget(self.moreRangesButton) hspacer1 = QSpacerItem( - 30, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) + 30, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum) hlayout1.addItem(hspacer1) self.rangesBoxLayout.addLayout(hlayout1) self.moreRangesButton.clicked.connect(self.__addRangesLine)
--- a/eric6/Plugins/WizardPlugins/PyRegExpWizard/PyRegExpWizardDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/WizardPlugins/PyRegExpWizard/PyRegExpWizardDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -73,37 +73,39 @@ self.namedGroups = re.compile(r"""\(?P<([^>]+)>""").findall self.saveButton = self.buttonBox.addButton( - self.tr("Save"), QDialogButtonBox.ActionRole) + self.tr("Save"), QDialogButtonBox.ButtonRole.ActionRole) self.saveButton.setToolTip( self.tr("Save the regular expression to a file")) self.loadButton = self.buttonBox.addButton( - self.tr("Load"), QDialogButtonBox.ActionRole) + self.tr("Load"), QDialogButtonBox.ButtonRole.ActionRole) self.loadButton.setToolTip( self.tr("Load a regular expression from a file")) self.validateButton = self.buttonBox.addButton( - self.tr("Validate"), QDialogButtonBox.ActionRole) + self.tr("Validate"), QDialogButtonBox.ButtonRole.ActionRole) self.validateButton.setToolTip( self.tr("Validate the regular expression")) self.executeButton = self.buttonBox.addButton( - self.tr("Execute"), QDialogButtonBox.ActionRole) + self.tr("Execute"), QDialogButtonBox.ButtonRole.ActionRole) self.executeButton.setToolTip( self.tr("Execute the regular expression")) self.nextButton = self.buttonBox.addButton( - self.tr("Next match"), QDialogButtonBox.ActionRole) + self.tr("Next match"), QDialogButtonBox.ButtonRole.ActionRole) self.nextButton.setToolTip( self.tr("Show the next match of the regular expression")) self.nextButton.setEnabled(False) if fromEric: self.buttonBox.setStandardButtons( - QDialogButtonBox.Cancel | QDialogButtonBox.Ok) + QDialogButtonBox.StandardButton.Cancel | + QDialogButtonBox.StandardButton.Ok) self.copyButton = None else: self.copyButton = self.buttonBox.addButton( - self.tr("Copy"), QDialogButtonBox.ActionRole) + self.tr("Copy"), QDialogButtonBox.ButtonRole.ActionRole) self.copyButton.setToolTip( self.tr("Copy the regular expression to the clipboard")) - self.buttonBox.setStandardButtons(QDialogButtonBox.Close) + self.buttonBox.setStandardButtons( + QDialogButtonBox.StandardButton.Close) self.variableLabel.hide() self.variableLineEdit.hide() self.variableLine.hide() @@ -123,10 +125,10 @@ tc = self.regexpTextEdit.textCursor() if steps != 0: if steps < 0: - act = QTextCursor.Left + act = QTextCursor.MoveOperation.Left steps = abs(steps) else: - act = QTextCursor.Right + act = QTextCursor.MoveOperation.Right for _ in range(steps): tc.movePosition(act) self.regexpTextEdit.setTextCursor(tc) @@ -264,7 +266,7 @@ """ from .PyRegExpWizardRepeatDialog import PyRegExpWizardRepeatDialog dlg = PyRegExpWizardRepeatDialog(self) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: self.__insertString(dlg.getRepeat()) @pyqtSlot() @@ -276,7 +278,7 @@ PyRegExpWizardCharactersDialog ) dlg = PyRegExpWizardCharactersDialog(self) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: self.__insertString(dlg.getCharacters()) @pyqtSlot() @@ -387,9 +389,9 @@ if escaped: escaped = escaped.replace("\\", "\\\\") cb = QApplication.clipboard() - cb.setText(escaped, QClipboard.Clipboard) + cb.setText(escaped, QClipboard.Mode.Clipboard) if cb.supportsSelection(): - cb.setText(escaped, QClipboard.Selection) + cb.setText(escaped, QClipboard.Mode.Selection) @pyqtSlot() def on_validateButton_clicked(self): @@ -536,7 +538,8 @@ # highlight the matched text tc = self.textTextEdit.textCursor() tc.setPosition(offset) - tc.setPosition(self.lastMatchEnd, QTextCursor.KeepAnchor) + tc.setPosition(self.lastMatchEnd, + QTextCursor.MoveMode.KeepAnchor) self.textTextEdit.setTextCursor(tc) else: self.nextButton.setEnabled(False)
--- a/eric6/Plugins/WizardPlugins/QRegularExpressionWizard/QRegularExpressionWizardCharactersDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/WizardPlugins/QRegularExpressionWizard/QRegularExpressionWizardCharactersDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -98,7 +98,7 @@ self.moreSinglesButton.setObjectName("moreSinglesButton") hlayout0.addWidget(self.moreSinglesButton) hspacer0 = QSpacerItem( - 30, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) + 30, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum) hlayout0.addItem(hspacer0) self.singlesBoxLayout.addLayout(hlayout0) self.moreSinglesButton.clicked.connect(self.__addSinglesLine) @@ -133,7 +133,7 @@ self.moreSinglesButton.setObjectName("moreRangesButton") hlayout1.addWidget(self.moreRangesButton) hspacer1 = QSpacerItem( - 30, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) + 30, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum) hlayout1.addItem(hspacer1) self.rangesBoxLayout.addLayout(hlayout1) self.moreRangesButton.clicked.connect(self.__addRangesLine) @@ -348,7 +348,7 @@ hboxLayout.addWidget(le1) cb1a = QComboBox(hbox) cb1a.setEditable(False) - cb1a.setSizeAdjustPolicy(QComboBox.AdjustToContents) + cb1a.setSizeAdjustPolicy(QComboBox.SizeAdjustPolicy.AdjustToContents) hboxLayout.addWidget(cb1a) cb1a.hide() cb2 = QComboBox(hbox) @@ -360,7 +360,7 @@ hboxLayout.addWidget(le2) cb2a = QComboBox(hbox) cb2a.setEditable(False) - cb2a.setSizeAdjustPolicy(QComboBox.AdjustToContents) + cb2a.setSizeAdjustPolicy(QComboBox.SizeAdjustPolicy.AdjustToContents) hboxLayout.addWidget(cb2a) cb2a.hide() self.singlesItemsBoxLayout.addWidget(hbox)
--- a/eric6/Plugins/WizardPlugins/QRegularExpressionWizard/QRegularExpressionWizardDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/WizardPlugins/QRegularExpressionWizard/QRegularExpressionWizardDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -87,31 +87,32 @@ os.path.dirname(__file__), "QRegularExpressionWizardServer.py") ]) if self.__pyqt5Server.waitForStarted(5000): - self.__pyqt5Server.setReadChannel(QProcess.StandardOutput) + self.__pyqt5Server.setReadChannel( + QProcess.ProcessChannel.StandardOutput) if self.__sendCommand("available"): response = self.__receiveResponse() if response and response["available"]: self.__pyqt5Available = True self.saveButton = self.buttonBox.addButton( - self.tr("Save"), QDialogButtonBox.ActionRole) + self.tr("Save"), QDialogButtonBox.ButtonRole.ActionRole) self.saveButton.setToolTip( self.tr("Save the regular expression to a file")) self.loadButton = self.buttonBox.addButton( - self.tr("Load"), QDialogButtonBox.ActionRole) + self.tr("Load"), QDialogButtonBox.ButtonRole.ActionRole) self.loadButton.setToolTip( self.tr("Load a regular expression from a file")) if self.__pyqt5Available: self.validateButton = self.buttonBox.addButton( - self.tr("Validate"), QDialogButtonBox.ActionRole) + self.tr("Validate"), QDialogButtonBox.ButtonRole.ActionRole) self.validateButton.setToolTip( self.tr("Validate the regular expression")) self.executeButton = self.buttonBox.addButton( - self.tr("Execute"), QDialogButtonBox.ActionRole) + self.tr("Execute"), QDialogButtonBox.ButtonRole.ActionRole) self.executeButton.setToolTip( self.tr("Execute the regular expression")) self.nextButton = self.buttonBox.addButton( - self.tr("Next match"), QDialogButtonBox.ActionRole) + self.tr("Next match"), QDialogButtonBox.ButtonRole.ActionRole) self.nextButton.setToolTip( self.tr("Show the next match of the regular expression")) self.nextButton.setEnabled(False) @@ -122,14 +123,16 @@ if fromEric: self.buttonBox.setStandardButtons( - QDialogButtonBox.Cancel | QDialogButtonBox.Ok) + QDialogButtonBox.StandardButton.Cancel | + QDialogButtonBox.StandardButton.Ok) self.copyButton = None else: self.copyButton = self.buttonBox.addButton( - self.tr("Copy"), QDialogButtonBox.ActionRole) + self.tr("Copy"), QDialogButtonBox.ButtonRole.ActionRole) self.copyButton.setToolTip( self.tr("Copy the regular expression to the clipboard")) - self.buttonBox.setStandardButtons(QDialogButtonBox.Close) + self.buttonBox.setStandardButtons( + QDialogButtonBox.StandardButton.Close) self.variableLabel.hide() self.variableLineEdit.hide() self.variableLine.hide() @@ -196,10 +199,10 @@ tc = self.regexpTextEdit.textCursor() if steps != 0: if steps < 0: - act = QTextCursor.Left + act = QTextCursor.MoveOperation.Left steps = abs(steps) else: - act = QTextCursor.Right + act = QTextCursor.MoveOperation.Right for _ in range(steps): tc.movePosition(act) self.regexpTextEdit.setTextCursor(tc) @@ -220,7 +223,7 @@ QRegularExpressionWizardCharactersDialog ) dlg = QRegularExpressionWizardCharactersDialog(self) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: self.__insertString(dlg.getCharacters()) @pyqtSlot() @@ -239,7 +242,7 @@ QRegularExpressionWizardRepeatDialog ) dlg = QRegularExpressionWizardRepeatDialog(self) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: self.__insertString(dlg.getRepeat()) @pyqtSlot() @@ -469,9 +472,9 @@ if escaped: escaped = escaped.replace("\\", "\\\\") cb = QApplication.clipboard() - cb.setText(escaped, QClipboard.Clipboard) + cb.setText(escaped, QClipboard.Mode.Clipboard) if cb.supportsSelection(): - cb.setText(escaped, QClipboard.Selection) + cb.setText(escaped, QClipboard.Mode.Selection) @pyqtSlot() def on_validateButton_clicked(self): @@ -666,7 +669,8 @@ tc = self.textTextEdit.textCursor() tc.setPosition(offset) tc.setPosition( - self.lastMatchEnd, QTextCursor.KeepAnchor) + self.lastMatchEnd, + QTextCursor.MoveMode.KeepAnchor) self.textTextEdit.setTextCursor(tc) else: self.nextButton.setEnabled(False) @@ -747,19 +751,26 @@ options = [] if self.caseInsensitiveCheckBox.isChecked(): - options.append("QRegularExpression.CaseInsensitiveOption") + options.append( + "QRegularExpression.PatternOption.CaseInsensitiveOption") if self.multilineCheckBox.isChecked(): - options.append("QRegularExpression.MultilineOption") + options.append( + "QRegularExpression.PatternOption.MultilineOption") if self.dotallCheckBox.isChecked(): - options.append("QRegularExpression.DotMatchesEverythingOption") + options.append( + "QRegularExpression.PatternOption.DotMatchesEverythingOption") if self.extendedCheckBox.isChecked(): - options.append("QRegularExpression.ExtendedPatternSyntaxOption") + options.append( + "QRegularExpression.PatternOption.ExtendedPatternSyntaxOption") if self.greedinessCheckBox.isChecked(): - options.append("QRegularExpression.InvertedGreedinessOption") + options.append( + "QRegularExpression.PatternOption.InvertedGreedinessOption") if self.unicodeCheckBox.isChecked(): - options.append("QRegularExpression.UseUnicodePropertiesOption") + options.append( + "QRegularExpression.PatternOption.UseUnicodePropertiesOption") if self.captureCheckBox.isChecked(): - options.append("QRegularExpression.DontCaptureOption") + options.append( + "QRegularExpression.PatternOption.DontCaptureOption") options = " |{0}{1}".format(os.linesep, i1string).join(options) code = '{0} = QRegularExpression('.format(reVar)
--- a/eric6/Plugins/WizardPlugins/QRegularExpressionWizard/QRegularExpressionWizardServer.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/WizardPlugins/QRegularExpressionWizard/QRegularExpressionWizardServer.py Tue Mar 02 17:17:09 2021 +0100 @@ -22,21 +22,29 @@ """ try: from PyQt5.QtCore import QRegularExpression - rxOptions = QRegularExpression.NoPatternOption + rxOptions = QRegularExpression.PatternOption.NoPatternOption if "CaseInsensitiveOption" in options: - rxOptions |= QRegularExpression.CaseInsensitiveOption + rxOptions |= QRegularExpression.PatternOption.CaseInsensitiveOption if "MultilineOption" in options: - rxOptions |= QRegularExpression.MultilineOption + rxOptions |= QRegularExpression.PatternOption.MultilineOption if "DotMatchesEverythingOption" in options: - rxOptions |= QRegularExpression.DotMatchesEverythingOption + rxOptions |= ( + QRegularExpression.PatternOption.DotMatchesEverythingOption + ) if "ExtendedPatternSyntaxOption" in options: - rxOptions |= QRegularExpression.ExtendedPatternSyntaxOption + rxOptions |= ( + QRegularExpression.PatternOption.ExtendedPatternSyntaxOption + ) if "InvertedGreedinessOption" in options: - rxOptions |= QRegularExpression.InvertedGreedinessOption + rxOptions |= ( + QRegularExpression.PatternOption.InvertedGreedinessOption + ) if "UseUnicodePropertiesOption" in options: - rxOptions |= QRegularExpression.UseUnicodePropertiesOption + rxOptions |= ( + QRegularExpression.PatternOption.UseUnicodePropertiesOption + ) if "DontCaptureOption" in options: - rxOptions |= QRegularExpression.DontCaptureOption + rxOptions |= QRegularExpression.PatternOption.DontCaptureOption error = "" errorOffset = -1 @@ -71,21 +79,27 @@ return valid, error, errorOffset from PyQt5.QtCore import QRegularExpression - rxOptions = QRegularExpression.NoPatternOption + rxOptions = QRegularExpression.PatternOption.NoPatternOption if "CaseInsensitiveOption" in options: - rxOptions |= QRegularExpression.CaseInsensitiveOption + rxOptions |= QRegularExpression.PatternOption.CaseInsensitiveOption if "MultilineOption" in options: - rxOptions |= QRegularExpression.MultilineOption + rxOptions |= QRegularExpression.PatternOption.MultilineOption if "DotMatchesEverythingOption" in options: - rxOptions |= QRegularExpression.DotMatchesEverythingOption + rxOptions |= ( + QRegularExpression.PatternOption.DotMatchesEverythingOption + ) if "ExtendedPatternSyntaxOption" in options: - rxOptions |= QRegularExpression.ExtendedPatternSyntaxOption + rxOptions |= ( + QRegularExpression.PatternOption.ExtendedPatternSyntaxOption + ) if "InvertedGreedinessOption" in options: - rxOptions |= QRegularExpression.InvertedGreedinessOption + rxOptions |= QRegularExpression.PatternOption.InvertedGreedinessOption if "UseUnicodePropertiesOption" in options: - rxOptions |= QRegularExpression.UseUnicodePropertiesOption + rxOptions |= ( + QRegularExpression.PatternOption.UseUnicodePropertiesOption + ) if "DontCaptureOption" in options: - rxOptions |= QRegularExpression.DontCaptureOption + rxOptions |= QRegularExpression.PatternOption.DontCaptureOption matched = False captures = []
--- a/eric6/Plugins/WizardPlugins/SetupWizard/SetupWizardDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/WizardPlugins/SetupWizard/SetupWizardDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -71,7 +71,8 @@ self.__loadClassifiersFromPyPI() - self.__okButton = self.buttonBox.button(QDialogButtonBox.Ok) + self.__okButton = self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok) self.__okButton.setEnabled(False) projectOpen = e5App().getObject("Project").isOpen() @@ -109,8 +110,9 @@ from PyPI. """ request = QNetworkRequest(QUrl(SetupWizardDialog.ClassifiersUrl)) - request.setAttribute(QNetworkRequest.CacheLoadControlAttribute, - QNetworkRequest.AlwaysNetwork) + request.setAttribute( + QNetworkRequest.Attribute.CacheLoadControlAttribute, + QNetworkRequest.CacheLoadControl.AlwaysNetwork) reply = e5App().getObject("UserInterface").networkAccessManager().get( request) reply.finished.connect(lambda: self.__classifiersDownloadDone(reply)) @@ -128,7 +130,7 @@ reply.deleteLater() if reply in self.__replies: self.__replies.remove(reply) - if reply.error() == QNetworkReply.NoError: + if reply.error() == QNetworkReply.NetworkError.NoError: ioEncoding = Preferences.getSystem("IOEncoding") lines = str(reply.readAll(), ioEncoding, 'replace').splitlines() @@ -191,7 +193,10 @@ self.licenseClassifierComboBox.setCurrentIndex( self.licenseClassifierComboBox.findText( - "(GPLv3)", Qt.MatchContains | Qt.MatchCaseSensitive)) + "(GPLv3)", + Qt.MatchFlag.MatchContains | Qt.MatchFlag.MatchCaseSensitive + ) + ) def __addClassifierEntry(self, line): """ @@ -215,8 +220,8 @@ self.__classifiersDict[key] = itm else: pitm = self.__classifiersDict[key] - itm.setCheckState(0, Qt.Unchecked) - itm.setData(0, Qt.UserRole, line) + itm.setCheckState(0, Qt.CheckState.Unchecked) + itm.setData(0, Qt.ItemDataRole.UserRole, line) def __getLicenseText(self): """ @@ -368,8 +373,8 @@ itm = self.classifiersList.topLevelItem(0) while itm: itm.setExpanded(True) - if itm.checkState(0) == Qt.Checked: - classifiers.append(itm.data(0, Qt.UserRole)) + if itm.checkState(0) == Qt.CheckState.Checked: + classifiers.append(itm.data(0, Qt.ItemDataRole.UserRole)) itm = self.classifiersList.itemBelow(itm) # cleanup classifiers list - remove all invalid entries @@ -759,7 +764,9 @@ self.excludePatternEdit.text().replace("\\", ".").replace("/", ".") ) if not self.excludePatternList.findItems( - pattern, Qt.MatchExactly | Qt.MatchCaseSensitive): + pattern, + Qt.MatchFlag.MatchExactly | Qt.MatchFlag.MatchCaseSensitive + ): QListWidgetItem(pattern, self.excludePatternList) @pyqtSlot(str)
--- a/eric6/Preferences/ConfigurationDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Preferences/ConfigurationDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -444,12 +444,12 @@ pitm = self.configList self.itmDict[key] = ConfigurationPageItem(pitm, pageData[0], key, pageData[1]) - self.itmDict[key].setData(0, Qt.UserRole, key) + self.itmDict[key].setData(0, Qt.ItemDataRole.UserRole, key) if (not self.fromEric or displayMode != ConfigurationWidget.DefaultMode or key in expandedEntries): self.itmDict[key].setExpanded(True) - self.configList.sortByColumn(0, Qt.AscendingOrder) + self.configList.sortByColumn(0, Qt.SortOrder.AscendingOrder) # set the initial size of the splitter self.configSplitter.setSizes([200, 600]) @@ -494,7 +494,7 @@ self.verticalLayout_2.setObjectName("verticalLayout_2") self.configSplitter = QSplitter(self) - self.configSplitter.setOrientation(Qt.Horizontal) + self.configSplitter.setOrientation(Qt.Orientation.Horizontal) self.configSplitter.setObjectName("configSplitter") self.configListWidget = QWidget(self.configSplitter) @@ -512,17 +512,19 @@ self.configListSearch.textChanged.connect(self.__searchTextChanged) self.scrollArea = QScrollArea(self.configSplitter) - self.scrollArea.setFrameShape(QFrame.NoFrame) - self.scrollArea.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn) - self.scrollArea.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOn) + self.scrollArea.setFrameShape(QFrame.Shape.NoFrame) + self.scrollArea.setVerticalScrollBarPolicy( + Qt.ScrollBarPolicy.ScrollBarAlwaysOn) + self.scrollArea.setHorizontalScrollBarPolicy( + Qt.ScrollBarPolicy.ScrollBarAlwaysOn) self.scrollArea.setWidgetResizable(False) self.scrollArea.setSizeAdjustPolicy( - QAbstractScrollArea.AdjustToContents) + QAbstractScrollArea.SizeAdjustPolicy.AdjustToContents) self.scrollArea.setObjectName("scrollArea") self.configStack = QStackedWidget() - self.configStack.setFrameShape(QFrame.Box) - self.configStack.setFrameShadow(QFrame.Sunken) + self.configStack.setFrameShape(QFrame.Shape.Box) + self.configStack.setFrameShadow(QFrame.Shadow.Sunken) self.configStack.setObjectName("configStack") self.scrollArea.setWidget(self.configStack) @@ -534,44 +536,50 @@ self.vboxlayout.setContentsMargins(6, 6, 6, 6) self.vboxlayout.setObjectName("vboxlayout") spacerItem = QSpacerItem( - 20, 20, QSizePolicy.Minimum, QSizePolicy.Expanding) + 20, 20, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding) self.vboxlayout.addItem(spacerItem) self.emptyPagePixmap = QLabel(self.emptyPage) - self.emptyPagePixmap.setAlignment(Qt.AlignCenter) + self.emptyPagePixmap.setAlignment(Qt.AlignmentFlag.AlignCenter) self.emptyPagePixmap.setObjectName("emptyPagePixmap") self.emptyPagePixmap.setPixmap( QPixmap(os.path.join(getConfig('ericPixDir'), 'eric.png'))) self.vboxlayout.addWidget(self.emptyPagePixmap) self.textLabel1 = QLabel(self.emptyPage) - self.textLabel1.setAlignment(Qt.AlignCenter) + self.textLabel1.setAlignment(Qt.AlignmentFlag.AlignCenter) self.textLabel1.setObjectName("textLabel1") self.vboxlayout.addWidget(self.textLabel1) spacerItem1 = QSpacerItem( - 20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) + 20, 40, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding) self.vboxlayout.addItem(spacerItem1) self.configStack.addWidget(self.emptyPage) self.verticalLayout_2.addWidget(self.configSplitter) self.buttonBox = QDialogButtonBox(self) - self.buttonBox.setOrientation(Qt.Horizontal) + self.buttonBox.setOrientation(Qt.Orientation.Horizontal) self.buttonBox.setStandardButtons( - QDialogButtonBox.Apply | QDialogButtonBox.Cancel | - QDialogButtonBox.Ok | QDialogButtonBox.Reset) + QDialogButtonBox.StandardButton.Apply | + QDialogButtonBox.StandardButton.Cancel | + QDialogButtonBox.StandardButton.Ok | + QDialogButtonBox.StandardButton.Reset + ) self.buttonBox.setObjectName("buttonBox") if ( not self.fromEric and self.displayMode == ConfigurationWidget.DefaultMode ): - self.buttonBox.button(QDialogButtonBox.Apply).hide() - self.buttonBox.button(QDialogButtonBox.Apply).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Reset).setEnabled(False) + self.buttonBox.button(QDialogButtonBox.StandardButton.Apply).hide() + self.buttonBox.button( + QDialogButtonBox.StandardButton.Apply).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Reset).setEnabled(False) self.verticalLayout_2.addWidget(self.buttonBox) self.setWindowTitle(self.tr("Preferences")) self.configList.header().hide() - self.configList.header().setSortIndicator(0, Qt.AscendingOrder) + self.configList.header().setSortIndicator( + 0, Qt.SortOrder.AscendingOrder) self.configList.setSortingEnabled(True) self.textLabel1.setText( self.tr("Please select an entry of the list \n" @@ -711,20 +719,25 @@ elif setCurrent: items = self.configList.findItems( pageData[0], - Qt.MatchFixedString | Qt.MatchRecursive) + Qt.MatchFlag.MatchFixedString | + Qt.MatchFlag.MatchRecursive) for item in items: - if item.data(0, Qt.UserRole) == pageName: + if item.data(0, Qt.ItemDataRole.UserRole) == pageName: self.configList.setCurrentItem(item) self.configStack.setCurrentWidget(page) self.__resizeConfigStack() if page != self.emptyPage: page.polishPage() - self.buttonBox.button(QDialogButtonBox.Apply).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Reset).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Apply).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Reset).setEnabled(True) else: - self.buttonBox.button(QDialogButtonBox.Apply).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Reset).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Apply).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Reset).setEnabled(False) # reset scrollbars for sb in [self.scrollArea.horizontalScrollBar(), @@ -811,9 +824,13 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Apply): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Apply + ): self.on_applyButton_clicked() - elif button == self.buttonBox.button(QDialogButtonBox.Reset): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Reset + ): self.on_resetButton_clicked() @pyqtSlot() @@ -863,7 +880,7 @@ @param item reference to the collapsed item (QTreeWidgetItem) """ - pageName = item.data(0, Qt.UserRole) + pageName = item.data(0, Qt.ItemDataRole.UserRole) if pageName in self.__expandedEntries: self.__expandedEntries.remove(pageName) @@ -874,7 +891,7 @@ @param item reference to the expanded item (QTreeWidgetItem) """ - pageName = item.data(0, Qt.UserRole) + pageName = item.data(0, Qt.ItemDataRole.UserRole) if pageName not in self.__expandedEntries: self.__expandedEntries.append(pageName) @@ -929,7 +946,7 @@ if name: self.setObjectName(name) self.setModal(modal) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) self.layout = QVBoxLayout(self) self.layout.setContentsMargins(0, 0, 0, 0)
--- a/eric6/Preferences/ConfigurationPages/ConfigurationPageBase.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Preferences/ConfigurationPages/ConfigurationPageBase.py Tue Mar 02 17:17:09 2021 +0100 @@ -85,7 +85,7 @@ colDlg = QColorDialog(self) if hasAlpha: - colDlg.setOptions(QColorDialog.ShowAlphaChannel) + colDlg.setOptions(QColorDialog.ColorDialogOption.ShowAlphaChannel) # Set current colour last to avoid conflicts with alpha channel colDlg.setCurrentColor(self.__coloursDict[colorKey][0]) colDlg.currentColorChanged.connect(
--- a/eric6/Preferences/ConfigurationPages/CooperationPage.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Preferences/ConfigurationPages/CooperationPage.py Tue Mar 02 17:17:09 2021 +0100 @@ -93,7 +93,7 @@ """ self.addBannedUserButton.setEnabled( self.__bannedUserValidator.validate(txt, len(txt))[0] == - QValidator.Acceptable) + QValidator.State.Acceptable) @pyqtSlot() def on_deleteBannedUsersButton_clicked(self):
--- a/eric6/Preferences/ConfigurationPages/DebuggerGeneralPage.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Preferences/ConfigurationPages/DebuggerGeneralPage.py Tue Mar 02 17:17:09 2021 +0100 @@ -272,10 +272,11 @@ None, self.tr("Add allowed host"), self.tr("Enter the IP address of an allowed host"), - QLineEdit.Normal) + QLineEdit.EchoMode.Normal) if ok and allowedHost: if QHostAddress(allowedHost).protocol() in [ - QAbstractSocket.IPv4Protocol, QAbstractSocket.IPv6Protocol + QAbstractSocket.NetworkLayerProtocol.IPv4Protocol, + QAbstractSocket.NetworkLayerProtocol.IPv6Protocol ]: self.allowedHostsList.addItem(allowedHost) else: @@ -305,11 +306,12 @@ None, self.tr("Edit allowed host"), self.tr("Enter the IP address of an allowed host"), - QLineEdit.Normal, + QLineEdit.EchoMode.Normal, allowedHost) if ok and allowedHost: if QHostAddress(allowedHost).protocol() in [ - QAbstractSocket.IPv4Protocol, QAbstractSocket.IPv6Protocol + QAbstractSocket.NetworkLayerProtocol.IPv4Protocol, + QAbstractSocket.NetworkLayerProtocol.IPv6Protocol ]: self.allowedHostsList.currentItem().setText(allowedHost) else: @@ -415,9 +417,9 @@ @return item flags @rtype QtCore.Qt.ItemFlag """ - return Qt.ItemIsEnabled | Qt.ItemIsSelectable + return Qt.ItemFlag.ItemIsEnabled | Qt.ItemFlag.ItemIsSelectable - def data(self, index, role=Qt.DisplayRole): + def data(self, index, role=Qt.ItemDataRole.DisplayRole): """ Public Qt slot get the role data of item. @@ -428,9 +430,9 @@ @return role data of item @rtype str, QBrush or None """ - if role == Qt.DisplayRole: + if role == Qt.ItemDataRole.DisplayRole: return self.tr("Variable Name") - elif role == Qt.BackgroundRole: + elif role == Qt.ItemDataRole.BackgroundRole: if index.row() >= 2: return self.bgColorChanged else:
--- a/eric6/Preferences/ConfigurationPages/DiffColoursPage.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Preferences/ConfigurationPages/DiffColoursPage.py Tue Mar 02 17:17:09 2021 +0100 @@ -138,8 +138,9 @@ """ colorKey = button.property("colorKey") - colour = QColorDialog.getColor(self.__coloursDict[colorKey][0], self, - "", QColorDialog.ShowAlphaChannel) + colour = QColorDialog.getColor( + self.__coloursDict[colorKey][0], self, "", + QColorDialog.ColorDialogOption.ShowAlphaChannel) if colour.isValid(): self.__coloursDict[colorKey][0] = colour self.__updateSampleBackgroundColour(colorKey) @@ -155,7 +156,7 @@ colour = self.__coloursDict[colourKey][0] for sample in self.__allSamples: pl = sample.palette() - pl.setColor(QPalette.Text, colour) + pl.setColor(QPalette.ColorRole.Text, colour) sample.setPalette(pl) sample.repaint() @@ -170,7 +171,7 @@ if sample: colour = self.__coloursDict[colourKey][0] pl = sample.palette() - pl.setColor(QPalette.Base, colour) + pl.setColor(QPalette.ColorRole.Base, colour) sample.setPalette(pl) sample.repaint()
--- a/eric6/Preferences/ConfigurationPages/EditorAutocompletionQScintillaPage.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Preferences/ConfigurationPages/EditorAutocompletionQScintillaPage.py Tue Mar 02 17:17:09 2021 +0100 @@ -37,11 +37,11 @@ Preferences.getEditor("AutoCompletionFillups")) acSource = Preferences.getEditor("AutoCompletionSource") - if acSource == QsciScintilla.AcsDocument: + if acSource == QsciScintilla.AutoCompletionSource.AcsDocument: self.acSourceDocumentRadioButton.setChecked(True) - elif acSource == QsciScintilla.AcsAPIs: + elif acSource == QsciScintilla.AutoCompletionSource.AcsAPIs: self.acSourceAPIsRadioButton.setChecked(True) - elif acSource == QsciScintilla.AcsAll: + elif acSource == QsciScintilla.AutoCompletionSource.AcsAll: self.acSourceAllRadioButton.setChecked(True) def save(self): @@ -49,17 +49,23 @@ Public slot to save the Editor Autocompletion configuration. """ Preferences.setEditor( - "AutoCompletionShowSingle", self.acShowSingleCheckBox.isChecked()) + "AutoCompletionShowSingle", + self.acShowSingleCheckBox.isChecked()) Preferences.setEditor( - "AutoCompletionFillups", self.acFillupsCheckBox.isChecked()) + "AutoCompletionFillups", + self.acFillupsCheckBox.isChecked()) if self.acSourceDocumentRadioButton.isChecked(): Preferences.setEditor( - "AutoCompletionSource", QsciScintilla.AcsDocument) + "AutoCompletionSource", + QsciScintilla.AutoCompletionSource.AcsDocument) elif self.acSourceAPIsRadioButton.isChecked(): Preferences.setEditor( - "AutoCompletionSource", QsciScintilla.AcsAPIs) + "AutoCompletionSource", + QsciScintilla.AutoCompletionSource.AcsAPIs) elif self.acSourceAllRadioButton.isChecked(): - Preferences.setEditor("AutoCompletionSource", QsciScintilla.AcsAll) + Preferences.setEditor( + "AutoCompletionSource", + QsciScintilla.AutoCompletionSource.AcsAll) def create(dlg):
--- a/eric6/Preferences/ConfigurationPages/EditorCalltipsPage.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Preferences/ConfigurationPages/EditorCalltipsPage.py Tue Mar 02 17:17:09 2021 +0100 @@ -29,10 +29,10 @@ self.positionComboBox.addItem( self.tr("Below Text"), - QsciScintilla.CallTipsBelowText) + QsciScintilla.CallTipsPosition.CallTipsBelowText) self.positionComboBox.addItem( self.tr("Above Text"), - QsciScintilla.CallTipsAboveText) + QsciScintilla.CallTipsPosition.CallTipsAboveText) # set initial values self.ctEnabledCheckBox.setChecked(
--- a/eric6/Preferences/ConfigurationPages/EditorCalltipsQScintillaPage.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Preferences/ConfigurationPages/EditorCalltipsQScintillaPage.py Tue Mar 02 17:17:09 2021 +0100 @@ -30,11 +30,14 @@ # set initial values ctContext = Preferences.getEditor("CallTipsStyle") - if ctContext == QsciScintilla.CallTipsNoContext: + if ctContext == QsciScintilla.CallTipsStyle.CallTipsNoContext: self.ctNoContextButton.setChecked(True) - elif ctContext == QsciScintilla.CallTipsNoAutoCompletionContext: + elif ( + ctContext == + QsciScintilla.CallTipsStyle.CallTipsNoAutoCompletionContext + ): self.ctNoAutoCompletionButton.setChecked(True) - elif ctContext == QsciScintilla.CallTipsContext: + elif ctContext == QsciScintilla.CallTipsStyle.CallTipsContext: self.ctContextButton.setChecked(True) def save(self): @@ -43,13 +46,16 @@ """ if self.ctNoContextButton.isChecked(): Preferences.setEditor( - "CallTipsStyle", QsciScintilla.CallTipsNoContext) + "CallTipsStyle", + QsciScintilla.CallTipsStyle.CallTipsNoContext) elif self.ctNoAutoCompletionButton.isChecked(): Preferences.setEditor( - "CallTipsStyle", QsciScintilla.CallTipsNoAutoCompletionContext) + "CallTipsStyle", + QsciScintilla.CallTipsStyle.CallTipsNoAutoCompletionContext) elif self.ctContextButton.isChecked(): Preferences.setEditor( - "CallTipsStyle", QsciScintilla.CallTipsContext) + "CallTipsStyle", + QsciScintilla.CallTipsStyle.CallTipsContext) def create(dlg):
--- a/eric6/Preferences/ConfigurationPages/EditorFilePage.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Preferences/ConfigurationPages/EditorFilePage.py Tue Mar 02 17:17:09 2021 +0100 @@ -81,11 +81,11 @@ Preferences.getEditor("InsertFinalNewline")) eolMode = Preferences.getEditor("EOLMode") - if eolMode == QsciScintilla.EolWindows: + if eolMode == QsciScintilla.EolMode.EolWindows: self.crlfRadioButton.setChecked(True) - elif eolMode == QsciScintilla.EolMac: + elif eolMode == QsciScintilla.EolMode.EolMac: self.crRadioButton.setChecked(True) - elif eolMode == QsciScintilla.EolUnix: + elif eolMode == QsciScintilla.EolMode.EolUnix: self.lfRadioButton.setChecked(True) self.previewRefreshTimeoutSpinBox.setValue( @@ -163,11 +163,11 @@ self.insertFinalNewlineCheckBox.isChecked()) if self.crlfRadioButton.isChecked(): - Preferences.setEditor("EOLMode", QsciScintilla.EolWindows) + Preferences.setEditor("EOLMode", QsciScintilla.EolMode.EolWindows) elif self.crRadioButton.isChecked(): - Preferences.setEditor("EOLMode", QsciScintilla.EolMac) + Preferences.setEditor("EOLMode", QsciScintilla.EolMode.EolMac) elif self.lfRadioButton.isChecked(): - Preferences.setEditor("EOLMode", QsciScintilla.EolUnix) + Preferences.setEditor("EOLMode", QsciScintilla.EolMode.EolUnix) self.__extractFileFilters() Preferences.setEditor("AdditionalOpenFilters", self.openFileFilters) @@ -297,7 +297,7 @@ self, self.tr("Add File Filter"), self.tr("Enter the file filter entry:"), - QLineEdit.Normal) + QLineEdit.EchoMode.Normal) if ok and fileFilter: if self.__checkFileFilter(fileFilter): self.fileFiltersList.addItem(fileFilter) @@ -314,7 +314,7 @@ self, self.tr("Add File Filter"), self.tr("Enter the file filter entry:"), - QLineEdit.Normal, + QLineEdit.EchoMode.Normal, fileFilter) if ok and fileFilter: if self.__checkFileFilter(fileFilter):
--- a/eric6/Preferences/ConfigurationPages/EditorGeneralPage.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Preferences/ConfigurationPages/EditorGeneralPage.py Tue Mar 02 17:17:09 2021 +0100 @@ -158,7 +158,7 @@ overrides = Preferences.getEditor("TabIndentOverride") for language, (tabWidth, indentWidth) in overrides.items(): self.__createOverrideItem(language, tabWidth, indentWidth) - self.languageOverrideWidget.sortItems(0, Qt.AscendingOrder) + self.languageOverrideWidget.sortItems(0, Qt.SortOrder.AscendingOrder) self.__resizeOverrideColumns() self.on_languageOverrideWidget_itemSelectionChanged() @@ -177,15 +177,15 @@ language, "{0:2d}".format(tabWidth), "{0:2d}".format(indentWidth)]) - itm.setTextAlignment(1, Qt.AlignHCenter) - itm.setTextAlignment(2, Qt.AlignHCenter) + itm.setTextAlignment(1, Qt.AlignmentFlag.AlignHCenter) + itm.setTextAlignment(2, Qt.AlignmentFlag.AlignHCenter) def __resizeOverrideColumns(self): """ Private method to resize the list columns. """ self.languageOverrideWidget.header().resizeSections( - QHeaderView.ResizeToContents) + QHeaderView.ResizeMode.ResizeToContents) self.languageOverrideWidget.header().setStretchLastSection(True) def __saveLanguageOverrides(self): @@ -229,10 +229,11 @@ tabWidth=self.tabwidthSlider.value(), indentWidth=self.indentwidthSlider.value(), ) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: language, tabWidth, indentWidth = dlg.getData() self.__createOverrideItem(language, tabWidth, indentWidth) - self.languageOverrideWidget.sortItems(0, Qt.AscendingOrder) + self.languageOverrideWidget.sortItems( + 0, Qt.SortOrder.AscendingOrder) self.__resizeOverrideColumns() @pyqtSlot() @@ -262,7 +263,7 @@ tabWidth=int(itm.text(1)), indentWidth=int(itm.text(2)), ) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: language, tabWidth, indentWidth = dlg.getData() itm.setText(1, "{0:2d}".format(tabWidth)) itm.setText(2, "{0:2d}".format(indentWidth))
--- a/eric6/Preferences/ConfigurationPages/EditorHighlightersPage.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Preferences/ConfigurationPages/EditorHighlightersPage.py Tue Mar 02 17:17:09 2021 +0100 @@ -37,8 +37,8 @@ self.editorLexerList.headerItem().setText( self.editorLexerList.columnCount(), "") header = self.editorLexerList.header() - header.setSectionResizeMode(QHeaderView.ResizeToContents) - header.setSortIndicator(0, Qt.AscendingOrder) + header.setSectionResizeMode(QHeaderView.ResizeMode.ResizeToContents) + header.setSortIndicator(0, Qt.SortOrder.AscendingOrder) try: self.extsep = os.extsep @@ -60,7 +60,7 @@ lexerAssocs = Preferences.getEditorLexerAssocs() for ext in lexerAssocs: QTreeWidgetItem(self.editorLexerList, [ext, lexerAssocs[ext]]) - self.editorLexerList.sortByColumn(0, Qt.AscendingOrder) + self.editorLexerList.sortByColumn(0, Qt.SortOrder.AscendingOrder) def save(self): """ @@ -90,7 +90,7 @@ lexer = "Pygments|{0}".format(pygmentsLexer) if ext and lexer: itmList = self.editorLexerList.findItems( - ext, Qt.MatchFlags(Qt.MatchExactly), 0) + ext, Qt.MatchFlags(Qt.MatchFlag.MatchExactly), 0) if itmList: index = self.editorLexerList.indexOfTopLevelItem(itmList[0]) itm = self.editorLexerList.takeTopLevelItem(index) @@ -158,13 +158,15 @@ """ self.on_editorLexerList_itemClicked(itm, column) - @pyqtSlot(str) - def on_editorLexerCombo_currentIndexChanged(self, text): + @pyqtSlot(int) + def on_editorLexerCombo_currentIndexChanged(self, index): """ Private slot to handle the selection of a lexer. - @param text text of the lexer combo (string) + @param index index of the current item + @type int """ + text = self.editorLexerCombo.itemText(index) if text in self.extras: self.pygmentsLexerCombo.setEnabled(True) self.pygmentsLabel.setEnabled(True)
--- a/eric6/Preferences/ConfigurationPages/EditorHighlightingStylesPage.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Preferences/ConfigurationPages/EditorHighlightingStylesPage.py Tue Mar 02 17:17:09 2021 +0100 @@ -24,7 +24,7 @@ import UI.PixmapCache try: - MonospacedFontsOption = QFontDialog.MonospacedFonts + MonospacedFontsOption = QFontDialog.FontDialogOption.MonospacedFonts except AttributeError: MonospacedFontsOption = QFontDialog.FontDialogOptions(0x10) NoFontsOption = QFontDialog.FontDialogOptions(0) @@ -40,8 +40,8 @@ FAMILYANDSIZE = 2 FONT = 99 - StyleRole = Qt.UserRole + 1 - SubstyleRole = Qt.UserRole + 2 + StyleRole = Qt.ItemDataRole.UserRole + 1 + SubstyleRole = Qt.ItemDataRole.UserRole + 2 def __init__(self, lexers): """ @@ -130,7 +130,8 @@ for description, styleNo, subStyleNo in self.lexer.getStyles(): if subStyleNo >= 0: parent = self.styleElementList.findItems( - self.lexer.description(styleNo), Qt.MatchExactly)[0] + self.lexer.description(styleNo), + Qt.MatchFlag.MatchExactly)[0] parent.setExpanded(True) else: parent = self.styleElementList @@ -190,9 +191,9 @@ item.setBackground(0, paper) item.setForeground(0, colour) if eolfill: - item.setCheckState(0, Qt.Checked) + item.setCheckState(0, Qt.CheckState.Checked) else: - item.setCheckState(0, Qt.Unchecked) + item.setCheckState(0, Qt.CheckState.Unchecked) def __styleAllItems(self): """ @@ -225,8 +226,8 @@ self.sampleText.setFont(font) pl = self.sampleText.palette() - pl.setColor(QPalette.Text, colour) - pl.setColor(QPalette.Base, paper) + pl.setColor(QPalette.ColorRole.Text, colour) + pl.setColor(QPalette.ColorRole.Base, paper) self.sampleText.setPalette(pl) self.sampleText.repaint() self.eolfillCheckBox.setChecked(eolfill) @@ -250,7 +251,7 @@ colour = QColorDialog.getColor(self.lexer.color(style, substyle)) if colour.isValid(): pl = self.sampleText.palette() - pl.setColor(QPalette.Text, colour) + pl.setColor(QPalette.ColorRole.Text, colour) self.sampleText.setPalette(pl) self.sampleText.repaint() for selItem in self.styleElementList.selectedItems(): @@ -268,7 +269,7 @@ colour = QColorDialog.getColor(self.lexer.paper(style, substyle)) if colour.isValid(): pl = self.sampleText.palette() - pl.setColor(QPalette.Base, colour) + pl.setColor(QPalette.ColorRole.Base, colour) self.sampleText.setPalette(pl) self.sampleText.repaint() for selItem in self.styleElementList.selectedItems(): @@ -286,7 +287,7 @@ colour = QColorDialog.getColor(self.lexer.paper(style, substyle)) if colour.isValid(): pl = self.sampleText.palette() - pl.setColor(QPalette.Base, colour) + pl.setColor(QPalette.ColorRole.Base, colour) self.sampleText.setPalette(pl) self.sampleText.repaint() @@ -409,7 +410,7 @@ @param on flag indicating enabled or disabled state (boolean) """ style, substyle = self.__currentStyles() - checkState = Qt.Checked if on else Qt.Unchecked + checkState = Qt.CheckState.Checked if on else Qt.CheckState.Unchecked for selItem in self.styleElementList.selectedItems(): style, substyle = self.__stylesForItem(selItem) self.lexer.setEolFill(on, style, substyle) @@ -537,7 +538,7 @@ EditorHighlightingStylesSelectionDialog) dlg = EditorHighlightingStylesSelectionDialog( lexerNames, forImport=False, preselect=preselect) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: lexerNames = dlg.getLexerNames() else: # Cancelled by user @@ -581,7 +582,7 @@ highlightingStylesFile.writeFile(fn, lexers) else: f = QFile(fn) - if f.open(QIODevice.WriteOnly): + if f.open(QIODevice.OpenModeFlag.WriteOnly): from E5XML.HighlightingStylesWriter import ( HighlightingStylesWriter ) @@ -629,7 +630,7 @@ else: # old XML based file f = QFile(fn) - if f.open(QIODevice.ReadOnly): + if f.open(QIODevice.OpenModeFlag.ReadOnly): from E5XML.HighlightingStylesReader import ( HighlightingStylesReader ) @@ -672,7 +673,7 @@ EditorHighlightingStylesSelectionDialog) dlg = EditorHighlightingStylesSelectionDialog( lexerNames, forImport=True) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: lexerNames = dlg.getLexerNames() else: # Cancelled by user @@ -760,14 +761,14 @@ style, substyle = self.__currentStyles() dlg = SubstyleDefinitionDialog( self.lexer, style, substyle, parent=self) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: description, words = dlg.getData() substyle = self.lexer.addSubstyle(style) self.lexer.setDescription(description, style, substyle) self.lexer.setWords(words, style, substyle) parent = self.styleElementList.findItems( - self.lexer.description(style), Qt.MatchExactly)[0] + self.lexer.description(style), Qt.MatchFlag.MatchExactly)[0] parent.setExpanded(True) itm = QTreeWidgetItem(parent, [description]) itm.setData(0, self.StyleRole, style) @@ -804,7 +805,7 @@ style, substyle = self.__currentStyles() dlg = SubstyleDefinitionDialog( self.lexer, style, substyle, parent=self) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: description, words = dlg.getData() self.lexer.setDescription(description, style, substyle) self.lexer.setWords(words, style, substyle) @@ -835,7 +836,7 @@ style, newSubstyle) parent = self.styleElementList.findItems( - self.lexer.description(style), Qt.MatchExactly)[0] + self.lexer.description(style), Qt.MatchFlag.MatchExactly)[0] parent.setExpanded(True) itm = QTreeWidgetItem(parent, [description]) itm.setData(0, self.StyleRole, style)
--- a/eric6/Preferences/ConfigurationPages/EditorHighlightingStylesSelectionDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Preferences/ConfigurationPages/EditorHighlightingStylesSelectionDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -40,7 +40,7 @@ self.setupUi(self) self.__selectAllButton = self.buttonBox.addButton( - self.tr("Select All"), QDialogButtonBox.ActionRole) + self.tr("Select All"), QDialogButtonBox.ButtonRole.ActionRole) if forImport: self.setWindowTitle(self.tr("Import Highlighting Styles")) @@ -56,11 +56,12 @@ for name in lexerNames: itm = QListWidgetItem(name, self.lexersList) - itm.setFlags(Qt.ItemIsUserCheckable | Qt.ItemIsEnabled) + itm.setFlags( + Qt.ItemFlag.ItemIsUserCheckable | Qt.ItemFlag.ItemIsEnabled) if name in preselect: - itm.setCheckState(Qt.Checked) + itm.setCheckState(Qt.CheckState.Checked) else: - itm.setCheckState(Qt.Unchecked) + itm.setCheckState(Qt.CheckState.Unchecked) self.__updateOkButton() @@ -71,12 +72,13 @@ """ for row in range(self.lexersList.count()): itm = self.lexersList.item(row) - if itm.checkState() == Qt.Checked: + if itm.checkState() == Qt.CheckState.Checked: enable = True break else: enable = False - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enable) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(enable) @pyqtSlot(QListWidgetItem) def on_lexersList_itemChanged(self, item): @@ -99,7 +101,7 @@ if button is self.__selectAllButton: for row in range(self.lexersList.count()): itm = self.lexersList.item(row) - itm.setCheckState(Qt.Checked) + itm.setCheckState(Qt.CheckState.Checked) def getLexerNames(self): """ @@ -111,7 +113,7 @@ lexerNames = [] for row in range(self.lexersList.count()): itm = self.lexersList.item(row) - if itm.checkState() == Qt.Checked: + if itm.checkState() == Qt.CheckState.Checked: lexerNames.append(itm.text()) return lexerNames
--- a/eric6/Preferences/ConfigurationPages/EditorLanguageTabIndentOverrideDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Preferences/ConfigurationPages/EditorLanguageTabIndentOverrideDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -105,20 +105,23 @@ """ lang = self.languageComboBox.currentText() if lang in self.__extras: - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( - bool(self.pygmentsLexerCombo.currentText())) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled( + bool(self.pygmentsLexerCombo.currentText())) else: - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( - bool(lang)) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled( + bool(lang)) - @pyqtSlot(str) - def on_languageComboBox_currentIndexChanged(self, lang): + @pyqtSlot(int) + def on_languageComboBox_currentIndexChanged(self, index): """ Private slot to handle the selection of a language. - @param lang selected language - @type str + @param index index of the current item + @type int """ + lang = self.languageComboBox.itemText(index) if lang in self.__extras: self.pygmentsLexerCombo.setEnabled(True) self.pygmentsLabel.setEnabled(True) @@ -128,12 +131,12 @@ self.__updateOkButton() - @pyqtSlot(str) - def on_pygmentsLexerCombo_currentIndexChanged(self, lang): + @pyqtSlot(int) + def on_pygmentsLexerCombo_currentIndexChanged(self, index): """ Private slot to handle the selection of a language. - @param lang selected language - @type str + @param index index of the current item + @type int """ self.__updateOkButton()
--- a/eric6/Preferences/ConfigurationPages/EditorStylesPage.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Preferences/ConfigurationPages/EditorStylesPage.py Tue Mar 02 17:17:09 2021 +0100 @@ -18,7 +18,7 @@ import Preferences try: - MonospacedFontsOption = QFontDialog.MonospacedFonts + MonospacedFontsOption = QFontDialog.FontDialogOption.MonospacedFonts except AttributeError: MonospacedFontsOption = QFontDialog.FontDialogOptions(0x10) @@ -38,47 +38,53 @@ from QScintilla.QsciScintillaCompat import QsciScintillaCompat self.foldStyles = [ - QsciScintilla.PlainFoldStyle, - QsciScintilla.CircledFoldStyle, - QsciScintilla.BoxedFoldStyle, - QsciScintilla.CircledTreeFoldStyle, - QsciScintilla.BoxedTreeFoldStyle, + QsciScintilla.FoldStyle.PlainFoldStyle, + QsciScintilla.FoldStyle.CircledFoldStyle, + QsciScintilla.FoldStyle.BoxedFoldStyle, + QsciScintilla.FoldStyle.CircledTreeFoldStyle, + QsciScintilla.FoldStyle.BoxedTreeFoldStyle, QsciScintillaCompat.ArrowFoldStyle, QsciScintillaCompat.ArrowTreeFoldStyle, ] self.edgeModes = [ - QsciScintilla.EdgeNone, - QsciScintilla.EdgeLine, - QsciScintilla.EdgeBackground + QsciScintilla.EdgeMode.EdgeNone, + QsciScintilla.EdgeMode.EdgeLine, + QsciScintilla.EdgeMode.EdgeBackground ] self.wrapModeComboBox.addItem( - self.tr("Disabled"), QsciScintilla.WrapNone) + self.tr("Disabled"), + QsciScintilla.WrapMode.WrapNone) self.wrapModeComboBox.addItem( - self.tr("Word Boundary"), QsciScintilla.WrapWord) + self.tr("Word Boundary"), + QsciScintilla.WrapMode.WrapWord) self.wrapModeComboBox.addItem( - self.tr("Character Boundary"), QsciScintilla.WrapCharacter) + self.tr("Character Boundary"), + QsciScintilla.WrapMode.WrapCharacter) self.wrapVisualComboBox.addItem( - self.tr("No Indicator"), QsciScintilla.WrapFlagNone) + self.tr("No Indicator"), + QsciScintilla.WrapVisualFlag.WrapFlagNone) self.wrapVisualComboBox.addItem( - self.tr("Indicator by Text"), QsciScintilla.WrapFlagByText) + self.tr("Indicator by Text"), + QsciScintilla.WrapVisualFlag.WrapFlagByText) self.wrapVisualComboBox.addItem( - self.tr("Indicator by Margin"), QsciScintilla.WrapFlagByBorder) + self.tr("Indicator by Margin"), + QsciScintilla.WrapVisualFlag.WrapFlagByBorder) self.wrapVisualComboBox.addItem( self.tr("Indicator in Line Number Margin"), - QsciScintilla.WrapFlagInMargin) + QsciScintilla.WrapVisualFlag.WrapFlagInMargin) self.wrapIndentComboBox.addItem( - self.tr("Fixed"), QsciScintilla.WrapIndentFixed) + self.tr("Fixed"), QsciScintilla.WrapIndentMode.WrapIndentFixed) self.wrapIndentComboBox.addItem( - self.tr("Aligned"), QsciScintilla.WrapIndentSame) + self.tr("Aligned"), QsciScintilla.WrapIndentMode.WrapIndentSame) self.wrapIndentComboBox.addItem( self.tr("Aligned plus One"), - QsciScintilla.WrapIndentIndented) + QsciScintilla.WrapIndentMode.WrapIndentIndented) self.wrapIndentComboBox.addItem( self.tr("Aligned plus Two"), - QsciScintilla.WrapIndentDeeplyIndented) + QsciScintilla.WrapIndentMode.WrapIndentDeeplyIndented) # set initial values try: @@ -435,25 +441,25 @@ self.monospacedFontSample.setFont(self.monospacedFont) pl = self.annotationsWarningSample.palette() - pl.setColor(QPalette.Text, + pl.setColor(QPalette.ColorRole.Text, self.editorColours["AnnotationsWarningForeground"]) - pl.setColor(QPalette.Base, + pl.setColor(QPalette.ColorRole.Base, self.editorColours["AnnotationsWarningBackground"]) self.annotationsWarningSample.setPalette(pl) self.annotationsWarningSample.repaint() pl = self.annotationsErrorSample.palette() - pl.setColor(QPalette.Text, + pl.setColor(QPalette.ColorRole.Text, self.editorColours["AnnotationsErrorForeground"]) - pl.setColor(QPalette.Base, + pl.setColor(QPalette.ColorRole.Base, self.editorColours["AnnotationsErrorBackground"]) self.annotationsErrorSample.setPalette(pl) self.annotationsErrorSample.repaint() pl = self.annotationsStyleWarningSample.palette() - pl.setColor(QPalette.Text, + pl.setColor(QPalette.ColorRole.Text, self.editorColours["AnnotationsStyleForeground"]) - pl.setColor(QPalette.Base, + pl.setColor(QPalette.ColorRole.Base, self.editorColours["AnnotationsStyleBackground"]) self.annotationsStyleWarningSample.setPalette(pl) self.annotationsStyleWarningSample.repaint() @@ -467,7 +473,7 @@ self.editorColours["AnnotationsWarningForeground"]) if colour.isValid(): pl = self.annotationsWarningSample.palette() - pl.setColor(QPalette.Text, colour) + pl.setColor(QPalette.ColorRole.Text, colour) self.annotationsWarningSample.setPalette(pl) self.annotationsWarningSample.repaint() self.editorColours["AnnotationsWarningForeground"] = colour @@ -481,7 +487,7 @@ self.editorColours["AnnotationsWarningBackground"]) if colour.isValid(): pl = self.annotationsWarningSample.palette() - pl.setColor(QPalette.Base, colour) + pl.setColor(QPalette.ColorRole.Base, colour) self.annotationsWarningSample.setPalette(pl) self.annotationsWarningSample.repaint() self.editorColours["AnnotationsWarningBackground"] = colour @@ -495,7 +501,7 @@ self.editorColours["AnnotationsErrorForeground"]) if colour.isValid(): pl = self.annotationsErrorSample.palette() - pl.setColor(QPalette.Text, colour) + pl.setColor(QPalette.ColorRole.Text, colour) self.annotationsErrorSample.setPalette(pl) self.annotationsErrorSample.repaint() self.editorColours["AnnotationsErrorForeground"] = colour @@ -509,7 +515,7 @@ self.editorColours["AnnotationsErrorBackground"]) if colour.isValid(): pl = self.annotationsErrorSample.palette() - pl.setColor(QPalette.Base, colour) + pl.setColor(QPalette.ColorRole.Base, colour) self.annotationsErrorSample.setPalette(pl) self.annotationsErrorSample.repaint() self.editorColours["AnnotationsErrorBackground"] = colour @@ -523,7 +529,7 @@ self.editorColours["AnnotationsStyleForeground"]) if colour.isValid(): pl = self.annotationsStyleWarningSample.palette() - pl.setColor(QPalette.Text, colour) + pl.setColor(QPalette.ColorRole.Text, colour) self.annotationsStyleWarningSample.setPalette(pl) self.annotationsStyleWarningSample.repaint() self.editorColours["AnnotationsStyleForeground"] = colour @@ -537,7 +543,7 @@ self.editorColours["AnnotationsStyleBackground"]) if colour.isValid(): pl = self.annotationsStyleWarningSample.palette() - pl.setColor(QPalette.Base, colour) + pl.setColor(QPalette.ColorRole.Base, colour) self.annotationsStyleWarningSample.setPalette(pl) self.annotationsStyleWarningSample.repaint() self.editorColours["AnnotationsStyleackground"] = colour
--- a/eric6/Preferences/ConfigurationPages/HexEditorPage.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Preferences/ConfigurationPages/HexEditorPage.py Tue Mar 02 17:17:09 2021 +0100 @@ -17,7 +17,7 @@ import Preferences try: - MonospacedFontsOption = QFontDialog.MonospacedFonts + MonospacedFontsOption = QFontDialog.FontDialogOption.MonospacedFonts except AttributeError: MonospacedFontsOption = QFontDialog.FontDialogOptions(0x10)
--- a/eric6/Preferences/ConfigurationPages/IconsPreviewDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Preferences/ConfigurationPages/IconsPreviewDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -33,8 +33,8 @@ self.setupUi(self) palette = self.iconView.palette() - self.__baseBrush = palette.brush(QPalette.Base) - self.__textBrush = palette.brush(QPalette.Text) + self.__baseBrush = palette.brush(QPalette.ColorRole.Base) + self.__textBrush = palette.brush(QPalette.ColorRole.Text) self.__inverted = False self.directoryCombo.addItems(sorted(directories)) @@ -70,11 +70,11 @@ palette = self.iconView.palette() if self.__inverted: - palette.setBrush(QPalette.Base, self.__textBrush) - palette.setBrush(QPalette.Text, self.__baseBrush) + palette.setBrush(QPalette.ColorRole.Base, self.__textBrush) + palette.setBrush(QPalette.ColorRole.Text, self.__baseBrush) else: - palette.setBrush(QPalette.Base, self.__baseBrush) - palette.setBrush(QPalette.Text, self.__textBrush) + palette.setBrush(QPalette.ColorRole.Base, self.__baseBrush) + palette.setBrush(QPalette.ColorRole.Text, self.__textBrush) self.iconView.viewport().setPalette(palette) self.on_refreshButton_clicked()
--- a/eric6/Preferences/ConfigurationPages/MasterPasswordEntryDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Preferences/ConfigurationPages/MasterPasswordEntryDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -34,7 +34,8 @@ self.currentPasswordEdit.setPlaceholderText( self.tr("(not defined yet)")) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) def __updateUI(self): """ @@ -66,7 +67,8 @@ error = error or self.tr( "Old and new password must not be the same.") - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enable) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(enable) self.errorLabel.setText(error) @pyqtSlot(str)
--- a/eric6/Preferences/ConfigurationPages/MicroPythonPage.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Preferences/ConfigurationPages/MicroPythonPage.py Tue Mar 02 17:17:09 2021 +0100 @@ -44,21 +44,29 @@ self.chartThemeComboBox.addItem( self.tr("Automatic"), -1) self.chartThemeComboBox.addItem( - self.tr("Light"), QChart.ChartThemeLight) + self.tr("Light"), + QChart.ChartTheme.ChartThemeLight) self.chartThemeComboBox.addItem( - self.tr("Dark"), QChart.ChartThemeDark) + self.tr("Dark"), + QChart.ChartTheme.ChartThemeDark) self.chartThemeComboBox.addItem( - self.tr("Blue Cerulean"), QChart.ChartThemeBlueCerulean) + self.tr("Blue Cerulean"), + QChart.ChartTheme.ChartThemeBlueCerulean) self.chartThemeComboBox.addItem( - self.tr("Brown Sand"), QChart.ChartThemeBrownSand) + self.tr("Brown Sand"), + QChart.ChartTheme.ChartThemeBrownSand) self.chartThemeComboBox.addItem( - self.tr("Blue NCS"), QChart.ChartThemeBlueNcs) + self.tr("Blue NCS"), + QChart.ChartTheme.ChartThemeBlueNcs) self.chartThemeComboBox.addItem( - self.tr("High Contrast"), QChart.ChartThemeHighContrast) + self.tr("High Contrast"), + QChart.ChartTheme.ChartThemeHighContrast) self.chartThemeComboBox.addItem( - self.tr("Blue Icy"), QChart.ChartThemeBlueIcy) + self.tr("Blue Icy"), + QChart.ChartTheme.ChartThemeBlueIcy) self.chartThemeComboBox.addItem( - self.tr("Qt"), QChart.ChartThemeQt) + self.tr("Qt"), + QChart.ChartTheme.ChartThemeQt) except ImportError: self.chartThemeComboBox.setEnabled(False)
--- a/eric6/Preferences/ConfigurationPages/SecurityPage.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Preferences/ConfigurationPages/SecurityPage.py Tue Mar 02 17:17:09 2021 +0100 @@ -100,7 +100,7 @@ if checked: from .MasterPasswordEntryDialog import MasterPasswordEntryDialog dlg = MasterPasswordEntryDialog("", self) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: Preferences.setUser( "MasterPassword", dlg.getMasterPassword()) @@ -120,7 +120,7 @@ from .MasterPasswordEntryDialog import MasterPasswordEntryDialog dlg = MasterPasswordEntryDialog( Preferences.getUser("MasterPassword"), self) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: Preferences.setUser( "MasterPassword", dlg.getMasterPassword())
--- a/eric6/Preferences/ConfigurationPages/ShellPage.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Preferences/ConfigurationPages/ShellPage.py Tue Mar 02 17:17:09 2021 +0100 @@ -16,7 +16,7 @@ import Preferences try: - MonospacedFontsOption = QFontDialog.MonospacedFonts + MonospacedFontsOption = QFontDialog.FontDialogOption.MonospacedFonts except AttributeError: MonospacedFontsOption = QFontDialog.FontDialogOptions(0x10)
--- a/eric6/Preferences/ConfigurationPages/TemplatesPage.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Preferences/ConfigurationPages/TemplatesPage.py Tue Mar 02 17:17:09 2021 +0100 @@ -16,7 +16,7 @@ import Preferences try: - MonospacedFontsOption = QFontDialog.MonospacedFonts + MonospacedFontsOption = QFontDialog.FontDialogOption.MonospacedFonts except AttributeError: MonospacedFontsOption = QFontDialog.FontDialogOptions(0x10)
--- a/eric6/Preferences/ConfigurationPages/WebBrowserAppearancePage.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Preferences/ConfigurationPages/WebBrowserAppearancePage.py Tue Mar 02 17:17:09 2021 +0100 @@ -18,7 +18,7 @@ import Preferences try: - MonospacedFontsOption = QFontDialog.MonospacedFonts + MonospacedFontsOption = QFontDialog.FontDialogOption.MonospacedFonts except AttributeError: MonospacedFontsOption = QFontDialog.FontDialogOptions(0x10) @@ -54,25 +54,25 @@ self.standardFontCombo.setCurrentFont( QFont(Preferences.getWebBrowser("StandardFontFamily"), - defaultFontSize, QFont.Normal, False)) + defaultFontSize, QFont.Weight.Normal, False)) self.fixedFontCombo.setCurrentFont( QFont(Preferences.getWebBrowser("FixedFontFamily"), - fixedFontSize, QFont.Normal, False)) + fixedFontSize, QFont.Weight.Normal, False)) self.serifFontCombo.setCurrentFont( QFont(Preferences.getWebBrowser("SerifFontFamily"), - defaultFontSize, QFont.Normal, False)) + defaultFontSize, QFont.Weight.Normal, False)) self.sansSerifFontCombo.setCurrentFont( QFont(Preferences.getWebBrowser("SansSerifFontFamily"), - defaultFontSize, QFont.Normal, False)) + defaultFontSize, QFont.Weight.Normal, False)) self.cursiveFontCombo.setCurrentFont( QFont(Preferences.getWebBrowser("CursiveFontFamily"), - defaultFontSize, QFont.Normal, True)) + defaultFontSize, QFont.Weight.Normal, True)) self.fantasyFontCombo.setCurrentFont( QFont(Preferences.getWebBrowser("FantasyFontFamily"), - defaultFontSize, QFont.Normal, False)) + defaultFontSize, QFont.Weight.Normal, False)) self.pictographFontCombo.setCurrentFont( QFont(Preferences.getWebBrowser("PictographFontFamily"), - defaultFontSize, QFont.Normal, False)) + defaultFontSize, QFont.Weight.Normal, False)) self.initColour("SecureUrlColor", self.secureURLsColourButton,
--- a/eric6/Preferences/ConfigurationPages/WebBrowserPage.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Preferences/ConfigurationPages/WebBrowserPage.py Tue Mar 02 17:17:09 2021 +0100 @@ -144,9 +144,14 @@ idx = 5 self.expireHistory.setCurrentIndex(idx) - for language in range(2, QLocale.LastLanguage + 1): - countries = [loc.country() for loc in QLocale.matchingLocales( - language, QLocale.AnyScript, QLocale.AnyCountry)] + for language in range(2, QLocale.Language.LastLanguage + 1): + countries = [ + loc.country() + for loc in QLocale.matchingLocales( + language, QLocale.Script.AnyScript, + QLocale.Country.AnyCountry + ) + ] if len(countries) > 0: self.languageCombo.addItem( QLocale.languageToString(language), language)
--- a/eric6/Preferences/ConfigurationPages/WebBrowserSpellCheckingPage.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Preferences/ConfigurationPages/WebBrowserSpellCheckingPage.py Tue Mar 02 17:17:09 2021 +0100 @@ -55,8 +55,10 @@ QCoreApplication.applicationDirPath() + "/qtwebengine_dictionaries"), QDir.cleanPath( - QLibraryInfo.location(QLibraryInfo.DataPath) + - "/qtwebengine_dictionaries"), + QLibraryInfo.location( + QLibraryInfo.LibraryLocation.DataPath) + + "/qtwebengine_dictionaries" + ), } self.spellCheckDictionaryDirectoriesEdit.setPlainText( "\n".join(self.__dictionaryDirectories)) @@ -90,27 +92,28 @@ for fileName in fileNames: lang = fileName[:-5] langStr = self.__createLanguageString(lang) - if self.spellCheckLanguagesList.findItems(langStr, - Qt.MatchExactly): + if self.spellCheckLanguagesList.findItems( + langStr, Qt.MatchFlag.MatchExactly + ): continue itm = QListWidgetItem(langStr, self.spellCheckLanguagesList) - itm.setData(Qt.UserRole, lang) - itm.setFlags(itm.flags() | Qt.ItemIsUserCheckable) - itm.setCheckState(Qt.Unchecked) - self.spellCheckLanguagesList.sortItems(Qt.AscendingOrder) + itm.setData(Qt.ItemDataRole.UserRole, lang) + itm.setFlags(itm.flags() | Qt.ItemFlag.ItemIsUserCheckable) + itm.setCheckState(Qt.CheckState.Unchecked) + self.spellCheckLanguagesList.sortItems(Qt.SortOrder.AscendingOrder) spellCheckLanguages = Preferences.getWebBrowser("SpellCheckLanguages") topIndex = 0 for lang in spellCheckLanguages: items = self.spellCheckLanguagesList.findItems( - self.__createLanguageString(lang), Qt.MatchExactly) + self.__createLanguageString(lang), Qt.MatchFlag.MatchExactly) if items: itm = items[0] self.spellCheckLanguagesList.takeItem( self.spellCheckLanguagesList.row(itm)) self.spellCheckLanguagesList.insertItem(topIndex, itm) - itm.setCheckState(Qt.Checked) + itm.setCheckState(Qt.CheckState.Checked) topIndex += 1 if self.spellCheckLanguagesList.count(): @@ -129,8 +132,8 @@ languages = [] for row in range(self.spellCheckLanguagesList.count()): itm = self.spellCheckLanguagesList.item(row) - if itm.checkState() == Qt.Checked: - languages.append(itm.data(Qt.UserRole)) + if itm.checkState() == Qt.CheckState.Checked: + languages.append(itm.data(Qt.ItemDataRole.UserRole)) Preferences.setWebBrowser( "SpellCheckEnabled", @@ -159,7 +162,7 @@ """ loc = QLocale(language) - if loc.language() == QLocale.C: + if loc.language() == QLocale.Language.C: return language country = QLocale.countryToString(loc.country())
--- a/eric6/Preferences/MouseClickDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Preferences/MouseClickDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -39,8 +39,10 @@ self.clearButton.installEventFilter(self) self.clickEdit.installEventFilter(self) - self.buttonBox.button(QDialogButtonBox.Ok).installEventFilter(self) - self.buttonBox.button(QDialogButtonBox.Cancel).installEventFilter(self) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).installEventFilter(self) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).installEventFilter(self) self.__modifiers = modifiers self.__button = button @@ -55,8 +57,8 @@ """ Private slot to clear the entered sequence. """ - self.__modifiers = Qt.NoModifier - self.__button = Qt.NoButton + self.__modifiers = Qt.KeyboardModifier.NoModifier + self.__button = Qt.MouseButton.NoButton self.__showClickText() def __showClickText(self): @@ -64,7 +66,7 @@ Private method to show a string representing the entered mouse click sequence. """ - if self.__button == Qt.NoButton: + if self.__button == Qt.MouseButton.NoButton: self.clickEdit.setText("") else: self.clickEdit.setText(MouseUtilities.MouseButtonModifier2String( @@ -82,7 +84,7 @@ @rtype bool """ if ( - event.type() == QEvent.MouseButtonRelease and + event.type() == QEvent.Type.MouseButtonRelease and watched == self.clickEdit ): self.__modifiers = int(event.modifiers())
--- a/eric6/Preferences/ProgramsDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Preferences/ProgramsDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -29,7 +29,7 @@ """ Class implementing the Programs page. """ - ToolAvailableRole = Qt.UserRole + 1 + ToolAvailableRole = Qt.ItemDataRole.UserRole + 1 def __init__(self, parent=None): """ @@ -40,7 +40,7 @@ super(ProgramsDialog, self).__init__(parent) self.setupUi(self) self.setObjectName("ProgramsDialog") - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) self.__hasSearched = False @@ -48,7 +48,7 @@ self.programsList.columnCount(), "") self.searchButton = self.buttonBox.addButton( - self.tr("Search"), QDialogButtonBox.ActionRole) + self.tr("Search"), QDialogButtonBox.ButtonRole.ActionRole) self.searchButton.setToolTip( self.tr("Press to search for programs")) @@ -82,7 +82,7 @@ """ self.programsList.clear() header = self.programsList.header() - header.setSortIndicator(0, Qt.AscendingOrder) + header.setSortIndicator(0, Qt.SortOrder.AscendingOrder) header.setSortIndicatorShown(False) with E5OverrideCursor(): @@ -323,7 +323,7 @@ info["version"] ) - self.programsList.sortByColumn(0, Qt.AscendingOrder) + self.programsList.sortByColumn(0, Qt.SortOrder.AscendingOrder) self.on_showComboBox_currentIndexChanged( self.showComboBox.currentIndex()) @@ -356,7 +356,7 @@ @return version string of detected or given version (string) """ itmList = self.programsList.findItems( - description, Qt.MatchCaseSensitive) + description, Qt.MatchFlag.MatchCaseSensitive) if itmList: itm = itmList[0] else: @@ -377,7 +377,8 @@ available = True if versionCommand and versionPosition is not None: proc = QProcess() - proc.setProcessChannelMode(QProcess.MergedChannels) + proc.setProcessChannelMode( + QProcess.ProcessChannelMode.MergedChannels) if exeModule: args = exeModule[:] + [versionCommand] else: @@ -452,7 +453,8 @@ citm.setData(0, self.ToolAvailableRole, False) itm.setExpanded(True) QApplication.processEvents() - self.programsList.header().resizeSections(QHeaderView.ResizeToContents) + self.programsList.header().resizeSections( + QHeaderView.ResizeMode.ResizeToContents) self.programsList.header().setStretchLastSection(True) return version @@ -478,7 +480,8 @@ else: itm.setText(1, self.tr("(not found)")) QApplication.processEvents() - self.programsList.header().resizeSections(QHeaderView.ResizeToContents) + self.programsList.header().resizeSections( + QHeaderView.ResizeMode.ResizeToContents) self.programsList.header().setStretchLastSection(True) @pyqtSlot(int)
--- a/eric6/Preferences/ShortcutDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Preferences/ShortcutDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -36,7 +36,7 @@ self.setObjectName(name) self.setModal(modal) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) self.keyIndex = 0 self.keys = [0, 0, 0, 0] @@ -56,8 +56,10 @@ self.keyEdit.installEventFilter(self) self.alternateKeyEdit.installEventFilter(self) - self.buttonBox.button(QDialogButtonBox.Ok).installEventFilter(self) - self.buttonBox.button(QDialogButtonBox.Cancel).installEventFilter(self) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).installEventFilter(self) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).installEventFilter(self) msh = self.minimumSizeHint() self.resize(max(self.width(), msh.width()), msh.height()) @@ -124,7 +126,7 @@ @param event the event that occurred @return always False """ - if event.type() == QEvent.KeyPress: + if event.type() == QEvent.Type.KeyPress: self.keyPressEvent(event) return True @@ -136,28 +138,34 @@ @param evt the key event (QKeyEvent) """ - if evt.key() in [Qt.Key_Control, Qt.Key_Meta, Qt.Key_Shift, Qt.Key_Alt, - Qt.Key_Menu, Qt.Key_Hyper_L, Qt.Key_Hyper_R, - Qt.Key_Super_L, Qt.Key_Super_R]: + if evt.key() in [ + Qt.Key.Key_Control, Qt.Key.Key_Meta, Qt.Key.Key_Shift, + Qt.Key.Key_Alt, Qt.Key.Key_Menu, + Qt.Key.Key_Hyper_L, Qt.Key.Key_Hyper_R, + Qt.Key.Key_Super_L, Qt.Key.Key_Super_R + ]: return if self.keyIndex == 4: self.keyIndex = 0 self.keys = [0, 0, 0, 0] - if evt.key() == Qt.Key_Backtab and evt.modifiers() & Qt.ShiftModifier: - self.keys[self.keyIndex] = Qt.Key_Tab + if ( + evt.key() == Qt.Key.Key_Backtab and + evt.modifiers() & Qt.KeyboardModifier.ShiftModifier + ): + self.keys[self.keyIndex] = Qt.Key.Key_Tab else: self.keys[self.keyIndex] = evt.key() - if evt.modifiers() & Qt.ShiftModifier: - self.keys[self.keyIndex] += Qt.SHIFT - if evt.modifiers() & Qt.ControlModifier: - self.keys[self.keyIndex] += Qt.CTRL - if evt.modifiers() & Qt.AltModifier: - self.keys[self.keyIndex] += Qt.ALT - if evt.modifiers() & Qt.MetaModifier: - self.keys[self.keyIndex] += Qt.META + if evt.modifiers() & Qt.KeyboardModifier.ShiftModifier: + self.keys[self.keyIndex] += Qt.Modifier.SHIFT + if evt.modifiers() & Qt.KeyboardModifier.ControlModifier: + self.keys[self.keyIndex] += Qt.Modifier.CTRL + if evt.modifiers() & Qt.KeyboardModifier.AltModifier: + self.keys[self.keyIndex] += Qt.Modifier.ALT + if evt.modifiers() & Qt.KeyboardModifier.MetaModifier: + self.keys[self.keyIndex] += Qt.Modifier.META self.keyIndex += 1
--- a/eric6/Preferences/Shortcuts.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Preferences/Shortcuts.py Tue Mar 02 17:17:09 2021 +0100 @@ -217,7 +217,7 @@ else: # old XML based file f = QFile(fn) - if f.open(QIODevice.WriteOnly): + if f.open(QIODevice.OpenModeFlag.WriteOnly): from E5XML.ShortcutsWriter import ShortcutsWriter ShortcutsWriter(f).writeXML(helpViewer=helpViewer) f.close() @@ -258,7 +258,7 @@ else: # old XML based file f = QFile(fn) - if f.open(QIODevice.ReadOnly): + if f.open(QIODevice.OpenModeFlag.ReadOnly): from E5XML.ShortcutsReader import ShortcutsReader reader = ShortcutsReader(f) reader.readXML()
--- a/eric6/Preferences/ShortcutsDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Preferences/ShortcutsDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -33,9 +33,9 @@ """ updateShortcuts = pyqtSignal() - objectNameRole = Qt.UserRole - noCheckRole = Qt.UserRole + 1 - objectTypeRole = Qt.UserRole + 2 + objectNameRole = Qt.ItemDataRole.UserRole + noCheckRole = Qt.ItemDataRole.UserRole + 1 + objectTypeRole = Qt.ItemDataRole.UserRole + 2 def __init__(self, parent=None): """ @@ -46,13 +46,14 @@ """ super(ShortcutsDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) self.__helpViewer = None self.shortcutsList.headerItem().setText( self.shortcutsList.columnCount(), "") - self.shortcutsList.header().setSortIndicator(0, Qt.AscendingOrder) + self.shortcutsList.header().setSortIndicator( + 0, Qt.SortOrder.AscendingOrder) from .ShortcutDialog import ShortcutDialog self.shortcutDialog = ShortcutDialog() @@ -71,7 +72,7 @@ Private method to resize the list columns. """ self.shortcutsList.header().resizeSections( - QHeaderView.ResizeToContents) + QHeaderView.ResizeMode.ResizeToContents) self.shortcutsList.header().setStretchLastSection(True) def __generateCategoryItem(self, title):
--- a/eric6/Preferences/SubstyleDefinitionDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Preferences/SubstyleDefinitionDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -52,7 +52,7 @@ """ Private slot to update the state of the OK button. """ - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( + self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( bool(self.descriptionEdit.text().strip()) and bool(self.wordsEdit.toPlainText().strip()) )
--- a/eric6/Preferences/ToolConfigurationDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Preferences/ToolConfigurationDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -127,7 +127,7 @@ return if len(self.toolsList.findItems( - menutext, Qt.MatchFlags(Qt.MatchExactly))): + menutext, Qt.MatchFlags(Qt.MatchFlag.MatchExactly))): E5MessageBox.critical( self, self.tr("Add tool entry"),
--- a/eric6/Preferences/ToolGroupConfigurationDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Preferences/ToolGroupConfigurationDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -63,7 +63,7 @@ return if len(self.groupsList.findItems( - groupName, Qt.MatchFlags(Qt.MatchExactly))): + groupName, Qt.MatchFlags(Qt.MatchFlag.MatchExactly))): E5MessageBox.critical( self, self.tr("Add tool group entry"), @@ -93,7 +93,7 @@ return if len(self.groupsList.findItems( - groupName, Qt.MatchFlags(Qt.MatchExactly))): + groupName, Qt.MatchFlags(Qt.MatchFlag.MatchExactly))): E5MessageBox.critical( self, self.tr("Add tool group entry"),
--- a/eric6/Preferences/__init__.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Preferences/__init__.py Tue Mar 02 17:17:09 2021 +0100 @@ -228,7 +228,7 @@ # 2 = QtCriticalMsg, QtSystemMsg # 3 = QtFatalMsg - "LogStdErrColour": QColor(Qt.red), + "LogStdErrColour": QColor(Qt.GlobalColor.red), "NotificationTimeout": 5, # time in seconds the notification # is shown "NotificationPosition": QPoint(10, 10), @@ -376,9 +376,9 @@ "WhitespaceSize": 1, "ShowEOL": False, "UseMonospacedFont": False, - "WrapLongLinesMode": QsciScintilla.WrapNone, - "WrapVisualFlag": QsciScintilla.WrapFlagNone, - "WrapIndentMode": QsciScintilla.WrapIndentFixed, + "WrapLongLinesMode": QsciScintilla.WrapMode.WrapNone, + "WrapVisualFlag": QsciScintilla.WrapVisualFlag.WrapFlagNone, + "WrapIndentMode": QsciScintilla.WrapIndentMode.WrapIndentFixed, "WrapStartIndent": 0, "WarnFilesize": 512, "ClearBreaksOnClose": True, @@ -387,7 +387,7 @@ "CommentColumn0": True, "OverrideEditAreaColours": False, - "EdgeMode": QsciScintilla.EdgeNone, + "EdgeMode": QsciScintilla.EdgeMode.EdgeNone, "EdgeColumn": 80, "AutoIndentation": True, @@ -408,7 +408,7 @@ "AutoCompletionCaseSensitivity": True, "AutoCompletionReplaceWord": False, "AutoCompletionShowSingle": False, - "AutoCompletionSource": QsciScintilla.AcsDocument, + "AutoCompletionSource": QsciScintilla.AutoCompletionSource.AcsDocument, "AutoCompletionThreshold": 2, # timeout in ms before auto-completion is started "AutoCompletionTimeout": 200, @@ -425,7 +425,7 @@ "CallTipsEnabled": False, "CallTipsVisible": 0, - "CallTipsStyle": QsciScintilla.CallTipsNoContext, + "CallTipsStyle": QsciScintilla.CallTipsStyle.CallTipsNoContext, # show QScintilla calltips, if plug-in fails "CallTipsScintillaOnFail": False, @@ -581,7 +581,9 @@ "PropertiesInitialSpaces": True, # Python specifics - "PythonBadIndentation": QsciLexerPython.Inconsistent, + "PythonBadIndentation": ( + QsciLexerPython.IndentationWarning.Inconsistent + ), "PythonFoldComment": True, "PythonFoldString": True, "PythonAutoIndent": True, @@ -626,50 +628,52 @@ } if Globals.isWindowsPlatform(): - editorDefaults["EOLMode"] = QsciScintilla.EolWindows + editorDefaults["EOLMode"] = QsciScintilla.EolMode.EolWindows else: - editorDefaults["EOLMode"] = QsciScintilla.EolUnix + editorDefaults["EOLMode"] = QsciScintilla.EolMode.EolUnix try: # since QScintilla 2.7.0 - editorDefaults["CallTipsPosition"] = QsciScintilla.CallTipsBelowText + editorDefaults["CallTipsPosition"] = ( + QsciScintilla.CallTipsPosition.CallTipsBelowText + ) except AttributeError: editorDefaults["CallTipsPosition"] = 0 editorColourDefaults = { - "CurrentMarker": QColor(Qt.yellow), - "ErrorMarker": QColor(Qt.red), - "MatchingBrace": QColor(Qt.green), - "MatchingBraceBack": QColor(Qt.white), - "NonmatchingBrace": QColor(Qt.red), - "NonmatchingBraceBack": QColor(Qt.white), - "CallTipsBackground": QColor(Qt.white), + "CurrentMarker": QColor(Qt.GlobalColor.yellow), + "ErrorMarker": QColor(Qt.GlobalColor.red), + "MatchingBrace": QColor(Qt.GlobalColor.green), + "MatchingBraceBack": QColor(Qt.GlobalColor.white), + "NonmatchingBrace": QColor(Qt.GlobalColor.red), + "NonmatchingBraceBack": QColor(Qt.GlobalColor.white), + "CallTipsBackground": QColor(Qt.GlobalColor.white), "CallTipsForeground": QColor("#7f7f7f"), "CallTipsHighlight": QColor("#00007f"), - "CaretForeground": QColor(Qt.black), - "CaretLineBackground": QColor(Qt.white), - "Edge": QColor(Qt.lightGray), - "SelectionBackground": QColor(Qt.black), - "SelectionForeground": QColor(Qt.white), - "SearchMarkers": QColor(Qt.blue), - "MarginsBackground": QColor(Qt.lightGray), - "MarginsForeground": QColor(Qt.black), + "CaretForeground": QColor(Qt.GlobalColor.black), + "CaretLineBackground": QColor(Qt.GlobalColor.white), + "Edge": QColor(Qt.GlobalColor.lightGray), + "SelectionBackground": QColor(Qt.GlobalColor.black), + "SelectionForeground": QColor(Qt.GlobalColor.white), + "SearchMarkers": QColor(Qt.GlobalColor.blue), + "MarginsBackground": QColor(Qt.GlobalColor.lightGray), + "MarginsForeground": QColor(Qt.GlobalColor.black), "FoldmarginBackground": QColor("#e6e6e6"), - "FoldMarkersForeground": QColor(Qt.white), - "FoldMarkersBackground": QColor(Qt.black), - "SpellingMarkers": QColor(Qt.red), + "FoldMarkersForeground": QColor(Qt.GlobalColor.white), + "FoldMarkersBackground": QColor(Qt.GlobalColor.black), + "SpellingMarkers": QColor(Qt.GlobalColor.red), "AnnotationsWarningForeground": QColor("#606000"), "AnnotationsWarningBackground": QColor("#ffffd0"), "AnnotationsErrorForeground": QColor("#600000"), "AnnotationsErrorBackground": QColor("#ffd0d0"), "AnnotationsStyleForeground": QColor("#000060"), "AnnotationsStyleBackground": QColor("#d0d0ff"), - "WhitespaceForeground": QColor(Qt.darkGray), - "WhitespaceBackground": QColor(Qt.white), + "WhitespaceForeground": QColor(Qt.GlobalColor.darkGray), + "WhitespaceBackground": QColor(Qt.GlobalColor.white), "OnlineChangeTraceMarkerUnsaved": QColor("#ff8888"), "OnlineChangeTraceMarkerSaved": QColor("#88ff88"), - "IndentationGuidesBackground": QColor(Qt.white), - "IndentationGuidesForeground": QColor(Qt.black), + "IndentationGuidesBackground": QColor(Qt.GlobalColor.white), + "IndentationGuidesForeground": QColor(Qt.GlobalColor.black), "HighlightMarker": QColor("#200000FF"), # ARGB format # colors for the marker map "BookmarksMap": QColor("#f8c700"), @@ -680,7 +684,7 @@ "CoverageMap": QColor("#ad3636"), "ChangesMap": QColor("#00b000"), "CurrentMap": QColor("#000000"), - "SearchMarkersMap": QColor(Qt.blue), + "SearchMarkersMap": QColor(Qt.GlobalColor.blue), "VcsConflictMarkersMap": QColor("#dd00dd"), "MarkerMapBackground": QColor("#e7e7e7"), } @@ -888,14 +892,14 @@ # defaults for the project browser colour settings projectBrowserColourDefaults = { - "Highlighted": QColor(Qt.red), + "Highlighted": QColor(Qt.GlobalColor.red), - "VcsAdded": QColor(Qt.blue), - "VcsConflict": QColor(Qt.red), - "VcsModified": QColor(Qt.yellow), - "VcsReplaced": QColor(Qt.cyan), - "VcsUpdate": QColor(Qt.green), - "VcsRemoved": QColor(Qt.magenta) + "VcsAdded": QColor(Qt.GlobalColor.blue), + "VcsConflict": QColor(Qt.GlobalColor.red), + "VcsModified": QColor(Qt.GlobalColor.yellow), + "VcsReplaced": QColor(Qt.GlobalColor.cyan), + "VcsUpdate": QColor(Qt.GlobalColor.green), + "VcsRemoved": QColor(Qt.GlobalColor.magenta) } # defaults for the help settings @@ -1058,93 +1062,98 @@ webEngineSettings = QWebEngineSettings.defaultSettings() cls.webBrowserDefaults.update({ "StandardFontFamily": webEngineSettings.fontFamily( - QWebEngineSettings.StandardFont), + QWebEngineSettings.FontFamily.StandardFont), "FixedFontFamily": webEngineSettings.fontFamily( - QWebEngineSettings.FixedFont), + QWebEngineSettings.FontFamily.FixedFont), "SerifFontFamily": webEngineSettings.fontFamily( - QWebEngineSettings.StandardFont), + QWebEngineSettings.FontFamily.StandardFont), "SansSerifFontFamily": webEngineSettings.fontFamily( - QWebEngineSettings.SansSerifFont), + QWebEngineSettings.FontFamily.SansSerifFont), "CursiveFontFamily": webEngineSettings.fontFamily( - QWebEngineSettings.CursiveFont), + QWebEngineSettings.FontFamily.CursiveFont), "FantasyFontFamily": webEngineSettings.fontFamily( - QWebEngineSettings.FantasyFont), + QWebEngineSettings.FontFamily.FantasyFont), "DefaultFontSize": webEngineSettings.fontSize( - QWebEngineSettings.DefaultFontSize), + QWebEngineSettings.FontSize.DefaultFontSize), "DefaultFixedFontSize": webEngineSettings.fontSize( - QWebEngineSettings.DefaultFixedFontSize), + QWebEngineSettings.FontSize.DefaultFixedFontSize), "MinimumFontSize": webEngineSettings.fontSize( - QWebEngineSettings.MinimumFontSize), + QWebEngineSettings.FontSize.MinimumFontSize), "MinimumLogicalFontSize": webEngineSettings.fontSize( - QWebEngineSettings.MinimumLogicalFontSize), + QWebEngineSettings.FontSize.MinimumLogicalFontSize), "AutoLoadImages": webEngineSettings.testAttribute( - QWebEngineSettings.AutoLoadImages), + QWebEngineSettings.WebAttribute.AutoLoadImages), "JavaScriptEnabled": webEngineSettings.testAttribute( - QWebEngineSettings.JavascriptEnabled), + QWebEngineSettings.WebAttribute.JavascriptEnabled), "JavaScriptCanOpenWindows": webEngineSettings.testAttribute( - QWebEngineSettings.JavascriptCanOpenWindows), + QWebEngineSettings.WebAttribute.JavascriptCanOpenWindows), "JavaScriptCanAccessClipboard": webEngineSettings.testAttribute( - QWebEngineSettings.JavascriptCanAccessClipboard), + QWebEngineSettings.WebAttribute.JavascriptCanAccessClipboard), "PluginsEnabled": webEngineSettings.testAttribute( - QWebEngineSettings.PluginsEnabled), + QWebEngineSettings.WebAttribute.PluginsEnabled), "LocalStorageEnabled": webEngineSettings.testAttribute( - QWebEngineSettings.LocalStorageEnabled), + QWebEngineSettings.WebAttribute.LocalStorageEnabled), "DefaultTextEncoding": webEngineSettings.defaultTextEncoding(), "SpatialNavigationEnabled": webEngineSettings.testAttribute( - QWebEngineSettings.SpatialNavigationEnabled), + QWebEngineSettings.WebAttribute.SpatialNavigationEnabled), "LinksIncludedInFocusChain": webEngineSettings.testAttribute( - QWebEngineSettings.LinksIncludedInFocusChain), + QWebEngineSettings.WebAttribute.LinksIncludedInFocusChain), "LocalContentCanAccessRemoteUrls": webEngineSettings.testAttribute( - QWebEngineSettings.LocalContentCanAccessRemoteUrls), + QWebEngineSettings.WebAttribute + .LocalContentCanAccessRemoteUrls), "LocalContentCanAccessFileUrls": webEngineSettings.testAttribute( - QWebEngineSettings.LocalContentCanAccessFileUrls), + QWebEngineSettings.WebAttribute.LocalContentCanAccessFileUrls), "XSSAuditingEnabled": webEngineSettings.testAttribute( - QWebEngineSettings.XSSAuditingEnabled), + QWebEngineSettings.WebAttribute.XSSAuditingEnabled), "ScrollAnimatorEnabled": webEngineSettings.testAttribute( - QWebEngineSettings.ScrollAnimatorEnabled), + QWebEngineSettings.WebAttribute.ScrollAnimatorEnabled), "ErrorPageEnabled": webEngineSettings.testAttribute( - QWebEngineSettings.ErrorPageEnabled), + QWebEngineSettings.WebAttribute.ErrorPageEnabled), "FullScreenSupportEnabled": webEngineSettings.testAttribute( - QWebEngineSettings.FullScreenSupportEnabled), + QWebEngineSettings.WebAttribute.FullScreenSupportEnabled), "PictographFontFamily": webEngineSettings.fontFamily( - QWebEngineSettings.PictographFont), + QWebEngineSettings.FontFamily.PictographFont), "ScreenCaptureEnabled": webEngineSettings.testAttribute( - QWebEngineSettings.ScreenCaptureEnabled), + QWebEngineSettings.WebAttribute.ScreenCaptureEnabled), "WebGLEnabled": webEngineSettings.testAttribute( - QWebEngineSettings.WebGLEnabled), + QWebEngineSettings.WebAttribute.WebGLEnabled), "FocusOnNavigationEnabled": webEngineSettings.testAttribute( - QWebEngineSettings.FocusOnNavigationEnabled), + QWebEngineSettings.WebAttribute.FocusOnNavigationEnabled), "PrintElementBackgrounds": webEngineSettings.testAttribute( - QWebEngineSettings.PrintElementBackgrounds), + QWebEngineSettings.WebAttribute.PrintElementBackgrounds), "AllowRunningInsecureContent": webEngineSettings.testAttribute( - QWebEngineSettings.AllowRunningInsecureContent), + QWebEngineSettings.WebAttribute.AllowRunningInsecureContent), "AllowGeolocationOnInsecureOrigins": webEngineSettings.testAttribute( - QWebEngineSettings.AllowGeolocationOnInsecureOrigins), + QWebEngineSettings.WebAttribute + .AllowGeolocationOnInsecureOrigins), "AllowWindowActivationFromJavaScript": webEngineSettings.testAttribute( - QWebEngineSettings.AllowWindowActivationFromJavaScript), + QWebEngineSettings.WebAttribute + .AllowWindowActivationFromJavaScript), "ShowScrollBars": webEngineSettings.testAttribute( - QWebEngineSettings.ShowScrollBars), + QWebEngineSettings.WebAttribute.ShowScrollBars), "PlaybackRequiresUserGesture": webEngineSettings.testAttribute( - QWebEngineSettings.PlaybackRequiresUserGesture), + QWebEngineSettings.WebAttribute + .PlaybackRequiresUserGesture), "JavaScriptCanPaste": webEngineSettings.testAttribute( - QWebEngineSettings.JavascriptCanPaste), + QWebEngineSettings.WebAttribute.JavascriptCanPaste), "WebRTCPublicInterfacesOnly": webEngineSettings.testAttribute( - QWebEngineSettings.WebRTCPublicInterfacesOnly), + QWebEngineSettings.WebAttribute + .WebRTCPublicInterfacesOnly), "DnsPrefetchEnabled": webEngineSettings.testAttribute( - QWebEngineSettings.DnsPrefetchEnabled), + QWebEngineSettings.WebAttribute.DnsPrefetchEnabled), }) try: # Qt 5.13 cls.webBrowserDefaults.update({ "PdfViewerEnabled": webEngineSettings.testAttribute( - QWebEngineSettings.PdfViewerEnabled), + QWebEngineSettings.WebAttribute.PdfViewerEnabled), }) except AttributeError: pass @@ -1391,11 +1400,11 @@ "OpenReadOnly": False, "HighlightChanges": True, "HighlightingBackGround": QColor(0xff, 0xff, 0x99, 0xff), - "HighlightingForeGround": QColor(Qt.black), + "HighlightingForeGround": QColor(Qt.GlobalColor.black), "SelectionBackGround": QColor("#308cc6"), - "SelectionForeGround": QColor(Qt.white), + "SelectionForeGround": QColor(Qt.GlobalColor.white), "AddressAreaBackGround": QColor("#efedec"), - "AddressAreaForeGround": QColor(Qt.black), + "AddressAreaForeGround": QColor(Qt.GlobalColor.black), "RecentNumber": 9, } if Globals.isWindowsPlatform(): @@ -1490,11 +1499,11 @@ # defaults for Python specific settings pythonDefaults = { - "ASTViewerErrorColor": QColor(Qt.darkRed), + "ASTViewerErrorColor": QColor(Qt.GlobalColor.darkRed), - "DisViewerErrorColor": QColor(Qt.darkRed), - "DisViewerCurrentColor": QColor(Qt.darkMagenta), - "DisViewerLabeledColor": QColor(Qt.darkGreen), + "DisViewerErrorColor": QColor(Qt.GlobalColor.darkRed), + "DisViewerCurrentColor": QColor(Qt.GlobalColor.darkMagenta), + "DisViewerLabeledColor": QColor(Qt.GlobalColor.darkGreen), "DisViewerExpandCodeInfoDetails": False, } @@ -1600,7 +1609,7 @@ """ from E5Gui.E5Application import e5App Prefs.settings = QSettings( - QSettings.IniFormat, QSettings.UserScope, + QSettings.Format.IniFormat, QSettings.Scope.UserScope, Globals.settingsNameOrganization, Globals.settingsNameGlobal, e5App()) if not Globals.isWindowsPlatform(): @@ -1696,7 +1705,7 @@ This function is called once upon import of the module. """ Prefs.rsettings = QSettings( - QSettings.IniFormat, QSettings.UserScope, + QSettings.Format.IniFormat, QSettings.Scope.UserScope, Globals.settingsNameOrganization, Globals.settingsNameRecent) @@ -2178,9 +2187,11 @@ else: # palette based defaults here because of Qt5 if key == "EditAreaForeground": - return QApplication.palette().color(QPalette.Active, QPalette.Base) + return QApplication.palette().color(QPalette.ColorGroup.Active, + QPalette.ColorRole.Base) elif key == "EditAreaBackground": - return QApplication.palette().color(QPalette.Active, QPalette.Text) + return QApplication.palette().color(QPalette.ColorGroup.Active, + QPalette.ColorRole.Text) else: return prefClass.editorColourDefaults[key] @@ -2683,7 +2694,9 @@ s = os.getenv(key.upper(), "") if s == "": s = os.path.join( - QLibraryInfo.location(QLibraryInfo.DocumentationPath), "qtdoc") + QLibraryInfo.location( + QLibraryInfo.LibraryLocation.DocumentationPath), + "qtdoc") return s @@ -2853,7 +2866,7 @@ elif key in ["SafeBrowsingUpdateDateTime"]: dateTimeStr = prefClass.settings.value("WebBrowser/" + key) if dateTimeStr is not None: - return QDateTime.fromString(dateTimeStr, Qt.ISODate) + return QDateTime.fromString(dateTimeStr, Qt.DateFormat.ISODate) else: return prefClass.webBrowserDefaults[key] else: @@ -2920,7 +2933,7 @@ elif key in ["SafeBrowsingUpdateDateTime"]: # value is a QDateTime prefClass.settings.setValue("WebBrowser/" + key, - value.toString(Qt.ISODate)) + value.toString(Qt.DateFormat.ISODate)) else: prefClass.settings.setValue("WebBrowser/" + key, value) @@ -2967,7 +2980,8 @@ "Qt/Qt5TranslationsDir", prefClass.qtDefaults["Qt5TranslationsDir"]) if s == "": - s = QLibraryInfo.location(QLibraryInfo.TranslationsPath) + s = QLibraryInfo.location( + QLibraryInfo.LibraryLocation.TranslationsPath) if s == "" and Globals.isWindowsPlatform(): transPath = os.path.join(Globals.getPyQt5ModulesDirectory(), "translations")
--- a/eric6/Project/AddFoundFilesDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Project/AddFoundFilesDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -36,10 +36,10 @@ self.setupUi(self) self.addAllButton = self.buttonBox.addButton( - self.tr("Add All"), QDialogButtonBox.AcceptRole) + self.tr("Add All"), QDialogButtonBox.ButtonRole.AcceptRole) self.addAllButton.setToolTip(self.tr("Add all files.")) self.addSelectedButton = self.buttonBox.addButton( - self.tr("Add Selected"), QDialogButtonBox.AcceptRole) + self.tr("Add Selected"), QDialogButtonBox.ButtonRole.AcceptRole) self.addSelectedButton.setToolTip( self.tr("Add selected files only."))
--- a/eric6/Project/CreateDialogCodeDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Project/CreateDialogCodeDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -30,12 +30,12 @@ import Preferences -pyqtSignatureRole = Qt.UserRole + 1 -pythonSignatureRole = Qt.UserRole + 2 -rubySignatureRole = Qt.UserRole + 3 -returnTypeRole = Qt.UserRole + 4 -parameterTypesListRole = Qt.UserRole + 5 -parameterNamesListRole = Qt.UserRole + 6 +pyqtSignatureRole = Qt.ItemDataRole.UserRole + 1 +pythonSignatureRole = Qt.ItemDataRole.UserRole + 2 +rubySignatureRole = Qt.ItemDataRole.UserRole + 3 +returnTypeRole = Qt.ItemDataRole.UserRole + 4 +parameterTypesListRole = Qt.ItemDataRole.UserRole + 5 +parameterNamesListRole = Qt.ItemDataRole.UserRole + 6 class CreateDialogCodeDialog(QDialog, Ui_CreateDialogCodeDialog): @@ -60,7 +60,8 @@ super(CreateDialogCodeDialog, self).__init__(parent) self.setupUi(self) - self.okButton = self.buttonBox.button(QDialogButtonBox.Ok) + self.okButton = self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok) self.slotsView.header().hide() @@ -344,12 +345,12 @@ methodDict["methods"][1] in signatureList ): itm2.setFlags( - Qt.ItemFlags(Qt.ItemIsEnabled)) - itm2.setCheckState(Qt.Checked) + Qt.ItemFlags(Qt.ItemFlag.ItemIsEnabled)) + itm2.setCheckState(Qt.CheckState.Checked) if e5App().usesDarkPalette(): itm2.setForeground(QBrush(QColor("#75bfff"))) else: - itm2.setForeground(QBrush(Qt.blue)) + itm2.setForeground(QBrush(Qt.GlobalColor.blue)) continue itm2.setData(methodDict["pyqt_signature"], @@ -364,13 +365,13 @@ parameterNamesListRole) itm2.setFlags(Qt.ItemFlags( - Qt.ItemIsUserCheckable | - Qt.ItemIsEnabled | - Qt.ItemIsSelectable) + Qt.ItemFlag.ItemIsUserCheckable | + Qt.ItemFlag.ItemIsEnabled | + Qt.ItemFlag.ItemIsSelectable) ) - itm2.setCheckState(Qt.Unchecked) + itm2.setCheckState(Qt.CheckState.Unchecked) - self.slotsView.sortByColumn(0, Qt.AscendingOrder) + self.slotsView.sortByColumn(0, Qt.SortOrder.AscendingOrder) def __generateCode(self): """ @@ -520,7 +521,8 @@ child = topItem.child(childRow) if ( child.checkState() and - child.flags() & Qt.ItemFlags(Qt.ItemIsUserCheckable) + child.flags() & Qt.ItemFlags( + Qt.ItemFlag.ItemIsUserCheckable) ): slotsCode.append('{0}\n'.format(indentStr)) slotsCode.append('{0}{1}\n'.format( @@ -608,7 +610,9 @@ @param text changed text (string) """ - rx = QRegularExpression(text, QRegularExpression.CaseInsensitiveOption) + rx = QRegularExpression( + text, + QRegularExpression.PatternOption.CaseInsensitiveOption) self.proxyModel.setFilterRegularExpression(rx) @pyqtSlot() @@ -620,7 +624,7 @@ objName = self.__objectName() if objName: dlg = NewDialogClassDialog(objName, file, path, self) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: className, fileName = dlg.getData() self.classNameCombo.clear()
--- a/eric6/Project/DebuggerPropertiesDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Project/DebuggerPropertiesDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -46,9 +46,10 @@ debugClientsHistory = Preferences.getProject( "DebugClientsHistory") self.debugClientPicker.setMode(E5PathPickerModes.OpenFileMode) - self.debugClientPicker.setInsertPolicy(QComboBox.InsertAtTop) + self.debugClientPicker.setInsertPolicy( + QComboBox.InsertPolicy.InsertAtTop) self.debugClientPicker.setSizeAdjustPolicy( - QComboBox.AdjustToMinimumContentsLength) + QComboBox.SizeAdjustPolicy.AdjustToContents) self.debugClientPicker.setPathsList(debugClientsHistory) self.debugClientClearHistoryButton.setIcon( UI.PixmapCache.getIcon("editDelete"))
--- a/eric6/Project/FiletypeAssociationDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Project/FiletypeAssociationDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -30,7 +30,7 @@ self.filetypeAssociationList.headerItem().setText( self.filetypeAssociationList.columnCount(), "") self.filetypeAssociationList.header().setSortIndicator( - 0, Qt.AscendingOrder) + 0, Qt.SortOrder.AscendingOrder) # keep these lists in sync self.filetypes = ["SOURCES", "FORMS", "TRANSLATIONS", "RESOURCES", @@ -68,7 +68,7 @@ Private method to reformat the tree. """ self.filetypeAssociationList.header().resizeSections( - QHeaderView.ResizeToContents) + QHeaderView.ResizeMode.ResizeToContents) self.filetypeAssociationList.header().setStretchLastSection(True) def __createItem(self, pattern, filetype): @@ -110,7 +110,7 @@ filetype = self.filetypeCombo.currentText() if pattern: items = self.filetypeAssociationList.findItems( - pattern, Qt.MatchFlags(Qt.MatchExactly), 0) + pattern, Qt.MatchFlags(Qt.MatchFlag.MatchExactly), 0) for itm in items: itm = self.filetypeAssociationList.takeTopLevelItem( self.filetypeAssociationList.indexOfTopLevelItem(itm))
--- a/eric6/Project/IdlCompilerDefineNameDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Project/IdlCompilerDefineNameDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -45,7 +45,7 @@ """ Private slot to update the enable state of the OK button. """ - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( + self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( bool(self.nameEdit.text())) @pyqtSlot(str)
--- a/eric6/Project/IdlCompilerOptionsDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Project/IdlCompilerOptionsDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -117,7 +117,8 @@ @return flag indicating that the given directory is already included @rtype bool """ - return len(self.idList.findItems(directory, Qt.MatchExactly)) > 0 + return len(self.idList.findItems( + directory, Qt.MatchFlag.MatchExactly)) > 0 @pyqtSlot() def on_idList_itemSelectionChanged(self): @@ -223,7 +224,7 @@ value = "" QTreeWidgetItem(self.dnList, [name, value]) - self.dnList.sortItems(0, Qt.AscendingOrder) + self.dnList.sortItems(0, Qt.SortOrder.AscendingOrder) def __generateDefinedNamesList(self): """ @@ -254,7 +255,8 @@ @return flag indicating that the given name is already included @rtype bool """ - return len(self.dnList.findItems(name, Qt.MatchExactly, 0)) > 0 + return len(self.dnList.findItems( + name, Qt.MatchFlag.MatchExactly, 0)) > 0 @pyqtSlot() def on_dnList_itemSelectionChanged(self): @@ -269,12 +271,12 @@ Private slot to add a 'Define Name' entry. """ dlg = IdlCompilerDefineNameDialog(parent=self) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: name, value = dlg.getData() if not self.__definedNamesContain(name): QTreeWidgetItem(self.dnList, [name, value]) - self.dnList.sortItems(0, Qt.AscendingOrder) + self.dnList.sortItems(0, Qt.SortOrder.AscendingOrder) @pyqtSlot() def on_dnDeleteButton_clicked(self): @@ -295,7 +297,7 @@ dlg = IdlCompilerDefineNameDialog( name=itm.text(0), value=itm.text(1), parent=self) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: name, value = dlg.getData() if self.__definedNamesContain(name) and itm.text(0) != name: # the entry exists already, delete the edited one @@ -304,13 +306,14 @@ del itm # change the named one - itm = self.dnList.findItems(name, Qt.MatchExactly, 0)[0] + itm = self.dnList.findItems( + name, Qt.MatchFlag.MatchExactly, 0)[0] itm.setText(1, value) else: itm.setText(0, name) itm.setText(1, value) - self.dnList.sortItems(0, Qt.AscendingOrder) + self.dnList.sortItems(0, Qt.SortOrder.AscendingOrder) ####################################################################### ## Methods implementing the 'Undefine Name' option @@ -346,7 +349,7 @@ @return flag indicating that the given name is already included @rtype bool """ - return len(self.unList.findItems(name, Qt.MatchExactly)) > 0 + return len(self.unList.findItems(name, Qt.MatchFlag.MatchExactly)) > 0 @pyqtSlot() def on_unList_itemSelectionChanged(self):
--- a/eric6/Project/LexerAssociationDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Project/LexerAssociationDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -32,8 +32,8 @@ self.editorLexerList.headerItem().setText( self.editorLexerList.columnCount(), "") header = self.editorLexerList.header() - header.setSectionResizeMode(QHeaderView.ResizeToContents) - header.setSortIndicator(0, Qt.AscendingOrder) + header.setSectionResizeMode(QHeaderView.ResizeMode.ResizeToContents) + header.setSortIndicator(0, Qt.SortOrder.AscendingOrder) try: self.extsep = os.extsep @@ -61,7 +61,7 @@ self.project = project for ext, lexer in list(self.project.pdata["LEXERASSOCS"].items()): QTreeWidgetItem(self.editorLexerList, [ext, lexer]) - self.editorLexerList.sortByColumn(0, Qt.AscendingOrder) + self.editorLexerList.sortByColumn(0, Qt.SortOrder.AscendingOrder) @pyqtSlot() def on_addLexerButton_clicked(self): @@ -80,7 +80,7 @@ lexer = "Pygments|{0}".format(pygmentsLexer) if ext and lexer: itmList = self.editorLexerList.findItems( - ext, Qt.MatchFlags(Qt.MatchExactly), 0) + ext, Qt.MatchFlags(Qt.MatchFlag.MatchExactly), 0) if itmList: index = self.editorLexerList.indexOfTopLevelItem(itmList[0]) itm = self.editorLexerList.takeTopLevelItem(index) @@ -148,13 +148,15 @@ """ self.on_editorLexerList_itemClicked(itm, column) - @pyqtSlot(str) - def on_editorLexerCombo_currentIndexChanged(self, text): + @pyqtSlot(int) + def on_editorLexerCombo_currentIndexChanged(self, index): """ Private slot to handle the selection of a lexer. - @param text text of the line edit (string) + @param index index of the current item + @type int """ + text = self.editorLexerCombo.itemText(index) if text in self.extras: self.pygmentsLexerCombo.setEnabled(True) self.pygmentsLabel.setEnabled(True)
--- a/eric6/Project/MakePropertiesDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Project/MakePropertiesDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -73,8 +73,9 @@ """ Private slot to update the enabled state of the OK button. """ - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(bool( - self.makeTargetEdit.text())) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(bool( + self.makeTargetEdit.text())) def storeData(self): """
--- a/eric6/Project/NewDialogClassDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Project/NewDialogClassDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -35,7 +35,8 @@ self.pathnamePicker.setMode(E5PathPickerModes.DirectoryMode) - self.okButton = self.buttonBox.button(QDialogButtonBox.Ok) + self.okButton = self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok) self.okButton.setEnabled(False) self.classnameEdit.setText(defaultClassName)
--- a/eric6/Project/NewPythonPackageDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Project/NewPythonPackageDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -28,7 +28,8 @@ super(NewPythonPackageDialog, self).__init__(parent) self.setupUi(self) - self.okButton = self.buttonBox.button(QDialogButtonBox.Ok) + self.okButton = self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok) self.okButton.setEnabled(False) rp = relPath.replace("/", ".").replace("\\", ".")
--- a/eric6/Project/Project.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Project/Project.py Tue Mar 02 17:17:09 2021 +0100 @@ -814,7 +814,7 @@ else: # old XML based format f = QFile(fn) - if f.open(QIODevice.ReadOnly): + if f.open(QIODevice.OpenModeFlag.ReadOnly): from E5XML.ProjectReader import ProjectReader reader = ProjectReader(f, self) reader.readXML() @@ -825,7 +825,7 @@ if reader.version.startswith("5.") and not self.pdata["HASH"]: hashStr = str(QCryptographicHash.hash( QByteArray(self.ppath.encode("utf-8")), - QCryptographicHash.Sha1).toHex(), + QCryptographicHash.Algorithm.Sha1).toHex(), encoding="utf-8") self.pdata["HASH"] = hashStr self.setDirty(True) @@ -911,7 +911,7 @@ if not self.pdata["HASH"]: hashStr = str(QCryptographicHash.hash( QByteArray(self.ppath.encode("utf-8")), - QCryptographicHash.Sha1).toHex(), + QCryptographicHash.Algorithm.Sha1).toHex(), encoding="utf-8") self.pdata["HASH"] = hashStr @@ -925,7 +925,7 @@ else: # old XML based format f = QFile(fn) - if f.open(QIODevice.WriteOnly): + if f.open(QIODevice.OpenModeFlag.WriteOnly): from E5XML.ProjectWriter import ProjectWriter ProjectWriter(f, os.path.splitext( os.path.basename(fn))[0]).writeXML() @@ -970,7 +970,7 @@ '{0}.e4q'.format(fn1)) if os.path.exists(fn): f = QFile(fn) - if f.open(QIODevice.ReadOnly): + if f.open(QIODevice.OpenModeFlag.ReadOnly): from E5XML.UserProjectReader import UserProjectReader reader = UserProjectReader(f, self) reader.readXML() @@ -1044,7 +1044,7 @@ '{0}{1}.e5s'.format(fn1, indicator)) if os.path.exists(fn): f = QFile(fn) - if f.open(QIODevice.ReadOnly): + if f.open(QIODevice.OpenModeFlag.ReadOnly): from E5XML.SessionReader import SessionReader reader = SessionReader(f, False) reader.readXML(quiet=quiet) @@ -1131,7 +1131,7 @@ '{0}.e6t'.format(base)) if os.path.exists(fn): f = QFile(fn) - if f.open(QIODevice.ReadOnly): + if f.open(QIODevice.OpenModeFlag.ReadOnly): from E5XML.TasksReader import TasksReader reader = TasksReader(f, True) reader.readXML() @@ -1209,7 +1209,7 @@ '{0}.e4d'.format(fn1)) f = QFile(fn) - if f.open(QIODevice.ReadOnly): + if f.open(QIODevice.OpenModeFlag.ReadOnly): from E5XML.DebuggerPropertiesReader import ( DebuggerPropertiesReader ) @@ -1315,7 +1315,7 @@ """ from .DebuggerPropertiesDialog import DebuggerPropertiesDialog dlg = DebuggerPropertiesDialog(self) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: dlg.storeData() def getDebugProperty(self, key): @@ -1418,7 +1418,7 @@ from .AddLanguageDialog import AddLanguageDialog dlg = AddLanguageDialog(self.parent()) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: lang = dlg.getSelectedLanguage() if self.pdata["PROJECTTYPE"] in [ "PyQt5", "PyQt5C", "PyQt6", "PyQt6C", "E6Plugin", @@ -1663,7 +1663,7 @@ from .AddFileDialog import AddFileDialog dlg = AddFileDialog(self, self.parent(), fileTypeFilter, startdir=startdir) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: fnames, target, isSource = dlg.getData() if target != '': for fn in fnames: @@ -1829,7 +1829,7 @@ from .AddDirectoryDialog import AddDirectoryDialog dlg = AddDirectoryDialog( self, fileTypeFilter, self.parent(), startdir=startdir) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: filetype, source, target, recursive = dlg.getData() if target == '': E5MessageBox.critical( @@ -2327,7 +2327,7 @@ from .PropertiesDialog import PropertiesDialog dlg = PropertiesDialog(self, True) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: self.closeProject() dlg.storeData() self.pdata["VCS"] = 'None' @@ -2364,7 +2364,7 @@ hashStr = str(QCryptographicHash.hash( QByteArray(self.ppath.encode("utf-8")), - QCryptographicHash.Sha1).toHex(), + QCryptographicHash.Algorithm.Sha1).toHex(), encoding="utf-8") self.pdata["HASH"] = hashStr @@ -2565,7 +2565,7 @@ VcsCommandOptionsDialog ) codlg = VcsCommandOptionsDialog(self.vcs) - if codlg.exec() == QDialog.Accepted: + if codlg.exec() == QDialog.DialogCode.Accepted: self.vcs.vcsSetOptions(codlg.getOptions()) # add project file to repository if res == 0: @@ -2617,7 +2617,7 @@ self.vcs = self.initVCS() if self.vcs is not None: vcsdlg = self.vcs.vcsOptionsDialog(self, self.name) - if vcsdlg.exec() == QDialog.Accepted: + if vcsdlg.exec() == QDialog.DialogCode.Accepted: vcsDataDict = vcsdlg.getData() else: self.pdata["VCS"] = 'None' @@ -2639,7 +2639,7 @@ VcsCommandOptionsDialog ) codlg = VcsCommandOptionsDialog(self.vcs) - if codlg.exec() == QDialog.Accepted: + if codlg.exec() == QDialog.DialogCode.Accepted: self.vcs.vcsSetOptions(codlg.getOptions()) # create the project in the VCS @@ -2714,7 +2714,7 @@ "Enter the path pattern for translation files " "(use '%language%' in place of the language" " code):"), - QLineEdit.Normal, + QLineEdit.EchoMode.Normal, tslist[0]) if pattern: self.pdata["TRANSLATIONPATTERN"] = pattern @@ -2755,7 +2755,7 @@ """ from .PropertiesDialog import PropertiesDialog dlg = PropertiesDialog(self, False) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: projectType = self.pdata["PROJECTTYPE"] dlg.storeData() self.setDirty(True) @@ -2830,7 +2830,7 @@ from .UserPropertiesDialog import UserPropertiesDialog dlg = UserPropertiesDialog(self) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: dlg.storeData() if ( @@ -2875,7 +2875,7 @@ """ from .FiletypeAssociationDialog import FiletypeAssociationDialog dlg = FiletypeAssociationDialog(self) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: dlg.transferData() self.setDirty(True) self.__reorganizeFiles() @@ -2901,7 +2901,7 @@ """ from .LexerAssociationDialog import LexerAssociationDialog dlg = LexerAssociationDialog(self) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: dlg.transferData() self.setDirty(True) self.lexerAssociationsChanged.emit() @@ -3694,11 +3694,11 @@ return self.eols[self.pdata["EOL"]] else: eolMode = Preferences.getEditor("EOLMode") - if eolMode == QsciScintilla.EolWindows: + if eolMode == QsciScintilla.EolMode.EolWindows: eol = '\r\n' - elif eolMode == QsciScintilla.EolUnix: + elif eolMode == QsciScintilla.EolMode.EolUnix: eol = '\n' - elif eolMode == QsciScintilla.EolMac: + elif eolMode == QsciScintilla.EolMode.EolMac: eol = '\r' else: eol = os.linesep @@ -5382,7 +5382,7 @@ sorted(pkglists), title=self.tr("Create Plugin Archive"), message=self.tr("Select package lists:"), checkBoxSelection=True) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: selectedLists = [os.path.join(self.ppath, s) for s in dlg.getSelection()] else: @@ -5774,7 +5774,7 @@ through a menu action) @type bool """ - if exitStatus == QProcess.CrashExit: + if exitStatus == QProcess.ExitStatus.CrashExit: E5MessageBox.critical( self.ui, self.tr("Execute Make"),
--- a/eric6/Project/ProjectBaseBrowser.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Project/ProjectBaseBrowser.py Tue Mar 02 17:17:09 2021 +0100 @@ -68,13 +68,17 @@ self.expandedNames = [] self.SelectFlags = QItemSelectionModel.SelectionFlags( - QItemSelectionModel.Select | QItemSelectionModel.Rows) + QItemSelectionModel.SelectionFlag.Select | + QItemSelectionModel.SelectionFlag.Rows + ) self.DeselectFlags = QItemSelectionModel.SelectionFlags( - QItemSelectionModel.Deselect | QItemSelectionModel.Rows) + QItemSelectionModel.SelectionFlag.Deselect | + QItemSelectionModel.SelectionFlag.Rows + ) self._activating = False - self.setContextMenuPolicy(Qt.CustomContextMenu) + self.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu) self.customContextMenuRequested.connect(self._contextMenuRequested) self.activated.connect(self._openItem) self._model.rowsInserted.connect(self.__modelRowsInserted) @@ -174,7 +178,9 @@ if index.isValid(): self.setCurrentIndex(index) flags = QItemSelectionModel.SelectionFlags( - QItemSelectionModel.ClearAndSelect | QItemSelectionModel.Rows) + QItemSelectionModel.SelectionFlag.ClearAndSelect | + QItemSelectionModel.SelectionFlag.Rows + ) self.selectionModel().select(index, flags) def _setItemSelected(self, index, selected): @@ -225,8 +231,8 @@ Protected slot to handle the projectOpened signal. """ self.layoutDisplay() - self.sortByColumn(0, Qt.DescendingOrder) - self.sortByColumn(0, Qt.AscendingOrder) + self.sortByColumn(0, Qt.SortOrder.DescendingOrder) + self.sortByColumn(0, Qt.SortOrder.AscendingOrder) self._initMenusAndVcs() def _initMenusAndVcs(self): @@ -301,7 +307,7 @@ " the project?"), dirs) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: for dn in fullNames: self.project.deleteDirectory(dn) @@ -342,7 +348,8 @@ index = self.model().mapFromSource(sindex) if index.isValid(): self._selectSingleItem(index) - self.scrollTo(index, QAbstractItemView.PositionAtTop) + self.scrollTo(index, + QAbstractItemView.ScrollHint.PositionAtTop) def selectFileLine(self, fn, lineno): """
--- a/eric6/Project/ProjectBrowser.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Project/ProjectBrowser.py Tue Mar 02 17:17:09 2021 +0100 @@ -50,7 +50,7 @@ self.setUsesScrollButtons(True) self.vcsStatusIndicator = E5ClickableLed(self) - self.setCornerWidget(self.vcsStatusIndicator, Qt.TopLeftCorner) + self.setCornerWidget(self.vcsStatusIndicator, Qt.Corner.TopLeftCorner) self.vcsStatusIndicator.clicked.connect( self.__vcsStatusIndicatorClicked) self.vcsStatusColorNames = { @@ -392,7 +392,7 @@ """ self.currentVcsStatus = state if state == " " or state not in self.vcsStatusColorNames: - self.vcsStatusIndicator.setColor(QColor(Qt.lightGray)) + self.vcsStatusIndicator.setColor(QColor(Qt.GlobalColor.lightGray)) else: self.vcsStatusIndicator.setColor( Preferences.getProjectBrowserColour(
--- a/eric6/Project/ProjectBrowserModel.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Project/ProjectBrowserModel.py Tue Mar 02 17:17:09 2021 +0100 @@ -171,7 +171,7 @@ """ if issubclass(other.__class__, BrowserFileItem): if Preferences.getUI("BrowsersListFoldersFirst"): - return order == Qt.AscendingOrder + return order == Qt.SortOrder.AscendingOrder return BrowserItem.lessThan(self, other, column, order) @@ -294,13 +294,13 @@ if not index.isValid(): return None - if role == Qt.TextColorRole: + if role == Qt.ItemDataRole.TextColorRole: if index.column() == 0: try: return index.internalPointer().getTextColor() except AttributeError: return None - elif role == Qt.BackgroundColorRole: + elif role == Qt.ItemDataRole.BackgroundColorRole: try: col = self.itemBackgroundColors[ index.internalPointer().vcsState] @@ -344,10 +344,13 @@ if Preferences.getProject("BrowsersListHiddenFiles"): fileFilter = QDir.Filters( - QDir.AllEntries | QDir.Hidden | QDir.NoDotAndDotDot) + QDir.Filter.AllEntries | + QDir.Filter.Hidden | + QDir.Filter.NoDotAndDotDot + ) else: fileFilter = QDir.Filters( - QDir.AllEntries | QDir.NoDotAndDotDot) + QDir.Filter.AllEntries | QDir.Filter.NoDotAndDotDot) entryInfoList = qdir.entryInfoList(fileFilter) if len(entryInfoList) > 0: @@ -695,10 +698,13 @@ if Preferences.getProject("BrowsersListHiddenFiles"): fileFilter = QDir.Filters( - QDir.AllEntries | QDir.Hidden | QDir.NoDotAndDotDot) + QDir.Filter.AllEntries | + QDir.Filter.Hidden | + QDir.Filter.NoDotAndDotDot + ) else: fileFilter = QDir.Filters( - QDir.AllEntries | QDir.NoDotAndDotDot) + QDir.Filter.AllEntries | QDir.Filter.NoDotAndDotDot) for itm in self.watchedItems[path]: oldCnt = itm.childCount()
--- a/eric6/Project/ProjectFormsBrowser.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Project/ProjectFormsBrowser.py Tue Mar 02 17:17:09 2021 +0100 @@ -662,7 +662,7 @@ "Do you really want to delete these forms from the project?"), files) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: for fn2, fn in zip(fullNames, files): self.closeSourceWindow.emit(fn2) self.project.deleteFile(fn) @@ -719,7 +719,7 @@ """ if self.compileProc is None: return - self.compileProc.setReadChannel(QProcess.StandardOutput) + self.compileProc.setReadChannel(QProcess.ProcessChannel.StandardOutput) while self.compileProc and self.compileProc.canReadLine(): self.buf += str(self.compileProc.readLine(), @@ -735,7 +735,7 @@ ioEncoding = Preferences.getSystem("IOEncoding") - self.compileProc.setReadChannel(QProcess.StandardError) + self.compileProc.setReadChannel(QProcess.ProcessChannel.StandardError) while self.compileProc and self.compileProc.canReadLine(): s = self.__uicompiler + ': ' error = str(self.compileProc.readLine(), @@ -753,7 +753,11 @@ self.compileRunning = False e5App().getObject("ViewManager").enableEditorsCheckFocusIn(True) ui = e5App().getObject("UserInterface") - if exitStatus == QProcess.NormalExit and exitCode == 0 and self.buf: + if ( + exitStatus == QProcess.ExitStatus.NormalExit and + exitCode == 0 and + self.buf + ): ofn = os.path.join(self.project.ppath, self.compiledFile) try: if self.project.useSystemEol(): @@ -937,7 +941,7 @@ proc = self.__compileUI(fn, True, progress) if proc is not None: - while proc.state() == QProcess.Running: + while proc.state() == QProcess.ProcessState.Running: QApplication.processEvents() QThread.msleep(300) QApplication.processEvents() @@ -975,7 +979,7 @@ proc = self.__compileUI(fn, True, progress) if proc is not None: - while proc.state() == QProcess.Running: + while proc.state() == QProcess.ProcessState.Running: QApplication.processEvents() QThread.msleep(300) QApplication.processEvents() @@ -1041,7 +1045,7 @@ proc = self.__compileUI(fn, True, progress) if proc is not None: - while proc.state() == QProcess.Running: + while proc.state() == QProcess.ProcessState.Running: QApplication.processEvents() QThread.msleep(300) QApplication.processEvents() @@ -1069,7 +1073,7 @@ if self.project.getProjectType() in ["PyQt5", "PyQt6", "E6Plugin"]: dlg = UicCompilerOptionsDialog(params, self.getUiCompiler()) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: package, suffix, root = dlg.getData() if package != params["Package"]: params["Package"] = package
--- a/eric6/Project/ProjectInterfacesBrowser.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Project/ProjectInterfacesBrowser.py Tue Mar 02 17:17:09 2021 +0100 @@ -464,7 +464,7 @@ " the project?"), files) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: for fn2, fn in zip(fullNames, files): self.closeSourceWindow.emit(fn2) self.project.deleteFile(fn) @@ -483,7 +483,7 @@ ioEncoding = Preferences.getSystem("IOEncoding") - self.compileProc.setReadChannel(QProcess.StandardOutput) + self.compileProc.setReadChannel(QProcess.ProcessChannel.StandardOutput) while self.compileProc and self.compileProc.canReadLine(): s = 'omniidl: ' output = str(self.compileProc.readLine(), ioEncoding, 'replace') @@ -500,7 +500,7 @@ ioEncoding = Preferences.getSystem("IOEncoding") - self.compileProc.setReadChannel(QProcess.StandardError) + self.compileProc.setReadChannel(QProcess.ProcessChannel.StandardError) while self.compileProc and self.compileProc.canReadLine(): s = 'omniidl: ' error = str(self.compileProc.readLine(), ioEncoding, 'replace') @@ -516,7 +516,7 @@ """ self.compileRunning = False ui = e5App().getObject("UserInterface") - if exitStatus == QProcess.NormalExit and exitCode == 0: + if exitStatus == QProcess.ExitStatus.NormalExit and exitCode == 0: path = os.path.dirname(self.idlFile) poaList = glob.glob(os.path.join(path, "*__POA")) npoaList = [f.replace("__POA", "") for f in poaList] @@ -624,7 +624,7 @@ break proc = self.__compileIDL(fn, True, progress) if proc is not None: - while proc.state() == QProcess.Running: + while proc.state() == QProcess.ProcessState.Running: QApplication.processEvents() QThread.msleep(300) QApplication.processEvents() @@ -659,7 +659,7 @@ break proc = self.__compileIDL(fn, True, progress) if proc is not None: - while proc.state() == QProcess.Running: + while proc.state() == QProcess.ProcessState.Running: QApplication.processEvents() QThread.msleep(300) QApplication.processEvents() @@ -680,7 +680,7 @@ dlg = IdlCompilerOptionsDialog( params["IncludeDirs"][:], params["DefinedNames"][:], params["UndefinedNames"][:], self.project, self) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: include, defined, undefined = dlg.getData() if include != params["IncludeDirs"]: params["IncludeDirs"] = include[:]
--- a/eric6/Project/ProjectOthersBrowser.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Project/ProjectOthersBrowser.py Tue Mar 02 17:17:09 2021 +0100 @@ -356,7 +356,7 @@ " project?"), names) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: for itm, fn2, fn in zip(items[:], fullNames, names): if isinstance(itm, ProjectBrowserFileItem): self.closeSourceWindow.emit(fn2)
--- a/eric6/Project/ProjectProtocolsBrowser.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Project/ProjectProtocolsBrowser.py Tue Mar 02 17:17:09 2021 +0100 @@ -456,7 +456,7 @@ " the project?"), files) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: for fn2, fn in zip(fullNames, files): self.closeSourceWindow.emit(fn2) self.project.deleteFile(fn) @@ -504,7 +504,7 @@ ioEncoding = Preferences.getSystem("IOEncoding") - self.compileProc.setReadChannel(QProcess.StandardOutput) + self.compileProc.setReadChannel(QProcess.ProcessChannel.StandardOutput) while self.compileProc and self.compileProc.canReadLine(): s = 'protoc: ' output = str(self.compileProc.readLine(), ioEncoding, 'replace') @@ -521,7 +521,7 @@ ioEncoding = Preferences.getSystem("IOEncoding") - self.compileProc.setReadChannel(QProcess.StandardError) + self.compileProc.setReadChannel(QProcess.ProcessChannel.StandardError) while self.compileProc and self.compileProc.canReadLine(): s = 'protoc: ' error = str(self.compileProc.readLine(), ioEncoding, 'replace') @@ -541,7 +541,7 @@ """ self.__compileRunning = False ui = e5App().getObject("UserInterface") - if exitStatus == QProcess.NormalExit and exitCode == 0: + if exitStatus == QProcess.ExitStatus.NormalExit and exitCode == 0: path = os.path.dirname(self.__protoFile) fileList = glob.glob(os.path.join(path, "*_pb2.py")) if grpc: @@ -669,7 +669,7 @@ break proc = self.__compileProto(fn, True, progress, grpc=grpc) if proc is not None: - while proc.state() == QProcess.Running: + while proc.state() == QProcess.ProcessState.Running: QApplication.processEvents() QThread.msleep(300) QApplication.processEvents() @@ -707,7 +707,7 @@ break proc = self.__compileProto(fn, True, progress, grpc=grpc) if proc is not None: - while proc.state() == QProcess.Running: + while proc.state() == QProcess.ProcessState.Running: QApplication.processEvents() QThread.msleep(300) QApplication.processEvents()
--- a/eric6/Project/ProjectResourcesBrowser.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Project/ProjectResourcesBrowser.py Tue Mar 02 17:17:09 2021 +0100 @@ -544,7 +544,7 @@ " project?"), files) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: for fn2, fn in zip(fullNames, files): self.closeSourceWindow.emit(fn2) self.project.deleteFile(fn) @@ -560,7 +560,7 @@ """ if self.compileProc is None: return - self.compileProc.setReadChannel(QProcess.StandardOutput) + self.compileProc.setReadChannel(QProcess.ProcessChannel.StandardOutput) while self.compileProc and self.compileProc.canReadLine(): self.buf += str(self.compileProc.readLine(), @@ -577,7 +577,7 @@ ioEncoding = Preferences.getSystem("IOEncoding") - self.compileProc.setReadChannel(QProcess.StandardError) + self.compileProc.setReadChannel(QProcess.ProcessChannel.StandardError) while self.compileProc and self.compileProc.canReadLine(): s = self.rccCompiler + ': ' error = str(self.compileProc.readLine(), @@ -595,7 +595,11 @@ self.compileRunning = False e5App().getObject("ViewManager").enableEditorsCheckFocusIn(True) ui = e5App().getObject("UserInterface") - if exitStatus == QProcess.NormalExit and exitCode == 0 and self.buf: + if ( + exitStatus == QProcess.ExitStatus.NormalExit and + exitCode == 0 and + self.buf + ): ofn = os.path.join(self.project.ppath, self.compiledFile) try: if self.project.useSystemEol(): @@ -754,7 +758,7 @@ break proc = self.__compileQRC(fn, True, progress) if proc is not None: - while proc.state() == QProcess.Running: + while proc.state() == QProcess.ProcessState.Running: QApplication.processEvents() QThread.msleep(300) QApplication.processEvents() @@ -792,7 +796,7 @@ if not fn.endswith('.ui.h'): proc = self.__compileQRC(fn, True, progress) if proc is not None: - while proc.state() == QProcess.Running: + while proc.state() == QProcess.ProcessState.Running: QApplication.processEvents() QThread.msleep(300) QApplication.processEvents() @@ -898,7 +902,7 @@ break proc = self.__compileQRC(fn, True, progress) if proc is not None: - while proc.state() == QProcess.Running: + while proc.state() == QProcess.ProcessState.Running: QApplication.processEvents() QThread.msleep(300) QApplication.processEvents() @@ -923,7 +927,7 @@ params = self.project.pdata["RCCPARAMS"] dlg = RccCompilerOptionsDialog(params) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: threshold, compression, noCompression, root = dlg.getData() if threshold != params["CompressionThreshold"]: params["CompressionThreshold"] = threshold
--- a/eric6/Project/ProjectSourcesBrowser.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Project/ProjectSourcesBrowser.py Tue Mar 02 17:17:09 2021 +0100 @@ -814,7 +814,7 @@ dn = dn[1:] from .NewPythonPackageDialog import NewPythonPackageDialog dlg = NewPythonPackageDialog(dn, self) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: packageName = dlg.getData() nameParts = packageName.split(".") packagePath = self.project.ppath @@ -915,7 +915,7 @@ "Do you really want to delete these files from the project?"), files) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: for fn2, fn in zip(fullNames, files): self.closeSourceWindow.emit(fn2) self.project.deleteFile(fn)
--- a/eric6/Project/ProjectTranslationsBrowser.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Project/ProjectTranslationsBrowser.py Tue Mar 02 17:17:09 2021 +0100 @@ -691,7 +691,7 @@ " from the project?"), translationFiles) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: for fn in translationFiles: self.closeSourceWindow.emit(fn) self.project.deleteLanguageFile(fn) @@ -870,7 +870,7 @@ """ ioEncoding = Preferences.getSystem("IOEncoding") - proc.setReadChannel(QProcess.StandardOutput) + proc.setReadChannel(QProcess.ProcessChannel.StandardOutput) while proc and proc.canReadLine(): s = ps output = str(proc.readLine(), ioEncoding, 'replace') @@ -906,7 +906,7 @@ """ ioEncoding = Preferences.getSystem("IOEncoding") - proc.setReadChannel(QProcess.StandardError) + proc.setReadChannel(QProcess.ProcessChannel.StandardError) while proc and proc.canReadLine(): s = ps error = str(proc.readLine(), ioEncoding, 'replace') @@ -936,7 +936,7 @@ @type QProcess.ExitStatus """ ui = e5App().getObject("UserInterface") - if exitStatus == QProcess.NormalExit and exitCode == 0: + if exitStatus == QProcess.ExitStatus.NormalExit and exitCode == 0: ui.showNotification( UI.PixmapCache.getPixmap("linguist48"), self.tr("Translation file generation"), @@ -944,7 +944,7 @@ "The generation of the translation files (*.ts)" " was successful.")) else: - if exitStatus == QProcess.CrashExit: + if exitStatus == QProcess.ExitStatus.CrashExit: info = self.tr(" The process has crashed.") else: info = "" @@ -1189,7 +1189,7 @@ @type QProcess.ExitStatus """ ui = e5App().getObject("UserInterface") - if exitStatus == QProcess.NormalExit and exitCode == 0: + if exitStatus == QProcess.ExitStatus.NormalExit and exitCode == 0: ui.showNotification( UI.PixmapCache.getPixmap("linguist48"), self.tr("Translation file release"),
--- a/eric6/Project/PropertiesDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Project/PropertiesDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -145,17 +145,19 @@ if not self.project.vcsSoftwareAvailable(): self.vcsCheckBox.hide() - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( + self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( bool(self.dirPicker.text()) and self.dirPicker.text() not in self.__initPaths) - @pyqtSlot(str) - def on_languageComboBox_currentIndexChanged(self, language): + @pyqtSlot(int) + def on_languageComboBox_currentIndexChanged(self, index): """ Private slot handling the selection of a programming language. - @param language selected programming language (string) + @param index index of the current item + @type int """ + language = self.languageComboBox.itemText(index) curProjectType = self.getProjectType() projectTypes = [] @@ -178,7 +180,7 @@ @param txt name of the project directory (string) """ - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( + self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( bool(txt) and Utilities.fromNativeSeparators(txt) not in self.__initPaths) @@ -192,7 +194,7 @@ self.spellPropertiesDlg = SpellingPropertiesDialog( self.project, self.newProject, self) res = self.spellPropertiesDlg.exec() - if res == QDialog.Rejected: + if res == QDialog.DialogCode.Rejected: self.spellPropertiesDlg.initDialog() # reset the dialogs contents @pyqtSlot() @@ -209,7 +211,7 @@ else: self.transPropertiesDlg.initFilters() res = self.transPropertiesDlg.exec() - if res == QDialog.Rejected: + if res == QDialog.DialogCode.Rejected: self.transPropertiesDlg.initDialog() # reset the dialogs contents @pyqtSlot() @@ -222,7 +224,7 @@ self.makePropertiesDlg = MakePropertiesDialog( self.project, self.newProject, self) res = self.makePropertiesDlg.exec() - if res == QDialog.Rejected: + if res == QDialog.DialogCode.Rejected: self.makePropertiesDlg.initDialog() @pyqtSlot(str)
--- a/eric6/Project/QuickFindFileDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Project/QuickFindFileDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -55,7 +55,7 @@ self.installEventFilter(self) self.stopButton = self.buttonBox.addButton( - self.tr("Stop"), QDialogButtonBox.ActionRole) + self.tr("Stop"), QDialogButtonBox.ButtonRole.ActionRole) self.project = project def eventFilter(self, source, event): @@ -69,19 +69,22 @@ @return flag indicating that the event was handled @rtype bool """ - if event.type() == QEvent.KeyPress: + if event.type() == QEvent.Type.KeyPress: # Anywhere in the dialog, make hitting escape cancel it - if event.key() == Qt.Key_Escape: + if event.key() == Qt.Key.Key_Escape: self.close() # Anywhere in the dialog, make hitting up/down choose next item # Note: This doesn't really do anything, as other than the text # input there's nothing that doesn't handle up/down already. - elif event.key() == Qt.Key_Up or event.key() == Qt.Key_Down: + elif ( + event.key() == Qt.Key.Key_Up or + event.key() == Qt.Key.Key_Down + ): current = self.fileList.currentItem() index = self.fileList.indexOfTopLevelItem(current) - if event.key() == Qt.Key_Up: + if event.key() == Qt.Key.Key_Up: if index != 0: self.fileList.setCurrentItem( self.fileList.topLevelItem(index - 1)) @@ -99,7 +102,10 @@ """ if button == self.stopButton: self.shouldStop = True - elif button == self.buttonBox.button(QDialogButtonBox.Open): + elif ( + button == + self.buttonBox.button(QDialogButtonBox.StandardButton.Open) + ): self.__openFile() def __openFile(self, itm=None): @@ -222,7 +228,8 @@ del locations self.stopButton.setEnabled(False) - self.fileList.header().resizeSections(QHeaderView.ResizeToContents) + self.fileList.header().resizeSections( + QHeaderView.ResizeMode.ResizeToContents) self.fileList.header().setStretchLastSection(True) if found: @@ -263,7 +270,7 @@ @param current current item (QTreeWidgetItem) @param previous prevoius current item (QTreeWidgetItem) """ - self.buttonBox.button(QDialogButtonBox.Open).setEnabled( + self.buttonBox.button(QDialogButtonBox.StandardButton.Open).setEnabled( current is not None) def show(self):
--- a/eric6/Project/TranslationPropertiesDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Project/TranslationPropertiesDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -71,7 +71,8 @@ """ Public method to initialize the dialogs data. """ - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) self.transPatternPicker.setText( self.project.pdata["TRANSLATIONPATTERN"]) self.transBinPathPicker.setText( @@ -98,7 +99,7 @@ @param txt text of the transPatternPicker line edit (string) """ - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( + self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( "%language%" in txt) @pyqtSlot(str)
--- a/eric6/Project/UicLoadUi5.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Project/UicLoadUi5.py Tue Mar 02 17:17:09 2021 +0100 @@ -130,7 +130,7 @@ for index in range(metaObject.methodCount()): metaMethod = metaObject.method(index) - if metaMethod.methodType() == QMetaMethod.Signal: + if metaMethod.methodType() == QMetaMethod.MethodType.Signal: signatureDict = { "methods": [] }
--- a/eric6/PyUnit/UnittestDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/PyUnit/UnittestDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -43,10 +43,10 @@ unittestFile = pyqtSignal(str, int, bool) unittestStopped = pyqtSignal() - TestCaseNameRole = Qt.UserRole - TestCaseFileRole = Qt.UserRole + 1 + TestCaseNameRole = Qt.ItemDataRole.UserRole + TestCaseFileRole = Qt.ItemDataRole.UserRole + 1 - ErrorsInfoRole = Qt.UserRole + ErrorsInfoRole = Qt.ItemDataRole.UserRole SkippedColorDarkTheme = QColor("#00aaff") FailedExpectedColorDarkTheme = QColor("#ccaaff") @@ -77,31 +77,33 @@ self.setupUi(self) self.testsuitePicker.setMode(E5PathPickerModes.OpenFileMode) - self.testsuitePicker.setInsertPolicy(QComboBox.InsertAtTop) + self.testsuitePicker.setInsertPolicy( + QComboBox.InsertPolicy.InsertAtTop) self.testsuitePicker.setSizeAdjustPolicy( - QComboBox.AdjustToMinimumContentsLength) + QComboBox.SizeAdjustPolicy.AdjustToContents) self.discoveryPicker.setMode(E5PathPickerModes.DirectoryMode) - self.discoveryPicker.setInsertPolicy(QComboBox.InsertAtTop) + self.discoveryPicker.setInsertPolicy( + QComboBox.InsertPolicy.InsertAtTop) self.discoveryPicker.setSizeAdjustPolicy( - QComboBox.AdjustToMinimumContentsLength) + QComboBox.SizeAdjustPolicy.AdjustToContents) self.discoverButton = self.buttonBox.addButton( - self.tr("Discover"), QDialogButtonBox.ActionRole) + self.tr("Discover"), QDialogButtonBox.ButtonRole.ActionRole) self.discoverButton.setToolTip(self.tr( "Discover tests")) self.discoverButton.setWhatsThis(self.tr( """<b>Discover</b>""" """<p>This button starts a discovery of available tests.</p>""")) self.startButton = self.buttonBox.addButton( - self.tr("Start"), QDialogButtonBox.ActionRole) + self.tr("Start"), QDialogButtonBox.ButtonRole.ActionRole) self.startButton.setToolTip(self.tr( "Start the selected testsuite")) self.startButton.setWhatsThis(self.tr( """<b>Start Test</b>""" """<p>This button starts the selected testsuite.</p>""")) self.startFailedButton = self.buttonBox.addButton( - self.tr("Rerun Failed"), QDialogButtonBox.ActionRole) + self.tr("Rerun Failed"), QDialogButtonBox.ButtonRole.ActionRole) self.startFailedButton.setToolTip( self.tr("Reruns failed tests of the selected testsuite")) self.startFailedButton.setWhatsThis(self.tr( @@ -109,7 +111,7 @@ """<p>This button reruns all failed tests of the selected""" """ testsuite.</p>""")) self.stopButton = self.buttonBox.addButton( - self.tr("Stop"), QDialogButtonBox.ActionRole) + self.tr("Stop"), QDialogButtonBox.ButtonRole.ActionRole) self.stopButton.setToolTip(self.tr("Stop the running unittest")) self.stopButton.setWhatsThis(self.tr( """<b>Stop Test</b>""" @@ -124,7 +126,7 @@ self.setWindowFlags( self.windowFlags() | Qt.WindowFlags( - Qt.WindowContextHelpButtonHint)) + Qt.WindowType.WindowContextHelpButtonHint)) self.setWindowIcon(UI.PixmapCache.getIcon("eric")) self.setWindowTitle(self.tr("Unittest")) if dbs: @@ -194,7 +196,7 @@ @param evt key press event to handle (QKeyEvent) """ - if evt.key() == Qt.Key_Escape and self.__dbs: + if evt.key() == Qt.Key.Key_Escape and self.__dbs: self.close() def __populateVenvComboBox(self): @@ -549,8 +551,9 @@ itm = QTreeWidgetItem(pitm, [testPath[index - 1]]) pitm.setExpanded(True) - itm.setFlags(Qt.ItemIsUserCheckable | Qt.ItemIsEnabled) - itm.setCheckState(0, Qt.Unchecked) + itm.setFlags(Qt.ItemFlag.ItemIsUserCheckable | + Qt.ItemFlag.ItemIsEnabled) + itm.setCheckState(0, Qt.CheckState.Unchecked) itm.setData(0, UnittestDialog.TestCaseNameRole, modulePath) if ( os.path.splitext(os.path.basename(filename))[0] == @@ -578,7 +581,7 @@ # top level for index in range(self.discoveryList.topLevelItemCount()): itm = self.discoveryList.topLevelItem(index) - if itm.checkState(0) == Qt.Checked: + if itm.checkState(0) == Qt.CheckState.Checked: selectedTests.append( itm.data(0, UnittestDialog.TestCaseNameRole)) # ignore children because they are included implicitly @@ -590,7 +593,7 @@ # parent item with children for index in range(parent.childCount()): itm = parent.child(index) - if itm.checkState(0) == Qt.Checked: + if itm.checkState(0) == Qt.CheckState.Checked: selectedTests.append( itm.data(0, UnittestDialog.TestCaseNameRole)) # ignore children because they are included implicitly @@ -937,7 +940,7 @@ text = re.sub(pattern, "", text) foundItems = self.testsListWidget.findItems( - text, Qt.MatchFlags(Qt.MatchExactly)) + text, Qt.MatchFlags(Qt.MatchFlag.MatchExactly)) if len(foundItems) > 0: itm = foundItems[0] self.testsListWidget.setCurrentItem(itm) @@ -1156,10 +1159,11 @@ self.dlg.traceback = ui.traceback ui.showButton = ui.buttonBox.addButton( - self.tr("Show Source"), QDialogButtonBox.ActionRole) + self.tr("Show Source"), QDialogButtonBox.ButtonRole.ActionRole) ui.showButton.clicked.connect(self.__showSource) - ui.buttonBox.button(QDialogButtonBox.Close).setDefault(True) + ui.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) self.dlg.setWindowTitle(text) ui.testLabel.setText(test) @@ -1355,7 +1359,7 @@ @param event reference to the event object (QEvent) @return flag indicating, whether the event was handled (boolean) """ - if event.type() == QEvent.Close: + if event.type() == QEvent.Type.Close: QApplication.exit() return True
--- a/eric6/QScintilla/APIsManager.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/QScintilla/APIsManager.py Tue Mar 02 17:17:09 2021 +0100 @@ -218,7 +218,8 @@ self.__lexer.lexerName()) fnames = [] filist = QDir(apidir).entryInfoList( - ["*.api"], QDir.Files, QDir.IgnoreCase) + ["*.api"], QDir.Filter.Files, + QDir.SortFlag.IgnoreCase) for fi in filist: fnames.append(fi.absoluteFilePath()) return fnames
--- a/eric6/QScintilla/DocstringGenerator/BaseDocstringGenerator.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/QScintilla/DocstringGenerator/BaseDocstringGenerator.py Tue Mar 02 17:17:09 2021 +0100 @@ -225,7 +225,7 @@ @type QKeyEvent """ key = evt.key() - if key not in (Qt.Key_Enter, Qt.Key_Return): + if key not in (Qt.Key.Key_Enter, Qt.Key.Key_Return): self.__editor.keyPressEvent(evt) self.close() else:
--- a/eric6/QScintilla/Editor.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/QScintilla/Editor.py Tue Mar 02 17:17:09 2021 +0100 @@ -194,7 +194,7 @@ @exception OSError raised to indicate an issue accessing the file """ super(Editor, self).__init__(parent) - self.setAttribute(Qt.WA_KeyCompression) + self.setAttribute(Qt.WidgetAttribute.WA_KeyCompression) self.setUtf8(True) self.dbs = dbs @@ -334,8 +334,10 @@ # define the line markers if Preferences.getEditor("LineMarkersBackground"): - self.currentline = self.markerDefine(QsciScintilla.Background) - self.errorline = self.markerDefine(QsciScintilla.Background) + self.currentline = self.markerDefine( + QsciScintilla.MarkerSymbol.Background) + self.errorline = self.markerDefine( + QsciScintilla.MarkerSymbol.Background) self.__setLineMarkerColours() else: self.currentline = self.markerDefine( @@ -471,7 +473,7 @@ self.resize(sh) # Make sure tabbing through a QWorkspace works. - self.setFocusPolicy(Qt.StrongFocus) + self.setFocusPolicy(Qt.FocusPolicy.StrongFocus) self.__updateReadOnly(True) @@ -557,7 +559,7 @@ self.project.projectPropertiesChanged.connect( self.__projectPropertiesChanged) - self.grabGesture(Qt.PinchGesture) + self.grabGesture(Qt.GestureType.PinchGesture) self.SCN_ZOOM.connect(self.__markerMap.update) self.__markerMap.update() @@ -2514,7 +2516,7 @@ (self.fileName, ln), (cond, temp, enabled, ignorecount), self.condHistory, self, modal=True) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: cond, temp, enabled, ignorecount = dlg.getData() self.breakpointModel.setBreakPointByIndex( index, self.fileName, ln, @@ -2702,12 +2704,14 @@ Public slot to print the text. """ from .Printer import Printer - printer = Printer(mode=QPrinter.HighResolution) + printer = Printer(mode=QPrinter.PrinterMode.HighResolution) sb = e5App().getObject("UserInterface").statusBar() printDialog = QPrintDialog(printer, self) if self.hasSelectedText(): - printDialog.setOption(QAbstractPrintDialog.PrintSelection, True) - if printDialog.exec() == QDialog.Accepted: + printDialog.setOption( + QAbstractPrintDialog.PrintDialogOption.PrintSelection, + True) + if printDialog.exec() == QDialog.DialogCode.Accepted: sb.showMessage(self.tr('Printing...')) QApplication.processEvents() fn = self.getFileName() @@ -2715,7 +2719,10 @@ printer.setDocName(os.path.basename(fn)) else: printer.setDocName(self.noName) - if printDialog.printRange() == QAbstractPrintDialog.Selection: + if ( + printDialog.printRange() == + QAbstractPrintDialog.PrintRange.Selection + ): # get the selection fromLine, fromIndex, toLine, toIndex = self.getSelection() if toIndex == 0: @@ -2740,7 +2747,7 @@ from PyQt5.QtPrintSupport import QPrintPreviewDialog from .Printer import Printer - printer = Printer(mode=QPrinter.HighResolution) + printer = Printer(mode=QPrinter.PrinterMode.HighResolution) fn = self.getFileName() if fn is not None: printer.setDocName(os.path.basename(fn)) @@ -2878,7 +2885,7 @@ @return create pixmap (QPixmap) """ pixmap = QPixmap(size, size) - pixmap.fill(Qt.transparent) + pixmap.fill(Qt.GlobalColor.transparent) painter = QPainter(pixmap) painter.fillRect(size - 4, 0, 4, size, Preferences.getEditorColour(key)) @@ -4371,8 +4378,10 @@ # set the line marker colours or pixmap if Preferences.getEditor("LineMarkersBackground"): - self.markerDefine(QsciScintilla.Background, self.currentline) - self.markerDefine(QsciScintilla.Background, self.errorline) + self.markerDefine(QsciScintilla.MarkerSymbol.Background, + self.currentline) + self.markerDefine(QsciScintilla.MarkerSymbol.Background, + self.errorline) self.__setLineMarkerColours() else: self.markerDefine( @@ -4549,7 +4558,8 @@ Preferences.getEditorColour("FoldMarkersBackground")) else: self.setMarginWidth(self.__foldMargin, 0) - self.setFolding(QsciScintilla.NoFoldStyle, self.__foldMargin) + self.setFolding(QsciScintilla.FoldStyle.NoFoldStyle, + self.__foldMargin) def __resizeLinenoMargin(self): """ @@ -4586,7 +4596,8 @@ self.setIndentationGuidesForegroundColor( Preferences.getEditorColour("IndentationGuidesForeground")) if Preferences.getEditor("ShowWhitespace"): - self.setWhitespaceVisibility(QsciScintilla.WsVisible) + self.setWhitespaceVisibility( + QsciScintilla.WhitespaceVisibility.WsVisible) try: self.setWhitespaceForegroundColor( Preferences.getEditorColour("WhitespaceForeground")) @@ -4598,13 +4609,14 @@ # QScintilla before 2.5 doesn't support this pass else: - self.setWhitespaceVisibility(QsciScintilla.WsInvisible) + self.setWhitespaceVisibility( + QsciScintilla.WhitespaceVisibility.WsInvisible) self.setEolVisibility(Preferences.getEditor("ShowEOL")) self.setAutoIndent(Preferences.getEditor("AutoIndentation")) if Preferences.getEditor("BraceHighlighting"): - self.setBraceMatching(QsciScintilla.SloppyBraceMatch) - else: - self.setBraceMatching(QsciScintilla.NoBraceMatch) + self.setBraceMatching(QsciScintilla.BraceMatch.SloppyBraceMatch) + else: + self.setBraceMatching(QsciScintilla.BraceMatch.NoBraceMatch) self.setMatchedBraceForegroundColor( Preferences.getEditorColour("MatchingBrace")) self.setMatchedBraceBackgroundColor( @@ -4618,7 +4630,7 @@ Preferences.getEditorColour("SelectionBackground")) else: self.setSelectionBackgroundColor( - QApplication.palette().color(QPalette.Highlight)) + QApplication.palette().color(QPalette.ColorRole.Highlight)) if Preferences.getEditor("ColourizeSelText"): self.resetSelectionForegroundColor() elif Preferences.getEditor("CustomSelectionColours"): @@ -4626,7 +4638,8 @@ Preferences.getEditorColour("SelectionForeground")) else: self.setSelectionForegroundColor( - QApplication.palette().color(QPalette.HighlightedText)) + QApplication.palette().color( + QPalette.ColorRole.HighlightedText)) self.setSelectionToEol(Preferences.getEditor("ExtendSelectionToEol")) self.setCaretForegroundColor( Preferences.getEditorColour("CaretForeground")) @@ -4682,9 +4695,11 @@ try: if Preferences.getEditor("AnnotationsEnabled"): - self.setAnnotationDisplay(QsciScintilla.AnnotationBoxed) + self.setAnnotationDisplay( + QsciScintilla.AnnotationDisplay.AnnotationBoxed) else: - self.setAnnotationDisplay(QsciScintilla.AnnotationHidden) + self.setAnnotationDisplay( + QsciScintilla.AnnotationDisplay.AnnotationHidden) except AttributeError: pass self.__setAnnotationStyles() @@ -4738,12 +4753,20 @@ self.setAutoCompletionShowSingle( Preferences.getEditor("AutoCompletionShowSingle")) autoCompletionSource = Preferences.getEditor("AutoCompletionSource") - if autoCompletionSource == QsciScintilla.AcsDocument: - self.setAutoCompletionSource(QsciScintilla.AcsDocument) - elif autoCompletionSource == QsciScintilla.AcsAPIs: - self.setAutoCompletionSource(QsciScintilla.AcsAPIs) - else: - self.setAutoCompletionSource(QsciScintilla.AcsAll) + if ( + autoCompletionSource == + QsciScintilla.AutoCompletionSource.AcsDocument + ): + self.setAutoCompletionSource( + QsciScintilla.AutoCompletionSource.AcsDocument) + elif ( + autoCompletionSource == QsciScintilla.AutoCompletionSource.AcsAPIs + ): + self.setAutoCompletionSource( + QsciScintilla.AutoCompletionSource.AcsAPIs) + else: + self.setAutoCompletionSource( + QsciScintilla.AutoCompletionSource.AcsAll) self.maxLines = Preferences.getEditor("AutoCompletionMaxLines") self.maxChars = Preferences.getEditor("AutoCompletionMaxChars") @@ -4767,17 +4790,21 @@ pass if Preferences.getEditor("CallTipsEnabled"): - if calltipsStyle == QsciScintilla.CallTipsNoContext: - self.setCallTipsStyle(QsciScintilla.CallTipsNoContext) + if calltipsStyle == QsciScintilla.CallTipsStyle.CallTipsNoContext: + self.setCallTipsStyle( + QsciScintilla.CallTipsStyle.CallTipsNoContext) elif ( - calltipsStyle == QsciScintilla.CallTipsNoAutoCompletionContext + calltipsStyle == + QsciScintilla.CallTipsStyle.CallTipsNoAutoCompletionContext ): self.setCallTipsStyle( - QsciScintilla.CallTipsNoAutoCompletionContext) + QsciScintilla.CallTipsStyle + .CallTipsNoAutoCompletionContext) else: - self.setCallTipsStyle(QsciScintilla.CallTipsContext) - else: - self.setCallTipsStyle(QsciScintilla.CallTipsNone) + self.setCallTipsStyle( + QsciScintilla.CallTipsStyle.CallTipsContext) + else: + self.setCallTipsStyle(QsciScintilla.CallTipsStyle.CallTipsNone) ########################################################################### ## Autocompletion handling methods below @@ -4801,11 +4828,11 @@ return acs = Preferences.getEditor("AutoCompletionSource") - if acs == QsciScintilla.AcsDocument: + if acs == QsciScintilla.AutoCompletionSource.AcsDocument: self.autoCompleteFromDocument() - elif acs == QsciScintilla.AcsAPIs: + elif acs == QsciScintilla.AutoCompletionSource.AcsAPIs: self.autoCompleteFromAPIs() - elif acs == QsciScintilla.AcsAll: + elif acs == QsciScintilla.AutoCompletionSource.AcsAll: self.autoCompleteFromAll() else: E5MessageBox.information( @@ -4825,12 +4852,21 @@ if enable: autoCompletionSource = Preferences.getEditor( "AutoCompletionSource") - if autoCompletionSource == QsciScintilla.AcsDocument: - self.setAutoCompletionSource(QsciScintilla.AcsDocument) - elif autoCompletionSource == QsciScintilla.AcsAPIs: - self.setAutoCompletionSource(QsciScintilla.AcsAPIs) + if ( + autoCompletionSource == + QsciScintilla.AutoCompletionSource.AcsDocument + ): + self.setAutoCompletionSource( + QsciScintilla.AutoCompletionSource.AcsDocument) + elif ( + autoCompletionSource == + QsciScintilla.AutoCompletionSource.AcsAPIs + ): + self.setAutoCompletionSource( + QsciScintilla.AutoCompletionSource.AcsAPIs) else: - self.setAutoCompletionSource(QsciScintilla.AcsAll) + self.setAutoCompletionSource( + QsciScintilla.AutoCompletionSource.AcsAll) def __toggleAutoCompletionEnable(self): """ @@ -4872,7 +4908,8 @@ self.__acTimer.stop() if ( - self.callTipsStyle() != QsciScintilla.CallTipsNone and + self.callTipsStyle() != + QsciScintilla.CallTipsStyle.CallTipsNone and self.lexer_ is not None and chr(charNumber) in '()' ): self.callTip() @@ -5007,7 +5044,10 @@ self.__autoComplete(auto, context) elif not auto: self.autoCompleteQScintilla() - elif self.autoCompletionSource() != QsciScintilla.AcsNone: + elif ( + self.autoCompletionSource() != + QsciScintilla.AutoCompletionSource.AcsNone + ): self.autoCompleteQScintilla() def __getAcText(self): @@ -5521,7 +5561,7 @@ self.menuActs["MonospacedFont"].setEnabled(self.lexer_ is None) splitOrientation = self.vm.getSplitOrientation() - if splitOrientation == Qt.Horizontal: + if splitOrientation == Qt.Orientation.Horizontal: self.menuActs["NewSplit"].setIcon( UI.PixmapCache.getIcon("splitHorizontal")) else: @@ -6907,7 +6947,7 @@ self, self.tr("Macro Recording"), self.tr("Enter name of the macro:"), - QLineEdit.Normal) + QLineEdit.EchoMode.Normal) if ok and name: self.macros[name] = self.curMacro @@ -7115,10 +7155,13 @@ @type QEvent """ if ( - evt.type() == QEvent.WindowStateChange and + evt.type() == QEvent.Type.WindowStateChange and bool(self.fileName) ): - if self.windowState() == Qt.WindowStates(Qt.WindowMinimized): + if ( + self.windowState() == Qt.WindowStates( + Qt.WindowState.WindowMinimized) + ): cap = os.path.basename(self.fileName) else: cap = self.fileName @@ -7157,7 +7200,7 @@ @type QWheelEvent """ delta = evt.angleDelta().y() - if evt.modifiers() & Qt.ControlModifier: + if evt.modifiers() & Qt.KeyboardModifier.ControlModifier: if delta < 0: self.zoomOut() elif delta > 0: @@ -7165,7 +7208,7 @@ evt.accept() return - if evt.modifiers() & Qt.ShiftModifier: + if evt.modifiers() & Qt.KeyboardModifier.ShiftModifier: if delta < 0: self.gotoMethodClass(False) elif delta > 0: @@ -7184,7 +7227,7 @@ @return flag indicating, if the event was handled @rtype bool """ - if evt.type() == QEvent.Gesture: + if evt.type() == QEvent.Type.Gesture: self.gestureEvent(evt) return True @@ -7197,12 +7240,12 @@ @param evt reference to the gesture event @type QGestureEvent """ - pinch = evt.gesture(Qt.PinchGesture) + pinch = evt.gesture(Qt.GestureType.PinchGesture) if pinch: - if pinch.state() == Qt.GestureStarted: + if pinch.state() == Qt.GestureState.GestureStarted: zoom = (self.getZoom() + 10) / 10.0 pinch.setTotalScaleFactor(zoom) - elif pinch.state() == Qt.GestureUpdated: + elif pinch.state() == Qt.GestureState.GestureUpdated: zoom = int(pinch.totalScaleFactor() * 10) - 10 if zoom <= -9: zoom = -9 @@ -7505,7 +7548,7 @@ self, self.tr("Add aliased file resource"), self.tr("Alias for file <b>{0}</b>:").format(relFile), - QLineEdit.Normal, + QLineEdit.EchoMode.Normal, relFile) if ok and alias: line, index = self.getCursorPosition() @@ -7520,7 +7563,7 @@ """ from Project.AddLanguageDialog import AddLanguageDialog dlg = AddLanguageDialog(self) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: lang = dlg.getSelectedLanguage() line, index = self.getCursorPosition() self.insert('<qresource lang="{0}">\n</qresource>\n'.format(lang)) @@ -7820,7 +7863,7 @@ if Preferences.getEditor("AutoSpellCheckingEnabled"): try: self.SCN_CHARADDED.connect( - self.__spellCharAdded, Qt.UniqueConnection) + self.__spellCharAdded, Qt.ConnectionType.UniqueConnection) except TypeError: pass self.spell.checkDocumentIncrementally() @@ -8051,7 +8094,7 @@ hashStr = str( QCryptographicHash.hash( Utilities.encode(self.__savedText, self.encoding)[0], - QCryptographicHash.Sha1).toHex(), + QCryptographicHash.Algorithm.Sha1).toHex(), encoding="utf-8") self.__send(Editor.StartEditToken, hashStr) @@ -8148,7 +8191,7 @@ hashStr = str( QCryptographicHash.hash( Utilities.encode(self.text(), self.encoding)[0], - QCryptographicHash.Sha1).toHex(), + QCryptographicHash.Algorithm.Sha1).toHex(), encoding="utf-8") if hashStr != argsString: # text is different to the remote site, request to sync it @@ -8231,7 +8274,7 @@ hashStr = str( QCryptographicHash.hash( Utilities.encode(self.__savedText, self.encoding)[0], - QCryptographicHash.Sha1).toHex(), + QCryptographicHash.Algorithm.Sha1).toHex(), encoding="utf-8") if hashStr == argsString: @@ -8331,7 +8374,7 @@ from .SortOptionsDialog import SortOptionsDialog dlg = SortOptionsDialog() - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: ascending, alnum, caseSensitive = dlg.getData() origStartLine, origStartIndex, origEndLine, origEndIndex = ( self.getRectangularSelection() @@ -8417,7 +8460,7 @@ super(Editor, self).mouseReleaseEvent(evt) if ( - button != Qt.NoButton and + button != Qt.MouseButton.NoButton and Preferences.getEditor("MouseClickHandlersEnabled") and key in self.__mouseClickHandlers ): @@ -8609,11 +8652,11 @@ if option == "EOLMode": value = config["end_of_line"] if value == "lf": - value = QsciScintilla.EolUnix + value = QsciScintilla.EolMode.EolUnix elif value == "crlf": - value = QsciScintilla.EolWindows + value = QsciScintilla.EolMode.EolWindows elif value == "cr": - value = QsciScintilla.EolMac + value = QsciScintilla.EolMode.EolMac else: value = None elif option == "DefaultEncoding":
--- a/eric6/QScintilla/EditorButtonsWidget.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/QScintilla/EditorButtonsWidget.py Tue Mar 02 17:17:09 2021 +0100 @@ -60,27 +60,29 @@ self.__outerLayout = QVBoxLayout(self) self.__outerLayout.setContentsMargins(margin, margin, margin, margin) self.__outerLayout.setSpacing(spacing) - self.__outerLayout.setAlignment(Qt.AlignHCenter) + self.__outerLayout.setAlignment(Qt.AlignmentFlag.AlignHCenter) self.__upButton = QToolButton(self) - self.__upButton.setArrowType(Qt.UpArrow) + self.__upButton.setArrowType(Qt.ArrowType.UpArrow) self.__upButton.setSizePolicy( - QSizePolicy.MinimumExpanding, QSizePolicy.Minimum) + QSizePolicy.Policy.MinimumExpanding, QSizePolicy.Policy.Minimum) self.__upButton.setAutoRepeat(True) self.__scroller = QScrollArea(self) self.__scroller.setWidget(self.__buttonsWidget) self.__scroller.setSizePolicy( - QSizePolicy.Minimum, QSizePolicy.Expanding) - self.__scroller.setFrameShape(QFrame.NoFrame) - self.__scroller.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) - self.__scroller.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) + QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding) + self.__scroller.setFrameShape(QFrame.Shape.NoFrame) + self.__scroller.setVerticalScrollBarPolicy( + Qt.ScrollBarPolicy.ScrollBarAlwaysOff) + self.__scroller.setHorizontalScrollBarPolicy( + Qt.ScrollBarPolicy.ScrollBarAlwaysOff) self.__scroller.setWidgetResizable(False) self.__downButton = QToolButton(self) - self.__downButton.setArrowType(Qt.DownArrow) + self.__downButton.setArrowType(Qt.ArrowType.DownArrow) self.__downButton.setSizePolicy( - QSizePolicy.MinimumExpanding, QSizePolicy.Minimum) + QSizePolicy.Policy.MinimumExpanding, QSizePolicy.Policy.Minimum) self.__downButton.setAutoRepeat(True) self.__outerLayout.addWidget(self.__upButton) @@ -186,7 +188,7 @@ self.tr("Header 3")) button = self.__addButton("header", "formatTextHeader", self.tr("Header")) - button.setPopupMode(QToolButton.InstantPopup) + button.setPopupMode(QToolButton.ToolButtonPopupMode.InstantPopup) button.setMenu(self.__headerMenu) self.__addSeparator() self.__addButton("code", "formatTextInlineCode", @@ -239,10 +241,10 @@ line = QFrame(self.__buttonsWidget) line.setLineWidth(2) if isinstance(self.__layout, QVBoxLayout): - line.setFrameShape(QFrame.HLine) + line.setFrameShape(QFrame.Shape.HLine) else: - line.setFrameShape(QFrame.VLine) - line.setFrameShadow(QFrame.Sunken) + line.setFrameShape(QFrame.Shape.VLine) + line.setFrameShadow(QFrame.Shadow.Sunken) self.__layout.addWidget(line) self.__separators.append(line)
--- a/eric6/QScintilla/EditorOutline.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/QScintilla/EditorOutline.py Tue Mar 02 17:17:09 2021 +0100 @@ -48,17 +48,18 @@ self.setAlternatingRowColors(True) header = self.header() - header.setSortIndicator(0, Qt.AscendingOrder) + header.setSortIndicator(0, Qt.SortOrder.AscendingOrder) header.setSortIndicatorShown(True) header.setSectionsClickable(True) self.setHeaderHidden(True) self.setSortingEnabled(True) - self.setSelectionMode(QAbstractItemView.SingleSelection) - self.setSelectionBehavior(QAbstractItemView.SelectRows) + self.setSelectionMode(QAbstractItemView.SelectionMode.SingleSelection) + self.setSelectionBehavior( + QAbstractItemView.SelectionBehavior.SelectRows) - self.setContextMenuPolicy(Qt.CustomContextMenu) + self.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu) self.customContextMenuRequested.connect(self.__contextMenuRequested) self.__createPopupMenus()
--- a/eric6/QScintilla/KeySequenceTranslator.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/QScintilla/KeySequenceTranslator.py Tue Mar 02 17:17:09 2021 +0100 @@ -14,98 +14,112 @@ __all__ = ["s2qTranslate"] Scintilla2QKeySequence = { - QsciScintilla.SCI_CHARLEFT: QKeySequence.MoveToPreviousChar, - QsciScintilla.SCI_CHARRIGHT: QKeySequence.MoveToNextChar, - QsciScintilla.SCI_LINEUP: QKeySequence.MoveToPreviousLine, - QsciScintilla.SCI_LINEDOWN: QKeySequence.MoveToNextLine, - QsciScintilla.SCI_WORDPARTLEFT: QKeySequence.UnknownKey, - QsciScintilla.SCI_WORDPARTRIGHT: QKeySequence.UnknownKey, - QsciScintilla.SCI_WORDLEFT: QKeySequence.MoveToNextWord, - QsciScintilla.SCI_WORDRIGHT: QKeySequence.MoveToPreviousWord, - QsciScintilla.SCI_VCHOME: QKeySequence.MoveToStartOfLine, - QsciScintilla.SCI_HOMEDISPLAY: QKeySequence.UnknownKey, - QsciScintilla.SCI_LINEEND: QKeySequence.MoveToEndOfLine, - QsciScintilla.SCI_LINESCROLLDOWN: QKeySequence.UnknownKey, - QsciScintilla.SCI_LINESCROLLUP: QKeySequence.UnknownKey, - QsciScintilla.SCI_PARAUP: QKeySequence.MoveToStartOfBlock, - QsciScintilla.SCI_PARADOWN: QKeySequence.MoveToEndOfBlock, - QsciScintilla.SCI_PAGEUP: QKeySequence.MoveToPreviousPage, - QsciScintilla.SCI_PAGEDOWN: QKeySequence.MoveToNextPage, - QsciScintilla.SCI_DOCUMENTSTART: QKeySequence.MoveToStartOfDocument, - QsciScintilla.SCI_DOCUMENTEND: QKeySequence.MoveToEndOfDocument, - QsciScintilla.SCI_TAB: QKeySequence.UnknownKey, - QsciScintilla.SCI_BACKTAB: QKeySequence.UnknownKey, - QsciScintilla.SCI_CHARLEFTEXTEND: QKeySequence.SelectPreviousChar, - QsciScintilla.SCI_CHARRIGHTEXTEND: QKeySequence.SelectNextChar, - QsciScintilla.SCI_LINEUPEXTEND: QKeySequence.SelectPreviousLine, - QsciScintilla.SCI_LINEDOWNEXTEND: QKeySequence.SelectNextLine, - QsciScintilla.SCI_WORDPARTLEFTEXTEND: QKeySequence.UnknownKey, - QsciScintilla.SCI_WORDPARTRIGHTEXTEND: QKeySequence.UnknownKey, - QsciScintilla.SCI_WORDLEFTEXTEND: QKeySequence.SelectPreviousWord, - QsciScintilla.SCI_WORDRIGHTEXTEND: QKeySequence.SelectNextWord, - QsciScintilla.SCI_VCHOMEEXTEND: QKeySequence.SelectStartOfLine, - QsciScintilla.SCI_LINEENDEXTEND: QKeySequence.SelectEndOfLine, - QsciScintilla.SCI_PARAUPEXTEND: QKeySequence.SelectStartOfBlock, - QsciScintilla.SCI_PARADOWNEXTEND: QKeySequence.SelectEndOfBlock, - QsciScintilla.SCI_PAGEUPEXTEND: QKeySequence.SelectPreviousPage, - QsciScintilla.SCI_PAGEDOWNEXTEND: QKeySequence.SelectNextPage, - QsciScintilla.SCI_DOCUMENTSTARTEXTEND: QKeySequence.SelectStartOfDocument, - QsciScintilla.SCI_DOCUMENTENDEXTEND: QKeySequence.SelectEndOfDocument, - QsciScintilla.SCI_DELETEBACK: QKeySequence.UnknownKey, - QsciScintilla.SCI_DELETEBACKNOTLINE: QKeySequence.UnknownKey, - QsciScintilla.SCI_CLEAR: QKeySequence.Delete, - QsciScintilla.SCI_DELWORDLEFT: QKeySequence.DeleteStartOfWord, - QsciScintilla.SCI_DELWORDRIGHT: QKeySequence.DeleteEndOfWord, - QsciScintilla.SCI_DELLINELEFT: QKeySequence.UnknownKey, - QsciScintilla.SCI_DELLINERIGHT: QKeySequence.DeleteEndOfLine, - QsciScintilla.SCI_NEWLINE: QKeySequence.InsertLineSeparator, - QsciScintilla.SCI_LINEDELETE: QKeySequence.UnknownKey, - QsciScintilla.SCI_LINEDUPLICATE: QKeySequence.UnknownKey, - QsciScintilla.SCI_LINETRANSPOSE: QKeySequence.UnknownKey, - QsciScintilla.SCI_LINECUT: QKeySequence.UnknownKey, - QsciScintilla.SCI_LINECOPY: QKeySequence.UnknownKey, - QsciScintilla.SCI_EDITTOGGLEOVERTYPE: QKeySequence.UnknownKey, - QsciScintilla.SCI_LINEENDDISPLAY: QKeySequence.UnknownKey, - QsciScintilla.SCI_LINEENDDISPLAYEXTEND: QKeySequence.UnknownKey, - QsciScintilla.SCI_FORMFEED: QKeySequence.UnknownKey, - QsciScintilla.SCI_CANCEL: QKeySequence.UnknownKey, - QsciScintilla.SCI_LINEDOWNRECTEXTEND: QKeySequence.UnknownKey, - QsciScintilla.SCI_LINEUPRECTEXTEND: QKeySequence.UnknownKey, - QsciScintilla.SCI_CHARLEFTRECTEXTEND: QKeySequence.UnknownKey, - QsciScintilla.SCI_CHARRIGHTRECTEXTEND: QKeySequence.UnknownKey, - QsciScintilla.SCI_VCHOMERECTEXTEND: QKeySequence.UnknownKey, - QsciScintilla.SCI_LINEENDRECTEXTEND: QKeySequence.UnknownKey, - QsciScintilla.SCI_PAGEUPRECTEXTEND: QKeySequence.UnknownKey, - QsciScintilla.SCI_PAGEDOWNRECTEXTEND: QKeySequence.UnknownKey, - QsciScintilla.SCI_SELECTIONDUPLICATE: QKeySequence.UnknownKey, - QsciScintilla.SCI_SCROLLTOSTART: QKeySequence.UnknownKey, - QsciScintilla.SCI_SCROLLTOEND: QKeySequence.UnknownKey, - QsciScintilla.SCI_VERTICALCENTRECARET: QKeySequence.UnknownKey, - QsciScintilla.SCI_WORDRIGHTEND: QKeySequence.UnknownKey, - QsciScintilla.SCI_WORDRIGHTENDEXTEND: QKeySequence.UnknownKey, - QsciScintilla.SCI_WORDLEFTEND: QKeySequence.UnknownKey, - QsciScintilla.SCI_WORDLEFTENDEXTEND: QKeySequence.UnknownKey, - QsciScintilla.SCI_HOME: QKeySequence.UnknownKey, - QsciScintilla.SCI_HOMEEXTEND: QKeySequence.UnknownKey, - QsciScintilla.SCI_HOMERECTEXTEND: QKeySequence.UnknownKey, - QsciScintilla.SCI_HOMEDISPLAYEXTEND: QKeySequence.UnknownKey, - QsciScintilla.SCI_HOMEWRAP: QKeySequence.UnknownKey, - QsciScintilla.SCI_HOMEWRAPEXTEND: QKeySequence.UnknownKey, - QsciScintilla.SCI_VCHOMEWRAP: QKeySequence.UnknownKey, - QsciScintilla.SCI_VCHOMEWRAPEXTEND: QKeySequence.UnknownKey, - QsciScintilla.SCI_LINEENDWRAP: QKeySequence.UnknownKey, - QsciScintilla.SCI_LINEENDWRAPEXTEND: QKeySequence.UnknownKey, - QsciScintilla.SCI_STUTTEREDPAGEUP: QKeySequence.UnknownKey, - QsciScintilla.SCI_STUTTEREDPAGEUPEXTEND: QKeySequence.UnknownKey, - QsciScintilla.SCI_STUTTEREDPAGEDOWN: QKeySequence.UnknownKey, - QsciScintilla.SCI_STUTTEREDPAGEDOWNEXTEND: QKeySequence.UnknownKey, - QsciScintilla.SCI_DELWORDRIGHTEND: QKeySequence.UnknownKey, - QsciScintilla.SCI_MOVESELECTEDLINESUP: QKeySequence.UnknownKey, - QsciScintilla.SCI_MOVESELECTEDLINESDOWN: QKeySequence.UnknownKey, - QsciScintilla.SCI_LOWERCASE: QKeySequence.UnknownKey, - QsciScintilla.SCI_UPPERCASE: QKeySequence.UnknownKey, - QsciScintilla.SCI_LINEDELETE: QKeySequence.DeleteCompleteLine, - QsciScintilla.SCI_DELETEBACK: QKeySequence.Backspace, + QsciScintilla.SCI_CHARLEFT: QKeySequence.StandardKey.MoveToPreviousChar, + QsciScintilla.SCI_CHARRIGHT: QKeySequence.StandardKey.MoveToNextChar, + QsciScintilla.SCI_LINEUP: QKeySequence.StandardKey.MoveToPreviousLine, + QsciScintilla.SCI_LINEDOWN: QKeySequence.StandardKey.MoveToNextLine, + QsciScintilla.SCI_WORDPARTLEFT: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_WORDPARTRIGHT: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_WORDLEFT: QKeySequence.StandardKey.MoveToNextWord, + QsciScintilla.SCI_WORDRIGHT: QKeySequence.StandardKey.MoveToPreviousWord, + QsciScintilla.SCI_VCHOME: QKeySequence.StandardKey.MoveToStartOfLine, + QsciScintilla.SCI_HOMEDISPLAY: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_LINEEND: QKeySequence.StandardKey.MoveToEndOfLine, + QsciScintilla.SCI_LINESCROLLDOWN: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_LINESCROLLUP: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_PARAUP: QKeySequence.StandardKey.MoveToStartOfBlock, + QsciScintilla.SCI_PARADOWN: QKeySequence.StandardKey.MoveToEndOfBlock, + QsciScintilla.SCI_PAGEUP: QKeySequence.StandardKey.MoveToPreviousPage, + QsciScintilla.SCI_PAGEDOWN: QKeySequence.StandardKey.MoveToNextPage, + QsciScintilla.SCI_DOCUMENTSTART: + QKeySequence.StandardKey.MoveToStartOfDocument, + QsciScintilla.SCI_DOCUMENTEND: + QKeySequence.StandardKey.MoveToEndOfDocument, + QsciScintilla.SCI_TAB: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_BACKTAB: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_CHARLEFTEXTEND: + QKeySequence.StandardKey.SelectPreviousChar, + QsciScintilla.SCI_CHARRIGHTEXTEND: QKeySequence.StandardKey.SelectNextChar, + QsciScintilla.SCI_LINEUPEXTEND: + QKeySequence.StandardKey.SelectPreviousLine, + QsciScintilla.SCI_LINEDOWNEXTEND: QKeySequence.StandardKey.SelectNextLine, + QsciScintilla.SCI_WORDPARTLEFTEXTEND: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_WORDPARTRIGHTEXTEND: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_WORDLEFTEXTEND: + QKeySequence.StandardKey.SelectPreviousWord, + QsciScintilla.SCI_WORDRIGHTEXTEND: QKeySequence.StandardKey.SelectNextWord, + QsciScintilla.SCI_VCHOMEEXTEND: QKeySequence.StandardKey.SelectStartOfLine, + QsciScintilla.SCI_LINEENDEXTEND: QKeySequence.StandardKey.SelectEndOfLine, + QsciScintilla.SCI_PARAUPEXTEND: + QKeySequence.StandardKey.SelectStartOfBlock, + QsciScintilla.SCI_PARADOWNEXTEND: + QKeySequence.StandardKey.SelectEndOfBlock, + QsciScintilla.SCI_PAGEUPEXTEND: + QKeySequence.StandardKey.SelectPreviousPage, + QsciScintilla.SCI_PAGEDOWNEXTEND: QKeySequence.StandardKey.SelectNextPage, + QsciScintilla.SCI_DOCUMENTSTARTEXTEND: + QKeySequence.StandardKey.SelectStartOfDocument, + QsciScintilla.SCI_DOCUMENTENDEXTEND: + QKeySequence.StandardKey.SelectEndOfDocument, + QsciScintilla.SCI_DELETEBACK: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_DELETEBACKNOTLINE: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_CLEAR: QKeySequence.StandardKey.Delete, + QsciScintilla.SCI_DELWORDLEFT: QKeySequence.StandardKey.DeleteStartOfWord, + QsciScintilla.SCI_DELWORDRIGHT: QKeySequence.StandardKey.DeleteEndOfWord, + QsciScintilla.SCI_DELLINELEFT: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_DELLINERIGHT: QKeySequence.StandardKey.DeleteEndOfLine, + QsciScintilla.SCI_NEWLINE: QKeySequence.StandardKey.InsertLineSeparator, + QsciScintilla.SCI_LINEDELETE: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_LINEDUPLICATE: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_LINETRANSPOSE: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_LINECUT: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_LINECOPY: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_EDITTOGGLEOVERTYPE: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_LINEENDDISPLAY: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_LINEENDDISPLAYEXTEND: + QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_FORMFEED: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_CANCEL: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_LINEDOWNRECTEXTEND: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_LINEUPRECTEXTEND: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_CHARLEFTRECTEXTEND: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_CHARRIGHTRECTEXTEND: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_VCHOMERECTEXTEND: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_LINEENDRECTEXTEND: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_PAGEUPRECTEXTEND: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_PAGEDOWNRECTEXTEND: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_SELECTIONDUPLICATE: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_SCROLLTOSTART: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_SCROLLTOEND: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_VERTICALCENTRECARET: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_WORDRIGHTEND: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_WORDRIGHTENDEXTEND: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_WORDLEFTEND: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_WORDLEFTENDEXTEND: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_HOME: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_HOMEEXTEND: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_HOMERECTEXTEND: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_HOMEDISPLAYEXTEND: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_HOMEWRAP: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_HOMEWRAPEXTEND: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_VCHOMEWRAP: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_VCHOMEWRAPEXTEND: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_LINEENDWRAP: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_LINEENDWRAPEXTEND: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_STUTTEREDPAGEUP: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_STUTTEREDPAGEUPEXTEND: + QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_STUTTEREDPAGEDOWN: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_STUTTEREDPAGEDOWNEXTEND: + QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_DELWORDRIGHTEND: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_MOVESELECTEDLINESUP: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_MOVESELECTEDLINESDOWN: + QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_LOWERCASE: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_UPPERCASE: QKeySequence.StandardKey.UnknownKey, + QsciScintilla.SCI_LINEDELETE: QKeySequence.StandardKey.DeleteCompleteLine, + QsciScintilla.SCI_DELETEBACK: QKeySequence.StandardKey.Backspace, }
--- a/eric6/QScintilla/MarkupProviders/HtmlProvider.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/QScintilla/MarkupProviders/HtmlProvider.py Tue Mar 02 17:17:09 2021 +0100 @@ -214,7 +214,7 @@ from .HyperlinkMarkupDialog import HyperlinkMarkupDialog dlg = HyperlinkMarkupDialog(True, False) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: text, target, title = dlg.getData() if not text: text = target @@ -296,7 +296,7 @@ from .ImageMarkupDialog import ImageMarkupDialog dlg = ImageMarkupDialog(ImageMarkupDialog.HtmlMode) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: address, altText, title, originalSize, width, height = ( dlg.getData() )
--- a/eric6/QScintilla/MarkupProviders/HyperlinkMarkupDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/QScintilla/MarkupProviders/HyperlinkMarkupDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -50,7 +50,7 @@ """ Private method to update the state of the OK button. """ - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( + self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( (bool(self.textEdit.text()) or self.__allowEmptyText) and (bool(self.targetEdit.text()) or self.__allowEmptyTarget) )
--- a/eric6/QScintilla/MarkupProviders/ImageMarkupDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/QScintilla/MarkupProviders/ImageMarkupDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -107,7 +107,8 @@ if self.__mode == ImageMarkupDialog.MarkDownMode: enable = enable and bool(self.altTextEdit.text()) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enable) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(enable) @pyqtSlot(str) def on_imagePicker_textChanged(self, address):
--- a/eric6/QScintilla/MarkupProviders/MarkdownProvider.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/QScintilla/MarkupProviders/MarkdownProvider.py Tue Mar 02 17:17:09 2021 +0100 @@ -209,7 +209,7 @@ from .HyperlinkMarkupDialog import HyperlinkMarkupDialog dlg = HyperlinkMarkupDialog(False, True) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: text, target, title = dlg.getData() link = "[{0}]".format(text) @@ -300,7 +300,7 @@ from .ImageMarkupDialog import ImageMarkupDialog dlg = ImageMarkupDialog(ImageMarkupDialog.MarkDownMode) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: address, altText, title, originalSize, width, height = ( dlg.getData() )
--- a/eric6/QScintilla/MarkupProviders/RestructuredTextProvider.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/QScintilla/MarkupProviders/RestructuredTextProvider.py Tue Mar 02 17:17:09 2021 +0100 @@ -206,7 +206,7 @@ from .HyperlinkMarkupDialog import HyperlinkMarkupDialog dlg = HyperlinkMarkupDialog(False, True, noTitle=True) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: text, target, _ = dlg.getData() link1 = "`{0}`_".format(text) @@ -322,7 +322,7 @@ from .ImageMarkupDialog import ImageMarkupDialog dlg = ImageMarkupDialog(ImageMarkupDialog.RestMode) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: address, altText, title, originalSize, width, height = ( dlg.getData() )
--- a/eric6/QScintilla/MiniEditor.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/QScintilla/MiniEditor.py Tue Mar 02 17:17:09 2021 +0100 @@ -294,7 +294,8 @@ self.__cursorPositionChanged) self.__textEdit.linesChanged.connect(self.__resizeLinenoMargin) - self.__textEdit.setContextMenuPolicy(Qt.CustomContextMenu) + self.__textEdit.setContextMenuPolicy( + Qt.ContextMenuPolicy.CustomContextMenu) self.__textEdit.customContextMenuRequested.connect( self.__contextMenuRequested) @@ -2853,7 +2854,7 @@ Preferences.getEditorColour("FoldMarkersForeground"), Preferences.getEditorColour("FoldMarkersBackground")) else: - self.__textEdit.setFolding(QsciScintilla.NoFoldStyle) + self.__textEdit.setFolding(QsciScintilla.FoldStyle.NoFoldStyle) def __resizeLinenoMargin(self): """ @@ -2893,7 +2894,8 @@ self.__textEdit.setIndentationGuidesForegroundColor( Preferences.getEditorColour("IndentationGuidesForeground")) if Preferences.getEditor("ShowWhitespace"): - self.__textEdit.setWhitespaceVisibility(QsciScintilla.WsVisible) + self.__textEdit.setWhitespaceVisibility( + QsciScintilla.WhitespaceVisibility.WsVisible) self.__textEdit.setWhitespaceForegroundColor( Preferences.getEditorColour("WhitespaceForeground")) self.__textEdit.setWhitespaceBackgroundColor( @@ -2901,13 +2903,16 @@ self.__textEdit.setWhitespaceSize( Preferences.getEditor("WhitespaceSize")) else: - self.__textEdit.setWhitespaceVisibility(QsciScintilla.WsInvisible) + self.__textEdit.setWhitespaceVisibility( + QsciScintilla.WhitespaceVisibility.WsInvisible) self.__textEdit.setEolVisibility(Preferences.getEditor("ShowEOL")) self.__textEdit.setAutoIndent(Preferences.getEditor("AutoIndentation")) if Preferences.getEditor("BraceHighlighting"): - self.__textEdit.setBraceMatching(QsciScintilla.SloppyBraceMatch) + self.__textEdit.setBraceMatching( + QsciScintilla.BraceMatch.SloppyBraceMatch) else: - self.__textEdit.setBraceMatching(QsciScintilla.NoBraceMatch) + self.__textEdit.setBraceMatching( + QsciScintilla.BraceMatch.NoBraceMatch) self.__textEdit.setMatchedBraceForegroundColor( Preferences.getEditorColour("MatchingBrace")) self.__textEdit.setMatchedBraceBackgroundColor( @@ -2921,7 +2926,7 @@ Preferences.getEditorColour("SelectionBackground")) else: self.__textEdit.setSelectionBackgroundColor( - QApplication.palette().color(QPalette.Highlight)) + QApplication.palette().color(QPalette.ColorRole.Highlight)) if Preferences.getEditor("ColourizeSelText"): self.__textEdit.resetSelectionForegroundColor() elif Preferences.getEditor("CustomSelectionColours"): @@ -2929,7 +2934,8 @@ Preferences.getEditorColour("SelectionForeground")) else: self.__textEdit.setSelectionForegroundColor( - QApplication.palette().color(QPalette.HighlightedText)) + QApplication.palette().color( + QPalette.ColorRole.HighlightedText)) self.__textEdit.setSelectionToEol( Preferences.getEditor("ExtendSelectionToEol")) self.__textEdit.setCaretForegroundColor( @@ -3009,19 +3015,24 @@ Private slot to print the text. """ from .Printer import Printer - printer = Printer(mode=QPrinter.HighResolution) + printer = Printer(mode=QPrinter.PrinterMode.HighResolution) sb = self.statusBar() printDialog = QPrintDialog(printer, self) if self.__textEdit.hasSelectedText(): - printDialog.setOption(QAbstractPrintDialog.PrintSelection, True) - if printDialog.exec() == QDialog.Accepted: + printDialog.setOption( + QAbstractPrintDialog.PrintDialogOption.PrintSelection, + True) + if printDialog.exec() == QDialog.DialogCode.Accepted: sb.showMessage(self.tr('Printing...')) QApplication.processEvents() if self.__curFile: printer.setDocName(QFileInfo(self.__curFile).fileName()) else: printer.setDocName(self.tr("Untitled")) - if printDialog.printRange() == QAbstractPrintDialog.Selection: + if ( + printDialog.printRange() == + QAbstractPrintDialog.PrintRange.Selection + ): # get the selection fromLine, fromIndex, toLine, toIndex = ( self.__textEdit.getSelection() @@ -3048,7 +3059,7 @@ from PyQt5.QtPrintSupport import QPrintPreviewDialog from .Printer import Printer - printer = Printer(mode=QPrinter.HighResolution) + printer = Printer(mode=QPrinter.PrinterMode.HighResolution) if self.__curFile: printer.setDocName(QFileInfo(self.__curFile).fileName()) else: @@ -3741,11 +3752,11 @@ if option == "EOLMode": value = config["end_of_line"] if value == "lf": - value = QsciScintilla.EolUnix + value = QsciScintilla.EolMode.EolUnix elif value == "crlf": - value = QsciScintilla.EolWindows + value = QsciScintilla.EolMode.EolWindows elif value == "cr": - value = QsciScintilla.EolMac + value = QsciScintilla.EolMode.EolMac else: value = None elif option == "DefaultEncoding": @@ -3850,7 +3861,7 @@ """ from QScintilla.ZoomDialog import ZoomDialog dlg = ZoomDialog(self.getZoom(), self, None, True) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: value = dlg.getZoomSize() self.__zoomTo(value)
--- a/eric6/QScintilla/Printer.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/QScintilla/Printer.py Tue Mar 02 17:17:09 2021 +0100 @@ -19,7 +19,7 @@ """ Class implementing the QsciPrinter with a header. """ - def __init__(self, mode=QPrinter.ScreenResolution): + def __init__(self, mode=QPrinter.PrinterMode.ScreenResolution): """ Constructor @@ -29,25 +29,25 @@ self.setMagnification(Preferences.getPrinter("Magnification")) if Preferences.getPrinter("ColorMode"): - self.setColorMode(QPrinter.Color) + self.setColorMode(QPrinter.ColorMode.Color) else: - self.setColorMode(QPrinter.GrayScale) + self.setColorMode(QPrinter.ColorMode.GrayScale) if Preferences.getPrinter("FirstPageFirst"): - self.setPageOrder(QPrinter.FirstPageFirst) + self.setPageOrder(QPrinter.PageOrder.FirstPageFirst) else: - self.setPageOrder(QPrinter.LastPageFirst) + self.setPageOrder(QPrinter.PageOrder.LastPageFirst) self.setPageMargins( Preferences.getPrinter("LeftMargin") * 10, Preferences.getPrinter("TopMargin") * 10, Preferences.getPrinter("RightMargin") * 10, Preferences.getPrinter("BottomMargin") * 10, - QPrinter.Millimeter + QPrinter.Unit.Millimeter ) printerName = Preferences.getPrinter("PrinterName") if printerName: self.setPrinterName(printerName) - self.time = QTime.currentTime().toString(Qt.LocalDate) - self.date = QDate.currentDate().toString(Qt.LocalDate) + self.time = QTime.currentTime().toString(Qt.DateFormat.LocalDate) + self.date = QDate.currentDate().toString(Qt.DateFormat.LocalDate) self.headerFont = Preferences.getPrinter("HeaderFont") def formatPage(self, painter, drawing, area, pagenr): @@ -67,7 +67,7 @@ painter.save() painter.setFont(self.headerFont) # set our header font - painter.setPen(QColor(Qt.black)) # set color + painter.setPen(QColor(Qt.GlobalColor.black)) # set color if drawing: fm = painter.fontMetrics() try:
--- a/eric6/QScintilla/QsciScintillaCompat.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/QScintilla/QsciScintillaCompat.py Tue Mar 02 17:17:09 2021 +0100 @@ -41,7 +41,7 @@ """ zoomValueChanged = pyqtSignal(int) - ArrowFoldStyle = QsciScintilla.BoxedTreeFoldStyle + 1 + ArrowFoldStyle = QsciScintilla.FoldStyle.BoxedTreeFoldStyle + 1 ArrowTreeFoldStyle = ArrowFoldStyle + 1 UserSeparator = '\x04' @@ -118,10 +118,10 @@ palette = QApplication.palette() self.SendScintilla(QsciScintilla.SCI_STYLESETFORE, QsciScintilla.STYLE_DEFAULT, - palette.color(QPalette.Text)) + palette.color(QPalette.ColorRole.Text)) self.SendScintilla(QsciScintilla.SCI_STYLESETBACK, QsciScintilla.STYLE_DEFAULT, - palette.color(QPalette.Base)) + palette.color(QPalette.ColorRole.Base)) self.SendScintilla(QsciScintilla.SCI_STYLECLEARALL) self.SendScintilla(QsciScintilla.SCI_CLEARDOCUMENTSTYLE) @@ -653,11 +653,11 @@ @return eol string (string) """ m = self.eolMode() - if m == QsciScintilla.EolWindows: + if m == QsciScintilla.EolMode.EolWindows: eol = '\r\n' - elif m == QsciScintilla.EolUnix: + elif m == QsciScintilla.EolMode.EolUnix: eol = '\n' - elif m == QsciScintilla.EolMac: + elif m == QsciScintilla.EolMode.EolMac: eol = '\r' else: eol = '' @@ -670,11 +670,11 @@ @return eol indicator (string) """ m = self.eolMode() - if m == QsciScintilla.EolWindows: + if m == QsciScintilla.EolMode.EolWindows: eol = 'CRLF' - elif m == QsciScintilla.EolUnix: + elif m == QsciScintilla.EolMode.EolUnix: eol = 'LF' - elif m == QsciScintilla.EolMac: + elif m == QsciScintilla.EolMode.EolMac: eol = 'CR' else: eol = '' @@ -687,11 +687,14 @@ @param eolStr eol string (string) """ if eolStr == '\r\n': - self.setEolMode(QsciScintilla.EolMode(QsciScintilla.EolWindows)) + self.setEolMode( + QsciScintilla.EolMode(QsciScintilla.EolMode.EolWindows)) elif eolStr == '\n': - self.setEolMode(QsciScintilla.EolMode(QsciScintilla.EolUnix)) + self.setEolMode( + QsciScintilla.EolMode(QsciScintilla.EolMode.EolUnix)) elif eolStr == '\r': - self.setEolMode(QsciScintilla.EolMode(QsciScintilla.EolMac)) + self.setEolMode( + QsciScintilla.EolMode(QsciScintilla.EolMode.EolMac)) def detectEolString(self, txt): """ @@ -1294,9 +1297,9 @@ if mark != QsciScintilla.SC_MARK_EMPTY: self.SendScintilla(QsciScintilla.SCI_MARKERSETFORE, - marknr, QColor(Qt.white)) + marknr, QColor(Qt.GlobalColor.white)) self.SendScintilla(QsciScintilla.SCI_MARKERSETBACK, - marknr, QColor(Qt.black)) + marknr, QColor(Qt.GlobalColor.black)) def setFolding(self, style, margin=2): """ @@ -1309,7 +1312,7 @@ super(QsciScintillaCompat, self).setFolding(style, margin) else: super(QsciScintillaCompat, self).setFolding( - QsciScintilla.PlainFoldStyle, margin) + QsciScintilla.FoldStyle.PlainFoldStyle, margin) if style == self.ArrowFoldStyle: self.__setFoldMarker(QsciScintilla.SC_MARKNUM_FOLDER, @@ -1436,8 +1439,8 @@ """ if self.isListActive(): if event.reason() in [ - Qt.ActiveWindowFocusReason, - Qt.OtherFocusReason + Qt.FocusReason.ActiveWindowFocusReason, + Qt.FocusReason.OtherFocusReason ]: aw = QApplication.activeWindow() if aw is None or aw.parent() is not self: @@ -1447,8 +1450,8 @@ if self.isCallTipActive(): if event.reason() in [ - Qt.ActiveWindowFocusReason, - Qt.OtherFocusReason + Qt.FocusReason.ActiveWindowFocusReason, + Qt.FocusReason.OtherFocusReason ]: aw = QApplication.activeWindow() if aw is None or aw.parent() is not self: @@ -1550,7 +1553,8 @@ # Workaround for getting all items instead of # userListWidget.items() call with unknown mime types. - all_items = userListWidget.findItems('', Qt.MatchStartsWith) + all_items = userListWidget.findItems( + '', Qt.MatchFlag.MatchStartsWith) if not all_items: return @@ -1587,7 +1591,7 @@ # List box doesn't honor limited size to show scroll bars. # So just force it. userListWidget.setHorizontalScrollBarPolicy( - Qt.ScrollBarAlwaysOn) + Qt.ScrollBarPolicy.ScrollBarAlwaysOn) if len(all_items) > self.maxLines: width += userListWidget.verticalScrollBar().sizeHint().width()
--- a/eric6/QScintilla/SearchReplaceWidget.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/QScintilla/SearchReplaceWidget.py Tue Mar 02 17:17:09 2021 +0100 @@ -168,14 +168,16 @@ self.tr('Find Next'), 0, 0, self, 'search_widget_find_next') self.findNextAct.triggered.connect(self.on_findNextButton_clicked) - self.findNextAct.setShortcutContext(Qt.WidgetWithChildrenShortcut) + self.findNextAct.setShortcutContext( + Qt.ShortcutContext.WidgetWithChildrenShortcut) self.findPrevAct = E5Action( self.tr('Find Prev'), self.tr('Find Prev'), 0, 0, self, 'search_widget_find_prev') self.findPrevAct.triggered.connect(self.on_findPrevButton_clicked) - self.findPrevAct.setShortcutContext(Qt.WidgetWithChildrenShortcut) + self.findPrevAct.setShortcutContext( + Qt.ShortcutContext.WidgetWithChildrenShortcut) if replace: self.replaceAndSearchAct = E5Action( @@ -186,7 +188,7 @@ self.on_replaceSearchButton_clicked) self.replaceAndSearchAct.setEnabled(False) self.replaceAndSearchAct.setShortcutContext( - Qt.WidgetWithChildrenShortcut) + Qt.ShortcutContext.WidgetWithChildrenShortcut) self.replaceSelectionAct = E5Action( self.tr("Replace Occurrence"), @@ -196,7 +198,7 @@ self.on_replaceButton_clicked) self.replaceSelectionAct.setEnabled(False) self.replaceSelectionAct.setShortcutContext( - Qt.WidgetWithChildrenShortcut) + Qt.ShortcutContext.WidgetWithChildrenShortcut) self.replaceAllAct = E5Action( self.tr("Replace All"), @@ -206,7 +208,7 @@ self.on_replaceAllButton_clicked) self.replaceAllAct.setEnabled(False) self.replaceAllAct.setShortcutContext( - Qt.WidgetWithChildrenShortcut) + Qt.ShortcutContext.WidgetWithChildrenShortcut) self.addAction(self.findNextAct) self.addAction(self.findPrevAct) @@ -306,7 +308,7 @@ @param evt event containing the state change (QEvent) """ - if evt.type() == QEvent.FontChange: + if evt.type() == QEvent.Type.FontChange: self.adjustSize() def __selectionBoundary(self, selections=None): @@ -434,17 +436,17 @@ """ if not ok: palette = self.ui.findtextCombo.lineEdit().palette() - palette.setColor(QPalette.Base, QColor("red")) - palette.setColor(QPalette.Text, QColor("white")) + palette.setColor(QPalette.ColorRole.Base, QColor("red")) + palette.setColor(QPalette.ColorRole.Text, QColor("white")) self.ui.findtextCombo.lineEdit().setPalette(palette) else: palette = self.ui.findtextCombo.lineEdit().palette() palette.setColor( - QPalette.Base, - self.ui.findtextCombo.palette().color(QPalette.Base)) + QPalette.ColorRole.Base, + self.ui.findtextCombo.palette().color(QPalette.ColorRole.Base)) palette.setColor( - QPalette.Text, - self.ui.findtextCombo.palette().color(QPalette.Text)) + QPalette.ColorRole.Text, + self.ui.findtextCombo.palette().color(QPalette.ColorRole.Text)) self.ui.findtextCombo.lineEdit().setPalette(palette) @pyqtSlot() @@ -1209,10 +1211,10 @@ @param event reference to the key press event (QKeyEvent) """ - if event.key() == Qt.Key_Escape: + if event.key() == Qt.Key.Key_Escape: aw = self.__viewmanager.activeWindow() if aw: - aw.setFocus(Qt.ActiveWindowFocusReason) + aw.setFocus(Qt.FocusReason.ActiveWindowFocusReason) aw.hideFindIndicator() event.accept() if self.__sliding: @@ -1245,27 +1247,29 @@ self.__layout = QHBoxLayout(self) self.setLayout(self.__layout) self.__layout.setContentsMargins(0, 0, 0, 0) - self.__layout.setAlignment(Qt.AlignTop) + self.__layout.setAlignment(Qt.AlignmentFlag.AlignTop) self.__leftButton = QToolButton(self) - self.__leftButton.setArrowType(Qt.LeftArrow) + self.__leftButton.setArrowType(Qt.ArrowType.LeftArrow) self.__leftButton.setSizePolicy( - QSizePolicy.Minimum, QSizePolicy.MinimumExpanding) + QSizePolicy.Policy.Minimum, QSizePolicy.Policy.MinimumExpanding) self.__leftButton.setAutoRepeat(True) self.__scroller = QScrollArea(self) self.__scroller.setWidget(self.__searchReplaceWidget) self.__scroller.setSizePolicy( - QSizePolicy.Expanding, QSizePolicy.Minimum) - self.__scroller.setFrameShape(QFrame.NoFrame) - self.__scroller.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) - self.__scroller.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) + QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum) + self.__scroller.setFrameShape(QFrame.Shape.NoFrame) + self.__scroller.setVerticalScrollBarPolicy( + Qt.ScrollBarPolicy.ScrollBarAlwaysOff) + self.__scroller.setHorizontalScrollBarPolicy( + Qt.ScrollBarPolicy.ScrollBarAlwaysOff) self.__scroller.setWidgetResizable(False) self.__rightButton = QToolButton(self) - self.__rightButton.setArrowType(Qt.RightArrow) + self.__rightButton.setArrowType(Qt.ArrowType.RightArrow) self.__rightButton.setSizePolicy( - QSizePolicy.Minimum, QSizePolicy.MinimumExpanding) + QSizePolicy.Policy.Minimum, QSizePolicy.Policy.MinimumExpanding) self.__rightButton.setAutoRepeat(True) self.__layout.addWidget(self.__leftButton) @@ -1286,7 +1290,7 @@ @param evt event containing the state change (QEvent) """ - if evt.type() == QEvent.FontChange: + if evt.type() == QEvent.Type.FontChange: self.setMaximumHeight( self.__searchReplaceWidget.sizeHint().height()) self.adjustSize()
--- a/eric6/QScintilla/Shell.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/QScintilla/Shell.py Tue Mar 02 17:17:09 2021 +0100 @@ -58,8 +58,8 @@ from UI.SearchWidget import SearchWidget self.__searchWidget = SearchWidget(self.__shell, self, horizontal) - self.__searchWidget.setSizePolicy(QSizePolicy.Fixed, - QSizePolicy.Preferred) + self.__searchWidget.setSizePolicy(QSizePolicy.Policy.Fixed, + QSizePolicy.Policy.Preferred) self.__searchWidget.hide() if horizontal: @@ -374,14 +374,15 @@ self.__queuedText = '' self.__blockTextProcessing = False - self.queueText.connect(self.__concatenateText, Qt.QueuedConnection) + self.queueText.connect(self.__concatenateText, + Qt.ConnectionType.QueuedConnection) self.__project = project if self.__project: self.__project.projectOpened.connect(self.__projectOpened) self.__project.projectClosed.connect(self.__projectClosed) - self.grabGesture(Qt.PinchGesture) + self.grabGesture(Qt.GestureType.PinchGesture) def __showStartMenu(self): """ @@ -479,7 +480,8 @@ """ self.setTabWidth(Preferences.getEditor("TabWidth")) if Preferences.getEditor("ShowWhitespace"): - self.setWhitespaceVisibility(QsciScintilla.WsVisible) + self.setWhitespaceVisibility( + QsciScintilla.WhitespaceVisibility.WsVisible) try: self.setWhitespaceForegroundColor( Preferences.getEditorColour("WhitespaceForeground")) @@ -491,12 +493,13 @@ # QScintilla before 2.5 doesn't support this pass else: - self.setWhitespaceVisibility(QsciScintilla.WsInvisible) + self.setWhitespaceVisibility( + QsciScintilla.WhitespaceVisibility.WsInvisible) self.setEolVisibility(Preferences.getEditor("ShowEOL")) if Preferences.getEditor("BraceHighlighting"): - self.setBraceMatching(QsciScintilla.SloppyBraceMatch) + self.setBraceMatching(QsciScintilla.BraceMatch.SloppyBraceMatch) else: - self.setBraceMatching(QsciScintilla.NoBraceMatch) + self.setBraceMatching(QsciScintilla.BraceMatch.NoBraceMatch) self.setMatchedBraceForegroundColor( Preferences.getEditorColour("MatchingBrace")) self.setMatchedBraceBackgroundColor( @@ -510,7 +513,7 @@ Preferences.getEditorColour("SelectionBackground")) else: self.setSelectionBackgroundColor( - QApplication.palette().color(QPalette.Highlight)) + QApplication.palette().color(QPalette.ColorRole.Highlight)) if Preferences.getEditor("ColourizeSelText"): self.resetSelectionForegroundColor() elif Preferences.getEditor("CustomSelectionColours"): @@ -518,7 +521,8 @@ Preferences.getEditorColour("SelectionForeground")) else: self.setSelectionForegroundColor( - QApplication.palette().color(QPalette.HighlightedText)) + QApplication.palette().color( + QPalette.ColorRole.HighlightedText)) self.setSelectionToEol(Preferences.getEditor("ExtendSelectionToEol")) self.setCaretForegroundColor( Preferences.getEditorColour("CaretForeground")) @@ -526,9 +530,9 @@ self.caretWidth = Preferences.getEditor("CaretWidth") self.setCaretWidth(self.caretWidth) if Preferences.getShell("WrapEnabled"): - self.setWrapMode(QsciScintilla.WrapWord) + self.setWrapMode(QsciScintilla.WrapMode.WrapWord) else: - self.setWrapMode(QsciScintilla.WrapNone) + self.setWrapMode(QsciScintilla.WrapMode.WrapNone) self.useMonospaced = Preferences.getShell("UseMonospacedFont") self.__setMonospaced(self.useMonospaced) @@ -586,18 +590,21 @@ Preferences.getEditorColour("CallTipsHighlight")) self.setCallTipsVisible(Preferences.getEditor("CallTipsVisible")) calltipsStyle = Preferences.getEditor("CallTipsStyle") - if calltipsStyle == QsciScintilla.CallTipsNoContext: - self.setCallTipsStyle(QsciScintilla.CallTipsNoContext) + if calltipsStyle == QsciScintilla.CallTipsStyle.CallTipsNoContext: + self.setCallTipsStyle( + QsciScintilla.CallTipsStyle.CallTipsNoContext) elif ( calltipsStyle == - QsciScintilla.CallTipsNoAutoCompletionContext + QsciScintilla.CallTipsStyle.CallTipsNoAutoCompletionContext ): self.setCallTipsStyle( - QsciScintilla.CallTipsNoAutoCompletionContext) + QsciScintilla.CallTipsStyle + .CallTipsNoAutoCompletionContext) else: - self.setCallTipsStyle(QsciScintilla.CallTipsContext) + self.setCallTipsStyle( + QsciScintilla.CallTipsStyle.CallTipsContext) else: - self.setCallTipsStyle(QsciScintilla.CallTipsNone) + self.setCallTipsStyle(QsciScintilla.CallTipsStyle.CallTipsNone) def setDebuggerUI(self, ui): """ @@ -786,7 +793,7 @@ """ from .ShellHistoryDialog import ShellHistoryDialog dlg = ShellHistoryDialog(self.__history, self.vm, self) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: self.__historyLists[self.clientType], idx = dlg.getHistory() self.__history = self.__historyLists[self.clientType] self.__setHistoryIndex(index=idx) @@ -1232,8 +1239,8 @@ @param event the mouse press event (QMouseEvent) """ self.setFocus() - if event.button() == Qt.MidButton: - lines = QApplication.clipboard().text(QClipboard.Selection) + if event.button() == Qt.MouseButton.MidButton: + lines = QApplication.clipboard().text(QClipboard.Mode.Selection) self.paste(lines) else: super(Shell, self).mousePressEvent(event) @@ -1244,7 +1251,7 @@ @param evt reference to the wheel event (QWheelEvent) """ - if evt.modifiers() & Qt.ControlModifier: + if evt.modifiers() & Qt.KeyboardModifier.ControlModifier: delta = evt.angleDelta().y() if delta < 0: self.zoomOut() @@ -1262,7 +1269,7 @@ @param evt reference to the event (QEvent) @return flag indicating, if the event was handled (boolean) """ - if evt.type() == QEvent.Gesture: + if evt.type() == QEvent.Type.Gesture: self.gestureEvent(evt) return True @@ -1274,12 +1281,12 @@ @param evt reference to the gesture event (QGestureEvent """ - pinch = evt.gesture(Qt.PinchGesture) + pinch = evt.gesture(Qt.GestureType.PinchGesture) if pinch: - if pinch.state() == Qt.GestureStarted: + if pinch.state() == Qt.GestureState.GestureStarted: zoom = (self.getZoom() + 10) / 10.0 pinch.setTotalScaleFactor(zoom) - elif pinch.state() == Qt.GestureUpdated: + elif pinch.state() == Qt.GestureState.GestureUpdated: zoom = int(pinch.totalScaleFactor() * 10) - 10 if zoom <= -9: zoom = -9
--- a/eric6/QScintilla/ShellHistoryDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/QScintilla/ShellHistoryDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -40,9 +40,11 @@ index = shell.getHistoryIndex() if index < 0 or index >= len(history): self.historyList.setCurrentRow( - self.historyList.count() - 1, QItemSelectionModel.Select) + self.historyList.count() - 1, + QItemSelectionModel.SelectionFlag.Select) else: - self.historyList.setCurrentRow(index, QItemSelectionModel.Select) + self.historyList.setCurrentRow( + index, QItemSelectionModel.SelectionFlag.Select) self.historyList.scrollToItem(self.historyList.currentItem()) @pyqtSlot() @@ -126,12 +128,14 @@ self.historyList.addItems(history) if index < 0 or index >= len(history): self.historyList.setCurrentRow( - self.historyList.count() - 1, QItemSelectionModel.Select) + self.historyList.count() - 1, + QItemSelectionModel.SelectionFlag.Select) else: - self.historyList.setCurrentRow(index, QItemSelectionModel.Select) + self.historyList.setCurrentRow( + index, QItemSelectionModel.SelectionFlag.Select) self.historyList.scrollToItem(self.historyList.currentItem()) - self.historyList.setFocus(Qt.OtherFocusReason) + self.historyList.setFocus(Qt.FocusReason.OtherFocusReason) def getHistory(self): """
--- a/eric6/QScintilla/ShellWindow.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/QScintilla/ShellWindow.py Tue Mar 02 17:17:09 2021 +0100 @@ -214,7 +214,7 @@ """<p>This quits the Shell window.</p>""" )) self.exitAct.triggered.connect(self.quit) - self.exitAct.setMenuRole(QAction.QuitRole) + self.exitAct.setMenuRole(QAction.MenuRole.QuitRole) self.fileActions.append(self.exitAct) self.newWindowAct = E5Action( @@ -251,7 +251,7 @@ self.tr('Restart and Clear'), UI.PixmapCache.getIcon("restartDelete"), self.tr('Restart and Clear'), - Qt.Key_F4, 0, self, 'shell_clear_restart') + Qt.Key.Key_F4, 0, self, 'shell_clear_restart') self.clearRestartAct.setStatusTip(self.tr( 'Clear the window and restart the shell')) self.clearRestartAct.setWhatsThis(self.tr( @@ -1060,7 +1060,7 @@ """ from QScintilla.ZoomDialog import ZoomDialog dlg = ZoomDialog(self.__shell.getZoom(), self, None, True) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: value = dlg.getZoomSize() self.__zoomTo(value)
--- a/eric6/QScintilla/SpellingDictionaryEditDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/QScintilla/SpellingDictionaryEditDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -38,7 +38,8 @@ self) self.__model.sort(0) self.__proxyModel = QSortFilterProxyModel(self) - self.__proxyModel.setFilterCaseSensitivity(Qt.CaseInsensitive) + self.__proxyModel.setFilterCaseSensitivity( + Qt.CaseSensitivity.CaseInsensitive) self.__proxyModel.setDynamicSortFilter(True) self.__proxyModel.setSourceModel(self.__model) self.wordList.setModel(self.__proxyModel)
--- a/eric6/Snapshot/SnapWidget.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Snapshot/SnapWidget.py Tue Mar 02 17:17:09 2021 +0100 @@ -91,7 +91,7 @@ self.delaySpin.setValue(delay) picturesLocation = QStandardPaths.writableLocation( - QStandardPaths.PicturesLocation) + QStandardPaths.StandardLocation.PicturesLocation) self.__filename = Preferences.Prefs.settings.value( "Snapshot/Filename", os.path.join(picturesLocation, @@ -154,27 +154,28 @@ Private method to initialize the keyboard shortcuts. """ self.__quitShortcut = QShortcut( - QKeySequence(QKeySequence.Quit), self, self.close) + QKeySequence(QKeySequence.StandardKey.Quit), self, self.close) self.__copyShortcut = QShortcut( - QKeySequence(QKeySequence.Copy), self, + QKeySequence(QKeySequence.StandardKey.Copy), self, self.copyButton.animateClick) self.__quickSaveShortcut = QShortcut( - QKeySequence(Qt.Key_Q), self, self.__quickSave) + QKeySequence(Qt.Key.Key_Q), self, self.__quickSave) self.__save1Shortcut = QShortcut( - QKeySequence(QKeySequence.Save), self, + QKeySequence(QKeySequence.StandardKey.Save), self, self.saveButton.animateClick) self.__save2Shortcut = QShortcut( - QKeySequence(Qt.Key_S), self, self.saveButton.animateClick) + QKeySequence(Qt.Key.Key_S), self, self.saveButton.animateClick) self.__grab1Shortcut = QShortcut( - QKeySequence(QKeySequence.New), self, self.takeButton.animateClick) + QKeySequence(QKeySequence.StandardKey.New), + self, self.takeButton.animateClick) self.__grab2Shortcut = QShortcut( - QKeySequence(Qt.Key_N), self, self.takeButton.animateClick) + QKeySequence(Qt.Key.Key_N), self, self.takeButton.animateClick) self.__grab3Shortcut = QShortcut( - QKeySequence(Qt.Key_Space), self, self.takeButton.animateClick) + QKeySequence(Qt.Key.Key_Space), self, self.takeButton.animateClick) def __quickSave(self): """ @@ -377,7 +378,7 @@ mimeData.setImageData(self.__snapshot) drag.setMimeData(mimeData) drag.setPixmap(self.preview.pixmap()) - drag.exec(Qt.CopyAction) + drag.exec(Qt.DropAction.CopyAction) def closeEvent(self, evt): """
--- a/eric6/Snapshot/SnapshotDefaultGrabber.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Snapshot/SnapshotDefaultGrabber.py Tue Mar 02 17:17:09 2021 +0100 @@ -34,7 +34,8 @@ super(SnapshotDefaultGrabber, self).__init__(parent) self.__grabber = None - self.__grabberWidget = QWidget(None, Qt.X11BypassWindowManagerHint) + self.__grabberWidget = QWidget( + None, Qt.WindowType.X11BypassWindowManagerHint) self.__grabberWidget.move(-10000, -10000) self.__grabberWidget.installEventFilter(self) @@ -107,7 +108,7 @@ self.__performGrab(self.__mode) else: self.__grabberWidget.show() - self.__grabberWidget.grabMouse(Qt.CrossCursor) + self.__grabberWidget.grabMouse(Qt.CursorShape.CrossCursor) def __grabRectangle(self): """ @@ -193,11 +194,11 @@ """ if ( obj == self.__grabberWidget and - evt.type() == QEvent.MouseButtonPress + evt.type() == QEvent.Type.MouseButtonPress ): if QWidget.mouseGrabber() != self.__grabberWidget: return False - if evt.button() == Qt.LeftButton: + if evt.button() == Qt.MouseButton.LeftButton: self.__performGrab(self.__mode) return False
--- a/eric6/Snapshot/SnapshotFreehandGrabber.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Snapshot/SnapshotFreehandGrabber.py Tue Mar 02 17:17:09 2021 +0100 @@ -28,7 +28,8 @@ """ clip = QRegion(polygon) clip = clip - QRegion(polygon) - pen = QPen(outline, 1, Qt.SolidLine, Qt.SquareCap, Qt.BevelJoin) + pen = QPen(outline, 1, Qt.PenStyle.SolidLine, Qt.PenCapStyle.SquareCap, + Qt.PenJoinStyle.BevelJoin) painter.save() painter.setClipRegion(clip) @@ -55,8 +56,11 @@ """ super(SnapshotFreehandGrabber, self).__init__( None, - Qt.X11BypassWindowManagerHint | Qt.WindowStaysOnTopHint | - Qt.FramelessWindowHint | Qt.Tool) + Qt.WindowType.X11BypassWindowManagerHint | + Qt.WindowType.WindowStaysOnTopHint | + Qt.WindowType.FramelessWindowHint | + Qt.WindowType.Tool + ) self.__selection = QPolygon() self.__mouseDown = False @@ -99,7 +103,7 @@ 0, geom.x(), geom.y(), geom.width(), geom.height()) self.resize(self.__pixmap.size()) self.move(geom.x(), geom.y()) - self.setCursor(Qt.CrossCursor) + self.setCursor(Qt.CursorShape.CrossCursor) self.show() self.grabMouse() @@ -119,11 +123,14 @@ pal = QPalette(QToolTip.palette()) font = QToolTip.font() - handleColor = pal.color(QPalette.Active, QPalette.Highlight) + handleColor = pal.color(QPalette.ColorGroup.Active, + QPalette.ColorRole.Highlight) handleColor.setAlpha(160) overlayColor = QColor(0, 0, 0, 160) - textColor = pal.color(QPalette.Active, QPalette.Text) - textBackgroundColor = pal.color(QPalette.Active, QPalette.Base) + textColor = pal.color(QPalette.ColorGroup.Active, + QPalette.ColorRole.Text) + textBackgroundColor = pal.color(QPalette.ColorGroup.Active, + QPalette.ColorRole.Base) painter.drawPixmap(0, 0, self.__pixmap) painter.setFont(font) @@ -132,8 +139,8 @@ # Draw outline around selection. # Important: the 1px-wide outline is *also* part of the # captured free-region - pen = QPen(handleColor, 1, Qt.SolidLine, Qt.SquareCap, - Qt.BevelJoin) + pen = QPen(handleColor, 1, Qt.PenStyle.SolidLine, + Qt.PenCapStyle.SquareCap, Qt.PenJoinStyle.BevelJoin) painter.setPen(pen) painter.drawPolygon(pol) @@ -141,7 +148,7 @@ grey = QRegion(self.rect()) grey = grey - QRegion(pol) painter.setClipRegion(grey) - painter.setPen(Qt.NoPen) + painter.setPen(Qt.PenStyle.NoPen) painter.setBrush(overlayColor) painter.drawRect(self.rect()) painter.setClipRect(self.rect()) @@ -152,13 +159,13 @@ painter.setBrush(textBackgroundColor) self.__helpTextRect = painter.boundingRect( self.rect().adjusted(2, 2, -2, -2), - Qt.TextWordWrap, self.__helpText).translated(0, 0) + Qt.TextFlag.TextWordWrap, self.__helpText).translated(0, 0) self.__helpTextRect.adjust(-2, -2, 4, 2) drawPolygon(painter, self.__helpTextRect, textColor, textBackgroundColor) painter.drawText( self.__helpTextRect.adjusted(3, 3, -3, -3), - Qt.TextWordWrap, self.__helpText) + Qt.TextFlag.TextWordWrap, self.__helpText) if self.__selection.isEmpty(): return @@ -173,7 +180,8 @@ self.__locale.toString(boundingRect.width()), self.__locale.toString(boundingRect.height()) ) - textRect = painter.boundingRect(self.rect(), Qt.AlignLeft, txt) + textRect = painter.boundingRect(self.rect(), + Qt.AlignmentFlag.AlignLeft, txt) boundingRect = textRect.adjusted(-4, 0, 0, 0) polBoundingRect = pol.boundingRect() @@ -227,14 +235,14 @@ # If the above didn't catch it, you are running on a very # tiny screen... drawPolygon(painter, boundingRect, textColor, textBackgroundColor) - painter.drawText(textRect, Qt.AlignHCenter, txt) + painter.drawText(textRect, Qt.AlignmentFlag.AlignHCenter, txt) if ( (polBoundingRect.height() > self.__handleSize * 2 and polBoundingRect.width() > self.__handleSize * 2) or not self.__mouseDown ): - painter.setBrush(Qt.transparent) + painter.setBrush(Qt.GlobalColor.transparent) painter.setClipRegion(QRegion(pol)) painter.drawPolygon(QPolygon(self.rect())) @@ -247,19 +255,20 @@ self.__pBefore = evt.pos() self.__showHelp = not self.__helpTextRect.contains(evt.pos()) - if evt.button() == Qt.LeftButton: + if evt.button() == Qt.MouseButton.LeftButton: self.__mouseDown = True self.__dragStartPoint = evt.pos() self.__selectionBeforeDrag = QPolygon(self.__selection) - if not self.__selection.containsPoint(evt.pos(), Qt.WindingFill): + if not self.__selection.containsPoint(evt.pos(), + Qt.FillRule.WindingFill): self.__newSelection = True self.__selection = QPolygon() else: - self.setCursor(Qt.ClosedHandCursor) - elif evt.button() == Qt.RightButton: + self.setCursor(Qt.CursorShape.ClosedHandCursor) + elif evt.button() == Qt.MouseButton.RightButton: self.__newSelection = False self.__selection = QPolygon() - self.setCursor(Qt.CrossCursor) + self.setCursor(Qt.CursorShape.CrossCursor) self.update() def mouseMoveEvent(self, evt): @@ -288,10 +297,11 @@ if self.__selection.boundingRect().isEmpty(): return - if self.__selection.containsPoint(evt.pos(), Qt.WindingFill): - self.setCursor(Qt.OpenHandCursor) + if self.__selection.containsPoint(evt.pos(), + Qt.FillRule.WindingFill): + self.setCursor(Qt.CursorShape.OpenHandCursor) else: - self.setCursor(Qt.CrossCursor) + self.setCursor(Qt.CursorShape.CrossCursor) def mouseReleaseEvent(self, evt): """ @@ -301,8 +311,8 @@ """ self.__mouseDown = False self.__newSelection = False - if self.__selection.containsPoint(evt.pos(), Qt.WindingFill): - self.setCursor(Qt.OpenHandCursor) + if self.__selection.containsPoint(evt.pos(), Qt.FillRule.WindingFill): + self.setCursor(Qt.CursorShape.OpenHandCursor) self.update() def mouseDoubleClickEvent(self, evt): @@ -319,9 +329,9 @@ @param evt key press event (QKeyEvent) """ - if evt.key() == Qt.Key_Escape: + if evt.key() == Qt.Key.Key_Escape: self.grabbed.emit(QPixmap()) - elif evt.key() in [Qt.Key_Enter, Qt.Key_Return]: + elif evt.key() in [Qt.Key.Key_Enter, Qt.Key.Key_Return]: self.__grabRegion() else: evt.ignore() @@ -339,23 +349,27 @@ translatedPol = pol.translated(xOffset, yOffset) pixmap2 = QPixmap(pol.boundingRect().size()) - pixmap2.fill(Qt.transparent) + pixmap2.fill(Qt.GlobalColor.transparent) pt = QPainter() pt.begin(pixmap2) - if pt.paintEngine().hasFeature(QPaintEngine.PorterDuff): + if pt.paintEngine().hasFeature( + QPaintEngine.PaintEngineFeature.PorterDuff + ): pt.setRenderHints( - QPainter.Antialiasing | - QPainter.HighQualityAntialiasing | - QPainter.SmoothPixmapTransform, + QPainter.RenderHint.Antialiasing | + QPainter.RenderHint.HighQualityAntialiasing | + QPainter.RenderHint.SmoothPixmapTransform, True) - pt.setBrush(Qt.black) - pt.setPen(QPen(QBrush(Qt.black), 0.5)) + pt.setBrush(Qt.GlobalColor.black) + pt.setPen(QPen(QBrush(Qt.GlobalColor.black), 0.5)) pt.drawPolygon(translatedPol) - pt.setCompositionMode(QPainter.CompositionMode_SourceIn) + pt.setCompositionMode( + QPainter.CompositionMode.CompositionMode_SourceIn) else: pt.setClipRegion(QRegion(translatedPol)) - pt.setCompositionMode(QPainter.CompositionMode_Source) + pt.setCompositionMode( + QPainter.CompositionMode.CompositionMode_Source) pt.drawPixmap(pixmap2.rect(), self.__pixmap, pol.boundingRect()) pt.end()
--- a/eric6/Snapshot/SnapshotPreview.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Snapshot/SnapshotPreview.py Tue Mar 02 17:17:09 2021 +0100 @@ -27,8 +27,9 @@ """ super(SnapshotPreview, self).__init__(parent) - self.setAlignment(Qt.AlignHCenter | Qt.AlignCenter) - self.setCursor(Qt.OpenHandCursor) + self.setAlignment(Qt.AlignmentFlag.AlignHCenter | + Qt.AlignmentFlag.AlignCenter) + self.setCursor(Qt.CursorShape.OpenHandCursor) self.__mouseClickPoint = QPoint(0, 0) @@ -41,7 +42,8 @@ if not preview.isNull(): pixmap = preview.scaled( self.width(), self.height(), - Qt.KeepAspectRatio, Qt.SmoothTransformation) + Qt.AspectRatioMode.KeepAspectRatio, + Qt.TransformationMode.SmoothTransformation) else: pixmap = preview self.setPixmap(pixmap) @@ -52,7 +54,7 @@ @param evt mouse button press event (QMouseEvent) """ - if evt.button() == Qt.LeftButton: + if evt.button() == Qt.MouseButton.LeftButton: self.__mouseClickPoint = evt.pos() def mouseReleaseEvent(self, evt):
--- a/eric6/Snapshot/SnapshotRegionGrabber.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Snapshot/SnapshotRegionGrabber.py Tue Mar 02 17:17:09 2021 +0100 @@ -31,7 +31,7 @@ painter.save() painter.setClipRegion(clip) - painter.setPen(Qt.NoPen) + painter.setPen(Qt.PenStyle.NoPen) painter.setBrush(outline) painter.drawRect(rect) if fill is not None and fill.isValid(): @@ -66,8 +66,11 @@ """ super(SnapshotRegionGrabber, self).__init__( None, - Qt.X11BypassWindowManagerHint | Qt.WindowStaysOnTopHint | - Qt.FramelessWindowHint | Qt.Tool) + Qt.WindowType.X11BypassWindowManagerHint | + Qt.WindowType.WindowStaysOnTopHint | + Qt.WindowType.FramelessWindowHint | + Qt.WindowType.Tool + ) if mode not in [SnapshotRegionGrabber.Rectangle, SnapshotRegionGrabber.Ellipse]: @@ -130,7 +133,7 @@ 0, geom.x(), geom.y(), geom.width(), geom.height()) self.resize(self.__pixmap.size()) self.move(geom.x(), geom.y()) - self.setCursor(Qt.CrossCursor) + self.setCursor(Qt.CursorShape.CrossCursor) self.show() self.grabMouse() @@ -150,11 +153,14 @@ pal = QPalette(QToolTip.palette()) font = QToolTip.font() - handleColor = pal.color(QPalette.Active, QPalette.Highlight) + handleColor = pal.color(QPalette.ColorGroup.Active, + QPalette.ColorRole.Highlight) handleColor.setAlpha(160) overlayColor = QColor(0, 0, 0, 160) - textColor = pal.color(QPalette.Active, QPalette.Text) - textBackgroundColor = pal.color(QPalette.Active, QPalette.Base) + textColor = pal.color(QPalette.ColorGroup.Active, + QPalette.ColorRole.Text) + textBackgroundColor = pal.color(QPalette.ColorGroup.Active, + QPalette.ColorRole.Base) painter.drawPixmap(0, 0, self.__pixmap) painter.setFont(font) @@ -162,12 +168,12 @@ if not self.__selection.isNull(): grey = QRegion(self.rect()) if self.__mode == SnapshotRegionGrabber.Ellipse: - reg = QRegion(r, QRegion.Ellipse) + reg = QRegion(r, QRegion.RegionType.Ellipse) else: reg = QRegion(r) grey = grey.subtracted(reg) painter.setClipRegion(grey) - painter.setPen(Qt.NoPen) + painter.setPen(Qt.PenStyle.NoPen) painter.setBrush(overlayColor) painter.drawRect(self.rect()) painter.setClipRect(self.rect()) @@ -178,13 +184,13 @@ painter.setBrush(textBackgroundColor) self.__helpTextRect = painter.boundingRect( self.rect().adjusted(2, 2, -2, -2), - Qt.TextWordWrap, self.__helpText).translated(0, 0) + Qt.TextFlag.TextWordWrap, self.__helpText).translated(0, 0) self.__helpTextRect.adjust(-2, -2, 4, 2) drawRect(painter, self.__helpTextRect, textColor, textBackgroundColor) painter.drawText( self.__helpTextRect.adjusted(3, 3, -3, -3), - Qt.TextWordWrap, self.__helpText) + Qt.TextFlag.TextWordWrap, self.__helpText) if self.__selection.isNull(): return @@ -198,7 +204,8 @@ self.__locale.toString(self.__selection.width()), self.__locale.toString(self.__selection.height()) ) - textRect = painter.boundingRect(self.rect(), Qt.AlignLeft, txt) + textRect = painter.boundingRect(self.rect(), + Qt.AlignmentFlag.AlignLeft, txt) boundingRect = textRect.adjusted(-4, 0, 0, 0) if ( @@ -236,7 +243,7 @@ # If the above didn't catch it, you are running on a very # tiny screen... drawRect(painter, boundingRect, textColor, textBackgroundColor) - painter.drawText(textRect, Qt.AlignHCenter, txt) + painter.drawText(textRect, Qt.AlignmentFlag.AlignHCenter, txt) if ( (r.height() > self.__handleSize * 2 and @@ -244,7 +251,7 @@ not self.__mouseDown ): self.__updateHandles() - painter.setPen(Qt.NoPen) + painter.setPen(Qt.PenStyle.NoPen) painter.setBrush(handleColor) painter.setClipRegion( self.__handleMask(SnapshotRegionGrabber.StrokeMask)) @@ -280,7 +287,7 @@ @param evt mouse press event (QMouseEvent) """ self.__showHelp = not self.__helpTextRect.contains(evt.pos()) - if evt.button() == Qt.LeftButton: + if evt.button() == Qt.MouseButton.LeftButton: self.__mouseDown = True self.__dragStartPoint = evt.pos() self.__selectionBeforeDrag = QRect(self.__selection) @@ -288,11 +295,11 @@ self.__newSelection = True self.__selection = QRect() else: - self.setCursor(Qt.ClosedHandCursor) - elif evt.button() == Qt.RightButton: + self.setCursor(Qt.CursorShape.ClosedHandCursor) + elif evt.button() == Qt.MouseButton.RightButton: self.__newSelection = False self.__selection = QRect() - self.setCursor(Qt.CrossCursor) + self.setCursor(Qt.CursorShape.CrossCursor) self.update() def mouseMoveEvent(self, evt): @@ -364,22 +371,22 @@ if not found: self.__mouseOverHandle = None if self.__selection.contains(evt.pos()): - self.setCursor(Qt.OpenHandCursor) + self.setCursor(Qt.CursorShape.OpenHandCursor) else: - self.setCursor(Qt.CrossCursor) + self.setCursor(Qt.CursorShape.CrossCursor) else: if self.__mouseOverHandle in [self.__TLHandle, self.__BRHandle]: - self.setCursor(Qt.SizeFDiagCursor) + self.setCursor(Qt.CursorShape.SizeFDiagCursor) elif self.__mouseOverHandle in [self.__TRHandle, self.__BLHandle]: - self.setCursor(Qt.SizeBDiagCursor) + self.setCursor(Qt.CursorShape.SizeBDiagCursor) elif self.__mouseOverHandle in [self.__LHandle, self.__RHandle]: - self.setCursor(Qt.SizeHorCursor) + self.setCursor(Qt.CursorShape.SizeHorCursor) elif self.__mouseOverHandle in [self.__THandle, self.__BHandle]: - self.setCursor(Qt.SizeVerCursor) + self.setCursor(Qt.CursorShape.SizeVerCursor) def mouseReleaseEvent(self, evt): """ @@ -393,7 +400,7 @@ self.__mouseOverHandle is None and self.__selection.contains(evt.pos()) ): - self.setCursor(Qt.OpenHandCursor) + self.setCursor(Qt.CursorShape.OpenHandCursor) self.update() def mouseDoubleClickEvent(self, evt): @@ -410,9 +417,9 @@ @param evt key press event (QKeyEvent) """ - if evt.key() == Qt.Key_Escape: + if evt.key() == Qt.Key.Key_Escape: self.grabbed.emit(QPixmap()) - elif evt.key() in [Qt.Key_Enter, Qt.Key_Return]: + elif evt.key() in [Qt.Key.Key_Enter, Qt.Key.Key_Return]: self.__grabRect() else: evt.ignore() @@ -504,7 +511,7 @@ Private method to grab the selected rectangle (i.e. do the snapshot). """ if self.__mode == SnapshotRegionGrabber.Ellipse: - ell = QRegion(self.__selection, QRegion.Ellipse) + ell = QRegion(self.__selection, QRegion.RegionType.Ellipse) if not ell.isEmpty(): self.__grabbing = True @@ -513,23 +520,27 @@ translatedEll = ell.translated(xOffset, yOffset) pixmap2 = QPixmap(ell.boundingRect().size()) - pixmap2.fill(Qt.transparent) + pixmap2.fill(Qt.GlobalColor.transparent) pt = QPainter() pt.begin(pixmap2) - if pt.paintEngine().hasFeature(QPaintEngine.PorterDuff): + if pt.paintEngine().hasFeature( + QPaintEngine.PaintEngineFeature.PorterDuff + ): pt.setRenderHints( - QPainter.Antialiasing | - QPainter.HighQualityAntialiasing | - QPainter.SmoothPixmapTransform, + QPainter.RenderHint.Antialiasing | + QPainter.RenderHint.HighQualityAntialiasing | + QPainter.RenderHint.SmoothPixmapTransform, True) - pt.setBrush(Qt.black) - pt.setPen(QPen(QBrush(Qt.black), 0.5)) + pt.setBrush(Qt.GlobalColor.black) + pt.setPen(QPen(QBrush(Qt.GlobalColor.black), 0.5)) pt.drawEllipse(translatedEll.boundingRect()) - pt.setCompositionMode(QPainter.CompositionMode_SourceIn) + pt.setCompositionMode( + QPainter.CompositionMode.CompositionMode_SourceIn) else: pt.setClipRegion(translatedEll) - pt.setCompositionMode(QPainter.CompositionMode_Source) + pt.setCompositionMode( + QPainter.CompositionMode.CompositionMode_Source) pt.drawPixmap(pixmap2.rect(), self.__pixmap, ell.boundingRect())
--- a/eric6/Snapshot/SnapshotTimer.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Snapshot/SnapshotTimer.py Tue Mar 02 17:17:09 2021 +0100 @@ -26,8 +26,11 @@ """ super(SnapshotTimer, self).__init__(None) - self.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint | - Qt.X11BypassWindowManagerHint) + self.setWindowFlags( + Qt.WindowType.WindowStaysOnTopHint | + Qt.WindowType.FramelessWindowHint | + Qt.WindowType.X11BypassWindowManagerHint + ) self.__timer = QTimer() self.__textRect = QRect() @@ -94,20 +97,26 @@ if self.__time < self.__length: pal = QToolTip.palette() - textBackgroundColor = pal.color(QPalette.Active, QPalette.Base) + textBackgroundColor = pal.color(QPalette.ColorGroup.Active, + QPalette.ColorRole.Base) if self.__toggle: - textColor = pal.color(QPalette.Active, QPalette.Text) + textColor = pal.color(QPalette.ColorGroup.Active, + QPalette.ColorRole.Text) else: - textColor = pal.color(QPalette.Active, QPalette.Base) + textColor = pal.color(QPalette.ColorGroup.Active, + QPalette.ColorRole.Base) painter.setPen(textColor) painter.setBrush(textBackgroundColor) helpText = self.tr("Snapshot will be taken in %n seconds", "", self.__length - self.__time) textRect = painter.boundingRect( self.rect().adjusted(2, 2, -2, -2), - Qt.AlignHCenter | Qt.TextSingleLine, helpText) - painter.drawText(textRect, Qt.AlignHCenter | Qt.TextSingleLine, - helpText) + Qt.AlignmentFlag.AlignHCenter | Qt.TextFlag.TextSingleLine, + helpText) + painter.drawText( + textRect, + Qt.AlignmentFlag.AlignHCenter | Qt.TextFlag.TextSingleLine, + helpText) def enterEvent(self, evt): """
--- a/eric6/Snapshot/SnapshotWaylandGrabber.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Snapshot/SnapshotWaylandGrabber.py Tue Mar 02 17:17:09 2021 +0100 @@ -338,7 +338,7 @@ @return flag indicating validity @rtype bool """ - if reply.type() == QDBusMessage.ReplyMessage: + if reply.type() == QDBusMessage.MessageType.ReplyMessage: if len(reply.arguments()) == argumentsCount: return True @@ -351,7 +351,7 @@ len(reply.arguments()), )) - elif reply.type() == QDBusMessage.ErrorMessage: + elif reply.type() == QDBusMessage.MessageType.ErrorMessage: E5MessageBox.warning( None, self.tr("Screenshot Error"), @@ -361,7 +361,7 @@ reply.errorMessage(), )) - elif reply.type() == QDBusMessage.InvalidMessage: + elif reply.type() == QDBusMessage.MessageType.InvalidMessage: E5MessageBox.warning( None, self.tr("Screenshot Error"),
--- a/eric6/SqlBrowser/SqlBrowser.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/SqlBrowser/SqlBrowser.py Tue Mar 02 17:17:09 2021 +0100 @@ -61,7 +61,7 @@ self.__warnings = [] for connection in connections: - url = QUrl(connection, QUrl.TolerantMode) + url = QUrl(connection, QUrl.ParsingMode.TolerantMode) if not url.isValid(): self.__warnings.append( self.tr("Invalid URL: {0}").format(connection)) @@ -70,7 +70,7 @@ err = self.__browser.addConnection(url.scheme(), url.path(), url.userName(), url.password(), url.host(), url.port(-1)) - if err.type() != QSqlError.NoError: + if err.type() != QSqlError.ErrorType.NoError: self.__warnings.append( self.tr("Unable to open connection: {0}".format( err.text())))
--- a/eric6/SqlBrowser/SqlBrowserWidget.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/SqlBrowser/SqlBrowserWidget.py Tue Mar 02 17:17:09 2021 +0100 @@ -113,7 +113,8 @@ """ model = QStandardItemModel(self.table) self.table.setModel(model) - self.table.setEditTriggers(QAbstractItemView.NoEditTriggers) + self.table.setEditTriggers( + QAbstractItemView.EditTrigger.NoEditTriggers) self.updateActions() @@ -153,12 +154,12 @@ """ from .SqlConnectionDialog import SqlConnectionDialog dlg = SqlConnectionDialog(self) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: driver, dbName, user, password, host, port = dlg.getData() err = self.addConnection( driver, dbName, user, password, host, port) - if err.type() != QSqlError.NoError: + if err.type() != QSqlError.ErrorType.NoError: E5MessageBox.warning( self, self.tr("Unable to open database"), @@ -172,14 +173,15 @@ @param table name of the table to be shown (string) """ model = QSqlTableModel(self.table, self.connections.currentDatabase()) - model.setEditStrategy(QSqlTableModel.OnRowChange) + model.setEditStrategy(QSqlTableModel.EditStrategy.OnRowChange) model.setTable(table) model.select() - if model.lastError().type() != QSqlError.NoError: + if model.lastError().type() != QSqlError.ErrorType.NoError: self.statusMessage.emit(model.lastError().text()) self.table.setModel(model) self.table.setEditTriggers( - QAbstractItemView.DoubleClicked | QAbstractItemView.EditKeyPressed) + QAbstractItemView.EditTrigger.DoubleClicked | + QAbstractItemView.EditTrigger.EditKeyPressed) self.table.resizeColumnsToContents() @@ -200,13 +202,13 @@ model.insertRows(0, rec.count()) model.insertColumns(0, 7) - model.setHeaderData(0, Qt.Horizontal, "Fieldname") - model.setHeaderData(1, Qt.Horizontal, "Type") - model.setHeaderData(2, Qt.Horizontal, "Length") - model.setHeaderData(3, Qt.Horizontal, "Precision") - model.setHeaderData(4, Qt.Horizontal, "Required") - model.setHeaderData(5, Qt.Horizontal, "Auto Value") - model.setHeaderData(6, Qt.Horizontal, "Default Value") + model.setHeaderData(0, Qt.Orientation.Horizontal, "Fieldname") + model.setHeaderData(1, Qt.Orientation.Horizontal, "Type") + model.setHeaderData(2, Qt.Orientation.Horizontal, "Length") + model.setHeaderData(3, Qt.Orientation.Horizontal, "Precision") + model.setHeaderData(4, Qt.Orientation.Horizontal, "Required") + model.setHeaderData(5, Qt.Orientation.Horizontal, "Auto Value") + model.setHeaderData(6, Qt.Orientation.Horizontal, "Default Value") for i in range(rec.count()): fld = rec.field(i) @@ -234,7 +236,8 @@ model.setData(model.index(i, 6), fld.defaultValue()) self.table.setModel(model) - self.table.setEditTriggers(QAbstractItemView.NoEditTriggers) + self.table.setEditTriggers( + QAbstractItemView.EditTrigger.NoEditTriggers) self.table.resizeColumnsToContents() @@ -276,7 +279,7 @@ if not isinstance(model, QSqlTableModel): return - model.setEditStrategy(QSqlTableModel.OnManualSubmit) + model.setEditStrategy(QSqlTableModel.EditStrategy.OnManualSubmit) currentSelection = self.table.selectionModel().selectedIndexes() for selectedIndex in currentSelection: @@ -285,7 +288,7 @@ model.removeRow(selectedIndex.row()) model.submitAll() - model.setEditStrategy(QSqlTableModel.OnRowChange) + model.setEditStrategy(QSqlTableModel.EditStrategy.OnRowChange) self.updateActions() @@ -298,7 +301,7 @@ self.sqlEdit.toPlainText(), self.connections.currentDatabase())) self.table.setModel(model) - if model.lastError().type() != QSqlError.NoError: + if model.lastError().type() != QSqlError.ErrorType.NoError: self.statusMessage.emit(model.lastError().text()) elif model.query().isSelect(): self.statusMessage.emit(self.tr("Query OK."))
--- a/eric6/SqlBrowser/SqlConnectionDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/SqlBrowser/SqlConnectionDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -31,7 +31,8 @@ self.databasePicker.setMode(E5PathPickerModes.OpenFileMode) - self.okButton = self.buttonBox.button(QDialogButtonBox.Ok) + self.okButton = self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok) drivers = QSqlDatabase.drivers()
--- a/eric6/SqlBrowser/SqlConnectionWidget.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/SqlBrowser/SqlConnectionWidget.py Tue Mar 02 17:17:09 2021 +0100 @@ -42,7 +42,7 @@ self.__connectionTree.setObjectName("connectionTree") self.__connectionTree.setHeaderLabels([self.tr("Database")]) self.__connectionTree.header().setSectionResizeMode( - QHeaderView.Stretch) + QHeaderView.ResizeMode.Stretch) refreshAction = QAction(self.tr("Refresh"), self.__connectionTree) self.__schemaAction = QAction( self.tr("Show Schema"), self.__connectionTree) @@ -52,7 +52,8 @@ self.__connectionTree.addAction(refreshAction) self.__connectionTree.addAction(self.__schemaAction) - self.__connectionTree.setContextMenuPolicy(Qt.ActionsContextMenu) + self.__connectionTree.setContextMenuPolicy( + Qt.ContextMenuPolicy.ActionsContextMenu) layout.addWidget(self.__connectionTree)
--- a/eric6/Tasks/Task.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Tasks/Task.py Tue Mar 02 17:17:09 2021 +0100 @@ -100,11 +100,11 @@ if isProjectTask: self.filename = self.project.getRelativePath(self.filename) - self.setData(0, Qt.DisplayRole, "") - self.setData(1, Qt.DisplayRole, "") - self.setData(2, Qt.DisplayRole, self.summary) - self.setData(3, Qt.DisplayRole, self.filename) - self.setData(4, Qt.DisplayRole, self.lineno or "") + self.setData(0, Qt.ItemDataRole.DisplayRole, "") + self.setData(1, Qt.ItemDataRole.DisplayRole, "") + self.setData(2, Qt.ItemDataRole.DisplayRole, self.summary) + self.setData(3, Qt.ItemDataRole.DisplayRole, self.filename) + self.setData(4, Qt.ItemDataRole.DisplayRole, self.lineno or "") if self.completed: self.setIcon(0, UI.PixmapCache.getIcon("taskCompleted")) @@ -133,7 +133,7 @@ self.setIcon(2, UI.PixmapCache.getIcon("empty")) self.colorizeTask() - self.setTextAlignment(4, Qt.AlignRight) + self.setTextAlignment(4, Qt.AlignmentFlag.AlignRight) def colorizeTask(self): """
--- a/eric6/Tasks/TaskViewer.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Tasks/TaskViewer.py Tue Mar 02 17:17:09 2021 +0100 @@ -64,7 +64,7 @@ 1, UI.PixmapCache.getIcon("taskPriority")) self.setHeaderItem(self.__headerItem) - self.header().setSortIndicator(2, Qt.AscendingOrder) + self.header().setSortIndicator(2, Qt.SortOrder.AscendingOrder) self.__resizeColumns() self.tasks = [] @@ -163,7 +163,7 @@ self.__activating = False - self.setContextMenuPolicy(Qt.CustomContextMenu) + self.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu) self.customContextMenuRequested.connect(self.__showContextMenu) self.itemActivated.connect(self.__taskItemActivated) @@ -208,7 +208,7 @@ """ Private method to resize the list columns. """ - self.header().resizeSections(QHeaderView.ResizeToContents) + self.header().resizeSections(QHeaderView.ResizeMode.ResizeToContents) self.header().setStretchLastSection(True) def findParentTask(self, parentUid): @@ -482,7 +482,7 @@ ro = task.getFilename() != "" if ro: dlg.setReadOnly() - if dlg.exec() == QDialog.Accepted and not ro: + if dlg.exec() == QDialog.DialogCode.Accepted and not ro: summary, priority, completed, isProjectTask, description = ( dlg.getData() ) @@ -499,7 +499,7 @@ """ from .TaskPropertiesDialog import TaskPropertiesDialog dlg = TaskPropertiesDialog(None, self, self.projectOpen) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: summary, priority, completed, isProjectTask, description = ( dlg.getData() ) @@ -516,7 +516,7 @@ from .TaskPropertiesDialog import TaskPropertiesDialog dlg = TaskPropertiesDialog(None, self, self.projectOpen) dlg.setSubTaskMode(projectTask) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: summary, priority, completed, isProjectTask, description = ( dlg.getData() ) @@ -553,7 +553,7 @@ ci = self.currentItem() if ci: ind = self.indexFromItem(ci, self.currentColumn()) - self.scrollTo(ind, QAbstractItemView.PositionAtCenter) + self.scrollTo(ind, QAbstractItemView.ScrollHint.PositionAtCenter) def __copyTask(self): """ @@ -631,7 +631,7 @@ ci = self.currentItem() if ci: ind = self.indexFromItem(ci, self.currentColumn()) - self.scrollTo(ind, QAbstractItemView.PositionAtCenter) + self.scrollTo(ind, QAbstractItemView.ScrollHint.PositionAtCenter) def __goToTask(self): """ @@ -678,7 +678,7 @@ """ from .TaskFilterConfigDialog import TaskFilterConfigDialog dlg = TaskFilterConfigDialog(self.taskFilter) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: dlg.configureTaskFilter(self.taskFilter) self.__refreshDisplay() @@ -691,7 +691,7 @@ self.tr("Scan Filter Patterns"), self.tr("Enter filename patterns of files" " to be excluded separated by a comma:"), - QLineEdit.Normal, + QLineEdit.EchoMode.Normal, self.__projectTasksScanFilter) if ok: self.__projectTasksScanFilter = scanFilter @@ -862,7 +862,7 @@ self.__markers[markerType] = markers[markerType][:] if not self.isRunning(): - self.start(QThread.LowPriority) + self.start(QThread.Priority.LowPriority) def run(self): """
--- a/eric6/Templates/TemplateMultipleVariablesDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Templates/TemplateMultipleVariablesDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -42,7 +42,7 @@ self.variablesView) self.variablesView.setWidgetResizable(True) - self.variablesView.setFrameStyle(QFrame.NoFrame) + self.variablesView.setFrameStyle(QFrame.Shape.NoFrame) self.top = QWidget(self) self.variablesView.setWidget(self.top) @@ -56,7 +56,8 @@ row = 0 for var in variables: label = QLabel("{0}:".format(var), self.top) - self.grid.addWidget(label, row, 0, Qt.Alignment(Qt.AlignTop)) + self.grid.addWidget(label, row, 0, + Qt.Alignment(Qt.AlignmentFlag.AlignTop)) if var.find(":") >= 0: formatStr = var[1:-1].split(":")[1] if formatStr in ["ml", "rl"]: @@ -71,7 +72,7 @@ row += 1 # add a spacer to make the entries aligned at the top spacer = QSpacerItem( - 20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) + 20, 40, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding) self.grid.addItem(spacer, row, 1) self.variablesEntries[variables[0]].setFocus() self.top.adjustSize() @@ -83,7 +84,7 @@ layout1.setObjectName("layout1") spacer1 = QSpacerItem( - 40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) + 40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum) layout1.addItem(spacer1) self.okButton = QPushButton(self) @@ -96,7 +97,7 @@ layout1.addWidget(self.cancelButton) spacer2 = QSpacerItem( - 40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) + 40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum) layout1.addItem(spacer2) self.TemplateMultipleVariablesDialogLayout.addLayout(layout1)
--- a/eric6/Templates/TemplatePropertiesDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Templates/TemplatePropertiesDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -97,7 +97,7 @@ @param ev key event (QKeyEvent) """ - if ev.key() == Qt.Key_Escape: + if ev.key() == Qt.Key.Key_Escape: res = E5MessageBox.yesNo( self, self.tr("Close dialog"),
--- a/eric6/Templates/TemplateViewer.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Templates/TemplateViewer.py Tue Mar 02 17:17:09 2021 +0100 @@ -393,7 +393,7 @@ self.setHeaderLabels(["Template"]) self.header().hide() - self.header().setSortIndicator(0, Qt.AscendingOrder) + self.header().setSortIndicator(0, Qt.SortOrder.AscendingOrder) self.setRootIsDecorated(True) self.setAlternatingRowColors(True) @@ -436,7 +436,7 @@ self.__templatesFile = TemplatesFile(self) - self.setContextMenuPolicy(Qt.CustomContextMenu) + self.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu) self.customContextMenuRequested.connect(self.__showContextMenu) self.itemActivated.connect(self.__templateItemActivated) @@ -494,7 +494,7 @@ from .TemplatePropertiesDialog import TemplatePropertiesDialog dlg = TemplatePropertiesDialog(self) dlg.setSelectedGroup(groupName) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: name, description, groupName, template = dlg.getData() self.addEntry(groupName, name, description, template) self.__dirty = True @@ -505,7 +505,7 @@ """ from .TemplatePropertiesDialog import TemplatePropertiesDialog dlg = TemplatePropertiesDialog(self, True) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: name, language = dlg.getData() self.addGroup(name, language) self.__dirty = True @@ -522,7 +522,7 @@ from .TemplatePropertiesDialog import TemplatePropertiesDialog dlg = TemplatePropertiesDialog(self, editGroup, itm) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: if editGroup: name, language = dlg.getData() self.changeGroup(itm.getName(), name, language) @@ -731,7 +731,7 @@ TemplateMultipleVariablesDialog ) dlg = TemplateMultipleVariablesDialog(variables, self) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: varValues.update(dlg.getVariables()) ok = True else: @@ -740,7 +740,7 @@ ) for var in variables: dlg = TemplateSingleVariableDialog(var, self) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: varValues[var] = dlg.getVariable() else: return @@ -985,7 +985,7 @@ else: # old XML based file f = QFile(filename) - ok = f.open(QIODevice.WriteOnly) + ok = f.open(QIODevice.OpenModeFlag.WriteOnly) if not ok: E5MessageBox.critical( self, @@ -1025,7 +1025,7 @@ self.__templatesFile.readFile(filename) else: f = QFile(filename) - if f.open(QIODevice.ReadOnly): + if f.open(QIODevice.OpenModeFlag.ReadOnly): from E5XML.TemplatesReader import TemplatesReader reader = TemplatesReader(f, viewer=self) reader.readXML()
--- a/eric6/Toolbox/SingleApplication.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Toolbox/SingleApplication.py Tue Mar 02 17:17:09 2021 +0100 @@ -152,7 +152,7 @@ return 1 else: err = self.sock.error() - if err == QLocalSocket.ServerNotFoundError: + if err == QLocalSocket.LocalSocketError.ServerNotFoundError: return 0 else: return -err
--- a/eric6/Toolbox/Startup.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Toolbox/Startup.py Tue Mar 02 17:17:09 2021 +0100 @@ -265,7 +265,8 @@ qtTransDir = Preferences.getQtTranslationsDir() if not qtTransDir: - qtTransDir = QLibraryInfo.location(QLibraryInfo.TranslationsPath) + qtTransDir = QLibraryInfo.location( + QLibraryInfo.LibraryLocation.TranslationsPath) loadTranslators(qtTransDir, app, ("qscintilla",)) # qscintilla needed for web browser
--- a/eric6/Tools/TRPreviewer.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Tools/TRPreviewer.py Tue Mar 02 17:17:09 2021 +0100 @@ -88,11 +88,11 @@ self.languageCombo.setEditable(False) self.languageCombo.setToolTip(self.tr("Select language file")) self.languageCombo.setSizePolicy( - QSizePolicy.Expanding, QSizePolicy.Preferred) + QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Preferred) self.languageLayout.addWidget(self.languageCombo) languageSpacer = QSpacerItem( - 40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) + 40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum) self.languageLayout.addItem(languageSpacer) self.TRPreviewerLayout.addLayout(self.languageLayout) @@ -769,8 +769,8 @@ """ super(WidgetArea, self).__init__(parent) - self.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded) - self.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded) + self.setHorizontalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAsNeeded) + self.setVerticalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAsNeeded) self.widgets = [] @@ -821,7 +821,7 @@ @param ev the event, that was generated by object (QEvent) @return flag indicating if event was filtered out """ - if obj in self.widgets and ev.type() == QEvent.Close: + if obj in self.widgets and ev.type() == QEvent.Type.Close: try: self.widgets.remove(obj) if len(self.widgets) == 0:
--- a/eric6/Tools/TrayStarter.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Tools/TrayStarter.py Tue Mar 02 17:17:09 2021 +0100 @@ -47,8 +47,8 @@ self.maxMenuFilePathLen = 75 self.rsettings = QSettings( - QSettings.IniFormat, - QSettings.UserScope, + QSettings.Format.IniFormat, + QSettings.Scope.UserScope, Globals.settingsNameOrganization, Globals.settingsNameRecent) @@ -231,11 +231,11 @@ (QSystemTrayIcon.ActivationReason) """ if ( - reason == QSystemTrayIcon.Context or - reason == QSystemTrayIcon.MiddleClick + reason == QSystemTrayIcon.ActivationReason.Context or + reason == QSystemTrayIcon.ActivationReason.MiddleClick ): self.__showContextMenu() - elif reason == QSystemTrayIcon.DoubleClick: + elif reason == QSystemTrayIcon.ActivationReason.DoubleClick: self.__startEric() def __showContextMenu(self): @@ -509,7 +509,7 @@ dlg.showConfigurationPageByName("trayStarterPage") dlg.exec() QApplication.processEvents() - if dlg.result() == QDialog.Accepted: + if dlg.result() == QDialog.DialogCode.Accepted: dlg.setPreferences() Preferences.syncPreferences() self.preferencesChanged()
--- a/eric6/Tools/UIPreviewer.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Tools/UIPreviewer.py Tue Mar 02 17:17:09 2021 +0100 @@ -86,16 +86,16 @@ self.styleCombo.setCurrentIndex(int(currentStyle)) styleSpacer = QSpacerItem( - 40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) + 40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum) self.styleLayout.addItem(styleSpacer) self.UIPreviewerLayout.addLayout(self.styleLayout) self.previewSV = QScrollArea(self.cw) self.previewSV.setObjectName("preview") - self.previewSV.setFrameShape(QFrame.NoFrame) - self.previewSV.setFrameShadow(QFrame.Plain) + self.previewSV.setFrameShape(QFrame.Shape.NoFrame) + self.previewSV.setFrameShadow(QFrame.Shadow.Plain) self.previewSV.setSizePolicy( - QSizePolicy.Expanding, QSizePolicy.Expanding) + QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding) self.UIPreviewerLayout.addWidget(self.previewSV) self.setCentralWidget(self.cw) @@ -434,7 +434,7 @@ @return flag indicating if event was filtered out """ if obj == self.mainWidget: - if ev.type() == QEvent.Close: + if ev.type() == QEvent.Type.Close: self.__handleCloseEvent() return True else: @@ -514,7 +514,7 @@ return settings = Preferences.Prefs.settings - printer = QPrinter(QPrinter.HighResolution) + printer = QPrinter(QPrinter.PrinterMode.HighResolution) printer.setFullPage(True) printerName = Preferences.getPrinter("UIPreviewer/printername") @@ -530,7 +530,7 @@ QPrinter.ColorMode(int(settings.value("UIPreviewer/colormode")))) printDialog = QPrintDialog(printer, self) - if printDialog.exec() == QDialog.Accepted: + if printDialog.exec() == QDialog.DialogCode.Accepted: self.statusBar().showMessage(self.tr("Printing the image...")) self.__print(printer) @@ -557,7 +557,7 @@ return settings = Preferences.Prefs.settings - printer = QPrinter(QPrinter.HighResolution) + printer = QPrinter(QPrinter.PrinterMode.HighResolution) printer.setFullPage(True) printerName = Preferences.getPrinter("UIPreviewer/printername") @@ -587,7 +587,7 @@ marginY = (printer.pageRect().y() - printer.paperRect().y()) // 2 # double the margin on bottom of page - if printer.orientation() == QPrinter.Portrait: + if printer.orientation() == QPrinter.Orientation.Portrait: width = printer.width() - marginX * 2 height = printer.height() - marginY * 3 else: @@ -596,7 +596,11 @@ height = printer.height() - marginY * 2 img = self.mainWidget.grab().toImage() self.__updateChildren(self.lastStyle) - p.drawImage(marginX, marginY, - img.scaled(width, height, - Qt.KeepAspectRatio, Qt.SmoothTransformation)) + p.drawImage( + marginX, marginY, img.scaled( + width, height, + Qt.AspectRatioMode.KeepAspectRatio, + Qt.TransformationMode.SmoothTransformation + ) + ) p.end()
--- a/eric6/UI/AuthenticationDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/UI/AuthenticationDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -37,8 +37,9 @@ self.iconLabel.setText("") self.iconLabel.setPixmap( - self.style().standardIcon(QStyle.SP_MessageBoxQuestion).pixmap( - 32, 32)) + self.style().standardIcon( + QStyle.StandardPixmap.SP_MessageBoxQuestion) + .pixmap(32, 32)) msh = self.minimumSizeHint() self.resize(max(self.width(), msh.width()), msh.height())
--- a/eric6/UI/Browser.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/UI/Browser.py Tue Mar 02 17:17:09 2021 +0100 @@ -104,7 +104,7 @@ self._activating = False - self.setContextMenuPolicy(Qt.CustomContextMenu) + self.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu) self.customContextMenuRequested.connect(self._contextMenuRequested) self.activated.connect(self._openItem) self.expanded.connect(self._resizeColumns) @@ -167,14 +167,16 @@ self.setAlternatingRowColors(True) header = self.header() - header.setSortIndicator(0, Qt.AscendingOrder) + header.setSortIndicator(0, Qt.SortOrder.AscendingOrder) header.setSortIndicatorShown(True) header.setSectionsClickable(True) self.setSortingEnabled(True) - self.setSelectionMode(QAbstractItemView.ExtendedSelection) - self.setSelectionBehavior(QAbstractItemView.SelectRows) + self.setSelectionMode( + QAbstractItemView.SelectionMode.ExtendedSelection) + self.setSelectionBehavior( + QAbstractItemView.SelectionBehavior.SelectRows) self.header().setStretchLastSection(True) self.headerSize0 = 0 @@ -382,8 +384,8 @@ if index.isValid(): self.setCurrentIndex(index) flags = QItemSelectionModel.SelectionFlags( - QItemSelectionModel.ClearAndSelect | - QItemSelectionModel.Rows) + QItemSelectionModel.SelectionFlag.ClearAndSelect | + QItemSelectionModel.SelectionFlag.Rows) self.selectionModel().select(index, flags) itm = self.model().item(index) @@ -862,7 +864,7 @@ self, self.tr("New Directory"), self.tr("Name for new directory:"), - QLineEdit.Normal) + QLineEdit.EchoMode.Normal) if ok and bool(newName): dirpath = os.path.join(dname, newName) if os.path.exists(dirpath): @@ -895,7 +897,7 @@ self, self.tr("New File"), self.tr("Name for new file:"), - QLineEdit.Normal) + QLineEdit.EchoMode.Normal) if ok and bool(fname): filepath = os.path.join(dname, fname) if os.path.exists(filepath): @@ -953,7 +955,7 @@ self.tr("Delete File"), trashMsg, [fn]) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: try: s2t(fn) except OSError as err: @@ -990,7 +992,7 @@ self.tr("Delete Directory"), trashMsg, [dn]) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: try: if s2tAvailable: send2trash(dn) @@ -1035,7 +1037,7 @@ trashMsg, sorted(fileNames) ) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: for fn in fileNames: try: s2t(fn)
--- a/eric6/UI/BrowserModel.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/UI/BrowserModel.py Tue Mar 02 17:17:09 2021 +0100 @@ -94,7 +94,7 @@ if not index.isValid(): return None - if role == Qt.DisplayRole: + if role == Qt.ItemDataRole.DisplayRole: item = index.internalPointer() if index.column() < item.columnCount(): return item.data(index.column()) @@ -105,10 +105,10 @@ # This is for the case where an item under a multi-column # parent doesn't have a value for all the columns return "" - elif role == Qt.DecorationRole: + elif role == Qt.ItemDataRole.DecorationRole: if index.column() == 0: return index.internalPointer().getIcon() - elif role == Qt.FontRole: + elif role == Qt.ItemDataRole.FontRole: item = index.internalPointer() if item.isSymlink(): font = QFont(QApplication.font("QTreeView")) @@ -125,11 +125,12 @@ @return requested flags (Qt.ItemFlags) """ if not index.isValid(): - return Qt.ItemIsEnabled + return Qt.ItemFlag.ItemIsEnabled - return Qt.ItemIsEnabled | Qt.ItemIsSelectable + return Qt.ItemFlag.ItemIsEnabled | Qt.ItemFlag.ItemIsSelectable - def headerData(self, section, orientation, role=Qt.DisplayRole): + def headerData(self, section, orientation, + role=Qt.ItemDataRole.DisplayRole): """ Public method to get the header data. @@ -138,7 +139,10 @@ @param role role of data (Qt.ItemDataRole) @return requested header data """ - if orientation == Qt.Horizontal and role == Qt.DisplayRole: + if ( + orientation == Qt.Orientation.Horizontal and + role == Qt.ItemDataRole.DisplayRole + ): if section >= self.rootItem.columnCount(): return "" else: @@ -317,7 +321,8 @@ # just ignore the situation we don't have a reference to the item return - dirFilter = QDir.Filters(QDir.AllEntries | QDir.NoDotAndDotDot) + dirFilter = QDir.Filters(QDir.Filter.AllEntries | + QDir.Filter.NoDotAndDotDot) for itm in self.watchedItems[path]: oldCnt = itm.childCount() @@ -547,7 +552,9 @@ qdir = QDir(parentItem.dirName()) - dirFilter = QDir.Filters(QDir.AllEntries | QDir.NoDotAndDotDot) + dirFilter = QDir.Filters( + QDir.Filter.AllEntries | + QDir.Filter.NoDotAndDotDot) entryInfoList = qdir.entryInfoList(dirFilter) if len(entryInfoList) > 0: if repopulate: @@ -1100,7 +1107,7 @@ """ if issubclass(other.__class__, BrowserFileItem): if Preferences.getUI("BrowsersListFoldersFirst"): - return order == Qt.AscendingOrder + return order == Qt.SortOrder.AscendingOrder return BrowserItem.lessThan(self, other, column, order) @@ -1409,16 +1416,16 @@ """ if not issubclass(other.__class__, BrowserFileItem): if Preferences.getUI("BrowsersListFoldersFirst"): - return order == Qt.DescendingOrder + return order == Qt.SortOrder.DescendingOrder if issubclass(other.__class__, BrowserFileItem): sinit = os.path.basename(self._filename).startswith('__init__.py') oinit = os.path.basename(other.fileName()).startswith( '__init__.py') if sinit and not oinit: - return order == Qt.AscendingOrder + return order == Qt.SortOrder.AscendingOrder if not sinit and oinit: - return order == Qt.DescendingOrder + return order == Qt.SortOrder.DescendingOrder return BrowserItem.lessThan(self, other, column, order) @@ -1555,13 +1562,13 @@ other.__class__, (BrowserCodingItem, BrowserClassAttributesItem) ): - return order == Qt.DescendingOrder + return order == Qt.SortOrder.DescendingOrder if ( Preferences.getUI("BrowsersListContentsByOccurrence") and column == 0 ): - if order == Qt.AscendingOrder: + if order == Qt.SortOrder.AscendingOrder: return self.lineno() < other.lineno() else: return self.lineno() > other.lineno() @@ -1680,17 +1687,17 @@ """ if issubclass(other.__class__, BrowserMethodItem): if self._name.startswith('__init__'): - return order == Qt.AscendingOrder + return order == Qt.SortOrder.AscendingOrder if other._name.startswith('__init__'): - return order == Qt.DescendingOrder + return order == Qt.SortOrder.DescendingOrder elif issubclass(other.__class__, BrowserClassAttributesItem): - return order == Qt.DescendingOrder + return order == Qt.SortOrder.DescendingOrder if ( Preferences.getUI("BrowsersListContentsByOccurrence") and column == 0 ): - if order == Qt.AscendingOrder: + if order == Qt.SortOrder.AscendingOrder: return self.lineno() < other.lineno() else: return self.lineno() > other.lineno() @@ -1765,12 +1772,12 @@ @return true, if this item is less than other (boolean) """ if issubclass(other.__class__, BrowserCodingItem): - return order == Qt.DescendingOrder + return order == Qt.SortOrder.DescendingOrder elif issubclass( other.__class__, (BrowserClassItem, BrowserMethodItem) ): - return order == Qt.AscendingOrder + return order == Qt.SortOrder.AscendingOrder return BrowserItem.lessThan(self, other, column, order) @@ -1854,7 +1861,7 @@ Preferences.getUI("BrowsersListContentsByOccurrence") and column == 0 ): - if order == Qt.AscendingOrder: + if order == Qt.SortOrder.AscendingOrder: return self.lineno() < other.lineno() else: return self.lineno() > other.lineno() @@ -1921,7 +1928,7 @@ other.__class__, (BrowserClassItem, BrowserClassAttributesItem, BrowserImportItem) ): - return order == Qt.AscendingOrder + return order == Qt.SortOrder.AscendingOrder return BrowserItem.lessThan(self, other, column, order) @@ -1955,7 +1962,7 @@ other.__class__, (BrowserClassItem, BrowserClassAttributesItem) ): - return order == Qt.AscendingOrder + return order == Qt.SortOrder.AscendingOrder return BrowserItem.lessThan(self, other, column, order) @@ -2024,7 +2031,7 @@ Preferences.getUI("BrowsersListContentsByOccurrence") and column == 0 ): - if order == Qt.AscendingOrder: + if order == Qt.SortOrder.AscendingOrder: return self.lineno() < other.lineno() else: return self.lineno() > other.lineno()
--- a/eric6/UI/CodeDocumentationViewer.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/UI/CodeDocumentationViewer.py Tue Mar 02 17:17:09 2021 +0100 @@ -86,7 +86,8 @@ self.__contents.page().linkHovered.connect(self.__showLink) try: self.__contents.settings().setAttribute( - QWebEngineSettings.FocusOnNavigationEnabled, False) + QWebEngineSettings.WebAttribute.FocusOnNavigationEnabled, + False) except AttributeError: # pre Qt 5.8 pass @@ -96,19 +97,21 @@ self.__contents.setOpenExternalLinks(True) self.__viewerType = "QTextEdit" - sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding) + sizePolicy = QSizePolicy(QSizePolicy.Policy.Preferred, + QSizePolicy.Policy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.__contents.sizePolicy().hasHeightForWidth()) self.__contents.setSizePolicy(sizePolicy) - self.__contents.setContextMenuPolicy(Qt.NoContextMenu) + self.__contents.setContextMenuPolicy( + Qt.ContextMenuPolicy.NoContextMenu) if self.__viewerType != "QTextEdit": self.__contents.setUrl(QUrl("about:blank")) self.__verticalLayout.addWidget(self.__contents) self.__searchWidget = E5TextEditSearchWidget(self, False) - self.__searchWidget.setFocusPolicy(Qt.WheelFocus) + self.__searchWidget.setFocusPolicy(Qt.FocusPolicy.WheelFocus) self.__searchWidget.setObjectName("searchWidget") self.__verticalLayout.addWidget(self.__searchWidget) @@ -206,17 +209,20 @@ self.label = QLabel(self) self.label.setObjectName("label") self.label.setText(self.tr("Code Info Provider:")) - self.label.setAlignment(Qt.AlignRight | Qt.AlignVCenter) + self.label.setAlignment(Qt.AlignmentFlag.AlignRight | + Qt.AlignmentFlag.AlignVCenter) self.horizontalLayout1.addWidget(self.label) self.providerComboBox = QComboBox(self) - sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed) + sizePolicy = QSizePolicy( + QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.providerComboBox.sizePolicy().hasHeightForWidth()) self.providerComboBox.setSizePolicy(sizePolicy) - self.providerComboBox.setSizeAdjustPolicy(QComboBox.AdjustToContents) + self.providerComboBox.setSizeAdjustPolicy( + QComboBox.SizeAdjustPolicy.AdjustToContents) self.providerComboBox.setObjectName("providerComboBox") self.providerComboBox.setToolTip( self.tr("Select the code info provider"))
--- a/eric6/UI/CompareDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/UI/CompareDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -105,7 +105,7 @@ self.file2Picker.setMode(E5PathPickerModes.OpenFileMode) self.diffButton = self.buttonBox.addButton( - self.tr("Compare"), QDialogButtonBox.ActionRole) + self.tr("Compare"), QDialogButtonBox.ButtonRole.ActionRole) self.diffButton.setToolTip( self.tr("Press to perform the comparison of the two files")) self.diffButton.setEnabled(False) @@ -200,7 +200,7 @@ @param interLine flag indicating interline changes (boolean) """ tc = pane.textCursor() - tc.movePosition(QTextCursor.End) + tc.movePosition(QTextCursor.MoveOperation.End) pane.setTextCursor(tc) pane.setCurrentCharFormat(charFormat) if interLine: @@ -210,12 +210,12 @@ if txt.count('\1'): txt1, txt = txt.split('\1', 1) tc = pane.textCursor() - tc.movePosition(QTextCursor.End) + tc.movePosition(QTextCursor.MoveOperation.End) pane.setTextCursor(tc) pane.setCurrentCharFormat(charFormat) pane.insertPlainText(txt1) tc = pane.textCursor() - tc.movePosition(QTextCursor.End) + tc.movePosition(QTextCursor.MoveOperation.End) pane.setTextCursor(tc) pane.setCurrentCharFormat(self.cNormalFormat) pane.insertPlainText(txt) @@ -489,7 +489,7 @@ @param event reference to the event object (QEvent) @return flag indicating, whether the event was handled (boolean) """ - if event.type() == QEvent.Close: + if event.type() == QEvent.Type.Close: QApplication.exit() return True
--- a/eric6/UI/DeleteFilesConfirmationDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/UI/DeleteFilesConfirmationDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -29,9 +29,12 @@ self.setupUi(self) self.setModal(True) - self.buttonBox.button(QDialogButtonBox.Yes).setAutoDefault(False) - self.buttonBox.button(QDialogButtonBox.No).setDefault(True) - self.buttonBox.button(QDialogButtonBox.No).setFocus() + self.buttonBox.button( + QDialogButtonBox.StandardButton.Yes).setAutoDefault(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.No).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.No).setFocus() self.setWindowTitle(caption) self.message.setText(message) @@ -44,7 +47,11 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Yes): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Yes + ): self.accept() - elif button == self.buttonBox.button(QDialogButtonBox.No): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.No + ): self.reject()
--- a/eric6/UI/DiffDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/UI/DiffDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -44,11 +44,11 @@ self.file2Picker.setMode(E5PathPickerModes.OpenFileMode) self.diffButton = self.buttonBox.addButton( - self.tr("Compare"), QDialogButtonBox.ActionRole) + self.tr("Compare"), QDialogButtonBox.ButtonRole.ActionRole) self.diffButton.setToolTip( self.tr("Press to perform the comparison of the two files")) self.saveButton = self.buttonBox.addButton( - self.tr("Save"), QDialogButtonBox.ActionRole) + self.tr("Save"), QDialogButtonBox.ButtonRole.ActionRole) self.saveButton.setToolTip( self.tr("Save the output to a patch file")) self.diffButton.setEnabled(False) @@ -200,7 +200,7 @@ filemtime1, filemtime2) tc = self.contents.textCursor() - tc.movePosition(QTextCursor.Start) + tc.movePosition(QTextCursor.MoveOperation.Start) self.contents.setTextCursor(tc) self.contents.ensureCursorVisible() @@ -213,7 +213,7 @@ @param txt text to insert (string) """ tc = self.contents.textCursor() - tc.movePosition(QTextCursor.End) + tc.movePosition(QTextCursor.MoveOperation.End) self.contents.setTextCursor(tc) self.contents.insertPlainText(txt) @@ -305,7 +305,7 @@ @param event reference to the event object (QEvent) @return flag indicating, whether the event was handled (boolean) """ - if event.type() == QEvent.Close: + if event.type() == QEvent.Type.Close: QApplication.exit() return True
--- a/eric6/UI/EmailDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/UI/EmailDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -54,9 +54,9 @@ """ super(EmailDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) - self.message.setWordWrapMode(QTextOption.WordWrap) + self.message.setWordWrapMode(QTextOption.WrapMode.WordWrap) self.__mode = mode if self.__mode == "feature": @@ -73,12 +73,13 @@ self.__toAddress = BugAddress self.sendButton = self.buttonBox.addButton( - self.tr("Send"), QDialogButtonBox.ActionRole) + self.tr("Send"), QDialogButtonBox.ButtonRole.ActionRole) self.sendButton.setEnabled(False) self.sendButton.setDefault(True) self.googleHelpButton = self.buttonBox.addButton( - self.tr("Google Mail API Help"), QDialogButtonBox.HelpRole) + self.tr("Google Mail API Help"), + QDialogButtonBox.ButtonRole.HelpRole) height = self.height() self.mainSplitter.setSizes([int(0.7 * height), int(0.3 * height)]) @@ -86,7 +87,7 @@ self.attachments.headerItem().setText( self.attachments.columnCount(), "") self.attachments.header().setSectionResizeMode( - QHeaderView.Interactive) + QHeaderView.ResizeMode.Interactive) sig = Preferences.getUser("Signature") if sig: @@ -107,7 +108,7 @@ @param ev key event (QKeyEvent) """ - if ev.key() == Qt.Key_Escape: + if ev.key() == Qt.Key.Key_Escape: res = E5MessageBox.yesNo( self, self.tr("Close dialog"), @@ -322,7 +323,7 @@ self, self.tr("Mail Server Password"), self.tr("Enter your mail server password"), - QLineEdit.Password) + QLineEdit.EchoMode.Password) if not ok: # abort return False @@ -438,7 +439,8 @@ if not mimeType: mimeType = "application/octet-stream" QTreeWidgetItem(self.attachments, [fname, mimeType]) - self.attachments.header().resizeSections(QHeaderView.ResizeToContents) + self.attachments.header().resizeSections( + QHeaderView.ResizeMode.ResizeToContents) self.attachments.header().setStretchLastSection(True) if deleteFile:
--- a/eric6/UI/ErrorLogDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/UI/ErrorLogDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -30,10 +30,11 @@ """ super(ErrorLogDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) pixmap = ( - self.style().standardIcon(QStyle.SP_MessageBoxQuestion) + self.style().standardIcon( + QStyle.StandardPixmap.SP_MessageBoxQuestion) .pixmap(32, 32) ) self.icon.setPixmap(pixmap)
--- a/eric6/UI/FindFileDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/UI/FindFileDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -41,11 +41,11 @@ sourceFile = pyqtSignal(str, int, str, int, int) designerFile = pyqtSignal(str) - lineRole = Qt.UserRole + 1 - startRole = Qt.UserRole + 2 - endRole = Qt.UserRole + 3 - replaceRole = Qt.UserRole + 4 - md5Role = Qt.UserRole + 5 + lineRole = Qt.ItemDataRole.UserRole + 1 + startRole = Qt.ItemDataRole.UserRole + 2 + endRole = Qt.ItemDataRole.UserRole + 3 + replaceRole = Qt.ItemDataRole.UserRole + 4 + md5Role = Qt.ItemDataRole.UserRole + 5 def __init__(self, project, replaceMode=False, parent=None): """ @@ -57,21 +57,21 @@ """ super(FindFileDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) self.dirPicker.setMode(E5PathPickerModes.DirectoryMode) - self.dirPicker.setInsertPolicy(QComboBox.InsertAtTop) + self.dirPicker.setInsertPolicy(QComboBox.InsertPolicy.InsertAtTop) self.dirPicker.setSizeAdjustPolicy( - QComboBox.AdjustToMinimumContentsLength) + QComboBox.SizeAdjustPolicy.AdjustToContents) self.__replaceMode = replaceMode self.stopButton = self.buttonBox.addButton( - self.tr("Stop"), QDialogButtonBox.ActionRole) + self.tr("Stop"), QDialogButtonBox.ButtonRole.ActionRole) self.stopButton.setEnabled(False) self.findButton = self.buttonBox.addButton( - self.tr("Find"), QDialogButtonBox.ActionRole) + self.tr("Find"), QDialogButtonBox.ButtonRole.ActionRole) self.findButton.setEnabled(False) self.findButton.setDefault(True) @@ -109,7 +109,7 @@ self.project = project self.findList.headerItem().setText(self.findList.columnCount(), "") - self.findList.header().setSortIndicator(0, Qt.AscendingOrder) + self.findList.header().setSortIndicator(0, Qt.SortOrder.AscendingOrder) self.__section0Size = self.findList.header().sectionSize(0) self.findList.setExpandsOnDoubleClick(False) if self.__replaceMode: @@ -136,7 +136,7 @@ self.__lastFileItem = None self.__populating = False - self.setContextMenuPolicy(Qt.CustomContextMenu) + self.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu) self.customContextMenuRequested.connect(self.__contextMenuRequested) def __createItem(self, file, line, text, start, end, replTxt="", md5=""): @@ -159,20 +159,22 @@ if self.__replaceMode: self.__lastFileItem.setFlags( self.__lastFileItem.flags() | - Qt.ItemFlags(Qt.ItemIsUserCheckable | Qt.ItemIsTristate)) + Qt.ItemFlags(Qt.ItemFlag.ItemIsUserCheckable | + Qt.ItemFlag.ItemIsTristate)) self.__lastFileItem.setData(0, self.md5Role, md5) itm = QTreeWidgetItem(self.__lastFileItem) - itm.setTextAlignment(0, Qt.AlignRight) - itm.setData(0, Qt.DisplayRole, line) - itm.setData(1, Qt.DisplayRole, text) + itm.setTextAlignment(0, Qt.AlignmentFlag.AlignRight) + itm.setData(0, Qt.ItemDataRole.DisplayRole, line) + itm.setData(1, Qt.ItemDataRole.DisplayRole, text) itm.setData(0, self.lineRole, line) itm.setData(0, self.startRole, start) itm.setData(0, self.endRole, end) itm.setData(0, self.replaceRole, replTxt) if self.__replaceMode: - itm.setFlags(itm.flags() | Qt.ItemFlags(Qt.ItemIsUserCheckable)) - itm.setCheckState(0, Qt.Checked) + itm.setFlags(itm.flags() | + Qt.ItemFlags(Qt.ItemFlag.ItemIsUserCheckable)) + itm.setCheckState(0, Qt.CheckState.Checked) self.replaceButton.setEnabled(True) def show(self, txt=""): @@ -275,7 +277,8 @@ self.filterEdit.text() == "") ): self.findButton.setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) else: self.findButton.setEnabled(True) self.findButton.setDefault(True) @@ -678,7 +681,8 @@ progress = 0 for index in range(self.findList.topLevelItemCount()): itm = self.findList.topLevelItem(index) - if itm.checkState(0) in [Qt.PartiallyChecked, Qt.Checked]: + if itm.checkState(0) in [Qt.CheckState.PartiallyChecked, + Qt.CheckState.Checked]: file = itm.text(0) origHash = itm.data(0, self.md5Role) @@ -727,7 +731,7 @@ # replace the lines authorized by the user for cindex in range(itm.childCount()): citm = itm.child(cindex) - if citm.checkState(0) == Qt.Checked: + if citm.checkState(0) == Qt.CheckState.Checked: line = citm.data(0, self.lineRole) rline = citm.data(0, self.replaceRole) lines[line - 1] = rline
--- a/eric6/UI/FindFileNameDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/UI/FindFileNameDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -52,12 +52,14 @@ self.fileList.headerItem().setText(self.fileList.columnCount(), "") self.stopButton = self.buttonBox.addButton( - self.tr("Stop"), QDialogButtonBox.ActionRole) + self.tr("Stop"), QDialogButtonBox.ButtonRole.ActionRole) self.stopButton.setToolTip(self.tr("Press to stop the search")) self.stopButton.setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Open).setToolTip( - self.tr("Opens the selected file")) - self.buttonBox.button(QDialogButtonBox.Open).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Open).setToolTip( + self.tr("Opens the selected file")) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Open).setEnabled(False) self.project = project self.extsepLabel.setText(os.extsep) @@ -72,7 +74,9 @@ """ if button == self.stopButton: self.shouldStop = True - elif button == self.buttonBox.button(QDialogButtonBox.Open): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Open + ): self.__openFile() def __openFile(self, itm=None): @@ -150,7 +154,8 @@ del locations self.stopButton.setEnabled(False) - self.fileList.header().resizeSections(QHeaderView.ResizeToContents) + self.fileList.header().resizeSections( + QHeaderView.ResizeMode.ResizeToContents) self.fileList.header().setStretchLastSection(True) if found: @@ -239,7 +244,7 @@ @param current current item (QTreeWidgetItem) @param previous prevoius current item (QTreeWidgetItem) """ - self.buttonBox.button(QDialogButtonBox.Open).setEnabled( + self.buttonBox.button(QDialogButtonBox.StandardButton.Open).setEnabled( current is not None) def show(self):
--- a/eric6/UI/InstallInfoDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/UI/InstallInfoDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -36,10 +36,11 @@ self.setupUi(self) self.__deleteButton = self.buttonBox.addButton( - self.tr("Delete Info"), QDialogButtonBox.ActionRole) + self.tr("Delete Info"), QDialogButtonBox.ButtonRole.ActionRole) self.__deleteButton.clicked.connect(self.on_deleteButton_clicked) self.__updateButton = self.buttonBox.addButton( - self.tr("Upgrade Instructions"), QDialogButtonBox.ActionRole) + self.tr("Upgrade Instructions"), + QDialogButtonBox.ButtonRole.ActionRole) self.__updateButton.clicked.connect(self.on_updateButton_clicked) self.__edited = False
--- a/eric6/UI/LogView.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/UI/LogView.py Tue Mar 02 17:17:09 2021 +0100 @@ -41,7 +41,7 @@ from .SearchWidget import SearchWidget self.__searchWidget = SearchWidget(self.__logViewer, self) self.__searchWidget.setSizePolicy( - QSizePolicy.Fixed, QSizePolicy.Preferred) + QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Preferred) self.__searchWidget.hide() self.__layout = QHBoxLayout(self) @@ -106,7 +106,7 @@ """ super(LogViewerEdit, self).__init__(parent) self.setAcceptRichText(False) - self.setLineWrapMode(QTextEdit.NoWrap) + self.setLineWrapMode(QTextEdit.LineWrapMode.NoWrap) self.setReadOnly(True) self.__mainWindow = parent @@ -123,7 +123,7 @@ self.__menu.addSeparator() self.__menu.addAction(self.tr("Configure..."), self.__configure) - self.setContextMenuPolicy(Qt.CustomContextMenu) + self.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu) self.customContextMenuRequested.connect(self.__handleShowContextMenu) self.cNormalFormat = self.currentCharFormat() @@ -152,7 +152,7 @@ @param isErrorMessage flag indicating to insert error text (boolean) """ tc = self.textCursor() - tc.movePosition(QTextCursor.End) + tc.movePosition(QTextCursor.MoveOperation.End) self.setTextCursor(tc) if isErrorMessage: self.setCurrentCharFormat(self.cErrorFormat) @@ -253,15 +253,15 @@ self.__lastSearch = (txt, caseSensitive, wholeWord, regexp) flags = QTextDocument.FindFlags() if caseSensitive: - flags |= QTextDocument.FindCaseSensitively + flags |= QTextDocument.FindFlag.FindCaseSensitively if wholeWord: - flags |= QTextDocument.FindWholeWords + flags |= QTextDocument.FindFlag.FindWholeWords if regexp: ok = self.find(QRegularExpression( txt, - QRegularExpression.NoPatternOption + QRegularExpression.PatternOption.NoPatternOption if caseSensitive - else QRegularExpression.CaseInsensitiveOption), + else QRegularExpression.PatternOption.CaseInsensitiveOption), flags ) else: @@ -284,17 +284,17 @@ @type bool """ self.__lastSearch = (txt, caseSensitive, wholeWord, regexp) - flags = QTextDocument.FindFlags(QTextDocument.FindBackward) + flags = QTextDocument.FindFlags(QTextDocument.FindFlag.FindBackward) if caseSensitive: - flags |= QTextDocument.FindCaseSensitively + flags |= QTextDocument.FindFlag.FindCaseSensitively if wholeWord: - flags |= QTextDocument.FindWholeWords + flags |= QTextDocument.FindFlag.FindWholeWords if regexp: ok = self.find(QRegularExpression( txt, - QRegularExpression.NoPatternOption + QRegularExpression.PatternOption.NoPatternOption if caseSensitive - else QRegularExpression.CaseInsensitiveOption), + else QRegularExpression.PatternOption.CaseInsensitiveOption), flags ) else: @@ -307,26 +307,29 @@ @param evt key press event (QKeyEvent) """ - if evt.modifiers() == Qt.ControlModifier: - if evt.key() == Qt.Key_F: + if evt.modifiers() == Qt.KeyboardModifier.ControlModifier: + if evt.key() == Qt.Key.Key_F: self.__find() evt.accept() return - elif evt.key() == Qt.Key_C: + elif evt.key() == Qt.Key.Key_C: self.copy() evt.accept() return - elif evt.key() == Qt.Key_A: + elif evt.key() == Qt.Key.Key_A: self.selectAll() evt.accept() return - elif evt.modifiers() == Qt.NoModifier: - if evt.key() == Qt.Key_F3 and self.__lastSearch: + elif evt.modifiers() == Qt.KeyboardModifier.NoModifier: + if evt.key() == Qt.Key.Key_F3 and self.__lastSearch: self.searchNext(*self.__lastSearch) evt.accept() return - elif evt.modifiers() == Qt.ShiftModifier and self.__lastSearch: - if evt.key() == Qt.Key_F3 and self.__lastSearch: + elif ( + evt.modifiers() == Qt.KeyboardModifier.ShiftModifier and + self.__lastSearch + ): + if evt.key() == Qt.Key.Key_F3 and self.__lastSearch: self.searchPrev(*self.__lastSearch) evt.accept() return
--- a/eric6/UI/NotificationWidget.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/UI/NotificationWidget.py Tue Mar 02 17:17:09 2021 +0100 @@ -55,7 +55,9 @@ self.setupUi(self) self.layout().setAlignment( - self.verticalLayout, Qt.AlignLeft | Qt.AlignVCenter) + self.verticalLayout, + Qt.AlignmentFlag.AlignLeft | Qt.AlignmentFlag.AlignVCenter + ) self.setStyleSheet(NotificationFrame.getStyleSheet(kind)) @@ -140,17 +142,17 @@ self.__settingPosition = setPosition flags = ( - Qt.Tool | - Qt.FramelessWindowHint | - Qt.WindowStaysOnTopHint | - Qt.X11BypassWindowManagerHint + Qt.WindowType.Tool | + Qt.WindowType.FramelessWindowHint | + Qt.WindowType.WindowStaysOnTopHint | + Qt.WindowType.X11BypassWindowManagerHint ) if Globals.isWindowsPlatform(): - flags |= Qt.ToolTip + flags |= Qt.WindowType.ToolTip self.setWindowFlags(flags) if self.__settingPosition: - self.setCursor(Qt.OpenHandCursor) + self.setCursor(Qt.CursorShape.OpenHandCursor) def showNotification(self, icon, heading, text, kind=NotificationTypes.Information, timeout=0): @@ -259,11 +261,11 @@ self.__removeNotification(clickedNotification) return - if evt.button() == Qt.LeftButton: + if evt.button() == Qt.MouseButton.LeftButton: self.__dragPosition = ( evt.globalPos() - self.frameGeometry().topLeft() ) - self.setCursor(Qt.ClosedHandCursor) + self.setCursor(Qt.CursorShape.ClosedHandCursor) evt.accept() def mouseReleaseEvent(self, evt): @@ -272,8 +274,11 @@ @param evt reference to the mouse event (QMouseEvent) """ - if self.__settingPosition and evt.button() == Qt.LeftButton: - self.setCursor(Qt.OpenHandCursor) + if ( + self.__settingPosition and + evt.button() == Qt.MouseButton.LeftButton + ): + self.setCursor(Qt.CursorShape.OpenHandCursor) def mouseMoveEvent(self, evt): """ @@ -281,6 +286,6 @@ @param evt reference to the mouse event (QMouseEvent) """ - if evt.buttons() & Qt.LeftButton: + if evt.buttons() & Qt.MouseButton.LeftButton: self.move(evt.globalPos() - self.__dragPosition) evt.accept()
--- a/eric6/UI/NumbersWidget.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/UI/NumbersWidget.py Tue Mar 02 17:17:09 2021 +0100 @@ -50,7 +50,7 @@ """ return self.__bits - def data(self, index, role=Qt.DisplayRole): + def data(self, index, role=Qt.ItemDataRole.DisplayRole): """ Public method to get data from the model. @@ -58,10 +58,10 @@ @param role role of the data to retrieve (integer) @return requested data """ - if role == Qt.CheckStateRole: + if role == Qt.ItemDataRole.CheckStateRole: return (self.__value >> (self.__bits - index.column() - 1)) & 1 - elif role == Qt.DisplayRole: + elif role == Qt.ItemDataRole.DisplayRole: return "" return None @@ -73,18 +73,26 @@ @param index index to get flags for (QModelIndex) @return flags (Qt.ItemFlags) """ - return Qt.ItemIsUserCheckable | Qt.ItemIsEnabled | Qt.ItemIsSelectable + return ( + Qt.ItemFlag.ItemIsUserCheckable | + Qt.ItemFlag.ItemIsEnabled | + Qt.ItemFlag.ItemIsSelectable + ) - def headerData(self, section, orientation, role=Qt.DisplayRole): + def headerData(self, section, orientation, + role=Qt.ItemDataRole.DisplayRole): """ Public method to get header data from the model. @param section section number (integer) @param orientation orientation (Qt.Orientation) - @param role role of the data to retrieve (integer) + @param role role of the data to retrieve (Qt.ItemDataRole) @return requested data """ - if orientation == Qt.Horizontal and role == Qt.DisplayRole: + if ( + orientation == Qt.Orientation.Horizontal and + role == Qt.ItemDataRole.DisplayRole + ): return str(self.__bits - section - 1) return QAbstractTableModel.headerData(self, section, orientation, role) @@ -129,7 +137,7 @@ """ return self.__value - def setData(self, index, value, role=Qt.EditRole): + def setData(self, index, value, role=Qt.ItemDataRole.EditRole): """ Public method to set the data of a node cell. @@ -138,9 +146,11 @@ @param role role of the data (integer) @return flag indicating success (boolean) """ - if role == Qt.CheckStateRole: - if value == Qt.Checked and not self.data(index, Qt.CheckStateRole): - # that seems like a hack; Qt 4.6 always sends Qt.Checked + if role == Qt.ItemDataRole.CheckStateRole: + if ( + value == Qt.CheckState.Checked and + not self.data(index, Qt.ItemDataRole.CheckStateRole) + ): self.__value |= (1 << self.__bits - index.column() - 1) else: self.__value &= ~(1 << self.__bits - index.column() - 1) @@ -199,7 +209,7 @@ self.__model = BinaryModel(self) self.binTable.setModel(self.__model) self.binTable.horizontalHeader().setSectionResizeMode( - QHeaderView.ResizeToContents) + QHeaderView.ResizeMode.ResizeToContents) self.__model.setBitsAndValue(self.__bytes * 8, self.__input) self.__model.dataChanged.connect(self.__binModelDataChanged)
--- a/eric6/UI/PixmapCache.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/UI/PixmapCache.py Tue Mar 02 17:17:09 2021 +0100 @@ -169,7 +169,7 @@ pixmaps.append(pix) if pixmaps: pix = QPixmap(len(pixmaps) * width, height) - pix.fill(Qt.transparent) + pix.fill(Qt.GlobalColor.transparent) painter = QPainter(pix) x = 0 for pixmap in pixmaps:
--- a/eric6/UI/Previewers/PreviewerHTML.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/UI/Previewers/PreviewerHTML.py Tue Mar 02 17:17:09 2021 +0100 @@ -43,7 +43,8 @@ self.titleLabel = QLabel(self) self.titleLabel.setWordWrap(True) - self.titleLabel.setTextInteractionFlags(Qt.NoTextInteraction) + self.titleLabel.setTextInteractionFlags( + Qt.TextInteractionFlag.NoTextInteraction) self.__layout.addWidget(self.titleLabel) self.__previewAvailable = True @@ -57,17 +58,19 @@ self.titleLabel.setText(self.tr( "<b>HTML Preview is not available!<br/>" "Install PyQtWebEngine.</b>")) - self.titleLabel.setAlignment(Qt.AlignHCenter) + self.titleLabel.setAlignment(Qt.AlignmentFlag.AlignHCenter) self.__layout.addStretch() return - sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding) + sizePolicy = QSizePolicy(QSizePolicy.Policy.Preferred, + QSizePolicy.Policy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.previewView.sizePolicy().hasHeightForWidth()) self.previewView.setSizePolicy(sizePolicy) - self.previewView.setContextMenuPolicy(Qt.NoContextMenu) + self.previewView.setContextMenuPolicy( + Qt.ContextMenuPolicy.NoContextMenu) self.previewView.setUrl(QUrl("about:blank")) self.__layout.addWidget(self.previewView) @@ -381,7 +384,7 @@ self.__markdownHtmlFormat = markdownHtmlFormat self.__restDocutilsHtmlFormat = restDocutilsHtmlFormat if not self.isRunning(): - self.start(QThread.LowPriority) + self.start(QThread.Priority.LowPriority) def run(self): """
--- a/eric6/UI/Previewers/PreviewerQSS.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/UI/Previewers/PreviewerQSS.py Tue Mar 02 17:17:09 2021 +0100 @@ -45,9 +45,9 @@ # tree and table widgets self.tree.header().setSectionResizeMode( - QHeaderView.ResizeToContents) + QHeaderView.ResizeMode.ResizeToContents) self.table.horizontalHeader().setSectionResizeMode( - QHeaderView.ResizeToContents) + QHeaderView.ResizeMode.ResizeToContents) self.tree.topLevelItem(0).setExpanded(True) # icon list widget
--- a/eric6/UI/PythonAstViewer.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/UI/PythonAstViewer.py Tue Mar 02 17:17:09 2021 +0100 @@ -28,10 +28,10 @@ Class implementing a widget to visualize the Python AST for some Python sources. """ - StartLineRole = Qt.UserRole - StartIndexRole = Qt.UserRole + 1 - EndLineRole = Qt.UserRole + 2 - EndIndexRole = Qt.UserRole + 3 + StartLineRole = Qt.ItemDataRole.UserRole + StartIndexRole = Qt.ItemDataRole.UserRole + 1 + EndLineRole = Qt.ItemDataRole.UserRole + 2 + EndIndexRole = Qt.ItemDataRole.UserRole + 3 def __init__(self, viewmanager, parent=None): """ @@ -59,8 +59,10 @@ self.__astWidget.setHeaderLabels([self.tr("Node"), self.tr("Code Range")]) self.__astWidget.setSortingEnabled(False) - self.__astWidget.setSelectionBehavior(QAbstractItemView.SelectRows) - self.__astWidget.setSelectionMode(QAbstractItemView.SingleSelection) + self.__astWidget.setSelectionBehavior( + QAbstractItemView.SelectionBehavior.SelectRows) + self.__astWidget.setSelectionMode( + QAbstractItemView.SelectionMode.SingleSelection) self.__astWidget.setAlternatingRowColors(True) self.__errorColor = QBrush( @@ -107,7 +109,7 @@ @param buttons mouse buttons that were double clicked @type Qt.MouseButtons """ - if editor is self.__editor and buttons == Qt.LeftButton: + if editor is self.__editor and buttons == Qt.MouseButton.LeftButton: if editor.isModified(): # reload the source QTimer.singleShot(0, self.__loadAST) @@ -489,14 +491,14 @@ self.__astWidget.topLevelItem(0), selection) if itm: self.__astWidget.scrollToItem( - itm, QAbstractItemView.PositionAtCenter) + itm, QAbstractItemView.ScrollHint.PositionAtCenter) itm.setSelected(True) def __grabFocus(self): """ Private method to grab the input focus. """ - self.__astWidget.setFocus(Qt.OtherFocusReason) + self.__astWidget.setFocus(Qt.FocusReason.OtherFocusReason) @pyqtSlot(QTreeWidgetItem, int) def __astItemClicked(self, itm, column):
--- a/eric6/UI/PythonDisViewer.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/UI/PythonDisViewer.py Tue Mar 02 17:17:09 2021 +0100 @@ -41,9 +41,9 @@ Class implementing a widget to visualize the Python Disassembly for some Python sources. """ - StartLineRole = Qt.UserRole - EndLineRole = Qt.UserRole + 1 - CodeInfoRole = Qt.UserRole + 2 + StartLineRole = Qt.ItemDataRole.UserRole + EndLineRole = Qt.ItemDataRole.UserRole + 1 + CodeInfoRole = Qt.ItemDataRole.UserRole + 2 def __init__(self, viewmanager, mode=PythonDisViewerModes.SourceDisassemblyMode, @@ -360,7 +360,7 @@ itm = QTreeWidgetItem(parent, fields) for col in (0, 1, 3): - itm.setTextAlignment(col, Qt.AlignRight) + itm.setTextAlignment(col, Qt.AlignmentFlag.AlignRight) # set font to indicate current instruction and jump target font = itm.font(0) if instr.offset == lasti: @@ -553,11 +553,14 @@ if lasti: lastInstructions = self.disWidget.findItems( "{0:d}".format(lasti), - Qt.MatchFixedString | Qt.MatchRecursive, 1) + Qt.MatchFlag.MatchFixedString | + Qt.MatchFlag.MatchRecursive, + 1 + ) if lastInstructions: self.disWidget.scrollToItem( lastInstructions[0], - QAbstractItemView.PositionAtCenter) + QAbstractItemView.ScrollHint.PositionAtCenter) if "codeinfo" in disassembly: self.__showCodeInfoData(disassembly["codeinfo"]) @@ -609,7 +612,7 @@ if child.data(0, self.StartLineRole) == lineno: self.disWidget.scrollToItem( - child, QAbstractItemView.PositionAtCenter) + child, QAbstractItemView.ScrollHint.PositionAtCenter) def __selectItemForEditorLine(self): """ @@ -802,7 +805,7 @@ for index, value in enumerate(infoList): itm = QTreeWidgetItem(parent, [str(index), str(value)]) - itm.setTextAlignment(0, Qt.AlignRight) + itm.setTextAlignment(0, Qt.AlignmentFlag.AlignRight) self.codeInfoWidget.clear()
--- a/eric6/UI/SearchWidget.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/UI/SearchWidget.py Tue Mar 02 17:17:09 2021 +0100 @@ -52,13 +52,15 @@ if not showLine: if spacer: spacerItem = QSpacerItem( - 20, 1, QSizePolicy.Minimum, QSizePolicy.Expanding) + 20, 1, + QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding + ) self.__ui.verticalLayout.addItem(spacerItem) else: # change the size policy of the search combo if the spacer is # not wanted, i.e. it is below the to be searched widget sizePolicy = self.__ui.findtextCombo.sizePolicy() - sizePolicy.setHorizontalPolicy(QSizePolicy.Expanding) + sizePolicy.setHorizontalPolicy(QSizePolicy.Policy.Expanding) self.__ui.findtextCombo.setSizePolicy(sizePolicy) self.__mainWindow = mainWindow @@ -93,8 +95,8 @@ @param event reference to the key press event (QKeyEvent) """ - if event.key() == Qt.Key_Escape: - self.__mainWindow.setFocus(Qt.ActiveWindowFocusReason) + if event.key() == Qt.Key.Key_Escape: + self.__mainWindow.setFocus(Qt.FocusReason.ActiveWindowFocusReason) event.accept() self.close()
--- a/eric6/UI/SplashScreen.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/UI/SplashScreen.py Tue Mar 02 17:17:09 2021 +0100 @@ -28,7 +28,10 @@ ericPic = QPixmap( os.path.join(getConfig('ericPixDir'), 'ericSplash.png')) self.labelAlignment = Qt.Alignment( - Qt.AlignBottom | Qt.AlignRight | Qt.AlignAbsolute) + Qt.AlignmentFlag.AlignBottom | + Qt.AlignmentFlag.AlignRight | + Qt.AlignmentFlag.AlignAbsolute + ) super(SplashScreen, self).__init__(ericPic) self.show() QApplication.flush() @@ -41,7 +44,7 @@ """ logging.debug(msg) super(SplashScreen, self).showMessage( - msg, self.labelAlignment, QColor(Qt.white)) + msg, self.labelAlignment, QColor(Qt.GlobalColor.white)) QApplication.processEvents() def clearMessage(self):
--- a/eric6/UI/SymbolsWidget.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/UI/SymbolsWidget.py Tue Mar 02 17:17:09 2021 +0100 @@ -330,21 +330,25 @@ self.__currentTableIndex = index self.endResetModel() - def headerData(self, section, orientation, role=Qt.DisplayRole): + def headerData(self, section, orientation, + role=Qt.ItemDataRole.DisplayRole): """ Public method to get header data from the model. @param section section number (integer) @param orientation orientation (Qt.Orientation) - @param role role of the data to retrieve (integer) + @param role role of the data to retrieve (Qt.ItemDataRole) @return requested data """ - if orientation == Qt.Horizontal and role == Qt.DisplayRole: + if ( + orientation == Qt.Orientation.Horizontal and + role == Qt.ItemDataRole.DisplayRole + ): return self.__headerData[section] return QAbstractTableModel.headerData(self, section, orientation, role) - def data(self, index, role=Qt.DisplayRole): + def data(self, index, role=Qt.ItemDataRole.DisplayRole): """ Public method to get data from the model. @@ -354,7 +358,7 @@ """ symbolId = self.__tables[self.__currentTableIndex][0] + index.row() - if role == Qt.DisplayRole: + if role == Qt.ItemDataRole.DisplayRole: col = index.column() if col == 0: return self.__locale.toString(symbolId) @@ -369,28 +373,28 @@ elif col == 4: return unicodedata.name(chr(symbolId), '').title() - if role == Qt.BackgroundColorRole: + if role == Qt.ItemDataRole.BackgroundColorRole: if index.column() == 0: - return QColor(Qt.lightGray) + return QColor(Qt.GlobalColor.lightGray) - if role == Qt.TextColorRole: + if role == Qt.ItemDataRole.TextColorRole: char = chr(symbolId) if self.__isDigit(char): - return QColor(Qt.darkBlue) + return QColor(Qt.GlobalColor.darkBlue) elif self.__isLetter(char): - return QColor(Qt.darkGreen) + return QColor(Qt.GlobalColor.darkGreen) elif self.__isMark(char): - return QColor(Qt.darkRed) + return QColor(Qt.GlobalColor.darkRed) elif self.__isSymbol(char): - return QColor(Qt.black) + return QColor(Qt.GlobalColor.black) elif self.__isPunct(char): - return QColor(Qt.darkMagenta) + return QColor(Qt.GlobalColor.darkMagenta) else: - return QColor(Qt.darkGray) + return QColor(Qt.GlobalColor.darkGray) - if role == Qt.TextAlignmentRole: + if role == Qt.ItemDataRole.TextAlignmentRole: if index.column() in [0, 1, 3]: - return Qt.AlignHCenter + return Qt.AlignmentFlag.AlignHCenter return None @@ -501,7 +505,7 @@ self.__currentRowChanged) self.symbolsTable.horizontalHeader().setSectionResizeMode( - QHeaderView.Fixed) + QHeaderView.ResizeMode.Fixed) fm = self.fontMetrics() try: em = fm.horizontalAdvance("M") @@ -523,10 +527,13 @@ index = self.__model.index( int(Preferences.Prefs.settings.value("Symbols/Top", 0)), 0) - self.symbolsTable.scrollTo(index, QAbstractItemView.PositionAtTop) + self.symbolsTable.scrollTo( + index, QAbstractItemView.ScrollHint.PositionAtTop) self.symbolsTable.selectionModel().setCurrentIndex( index, - QItemSelectionModel.SelectCurrent | QItemSelectionModel.Rows) + QItemSelectionModel.SelectionFlag.SelectCurrent | + QItemSelectionModel.SelectionFlag.Rows + ) @pyqtSlot(QModelIndex) def on_symbolsTable_activated(self, index): @@ -550,7 +557,8 @@ row = symbolId - first self.symbolsTable.selectRow(row) self.symbolsTable.scrollTo( - self.__model.index(row, 0), QAbstractItemView.PositionAtCenter) + self.__model.index(row, 0), + QAbstractItemView.ScrollHint.PositionAtCenter) @pyqtSlot(int) def on_tableCombo_currentIndexChanged(self, index):
--- a/eric6/UI/UserInterface.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/UI/UserInterface.py Tue Mar 02 17:17:09 2021 +0100 @@ -772,12 +772,12 @@ layout.addWidget(self.viewmanager.searchWidget()) layout.addWidget(self.viewmanager.replaceWidget()) self.viewmanager.mainWidget().setSizePolicy( - QSizePolicy.Preferred, QSizePolicy.Expanding) + QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Expanding) leftWidget.setLayout(layout) self.viewmanager.searchWidget().hide() self.viewmanager.replaceWidget().hide() - splitter = QSplitter(Qt.Horizontal) + splitter = QSplitter(Qt.Orientation.Horizontal) splitter.addWidget(leftWidget) self.setCentralWidget(splitter) @@ -827,21 +827,26 @@ # Create the left toolbox self.lToolboxDock = self.__createDockWindow("lToolboxDock") self.lToolbox = E5VerticalToolBox(self.lToolboxDock) - self.__setupDockWindow(self.lToolboxDock, Qt.LeftDockWidgetArea, - self.lToolbox, self.tr("Left Toolbox")) + self.__setupDockWindow(self.lToolboxDock, + Qt.DockWidgetArea.LeftDockWidgetArea, + self.lToolbox, + self.tr("Left Toolbox")) # Create the horizontal toolbox self.hToolboxDock = self.__createDockWindow("hToolboxDock") self.hToolbox = E5HorizontalToolBox(self.hToolboxDock) - self.__setupDockWindow(self.hToolboxDock, Qt.BottomDockWidgetArea, + self.__setupDockWindow(self.hToolboxDock, + Qt.DockWidgetArea.BottomDockWidgetArea, self.hToolbox, self.tr("Horizontal Toolbox")) # Create the right toolbox self.rToolboxDock = self.__createDockWindow("rToolboxDock") self.rToolbox = E5VerticalToolBox(self.rToolboxDock) - self.__setupDockWindow(self.rToolboxDock, Qt.RightDockWidgetArea, - self.rToolbox, self.tr("Right Toolbox")) + self.__setupDockWindow(self.rToolboxDock, + Qt.DockWidgetArea.RightDockWidgetArea, + self.rToolbox, + self.tr("Right Toolbox")) #################################################### ## Populate the left toolbox @@ -1216,9 +1221,9 @@ # create the central widget logging.debug("Creating central widget...") cw = self.centralWidget() # save the current central widget - self.leftSplitter = QSplitter(Qt.Horizontal) - self.rightSplitter = QSplitter(Qt.Horizontal) - self.verticalSplitter = QSplitter(Qt.Vertical) + self.leftSplitter = QSplitter(Qt.Orientation.Horizontal) + self.rightSplitter = QSplitter(Qt.Orientation.Horizontal) + self.verticalSplitter = QSplitter(Qt.Orientation.Vertical) self.verticalSplitter.addWidget(cw) self.verticalSplitter.addWidget(self.bottomSidebar) self.rightSplitter.addWidget(self.verticalSplitter) @@ -1561,7 +1566,12 @@ dock = QDockWidget() dock.setObjectName(name) dock.setFeatures( - QDockWidget.DockWidgetFeatures(QDockWidget.AllDockWidgetFeatures)) + QDockWidget.DockWidgetFeatures( + QDockWidget.DockWidgetFeature.DockWidgetClosable | + QDockWidget.DockWidgetFeature.DockWidgetMovable | + QDockWidget.DockWidgetFeature.DockWidgetFloatable + ) + ) return dock def __setupDockWindow(self, dock, where, widget, caption): @@ -1643,7 +1653,7 @@ """ and the preferences will be written to disc.</p>""" )) self.exitAct.triggered.connect(self.__quit) - self.exitAct.setMenuRole(QAction.QuitRole) + self.exitAct.setMenuRole(QAction.MenuRole.QuitRole) self.actions.append(self.exitAct) self.restartAct = E5Action( @@ -2527,7 +2537,7 @@ """ with your prefered values.</p>""" )) self.prefAct.triggered.connect(self.showPreferences) - self.prefAct.setMenuRole(QAction.PreferencesRole) + self.prefAct.setMenuRole(QAction.MenuRole.PreferencesRole) self.actions.append(self.prefAct) self.prefExportAct = E5Action( @@ -3456,8 +3466,8 @@ self.addToolBar(multiprojecttb) self.addToolBar(projecttb) self.addToolBar(vcstb) - self.addToolBar(Qt.RightToolBarArea, settingstb) - self.addToolBar(Qt.RightToolBarArea, toolstb) + self.addToolBar(Qt.ToolBarArea.RightToolBarArea, settingstb) + self.addToolBar(Qt.ToolBarArea.RightToolBarArea, toolstb) self.addToolBar(helptb) self.addToolBar(bookmarktb) self.addToolBar(spellingtb) @@ -4500,14 +4510,14 @@ if self.__layoutType == "Toolboxes": # set the corner usages - self.setCorner(Qt.TopLeftCorner, - Qt.LeftDockWidgetArea) - self.setCorner(Qt.BottomLeftCorner, - Qt.LeftDockWidgetArea) - self.setCorner(Qt.TopRightCorner, - Qt.RightDockWidgetArea) - self.setCorner(Qt.BottomRightCorner, - Qt.RightDockWidgetArea) + self.setCorner(Qt.Corner.TopLeftCorner, + Qt.DockWidgetArea.LeftDockWidgetArea) + self.setCorner(Qt.Corner.BottomLeftCorner, + Qt.DockWidgetArea.LeftDockWidgetArea) + self.setCorner(Qt.Corner.TopRightCorner, + Qt.DockWidgetArea.RightDockWidgetArea) + self.setCorner(Qt.Corner.BottomRightCorner, + Qt.DockWidgetArea.RightDockWidgetArea) # step 3: activate the windows of the new profile if self.__layoutType == "Toolboxes": @@ -4619,7 +4629,7 @@ self.leftSidebar.show() self.leftSidebar.setCurrentWidget(self.projectBrowser) self.projectBrowser.currentWidget().setFocus( - Qt.ActiveWindowFocusReason) + Qt.FocusReason.ActiveWindowFocusReason) def __activateMultiProjectBrowser(self): """ @@ -4631,7 +4641,8 @@ elif self.__layoutType == "Sidebars": self.leftSidebar.show() self.leftSidebar.setCurrentWidget(self.multiProjectBrowser) - self.multiProjectBrowser.setFocus(Qt.ActiveWindowFocusReason) + self.multiProjectBrowser.setFocus( + Qt.FocusReason.ActiveWindowFocusReason) def activateDebugViewer(self): """ @@ -4643,7 +4654,8 @@ elif self.__layoutType == "Sidebars": self.rightSidebar.show() self.rightSidebar.setCurrentWidget(self.debugViewer) - self.debugViewer.currentWidget().setFocus(Qt.ActiveWindowFocusReason) + self.debugViewer.currentWidget().setFocus( + Qt.FocusReason.ActiveWindowFocusReason) def __activateShell(self): """ @@ -4655,7 +4667,7 @@ elif self.__layoutType == "Sidebars": self.__shellParent.show() self.__shellParent.setCurrentWidget(self.shellAssembly) - self.shell.setFocus(Qt.ActiveWindowFocusReason) + self.shell.setFocus(Qt.FocusReason.ActiveWindowFocusReason) def __activateLogViewer(self): """ @@ -4667,7 +4679,7 @@ elif self.__layoutType == "Sidebars": self.bottomSidebar.show() self.bottomSidebar.setCurrentWidget(self.logViewer) - self.logViewer.setFocus(Qt.ActiveWindowFocusReason) + self.logViewer.setFocus(Qt.FocusReason.ActiveWindowFocusReason) def __activateTaskViewer(self): """ @@ -4679,7 +4691,7 @@ elif self.__layoutType == "Sidebars": self.bottomSidebar.show() self.bottomSidebar.setCurrentWidget(self.taskViewer) - self.taskViewer.setFocus(Qt.ActiveWindowFocusReason) + self.taskViewer.setFocus(Qt.FocusReason.ActiveWindowFocusReason) def __activateTemplateViewer(self): """ @@ -4692,7 +4704,8 @@ elif self.__layoutType == "Sidebars": self.leftSidebar.show() self.leftSidebar.setCurrentWidget(self.templateViewer) - self.templateViewer.setFocus(Qt.ActiveWindowFocusReason) + self.templateViewer.setFocus( + Qt.FocusReason.ActiveWindowFocusReason) def __activateBrowser(self): """ @@ -4705,7 +4718,7 @@ elif self.__layoutType == "Sidebars": self.leftSidebar.show() self.leftSidebar.setCurrentWidget(self.browser) - self.browser.setFocus(Qt.ActiveWindowFocusReason) + self.browser.setFocus(Qt.FocusReason.ActiveWindowFocusReason) def __toggleLeftToolbox(self): """ @@ -4714,7 +4727,8 @@ hasFocus = self.lToolbox.currentWidget().hasFocus() shown = self.__toggleWindow(self.lToolboxDock) if shown: - self.lToolbox.currentWidget().setFocus(Qt.ActiveWindowFocusReason) + self.lToolbox.currentWidget().setFocus( + Qt.FocusReason.ActiveWindowFocusReason) else: if hasFocus: self.__activateViewmanager() @@ -4726,7 +4740,8 @@ hasFocus = self.rToolbox.currentWidget().hasFocus() shown = self.__toggleWindow(self.rToolboxDock) if shown: - self.rToolbox.currentWidget().setFocus(Qt.ActiveWindowFocusReason) + self.rToolbox.currentWidget().setFocus( + Qt.FocusReason.ActiveWindowFocusReason) else: if hasFocus: self.__activateViewmanager() @@ -4738,7 +4753,8 @@ hasFocus = self.hToolbox.currentWidget().hasFocus() shown = self.__toggleWindow(self.hToolboxDock) if shown: - self.hToolbox.currentWidget().setFocus(Qt.ActiveWindowFocusReason) + self.hToolbox.currentWidget().setFocus( + Qt.FocusReason.ActiveWindowFocusReason) else: if hasFocus: self.__activateViewmanager() @@ -4751,7 +4767,7 @@ shown = self.__toggleWindow(self.leftSidebar) if shown: self.leftSidebar.currentWidget().setFocus( - Qt.ActiveWindowFocusReason) + Qt.FocusReason.ActiveWindowFocusReason) else: if hasFocus: self.__activateViewmanager() @@ -4764,7 +4780,7 @@ shown = self.__toggleWindow(self.rightSidebar) if shown: self.rightSidebar.currentWidget().setFocus( - Qt.ActiveWindowFocusReason) + Qt.FocusReason.ActiveWindowFocusReason) else: if hasFocus: self.__activateViewmanager() @@ -4777,7 +4793,7 @@ shown = self.__toggleWindow(self.bottomSidebar) if shown: self.bottomSidebar.currentWidget().setFocus( - Qt.ActiveWindowFocusReason) + Qt.FocusReason.ActiveWindowFocusReason) else: if hasFocus: self.__activateViewmanager() @@ -4793,7 +4809,7 @@ elif self.__layoutType == "Sidebars": self.rightSidebar.show() self.rightSidebar.setCurrentWidget(self.cooperation) - self.cooperation.setFocus(Qt.ActiveWindowFocusReason) + self.cooperation.setFocus(Qt.FocusReason.ActiveWindowFocusReason) def __activateIRC(self): """ @@ -4806,7 +4822,7 @@ elif self.__layoutType == "Sidebars": self.rightSidebar.show() self.rightSidebar.setCurrentWidget(self.irc) - self.irc.setFocus(Qt.ActiveWindowFocusReason) + self.irc.setFocus(Qt.FocusReason.ActiveWindowFocusReason) def __activateSymbolsViewer(self): """ @@ -4819,7 +4835,7 @@ elif self.__layoutType == "Sidebars": self.leftSidebar.show() self.leftSidebar.setCurrentWidget(self.symbolsViewer) - self.symbolsViewer.setFocus(Qt.ActiveWindowFocusReason) + self.symbolsViewer.setFocus(Qt.FocusReason.ActiveWindowFocusReason) def __activateNumbersViewer(self): """ @@ -4832,7 +4848,7 @@ elif self.__layoutType == "Sidebars": self.bottomSidebar.show() self.bottomSidebar.setCurrentWidget(self.numbersViewer) - self.numbersViewer.setFocus(Qt.ActiveWindowFocusReason) + self.numbersViewer.setFocus(Qt.FocusReason.ActiveWindowFocusReason) def __activateViewmanager(self): """ @@ -4840,7 +4856,7 @@ """ aw = self.viewmanager.activeWindow() if aw is not None: - aw.setFocus(Qt.ActiveWindowFocusReason) + aw.setFocus(Qt.FocusReason.ActiveWindowFocusReason) def activateCodeDocumentationViewer(self, switchFocus=True): """ @@ -4859,7 +4875,7 @@ self.codeDocumentationViewer) if switchFocus: self.codeDocumentationViewer.setFocus( - Qt.ActiveWindowFocusReason) + Qt.FocusReason.ActiveWindowFocusReason) def __activatePipWidget(self): """ @@ -4872,7 +4888,7 @@ elif self.__layoutType == "Sidebars": self.rightSidebar.show() self.rightSidebar.setCurrentWidget(self.pipWidget) - self.pipWidget.setFocus(Qt.ActiveWindowFocusReason) + self.pipWidget.setFocus(Qt.FocusReason.ActiveWindowFocusReason) def __activateCondaWidget(self): """ @@ -4885,7 +4901,7 @@ elif self.__layoutType == "Sidebars": self.rightSidebar.show() self.rightSidebar.setCurrentWidget(self.condaWidget) - self.condaWidget.setFocus(Qt.ActiveWindowFocusReason) + self.condaWidget.setFocus(Qt.FocusReason.ActiveWindowFocusReason) def __activateMicroPython(self): """ @@ -4898,7 +4914,8 @@ elif self.__layoutType == "Sidebars": self.rightSidebar.show() self.rightSidebar.setCurrentWidget(self.microPythonWidget) - self.microPythonWidget.setFocus(Qt.ActiveWindowFocusReason) + self.microPythonWidget.setFocus( + Qt.FocusReason.ActiveWindowFocusReason) def __toggleWindow(self, w): """ @@ -4921,7 +4938,7 @@ from Preferences.ToolConfigurationDialog import ToolConfigurationDialog dlg = ToolConfigurationDialog( self.toolGroups[self.currentToolGroup][1], self) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: self.toolGroups[self.currentToolGroup][1] = dlg.getToollist() self.__updateExternalToolsActions() @@ -4934,7 +4951,7 @@ ) dlg = ToolGroupConfigurationDialog( self.toolGroups, self.currentToolGroup, self) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: self.toolGroups, self.currentToolGroup = dlg.getToolGroups() def __createUnitTestDialog(self): @@ -5550,8 +5567,8 @@ else: self.toolProcs.append((program, proc, procData)) if tool['redirect'] == 'no': - proc.closeReadChannel(QProcess.StandardOutput) - proc.closeReadChannel(QProcess.StandardError) + proc.closeReadChannel(QProcess.ProcessChannel.StandardOutput) + proc.closeReadChannel(QProcess.ProcessChannel.StandardError) proc.closeWriteChannel() def __processToolStdout(self): @@ -5562,7 +5579,7 @@ # loop through all running tool processes for program, toolProc, toolProcData in self.toolProcs: - toolProc.setReadChannel(QProcess.StandardOutput) + toolProc.setReadChannel(QProcess.ProcessChannel.StandardOutput) if ( toolProcData[0] is None or @@ -5589,7 +5606,7 @@ # loop through all running tool processes for program, toolProc, _toolProcData in self.toolProcs: - toolProc.setReadChannel(QProcess.StandardError) + toolProc.setReadChannel(QProcess.ProcessChannel.StandardError) while toolProc.canReadLine(): error = str(toolProc.readLine(), ioEncoding, 'replace') @@ -5607,7 +5624,7 @@ # loop through all running tool processes for program, toolProc, toolProcData in self.toolProcs: - if toolProc.state() == QProcess.NotRunning: + if toolProc.state() == QProcess.ProcessState.NotRunning: exitedProcs.append((program, toolProc, toolProcData)) if toolProcData[0] is not None: if toolProcData[1] == "replaceSelection": @@ -5930,7 +5947,7 @@ @type bool """ if isinstance(home, QUrl): - home = home.toString(QUrl.None_) + home = home.toString(QUrl.UrlFormattingOption.None_) if len(home) > 0: homeUrl = QUrl(home) @@ -6033,8 +6050,8 @@ QThread.msleep(1000) QApplication.processEvents() if ( - process.state() == QProcess.NotRunning and - process.exitStatus() == QProcess.NormalExit and + process.state() == QProcess.ProcessState.NotRunning and + process.exitStatus() == QProcess.ExitStatus.NormalExit and process.exitCode() == 100 ): # Process exited prematurely due to missing pre-requisites @@ -6118,7 +6135,10 @@ self.__configurationDialog.showConfigurationPageByName("empty") self.__configurationDialog.exec() QApplication.processEvents() - if self.__configurationDialog.result() == QDialog.Accepted: + if ( + self.__configurationDialog.result() == + QDialog.DialogCode.Accepted + ): self.__configurationDialog.setPreferences() Preferences.syncPreferences() self.__preferencesChanged() @@ -6257,7 +6277,7 @@ from Preferences.ViewProfileDialog import ViewProfileDialog dlg = ViewProfileDialog(self.__layoutType, self.profiles['edit'][1], self.profiles['debug'][1]) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: edit, debug = dlg.getVisibilities() self.profiles['edit'][1] = edit self.profiles['debug'][1] = debug @@ -6273,7 +6293,7 @@ """ from E5Gui.E5ToolBarDialog import E5ToolBarDialog dlg = E5ToolBarDialog(self.toolbarManager) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: Preferences.setUI( "ToolbarManagerState", self.toolbarManager.saveState()) @@ -6352,7 +6372,7 @@ """ from .ClearPrivateDataDialog import ClearPrivateDataDialog dlg = ClearPrivateDataDialog(self) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: # recent files, recent projects, recent multi projects, # debug histories, shell histories (files, projects, multiProjects, debug, shell, vcs, plugins) = ( @@ -6509,7 +6529,7 @@ fn = os.path.join(Utilities.getConfigDir(), "eric6tasks.e6t") if os.path.exists(fn): f = QFile(fn) - if f.open(QIODevice.ReadOnly): + if f.open(QIODevice.OpenModeFlag.ReadOnly): from E5XML.TasksReader import TasksReader reader = TasksReader(f, viewer=self.taskViewer) reader.readXML() @@ -6547,7 +6567,7 @@ res = self.__sessionFile.writeFile(fn) else: f = QFile(fn) - if f.open(QIODevice.WriteOnly): + if f.open(QIODevice.OpenModeFlag.WriteOnly): from E5XML.SessionWriter import SessionWriter SessionWriter(f, None).writeXML() f.close() @@ -6599,7 +6619,7 @@ else: # old XML based format f = QFile(fn) - if f.open(QIODevice.ReadOnly): + if f.open(QIODevice.OpenModeFlag.ReadOnly): from E5XML.SessionReader import SessionReader self.__readingSession = True reader = SessionReader(f, True) @@ -6833,7 +6853,7 @@ from PluginManager.PluginRepositoryDialog import PluginRepositoryDialog dlg = PluginRepositoryDialog(self.pluginManager, self) res = dlg.exec() - if res == (QDialog.Accepted + 1): + if res == (QDialog.DialogCode.Accepted + 1): self.__installPlugins(dlg.getDownloadedPlugins()) def __pluginsConfigure(self): @@ -7072,8 +7092,9 @@ self.tr("Trying host {0}").format(url.host())) self.__versionCheckProgress.setValue(alternative) request = QNetworkRequest(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.__versionsDownloadDone(reply)) self.__replies.append(reply) @@ -7097,12 +7118,12 @@ reply.deleteLater() if reply in self.__replies: self.__replies.remove(reply) - if reply.error() == QNetworkReply.NoError: + if reply.error() == QNetworkReply.NetworkError.NoError: ioEncoding = Preferences.getSystem("IOEncoding") versions = str(reply.readAll(), ioEncoding, 'replace').splitlines() reply.close() if ( - reply.error() != QNetworkReply.NoError or + reply.error() != QNetworkReply.NetworkError.NoError or len(versions) == 0 or versions[0].startswith("<") ): @@ -7433,7 +7454,8 @@ """ if self.__startup: if Preferences.getGeometry("MainMaximized"): - self.setWindowState(Qt.WindowStates(Qt.WindowMaximized)) + self.setWindowState( + Qt.WindowStates(Qt.WindowState.WindowMaximized)) self.__startup = False ##########################################
--- a/eric6/Utilities/BackgroundService.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Utilities/BackgroundService.py Tue Mar 02 17:17:09 2021 +0100 @@ -93,7 +93,8 @@ getConfig('ericDir'), "Utilities", "BackgroundClient.py") proc = QProcess() - proc.setProcessChannelMode(QProcess.ForwardedChannels) + proc.setProcessChannelMode( + QProcess.ProcessChannelMode.ForwardedChannels) args = [backgroundClient, self.hostAddress, str(port), str(Preferences.getUI("BackgroundServiceProcesses"))] proc.start(interpreter, args)
--- a/eric6/Utilities/MouseUtilities.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Utilities/MouseUtilities.py Tue Mar 02 17:17:09 2021 +0100 @@ -13,42 +13,46 @@ if Globals.isMacPlatform(): __modifier2String = { - Qt.ShiftModifier: QCoreApplication.translate( + Qt.KeyboardModifier.ShiftModifier: QCoreApplication.translate( "MouseUtilities", "Shift"), - Qt.AltModifier: QCoreApplication.translate( + Qt.KeyboardModifier.AltModifier: QCoreApplication.translate( "MouseUtilities", "Alt"), - Qt.ControlModifier: QCoreApplication.translate( + Qt.KeyboardModifier.ControlModifier: QCoreApplication.translate( "MouseUtilities", "Cmd"), - Qt.MetaModifier: QCoreApplication.translate( + Qt.KeyboardModifier.MetaModifier: QCoreApplication.translate( "MouseUtilities", "Ctrl"), } - __modifierOrder = [Qt.MetaModifier, Qt.AltModifier, Qt.ShiftModifier, - Qt.ControlModifier] + __modifierOrder = [Qt.KeyboardModifier.MetaModifier, + Qt.KeyboardModifier.AltModifier, + Qt.KeyboardModifier.ShiftModifier, + Qt.KeyboardModifier.ControlModifier] else: __modifier2String = { - Qt.ShiftModifier: QCoreApplication.translate( + Qt.KeyboardModifier.ShiftModifier: QCoreApplication.translate( "MouseUtilities", "Shift"), - Qt.AltModifier: QCoreApplication.translate( + Qt.KeyboardModifier.AltModifier: QCoreApplication.translate( "MouseUtilities", "Alt"), - Qt.ControlModifier: QCoreApplication.translate( + Qt.KeyboardModifier.ControlModifier: QCoreApplication.translate( "MouseUtilities", "Ctrl"), - Qt.MetaModifier: QCoreApplication.translate( + Qt.KeyboardModifier.MetaModifier: QCoreApplication.translate( "MouseUtilities", "Meta"), } - __modifierOrder = [Qt.MetaModifier, Qt.ControlModifier, Qt.AltModifier, - Qt.ShiftModifier] + __modifierOrder = [Qt.KeyboardModifier.MetaModifier, + Qt.KeyboardModifier.ControlModifier, + Qt.KeyboardModifier.AltModifier, + Qt.KeyboardModifier.ShiftModifier] __button2String = { - Qt.LeftButton: QCoreApplication.translate( + Qt.MouseButton.LeftButton: QCoreApplication.translate( "MouseUtilities", "Left Button"), - Qt.RightButton: QCoreApplication.translate( + Qt.MouseButton.RightButton: QCoreApplication.translate( "MouseUtilities", "Right Button"), - Qt.MidButton: QCoreApplication.translate( + Qt.MouseButton.MidButton: QCoreApplication.translate( "MouseUtilities", "Middle Button"), - Qt.XButton1: QCoreApplication.translate( + Qt.MouseButton.XButton1: QCoreApplication.translate( "MouseUtilities", "Extra Button 1"), - Qt.XButton2: QCoreApplication.translate( + Qt.MouseButton.XButton2: QCoreApplication.translate( "MouseUtilities", "Extra Button 2"), }
--- a/eric6/Utilities/__init__.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Utilities/__init__.py Tue Mar 02 17:17:09 2021 +0100 @@ -208,7 +208,8 @@ with open(filename, "rb") as f: text = f.read() hashStr = str(QCryptographicHash.hash( - QByteArray(text), QCryptographicHash.Md5).toHex(), encoding="ASCII") + QByteArray(text), QCryptographicHash.Algorithm.Md5).toHex(), + encoding="ASCII") return decode(text) + (hashStr, ) @@ -604,9 +605,9 @@ @return line separator used by the editor (string) """ eolMode = Preferences.getEditor("EOLMode") - if eolMode == QsciScintilla.EolUnix: + if eolMode == QsciScintilla.EolMode.EolUnix: return "\n" - elif eolMode == QsciScintilla.EolMac: + elif eolMode == QsciScintilla.EolMode.EolMac: return "\r" else: return "\r\n" @@ -1854,7 +1855,7 @@ getConfig('ericDir'), "Utilities", "PySideImporter.py") args = [checker, "--variant={0}".format(variant)] proc = QProcess() - proc.setProcessChannelMode(QProcess.MergedChannels) + proc.setProcessChannelMode(QProcess.ProcessChannelMode.MergedChannels) proc.start(interpreter, args) finished = proc.waitForFinished(30000) if finished: @@ -2018,7 +2019,7 @@ getConfig('ericDir'), "Utilities", "GetSysPath.py") args = [getSysPath] proc = QProcess() - proc.setProcessChannelMode(QProcess.MergedChannels) + proc.setProcessChannelMode(QProcess.ProcessChannelMode.MergedChannels) proc.start(interpreter, args) finished = proc.waitForFinished(30000) if finished:
--- a/eric6/Utilities/crypto/__init__.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Utilities/crypto/__init__.py Tue Mar 02 17:17:09 2021 +0100 @@ -72,7 +72,7 @@ None, QCoreApplication.translate("Crypto", "Master Password"), QCoreApplication.translate("Crypto", "Enter the master password:"), - QLineEdit.Password) + QLineEdit.EchoMode.Password) if ok: from .py3PBKDF2 import verifyPassword masterPassword = Preferences.getUser("MasterPassword")
--- a/eric6/VCS/ProjectBrowserHelper.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/VCS/ProjectBrowserHelper.py Tue Mar 02 17:17:09 2021 +0100 @@ -304,7 +304,7 @@ " from the repository (and disk)?"), files) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: status = self.vcs.vcsRemove(names) if status: if isRemoveDirs:
--- a/eric6/VCS/ProjectHelper.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/VCS/ProjectHelper.py Tue Mar 02 17:17:09 2021 +0100 @@ -222,7 +222,7 @@ vcs = self.project.initVCS(selectedVcsSystem) if vcs is not None: vcsdlg = vcs.vcsNewProjectOptionsDialog() - if vcsdlg.exec() == QDialog.Accepted: + if vcsdlg.exec() == QDialog.DialogCode.Accepted: projectdir, vcsDataDict = vcsdlg.getData() # edit VCS command options if vcs.vcsSupportCommandOptions(): @@ -239,7 +239,7 @@ if vcores: from .CommandOptionsDialog import VcsCommandOptionsDialog codlg = VcsCommandOptionsDialog(vcs) - if codlg.exec() == QDialog.Accepted: + if codlg.exec() == QDialog.DialogCode.Accepted: vcs.vcsSetOptions(codlg.getOptions()) # create the project directory if it doesn't exist already @@ -313,7 +313,7 @@ PropertiesDialog ) dlg = PropertiesDialog(self.project, False) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: dlg.storeData() self.project.initFileTypes() self.project.pdata["VCS"] = selectedVcsSystem @@ -422,7 +422,7 @@ if self.project.vcs is not None: vcsdlg = self.project.vcs.vcsOptionsDialog( self.project, self.project.name, 1) - if vcsdlg.exec() == QDialog.Accepted: + if vcsdlg.exec() == QDialog.DialogCode.Accepted: vcsDataDict = vcsdlg.getData() # edit VCS command options if self.project.vcs.vcsSupportCommandOptions(): @@ -441,7 +441,7 @@ VcsCommandOptionsDialog ) codlg = VcsCommandOptionsDialog(self.project.vcs) - if codlg.exec() == QDialog.Accepted: + if codlg.exec() == QDialog.DialogCode.Accepted: self.project.vcs.vcsSetOptions(codlg.getOptions()) self.project.setDirty(True) self.project.vcs.vcsSetDataFromDict(vcsDataDict) @@ -534,7 +534,7 @@ if self.vcs.vcsSupportCommandOptions(): from .CommandOptionsDialog import VcsCommandOptionsDialog codlg = VcsCommandOptionsDialog(self.vcs) - if codlg.exec() == QDialog.Accepted: + if codlg.exec() == QDialog.DialogCode.Accepted: self.vcs.vcsSetOptions(codlg.getOptions()) self.project.setDirty(True)
--- a/eric6/VCS/StatusMonitorLed.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/VCS/StatusMonitorLed.py Tue Mar 02 17:17:09 2021 +0100 @@ -36,13 +36,13 @@ self.project = project self.vcsMonitorLedColors = { - "off": QColor(Qt.lightGray), - "ok": QColor(Qt.green), - "nok": QColor(Qt.red), - "op": QColor(Qt.yellow), - "send": QColor(Qt.blue), - "wait": QColor(Qt.cyan), - "timeout": QColor(Qt.darkRed) + "off": QColor(Qt.GlobalColor.lightGray), + "ok": QColor(Qt.GlobalColor.green), + "nok": QColor(Qt.GlobalColor.red), + "op": QColor(Qt.GlobalColor.yellow), + "send": QColor(Qt.GlobalColor.blue), + "wait": QColor(Qt.GlobalColor.cyan), + "timeout": QColor(Qt.GlobalColor.darkRed) } self.__on = False @@ -72,7 +72,7 @@ self.__checkActions() # connect signals to our slots - self.setContextMenuPolicy(Qt.CustomContextMenu) + self.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu) self.customContextMenuRequested.connect(self._showContextMenu) self.project.vcsStatusMonitorStatus.connect( self.__projectVcsMonitorStatus)
--- a/eric6/VCS/VersionControl.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/VCS/VersionControl.py Tue Mar 02 17:17:09 2021 +0100 @@ -615,12 +615,12 @@ ).format(program)) return False else: - while proc.state() == QProcess.Running: + while proc.state() == QProcess.ProcessState.Running: QApplication.processEvents() QThread.msleep(300) QApplication.processEvents() return ( - (proc.exitStatus() == QProcess.NormalExit) and + (proc.exitStatus() == QProcess.ExitStatus.NormalExit) and (proc.exitCode() == 0) ) @@ -728,11 +728,14 @@ vcsStatusMonitorInterval, project) if self.statusMonitorThread is not None: self.statusMonitorThread.vcsStatusMonitorData.connect( - self.__statusMonitorData, Qt.QueuedConnection) + self.__statusMonitorData, + Qt.ConnectionType.QueuedConnection) self.statusMonitorThread.vcsStatusMonitorStatus.connect( - self.__statusMonitorStatus, Qt.QueuedConnection) + self.__statusMonitorStatus, + Qt.ConnectionType.QueuedConnection) self.statusMonitorThread.vcsStatusMonitorInfo.connect( - self.__statusMonitorInfo, Qt.QueuedConnection) + self.__statusMonitorInfo, + Qt.ConnectionType.QueuedConnection) self.statusMonitorThread.setAutoUpdate( Preferences.getVCS("AutoUpdate")) self.statusMonitorThread.start()
--- a/eric6/ViewManager/BookmarkedFilesDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/ViewManager/BookmarkedFilesDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -36,7 +36,7 @@ for bookmark in self.bookmarks: itm = QListWidgetItem(bookmark, self.filesList) if not QFileInfo(bookmark).exists(): - itm.setBackground(QColor(Qt.red)) + itm.setBackground(QColor(Qt.GlobalColor.red)) if len(self.bookmarks): self.filesList.setCurrentRow(0) @@ -83,7 +83,7 @@ if bookmark: itm = QListWidgetItem(bookmark, self.filesList) if not QFileInfo(bookmark).exists(): - itm.setBackground(QColor(Qt.red)) + itm.setBackground(QColor(Qt.GlobalColor.red)) self.filePicker.clear() self.bookmarks.append(bookmark) row = self.filesList.currentRow() @@ -100,7 +100,7 @@ itm = self.filesList.item(row) itm.setText(bookmark) if not QFileInfo(bookmark).exists(): - itm.setBackground(QColor(Qt.red)) + itm.setBackground(QColor(Qt.GlobalColor.red)) else: itm.setBackground(QColor())
--- a/eric6/ViewManager/ViewManager.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/ViewManager/ViewManager.py Tue Mar 02 17:17:09 2021 +0100 @@ -485,16 +485,17 @@ """ Public method to get the orientation of the split view. - @return orientation of the split (Qt.Horizontal or Qt.Vertical) - """ - return Qt.Vertical + @return orientation of the split (Qt.Orientation.Horizontal or + Qt.Orientation.Vertical) + """ + return Qt.Orientation.Vertical def setSplitOrientation(self, orientation): """ Public method used to set the orientation of the split view. @param orientation orientation of the split - (Qt.Horizontal or Qt.Vertical) + (Qt.Orientation.Horizontal or Qt.Orientation.Vertical) """ pass @@ -3309,7 +3310,8 @@ tb.addAction(self.gotoLastEditAct) tb.setAllowedAreas( - Qt.ToolBarAreas(Qt.TopToolBarArea | Qt.BottomToolBarArea)) + Qt.ToolBarAreas(Qt.ToolBarArea.TopToolBarArea | + Qt.ToolBarArea.BottomToolBarArea)) toolbarManager.addToolBar(tb, tb.windowTitle()) toolbarManager.addAction(self.gotoAct, tb.windowTitle()) @@ -5234,7 +5236,7 @@ """ from .BookmarkedFilesDialog import BookmarkedFilesDialog dlg = BookmarkedFilesDialog(self.bookmarked, self.ui) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: self.bookmarked = dlg.getBookmarkedFiles() def __clearBookmarked(self): @@ -5622,7 +5624,7 @@ lines = aw.lines() curLine = aw.getCursorPosition()[0] + 1 dlg = GotoDialog(lines, curLine, self.ui, None, True) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: aw.gotoLine(dlg.getLinenumber(), expand=True) def __gotoBrace(self): @@ -5726,7 +5728,7 @@ if aw: from QScintilla.ZoomDialog import ZoomDialog dlg = ZoomDialog(aw.getZoom(), self.ui, None, True) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: value = dlg.getZoomSize() self.__zoomTo(value) @@ -5824,7 +5826,7 @@ (boolean). True means splitting horizontally. """ if checked: - self.setSplitOrientation(Qt.Horizontal) + self.setSplitOrientation(Qt.Orientation.Horizontal) self.splitViewAct.setIcon( UI.PixmapCache.getIcon("splitHorizontal")) self.splitRemoveAct.setIcon( @@ -5832,7 +5834,7 @@ self.newDocumentSplitViewAct.setIcon( UI.PixmapCache.getIcon("splitHorizontal")) else: - self.setSplitOrientation(Qt.Vertical) + self.setSplitOrientation(Qt.Orientation.Vertical) self.splitViewAct.setIcon( UI.PixmapCache.getIcon("splitVertical")) self.splitRemoveAct.setIcon( @@ -6234,7 +6236,7 @@ QCoreApplication.translate('ViewManager', "Editing {0}") .format(fileInfo), self.ui) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: data = dlg.getData() try: with open(dictionaryFile, "w", encoding="utf-8") as f:
--- a/eric6/VirtualEnv/VirtualenvAddEditDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/VirtualEnv/VirtualenvAddEditDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -101,7 +101,7 @@ self.__updateOk() - self.nameEdit.setFocus(Qt.OtherFocusReason) + self.nameEdit.setFocus(Qt.FocusReason.OtherFocusReason) def __updateOk(self): """ @@ -136,7 +136,8 @@ ) ) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enable) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(enable) @pyqtSlot(str) def on_nameEdit_textChanged(self, txt):
--- a/eric6/VirtualEnv/VirtualenvConfigurationDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/VirtualEnv/VirtualenvConfigurationDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -91,7 +91,8 @@ self.__virtualenvFound = False self.__pyvenvFound = False self.__condaFound = False - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) self.__mandatoryStyleSheet = "QLineEdit {border: 2px solid;}" self.targetDirectoryPicker.setStyleSheet(self.__mandatoryStyleSheet) @@ -127,7 +128,8 @@ bool(self.nameEdit.text()) ) enable &= self.targetDirectoryPicker.text() != self.__envBaseDir - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enable) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(enable) elif self.condaButton.isChecked(): enable = ( bool(self.condaNameEdit.text()) or @@ -141,9 +143,11 @@ ) elif self.condaRequirementsButton.isChecked(): enable &= bool(self.condaRequirementsFilePicker.text()) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enable) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(enable) else: - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) def __updateUi(self): """
--- a/eric6/VirtualEnv/VirtualenvExecDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/VirtualEnv/VirtualenvExecDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -42,8 +42,10 @@ super(VirtualenvExecDialog, self).__init__(parent) self.setupUi(self) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setDefault(True) self.__pyvenv = configuration["envType"] == "pyvenv" self.__targetDir = configuration["targetDirectory"] @@ -121,9 +123,13 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.accept() - elif button == self.buttonBox.button(QDialogButtonBox.Cancel): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): self.__finish(0, 0, giveUp=True) def __finish(self, exitCode, exitStatus, giveUp=False): @@ -139,15 +145,18 @@ """ if ( self.__process is not None and - self.__process.state() != QProcess.NotRunning + self.__process.state() != QProcess.ProcessState.NotRunning ): self.__process.terminate() QTimer.singleShot(2000, self.__process.kill) self.__process.waitForFinished(3000) - self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) - self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Close).setDefault(True) if not giveUp: if exitCode != 0: @@ -205,7 +214,7 @@ It reads the output of the process, formats it and inserts it into the contents pane. """ - self.__process.setReadChannel(QProcess.StandardOutput) + self.__process.setReadChannel(QProcess.ProcessChannel.StandardOutput) while self.__process.canReadLine(): s = str(self.__process.readLine(), @@ -220,7 +229,7 @@ It reads the error output of the process and inserts it into the error pane. """ - self.__process.setReadChannel(QProcess.StandardError) + self.__process.setReadChannel(QProcess.ProcessChannel.StandardError) while self.__process.canReadLine(): s = str(self.__process.readLine(),
--- a/eric6/VirtualEnv/VirtualenvInterpreterSelectionDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/VirtualEnv/VirtualenvInterpreterSelectionDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -52,7 +52,7 @@ Private method to update the enabled status of the OK button. """ interpreterPath = self.pythonExecPicker.text() - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( + self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( bool(interpreterPath) and os.path.isfile(interpreterPath) and os.access(interpreterPath, os.X_OK)
--- a/eric6/VirtualEnv/VirtualenvManager.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/VirtualEnv/VirtualenvManager.py Tue Mar 02 17:17:09 2021 +0100 @@ -186,7 +186,7 @@ baseDir = self.__virtualEnvironmentsBaseDir dlg = VirtualenvConfigurationDialog(baseDir=baseDir) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: resultDict = dlg.getData() if resultDict["envType"] == "conda": @@ -242,7 +242,7 @@ dlg = VirtualenvNameDialog( list(self.__virtualEnvironments.keys()), venvName) - if dlg.exec() != QDialog.Accepted: + if dlg.exec() != QDialog.DialogCode.Accepted: return venvName = dlg.getName() @@ -252,7 +252,7 @@ VirtualenvInterpreterSelectionDialog ) dlg = VirtualenvInterpreterSelectionDialog(venvName, venvDirectory) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: venvInterpreter = dlg.getData() if venvInterpreter: @@ -384,7 +384,7 @@ """ environments?"""), venvMessages ) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: for venvName in venvNames: if self.__isEnvironmentDeleteable(venvName): if self.isCondaEnvironment(venvName): @@ -449,7 +449,7 @@ """ environments?"""), venvMessages ) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: for venvName in venvNames: if venvName in self.__virtualEnvironments: del self.__virtualEnvironments[venvName]
--- a/eric6/VirtualEnv/VirtualenvManagerDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/VirtualEnv/VirtualenvManagerDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -23,10 +23,10 @@ Class implementing a dialog to manage the list of defined virtual environments. """ - IsGlobalRole = Qt.UserRole + 1 - IsCondaRole = Qt.UserRole + 2 - IsRemoteRole = Qt.UserRole + 3 - ExecPathRole = Qt.UserRole + 4 + IsGlobalRole = Qt.ItemDataRole.UserRole + 1 + IsCondaRole = Qt.ItemDataRole.UserRole + 2 + IsRemoteRole = Qt.ItemDataRole.UserRole + 3 + ExecPathRole = Qt.ItemDataRole.UserRole + 4 def __init__(self, manager, parent=None): """ @@ -54,7 +54,7 @@ self.__populateVenvList() self.__updateButtons() - self.venvList.header().setSortIndicator(0, Qt.AscendingOrder) + self.venvList.header().setSortIndicator(0, Qt.SortOrder.AscendingOrder) def __updateButtons(self): """ @@ -111,7 +111,7 @@ self.__manager, baseDir=self.envBaseDirectoryPicker.text() ) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: (venvName, venvDirectory, venvInterpreter, isGlobal, isConda, isRemote, execPath) = dlg.getData() @@ -145,7 +145,7 @@ selectedItem.data(0, VirtualenvManagerDialog.ExecPathRole), baseDir=self.envBaseDirectoryPicker.text() ) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: (venvName, venvDirectory, venvInterpreter, isGlobal, isConda, isRemote, execPath) = dlg.getData() if venvName != oldVenvName: @@ -234,7 +234,8 @@ # 4. re-establish selection for venvName in selectedVenvs: - itms = self.venvList.findItems(venvName, Qt.MatchExactly, 0) + itms = self.venvList.findItems( + venvName, Qt.MatchFlag.MatchExactly, 0) if itms: itms[0].setSelected(True) @@ -289,7 +290,7 @@ contents. """ self.venvList.header().resizeSections( - QHeaderView.ResizeToContents) + QHeaderView.ResizeMode.ResizeToContents) self.venvList.header().setStretchLastSection(True) def closeEvent(self, evt):
--- a/eric6/VirtualEnv/VirtualenvNameDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/VirtualEnv/VirtualenvNameDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -36,7 +36,7 @@ self.envsList.addItems(environments) self.nameEdit.setText(currentName) - self.nameEdit.setFocus(Qt.OtherFocusReason) + self.nameEdit.setFocus(Qt.FocusReason.OtherFocusReason) self.nameEdit.selectAll() @pyqtSlot(str) @@ -47,8 +47,8 @@ @param txt contens of the name edit @type str """ - items = self.envsList.findItems(txt, Qt.MatchExactly) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( + items = self.envsList.findItems(txt, Qt.MatchFlag.MatchExactly) + self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( bool(txt) and len(items) == 0) def getName(self):
--- a/eric6/WebBrowser/AdBlock/AdBlockDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/AdBlock/AdBlockDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -33,7 +33,7 @@ """ super(AdBlockDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) self.__manager = manager @@ -59,7 +59,8 @@ menu.aboutToShow.connect(self.__aboutToShowActionMenu) self.actionButton.setMenu(menu) self.actionButton.setIcon(UI.PixmapCache.getIcon("adBlockAction")) - self.actionButton.setPopupMode(QToolButton.InstantPopup) + self.actionButton.setPopupMode( + QToolButton.ToolButtonPopupMode.InstantPopup) self.__load()
--- a/eric6/WebBrowser/AdBlock/AdBlockExceptionsDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/AdBlock/AdBlockExceptionsDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -28,7 +28,7 @@ """ super(AdBlockExceptionsDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) self.iconLabel.setPixmap( UI.PixmapCache.getPixmap("adBlockPlusGreen48"))
--- a/eric6/WebBrowser/AdBlock/AdBlockIcon.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/AdBlock/AdBlockIcon.py Tue Mar 02 17:17:09 2021 +0100 @@ -33,7 +33,7 @@ self.__enabled = False self.setMaximumHeight(16) - self.setCursor(Qt.PointingHandCursor) + self.setCursor(Qt.CursorShape.PointingHandCursor) self.setToolTip(self.tr( "AdBlock lets you block unwanted content on web pages."))
--- a/eric6/WebBrowser/AdBlock/AdBlockManager.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/AdBlock/AdBlockManager.py Tue Mar 02 17:17:09 2021 +0100 @@ -169,7 +169,8 @@ res = True if ( info.resourceType() == - QWebEngineUrlRequestInfo.ResourceTypeMainFrame + QWebEngineUrlRequestInfo.ResourceType + .ResourceTypeMainFrame ): url = QUrl("eric:adblock") query = QUrlQuery()
--- a/eric6/WebBrowser/AdBlock/AdBlockRule.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/AdBlock/AdBlockRule.py Tue Mar 02 17:17:09 2021 +0100 @@ -100,7 +100,7 @@ self.__isEnabled = True self.__isException = False self.__isInternalDisabled = False - self.__caseSensitivity = Qt.CaseInsensitive + self.__caseSensitivity = Qt.CaseSensitivity.CaseInsensitive self.__type = AdBlockRuleType.StringContainsMatchRule self.__options = AdBlockRuleOption.NoOption @@ -195,7 +195,7 @@ self.__parseDomains(option[7:], "|") handledOptions += 1 elif option == "match-case": - self.__caseSensitivity = Qt.CaseSensitive + self.__caseSensitivity = Qt.CaseSensitivity.CaseSensitive handledOptions += 1 elif option.endswith("third-party"): self.setOption(AdBlockRuleOption.ThirdPartyOption) @@ -491,14 +491,14 @@ matched = False if self.__type == AdBlockRuleType.StringContainsMatchRule: - if self.__caseSensitivity == Qt.CaseInsensitive: + if self.__caseSensitivity == Qt.CaseSensitivity.CaseInsensitive: matched = self.__matchString.lower() in encodedUrl.lower() else: matched = self.__matchString in encodedUrl elif self.__type == AdBlockRuleType.DomainMatchRule: matched = self.__isMatchingDomain(domain, self.__matchString) elif self.__type == AdBlockRuleType.StringEndsMatchRule: - if self.__caseSensitivity == Qt.CaseInsensitive: + if self.__caseSensitivity == Qt.CaseSensitivity.CaseInsensitive: matched = encodedUrl.lower().endswith( self.__matchString.lower()) else: @@ -577,7 +577,8 @@ @rtype bool """ match = ( - req.resourceType() == QWebEngineUrlRequestInfo.ResourceTypeObject) + req.resourceType() == + QWebEngineUrlRequestInfo.ResourceType.ResourceTypeObject) if self.__hasException(AdBlockRuleOption.ObjectOption): return not match @@ -595,7 +596,7 @@ """ match = ( req.resourceType() == - QWebEngineUrlRequestInfo.ResourceTypeSubFrame) + QWebEngineUrlRequestInfo.ResourceType.ResourceTypeSubFrame) if self.__hasException(AdBlockRuleOption.SubdocumentOption): return not match @@ -612,7 +613,8 @@ @rtype bool """ match = ( - req.resourceType() == QWebEngineUrlRequestInfo.ResourceTypeXhr) + req.resourceType() == + QWebEngineUrlRequestInfo.ResourceType.ResourceTypeXhr) if self.__hasException(AdBlockRuleOption.XMLHttpRequestOption): return not match @@ -629,7 +631,8 @@ @rtype bool """ match = ( - req.resourceType() == QWebEngineUrlRequestInfo.ResourceTypeImage) + req.resourceType() == + QWebEngineUrlRequestInfo.ResourceType.ResourceTypeImage) if self.__hasException(AdBlockRuleOption.ImageOption): return not match @@ -646,7 +649,8 @@ @rtype bool """ match = ( - req.resourceType() == QWebEngineUrlRequestInfo.ResourceTypeScript) + req.resourceType() == + QWebEngineUrlRequestInfo.ResourceType.ResourceTypeScript) if self.__hasException(AdBlockRuleOption.ScriptOption): return not match @@ -664,7 +668,7 @@ """ match = ( req.resourceType() == - QWebEngineUrlRequestInfo.ResourceTypeStylesheet) + QWebEngineUrlRequestInfo.ResourceType.ResourceTypeStylesheet) if self.__hasException(AdBlockRuleOption.StyleSheetOption): return not match @@ -682,11 +686,11 @@ """ match = ( req.resourceType() == - QWebEngineUrlRequestInfo.ResourceTypeSubResource + QWebEngineUrlRequestInfo.ResourceType.ResourceTypeSubResource ) match = match or ( req.resourceType() == - QWebEngineUrlRequestInfo.ResourceTypePluginResource + QWebEngineUrlRequestInfo.ResourceType.ResourceTypePluginResource ) if self.__objectSubrequestException: @@ -704,7 +708,8 @@ @rtype bool """ match = ( - req.resourceType() == QWebEngineUrlRequestInfo.ResourceTypePing) + req.resourceType() == + QWebEngineUrlRequestInfo.ResourceType.ResourceTypePing) if self.__hasException(AdBlockRuleOption.PingOption): return not match @@ -721,7 +726,8 @@ @rtype bool """ match = ( - req.resourceType() == QWebEngineUrlRequestInfo.ResourceTypeMedia) + req.resourceType() == + QWebEngineUrlRequestInfo.ResourceType.ResourceTypeMedia) if self.__hasException(AdBlockRuleOption.MediaOption): return not match @@ -739,7 +745,7 @@ """ match = ( req.resourceType() == - QWebEngineUrlRequestInfo.ResourceTypeFontResource) + QWebEngineUrlRequestInfo.ResourceType.ResourceTypeFontResource) if self.__hasException(AdBlockRuleOption.FontOption): return not match @@ -756,13 +762,13 @@ @rtype bool """ match = req.resourceType() in [ - QWebEngineUrlRequestInfo.ResourceTypeSubResource, - QWebEngineUrlRequestInfo.ResourceTypeWorker, - QWebEngineUrlRequestInfo.ResourceTypeSharedWorker, - QWebEngineUrlRequestInfo.ResourceTypeServiceWorker, - QWebEngineUrlRequestInfo.ResourceTypePrefetch, - QWebEngineUrlRequestInfo.ResourceTypeFavicon, - QWebEngineUrlRequestInfo.ResourceTypeUnknown, + QWebEngineUrlRequestInfo.ResourceType.ResourceTypeSubResource, + QWebEngineUrlRequestInfo.ResourceType.ResourceTypeWorker, + QWebEngineUrlRequestInfo.ResourceType.ResourceTypeSharedWorker, + QWebEngineUrlRequestInfo.ResourceType.ResourceTypeServiceWorker, + QWebEngineUrlRequestInfo.ResourceType.ResourceTypePrefetch, + QWebEngineUrlRequestInfo.ResourceType.ResourceTypeFavicon, + QWebEngineUrlRequestInfo.ResourceType.ResourceTypeUnknown, ] if self.__hasException(AdBlockRuleOption.OtherOption):
--- a/eric6/WebBrowser/AdBlock/AdBlockSubscription.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/AdBlock/AdBlockSubscription.py Tue Mar 02 17:17:09 2021 +0100 @@ -130,7 +130,7 @@ lastUpdateString = urlQuery.queryItemValue("lastUpdate") self.__lastUpdate = QDateTime.fromString(lastUpdateString, - Qt.ISODate) + Qt.DateFormat.ISODate) self.__loadRules() @@ -154,8 +154,10 @@ if not self.__enabled: queryItems.append(("enabled", "false")) if self.__lastUpdate.isValid(): - queryItems.append(("lastUpdate", - self.__lastUpdate.toString(Qt.ISODate))) + queryItems.append( + ("lastUpdate", + self.__lastUpdate.toString(Qt.DateFormat.ISODate)) + ) query = QUrlQuery() query.setQueryItems(queryItems) @@ -261,7 +263,8 @@ return "" sha1 = bytes(QCryptographicHash.hash( - self.__location, QCryptographicHash.Sha1).toHex()).decode() + self.__location, QCryptographicHash.Algorithm.Sha1).toHex() + ).decode() dataDir = os.path.join( Utilities.getConfigDir(), "web_browser", "subscriptions") if not os.path.exists(dataDir): @@ -277,7 +280,7 @@ fileName = self.rulesFileName() f = QFile(fileName) if f.exists(): - if not f.open(QIODevice.ReadOnly): + if not f.open(QIODevice.OpenModeFlag.ReadOnly): E5MessageBox.warning( None, self.tr("Load subscription rules"), @@ -391,7 +394,7 @@ reply.close() self.__downloading = None - if reply.error() != QNetworkReply.NoError: + if reply.error() != QNetworkReply.NetworkError.NoError: if not self.__defaultSubscription: # don't show error if we try to load the default E5MessageBox.warning( @@ -416,7 +419,7 @@ fileName = self.rulesFileName() QFile.remove(fileName) f = QFile(fileName) - if not f.open(QIODevice.ReadWrite): + if not f.open(QIODevice.OpenModeFlag.ReadWrite): E5MessageBox.warning( None, self.tr("Downloading subscription rules"), @@ -519,7 +522,8 @@ return f = QFile(fileName) - if not f.open(QIODevice.ReadWrite | QIODevice.Truncate): + if not f.open(QIODevice.OpenModeFlag.ReadWrite | + QIODevice.OpenModeFlag.Truncate): E5MessageBox.warning( None, self.tr("Saving subscription rules"),
--- a/eric6/WebBrowser/AdBlock/AdBlockTreeWidget.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/AdBlock/AdBlockTreeWidget.py Tue Mar 02 17:17:09 2021 +0100 @@ -38,7 +38,7 @@ self.__ruleToBeSelected = "" self.__itemChangingBlock = False - self.setContextMenuPolicy(Qt.CustomContextMenu) + self.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu) self.setDefaultItemShowMode(E5TreeWidget.ItemsExpanded) self.setHeaderHidden(True) self.setAlternatingRowColors(True) @@ -67,11 +67,13 @@ if not bool(self.__topItem) and bool(rule): self.__ruleToBeSelected = rule.filter() elif self.__ruleToBeSelected: - items = self.findItems(self.__ruleToBeSelected, Qt.MatchRecursive) + items = self.findItems( + self.__ruleToBeSelected, Qt.MatchFlag.MatchRecursive) if items: item = items[0] self.setCurrentItem(item) - self.scrollToItem(item, QAbstractItemView.PositionAtCenter) + self.scrollToItem( + item, QAbstractItemView.ScrollHint.PositionAtCenter) self.__ruleToBeSelected = "" @@ -97,9 +99,9 @@ for rule in allRules: item = QTreeWidgetItem(self.__topItem) item.setText(0, rule.filter()) - item.setData(0, Qt.UserRole, index) + item.setData(0, Qt.ItemDataRole.UserRole, index) if self.__subscription.canEditRules(): - item.setFlags(item.flags() | Qt.ItemIsEditable) + item.setFlags(item.flags() | Qt.ItemFlag.ItemIsEditable) self.__adjustItemFeatures(item, rule) index += 1 @@ -122,7 +124,7 @@ self, self.tr("Add Custom Rule"), self.tr("Write your rule here:"), - QLineEdit.Normal) + QLineEdit.EchoMode.Normal) if not ok or filterRule == "": return @@ -142,7 +144,7 @@ ): return - offset = item.data(0, Qt.UserRole) + offset = item.data(0, Qt.ItemDataRole.UserRole) self.__subscription.removeRule(offset) self.deleteItem(item) @@ -181,14 +183,20 @@ self.__itemChangingBlock = True - offset = itm.data(0, Qt.UserRole) + offset = itm.data(0, Qt.ItemDataRole.UserRole) oldRule = self.__subscription.rule(offset) - if itm.checkState(0) == Qt.Unchecked and oldRule.isEnabled(): + if ( + itm.checkState(0) == Qt.CheckState.Unchecked and + oldRule.isEnabled() + ): # Disable rule rule = self.__subscription.setRuleEnabled(offset, False) self.__adjustItemFeatures(itm, rule) - elif itm.checkState(0) == Qt.Checked and not oldRule.isEnabled(): + elif ( + itm.checkState(0) == Qt.CheckState.Checked and + not oldRule.isEnabled() + ): # Enable rule rule = self.__subscription.setRuleEnabled(offset, True) self.__adjustItemFeatures(itm, rule) @@ -233,23 +241,23 @@ if not rule.isEnabled(): font = QFont() font.setItalic(True) - itm.setForeground(0, QColor(Qt.gray)) + itm.setForeground(0, QColor(Qt.GlobalColor.gray)) if not rule.isComment() and not rule.isHeader(): - itm.setFlags(itm.flags() | Qt.ItemIsUserCheckable) - itm.setCheckState(0, Qt.Unchecked) + itm.setFlags(itm.flags() | Qt.ItemFlag.ItemIsUserCheckable) + itm.setCheckState(0, Qt.CheckState.Unchecked) itm.setFont(0, font) return - itm.setFlags(itm.flags() | Qt.ItemIsUserCheckable) - itm.setCheckState(0, Qt.Checked) + itm.setFlags(itm.flags() | Qt.ItemFlag.ItemIsUserCheckable) + itm.setCheckState(0, Qt.CheckState.Checked) if rule.isCSSRule(): - itm.setForeground(0, QColor(Qt.darkBlue)) + itm.setForeground(0, QColor(Qt.GlobalColor.darkBlue)) itm.setFont(0, QFont()) elif rule.isException(): - itm.setForeground(0, QColor(Qt.darkGreen)) + itm.setForeground(0, QColor(Qt.GlobalColor.darkGreen)) itm.setFont(0, QFont()) else: itm.setForeground(0, QColor()) @@ -263,11 +271,11 @@ @type QKeyEvent """ if ( - evt.key() == Qt.Key_C and - evt.modifiers() & Qt.ControlModifier + evt.key() == Qt.Key.Key_C and + evt.modifiers() & Qt.KeyboardModifier.ControlModifier ): self.__copyFilter() - elif evt.key() == Qt.Key_Delete: + elif evt.key() == Qt.Key.Key_Delete: self.removeRule() else: super(AdBlockTreeWidget, self).keyPressEvent(evt)
--- a/eric6/WebBrowser/AutoScroll/AutoScroller.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/AutoScroll/AutoScroller.py Tue Mar 02 17:17:09 2021 +0100 @@ -97,7 +97,7 @@ @rtype bool """ if self.__enabled: - middleButton = evt.buttons() == Qt.MiddleButton + middleButton = evt.buttons() == Qt.MouseButton.MiddleButton if view: # test for start @@ -168,10 +168,10 @@ @rtype bool """ if obj == self.__indicator: - if evt.type() == QEvent.Enter: + if evt.type() == QEvent.Type.Enter: self.__scroller.stopScrolling() - elif evt.type() in [QEvent.Wheel, QEvent.Hide, - QEvent.MouseButtonPress]: + elif evt.type() in [QEvent.Type.Wheel, QEvent.Type.Hide, + QEvent.Type.MouseButtonPress]: self.__stopScrolling() return False @@ -233,7 +233,7 @@ self.__scroller.setPage(view.page()) self.__view.inputWidget().grabMouse() - QApplication.setOverrideCursor(Qt.ArrowCursor) + QApplication.setOverrideCursor(Qt.CursorShape.ArrowCursor) return True
--- a/eric6/WebBrowser/Bookmarks/BookmarksDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/Bookmarks/BookmarksDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -43,7 +43,7 @@ """ super(BookmarksDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) self.__bookmarksManager = manager if self.__bookmarksManager is None: @@ -69,7 +69,8 @@ header = fm.width("m") * 40 self.bookmarksTree.header().resizeSection(0, header) self.bookmarksTree.header().setStretchLastSection(True) - self.bookmarksTree.setContextMenuPolicy(Qt.CustomContextMenu) + self.bookmarksTree.setContextMenuPolicy( + Qt.ContextMenuPolicy.CustomContextMenu) self.bookmarksTree.activated.connect(self.__activated) self.bookmarksTree.customContextMenuRequested.connect( @@ -166,16 +167,16 @@ self.__openBookmarkInPrivateWindow) menu.addSeparator() act = menu.addAction(self.tr("Edit &Name"), self.__editName) - act.setEnabled(idx.flags() & Qt.ItemIsEditable) + act.setEnabled(idx.flags() & Qt.ItemFlag.ItemIsEditable) if idx.isValid() and node.type() != BookmarkNode.Folder: menu.addAction(self.tr("Edit &Address"), self.__editAddress) menu.addSeparator() act = menu.addAction( self.tr("&Delete"), self.bookmarksTree.removeSelected) - act.setEnabled(idx.flags() & Qt.ItemIsDragEnabled) + act.setEnabled(idx.flags() & Qt.ItemFlag.ItemIsDragEnabled) menu.addSeparator() act = menu.addAction(self.tr("&Properties..."), self.__edit) - act.setEnabled(idx.flags() & Qt.ItemIsEditable) + act.setEnabled(idx.flags() & Qt.ItemFlag.ItemIsEditable) if idx.isValid() and node.type() == BookmarkNode.Folder: menu.addSeparator() menu.addAction(self.tr("New &Folder..."), self.__newFolder) @@ -187,9 +188,15 @@ @param idx reference to the entry index (QModelIndex) """ - if QApplication.keyboardModifiers() & Qt.ControlModifier: + if ( + QApplication.keyboardModifiers() & + Qt.KeyboardModifier.ControlModifier + ): self.__openBookmarkInNewTab() - elif QApplication.keyboardModifiers() & Qt.ShiftModifier: + elif ( + QApplication.keyboardModifiers() & + Qt.KeyboardModifier.ShiftModifier + ): self.__openBookmarkInNewWindow() else: self.__openBookmarkInCurrentTab() @@ -264,16 +271,22 @@ if newTab: if background: self.newBackgroundTab.emit( - idx.sibling(idx.row(), 1).data(BookmarksModel.UrlRole), - idx.sibling(idx.row(), 0).data(Qt.DisplayRole)) + idx.sibling(idx.row(), 1).data( + BookmarksModel.UrlRole), + idx.sibling(idx.row(), 0).data( + Qt.ItemDataRole.DisplayRole)) else: self.newTab.emit( - idx.sibling(idx.row(), 1).data(BookmarksModel.UrlRole), - idx.sibling(idx.row(), 0).data(Qt.DisplayRole)) + idx.sibling(idx.row(), 1).data( + BookmarksModel.UrlRole), + idx.sibling(idx.row(), 0).data( + Qt.ItemDataRole.DisplayRole)) else: self.openUrl.emit( - idx.sibling(idx.row(), 1).data(BookmarksModel.UrlRole), - idx.sibling(idx.row(), 0).data(Qt.DisplayRole)) + idx.sibling(idx.row(), 1).data( + BookmarksModel.UrlRole), + idx.sibling(idx.row(), 0).data( + Qt.ItemDataRole.DisplayRole)) self.__bookmarksManager.incVisitCount(node) def __editName(self): @@ -335,7 +348,7 @@ self, self.tr("New Bookmark Folder"), self.tr("Enter title for new bookmark folder:"), - QLineEdit.Normal) + QLineEdit.EchoMode.Normal) if ok: if not title:
--- a/eric6/WebBrowser/Bookmarks/BookmarksImportDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/Bookmarks/BookmarksImportDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -26,7 +26,7 @@ """ Class implementing a dialog for importing bookmarks from other sources. """ - SourcesListIdRole = Qt.UserRole + SourcesListIdRole = Qt.ItemDataRole.UserRole def __init__(self, parent=None): """
--- a/eric6/WebBrowser/Bookmarks/BookmarksImporters/ChromeImporter.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/Bookmarks/BookmarksImporters/ChromeImporter.py Tue Mar 02 17:17:09 2021 +0100 @@ -142,7 +142,8 @@ else: importRootNode.title = self.tr( "Imported {0}" - ).format(QDate.currentDate().toString(Qt.SystemLocaleShortDate)) + ).format(QDate.currentDate().toString( + Qt.DateFormat.SystemLocaleShortDate)) return importRootNode def __processRoots(self, data, rootNode):
--- a/eric6/WebBrowser/Bookmarks/BookmarksImporters/FirefoxImporter.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/Bookmarks/BookmarksImporters/FirefoxImporter.py Tue Mar 02 17:17:09 2021 +0100 @@ -181,5 +181,6 @@ else: importRootNode.title = self.tr( "Imported {0}" - ).format(QDate.currentDate().toString(Qt.SystemLocaleShortDate)) + ).format(QDate.currentDate().toString( + Qt.DateFormat.SystemLocaleShortDate)) return importRootNode
--- a/eric6/WebBrowser/Bookmarks/BookmarksImporters/HtmlImporter.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/Bookmarks/BookmarksImporters/HtmlImporter.py Tue Mar 02 17:17:09 2021 +0100 @@ -105,5 +105,6 @@ else: importRootNode.title = self.tr( "Imported {0}" - ).format(QDate.currentDate().toString(Qt.SystemLocaleShortDate)) + ).format(QDate.currentDate().toString( + Qt.DateFormat.SystemLocaleShortDate)) return importRootNode
--- a/eric6/WebBrowser/Bookmarks/BookmarksImporters/IExplorerImporter.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/Bookmarks/BookmarksImporters/IExplorerImporter.py Tue Mar 02 17:17:09 2021 +0100 @@ -148,5 +148,6 @@ else: importRootNode.title = self.tr( "Imported {0}" - ).format(QDate.currentDate().toString(Qt.SystemLocaleShortDate)) + ).format(QDate.currentDate().toString( + Qt.DateFormat.SystemLocaleShortDate)) return importRootNode
--- a/eric6/WebBrowser/Bookmarks/BookmarksImporters/OperaImporter.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/Bookmarks/BookmarksImporters/OperaImporter.py Tue Mar 02 17:17:09 2021 +0100 @@ -132,5 +132,6 @@ else: importRootNode.title = self.tr( "Imported {0}" - ).format(QDate.currentDate().toString(Qt.SystemLocaleShortDate)) + ).format(QDate.currentDate().toString( + Qt.DateFormat.SystemLocaleShortDate)) return importRootNode
--- a/eric6/WebBrowser/Bookmarks/BookmarksImporters/SafariImporter.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/Bookmarks/BookmarksImporters/SafariImporter.py Tue Mar 02 17:17:09 2021 +0100 @@ -121,7 +121,8 @@ else: importRootNode.title = self.tr( "Imported {0}" - ).format(QDate.currentDate().toString(Qt.SystemLocaleShortDate)) + ).format(QDate.currentDate().toString( + Qt.DateFormat.SystemLocaleShortDate)) return importRootNode def __processChildren(self, children, rootNode):
--- a/eric6/WebBrowser/Bookmarks/BookmarksImporters/XbelImporter.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/Bookmarks/BookmarksImporters/XbelImporter.py Tue Mar 02 17:17:09 2021 +0100 @@ -134,7 +134,7 @@ reader = XbelReader() importRootNode = reader.read(self.__fileName) - if reader.error() != QXmlStreamReader.NoError: + if reader.error() != QXmlStreamReader.Error.NoError: self._error = True self._errorString = self.tr( """Error when importing bookmarks on line {0},""" @@ -155,5 +155,6 @@ else: importRootNode.title = self.tr( "Imported {0}" - ).format(QDate.currentDate().toString(Qt.SystemLocaleShortDate)) + ).format(QDate.currentDate().toString( + Qt.DateFormat.SystemLocaleShortDate)) return importRootNode
--- a/eric6/WebBrowser/Bookmarks/BookmarksManager.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/Bookmarks/BookmarksManager.py Tue Mar 02 17:17:09 2021 +0100 @@ -129,12 +129,12 @@ if not QFile.exists(bookmarkFile): bookmarkFile = QFile(os.path.join( os.path.dirname(__file__), "DefaultBookmarks.xbel")) - bookmarkFile.open(QIODevice.ReadOnly) + bookmarkFile.open(QIODevice.OpenModeFlag.ReadOnly) from .XbelReader import XbelReader reader = XbelReader() self.__bookmarkRootNode = reader.read(bookmarkFile) - if reader.error() != QXmlStreamReader.NoError: + if reader.error() != QXmlStreamReader.Error.NoError: E5MessageBox.warning( None, self.tr("Loading Bookmarks"), @@ -380,7 +380,7 @@ """ from .BookmarksImportDialog import BookmarksImportDialog dlg = BookmarksImportDialog() - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: importRootNode = dlg.getImportedBookmarks() if importRootNode is not None: self.addBookmark(self.menu(), importRootNode)
--- a/eric6/WebBrowser/Bookmarks/BookmarksMenu.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/Bookmarks/BookmarksMenu.py Tue Mar 02 17:17:09 2021 +0100 @@ -44,7 +44,7 @@ self.setStatusBarTextRole(BookmarksModel.UrlStringRole) self.setSeparatorRole(BookmarksModel.SeparatorRole) - self.setContextMenuPolicy(Qt.CustomContextMenu) + self.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu) self.customContextMenuRequested.connect(self.__contextMenuRequested) def createBaseMenu(self): @@ -77,18 +77,18 @@ @param idx index of the activated item (QModelIndex) """ - if self._keyboardModifiers & Qt.ControlModifier: + if self._keyboardModifiers & Qt.KeyboardModifier.ControlModifier: self.newTab.emit( idx.data(BookmarksModel.UrlRole), - idx.data(Qt.DisplayRole)) - elif self._keyboardModifiers & Qt.ShiftModifier: + idx.data(Qt.ItemDataRole.DisplayRole)) + elif self._keyboardModifiers & Qt.KeyboardModifier.ShiftModifier: self.newWindow.emit( idx.data(BookmarksModel.UrlRole), - idx.data(Qt.DisplayRole)) + idx.data(Qt.ItemDataRole.DisplayRole)) else: self.openUrl.emit( idx.data(BookmarksModel.UrlRole), - idx.data(Qt.DisplayRole)) + idx.data(Qt.ItemDataRole.DisplayRole)) self.__updateVisitCount(idx) def postPopulated(self): @@ -140,11 +140,11 @@ if i == 0: self.openUrl.emit( child.data(BookmarksModel.UrlRole), - child.data(Qt.DisplayRole)) + child.data(Qt.ItemDataRole.DisplayRole)) else: self.newTab.emit( child.data(BookmarksModel.UrlRole), - child.data(Qt.DisplayRole)) + child.data(Qt.ItemDataRole.DisplayRole)) self.__updateVisitCount(child) def __contextMenuRequested(self, pos): @@ -209,7 +209,7 @@ self.openUrl.emit( idx.data(BookmarksModel.UrlRole), - idx.data(Qt.DisplayRole)) + idx.data(Qt.ItemDataRole.DisplayRole)) self.__updateVisitCount(idx) def __openBookmarkInNewTab(self, act): @@ -223,7 +223,7 @@ self.newTab.emit( idx.data(BookmarksModel.UrlRole), - idx.data(Qt.DisplayRole)) + idx.data(Qt.ItemDataRole.DisplayRole)) self.__updateVisitCount(idx) def __openBookmarkInNewWindow(self, act):
--- a/eric6/WebBrowser/Bookmarks/BookmarksModel.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/Bookmarks/BookmarksModel.py Tue Mar 02 17:17:09 2021 +0100 @@ -19,11 +19,11 @@ """ Class implementing the bookmark model. """ - TypeRole = Qt.UserRole + 1 - UrlRole = Qt.UserRole + 2 - UrlStringRole = Qt.UserRole + 3 - VisitCountRole = Qt.UserRole + 4 - SeparatorRole = Qt.UserRole + 5 + TypeRole = Qt.ItemDataRole.UserRole + 1 + UrlRole = Qt.ItemDataRole.UserRole + 2 + UrlStringRole = Qt.ItemDataRole.UserRole + 3 + VisitCountRole = Qt.ItemDataRole.UserRole + 4 + SeparatorRole = Qt.ItemDataRole.UserRole + 5 MIMETYPE = "application/bookmarks.xbel" @@ -140,23 +140,27 @@ return True - def headerData(self, section, orientation, role=Qt.DisplayRole): + def headerData(self, section, orientation, + role=Qt.ItemDataRole.DisplayRole): """ Public method to get the header data. @param section section number (integer) @param orientation header orientation (Qt.Orientation) - @param role data role (integer) + @param role data role (Qt.ItemDataRole) @return header data """ - if orientation == Qt.Horizontal and role == Qt.DisplayRole: + if ( + orientation == Qt.Orientation.Horizontal and + role == Qt.ItemDataRole.DisplayRole + ): try: return self.__headers[section] except IndexError: pass return QAbstractItemModel.headerData(self, section, orientation, role) - def data(self, index, role=Qt.DisplayRole): + def data(self, index, role=Qt.ItemDataRole.DisplayRole): """ Public method to get data from the model. @@ -170,7 +174,7 @@ from .BookmarkNode import BookmarkNode bookmarkNode = self.node(index) - if role in [Qt.EditRole, Qt.DisplayRole]: + if role in [Qt.ItemDataRole.EditRole, Qt.ItemDataRole.DisplayRole]: if bookmarkNode.type() == BookmarkNode.Separator: if index.column() == 0: return 50 * '\xB7' @@ -197,7 +201,7 @@ elif role == BookmarksModel.SeparatorRole: return bookmarkNode.type() == BookmarkNode.Separator - elif role == Qt.DecorationRole: + elif role == Qt.ItemDataRole.DecorationRole: if index.column() == 0: if bookmarkNode.type() == BookmarkNode.Folder: return UI.PixmapCache.getIcon("dirOpen") @@ -319,14 +323,14 @@ @return flags (Qt.ItemFlags) """ if not index.isValid(): - return Qt.NoItemFlags + return Qt.ItemFlag.NoItemFlags node = self.node(index) type_ = node.type() - flags = Qt.ItemIsSelectable | Qt.ItemIsEnabled + flags = Qt.ItemFlag.ItemIsSelectable | Qt.ItemFlag.ItemIsEnabled if self.hasChildren(index): - flags |= Qt.ItemIsDropEnabled + flags |= Qt.ItemFlag.ItemIsDropEnabled if ( node == self.__bookmarksManager.menu() or @@ -334,14 +338,14 @@ ): return flags - flags |= Qt.ItemIsDragEnabled + flags |= Qt.ItemFlag.ItemIsDragEnabled from .BookmarkNode import BookmarkNode if ( (index.column() == 0 and type_ != BookmarkNode.Separator) or (index.column() == 1 and type_ == BookmarkNode.Bookmark) ): - flags |= Qt.ItemIsEditable + flags |= Qt.ItemFlag.ItemIsEditable return flags @@ -351,7 +355,7 @@ @return supported drop actions (Qt.DropAction) """ - return Qt.CopyAction | Qt.MoveAction + return Qt.DropAction.CopyAction | Qt.DropAction.MoveAction def mimeTypes(self): """ @@ -371,7 +375,7 @@ from .XbelWriter import XbelWriter data = QByteArray() - stream = QDataStream(data, QIODevice.WriteOnly) + stream = QDataStream(data, QIODevice.OpenModeFlag.WriteOnly) urls = [] for index in indexes: @@ -380,7 +384,7 @@ encodedData = QByteArray() buffer = QBuffer(encodedData) - buffer.open(QIODevice.ReadWrite) + buffer.open(QIODevice.OpenModeFlag.ReadWrite) writer = XbelWriter() parentNode = self.node(index) writer.write(buffer, parentNode) @@ -403,7 +407,7 @@ @param parent index of the parent node (QModelIndex) @return flag indicating successful acceptance of the data (boolean) """ - if action == Qt.IgnoreAction: + if action == Qt.DropAction.IgnoreAction: return True if column > 0: @@ -428,7 +432,7 @@ return True ba = data.data(self.MIMETYPE) - stream = QDataStream(ba, QIODevice.ReadOnly) + stream = QDataStream(ba, QIODevice.OpenModeFlag.ReadOnly) if stream.atEnd(): return False @@ -440,7 +444,7 @@ encodedData = QByteArray() stream >> encodedData buffer = QBuffer(encodedData) - buffer.open(QIODevice.ReadOnly) + buffer.open(QIODevice.OpenModeFlag.ReadOnly) reader = XbelReader() rootNode = reader.read(buffer) @@ -453,7 +457,7 @@ return True - def setData(self, index, value, role=Qt.EditRole): + def setData(self, index, value, role=Qt.ItemDataRole.EditRole): """ Public method to set the data of a node cell. @@ -462,12 +466,15 @@ @param role role of the data (integer) @return flag indicating success (boolean) """ - if not index.isValid() or (self.flags(index) & Qt.ItemIsEditable) == 0: + if ( + not index.isValid() or + (self.flags(index) & Qt.ItemFlag.ItemIsEditable) == 0 + ): return False item = self.node(index) - if role in (Qt.EditRole, Qt.DisplayRole): + if role in (Qt.ItemDataRole.EditRole, Qt.ItemDataRole.DisplayRole): if index.column() == 0: self.__bookmarksManager.setTitle(item, value) elif index.column() == 1:
--- a/eric6/WebBrowser/Bookmarks/BookmarksToolBar.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/Bookmarks/BookmarksToolBar.py Tue Mar 02 17:17:09 2021 +0100 @@ -50,11 +50,11 @@ self.setRootIndex(model.nodeIndex( self.__mw.bookmarksManager().toolbar())) - self.setContextMenuPolicy(Qt.CustomContextMenu) + self.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu) self.customContextMenuRequested.connect(self.__contextMenuRequested) self.activated.connect(self.__bookmarkActivated) - self.setToolButtonStyle(Qt.ToolButtonTextBesideIcon) + self.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon) self._build() @@ -135,25 +135,31 @@ @param idx index of the activated bookmark (QModelIndex) """ if idx.isValid(): - if self._mouseButton == Qt.XButton1: + if self._mouseButton == Qt.MouseButton.XButton1: + self.__mw.currentBrowser().triggerPageAction( + QWebEnginePage.WebAction.Back) + elif self._mouseButton == Qt.MouseButton.XButton2: self.__mw.currentBrowser().triggerPageAction( - QWebEnginePage.Back) - elif self._mouseButton == Qt.XButton2: - self.__mw.currentBrowser().triggerPageAction( - QWebEnginePage.Forward) - elif self._mouseButton == Qt.LeftButton: - if self._keyboardModifiers & Qt.ControlModifier: + QWebEnginePage.WebAction.Forward) + elif self._mouseButton == Qt.MouseButton.LeftButton: + if ( + self._keyboardModifiers & + Qt.KeyboardModifier.ControlModifier + ): self.newTab.emit( idx.data(BookmarksModel.UrlRole), - idx.data(Qt.DisplayRole)) - elif self._keyboardModifiers & Qt.ShiftModifier: + idx.data(Qt.ItemDataRole.DisplayRole)) + elif ( + self._keyboardModifiers & + Qt.KeyboardModifier.ShiftModifier + ): self.newWindow.emit( idx.data(BookmarksModel.UrlRole), - idx.data(Qt.DisplayRole)) + idx.data(Qt.ItemDataRole.DisplayRole)) else: self.openUrl.emit( idx.data(BookmarksModel.UrlRole), - idx.data(Qt.DisplayRole)) + idx.data(Qt.ItemDataRole.DisplayRole)) self.__updateVisitCount(idx) def __openBookmark(self, act): @@ -167,7 +173,7 @@ self.openUrl.emit( idx.data(BookmarksModel.UrlRole), - idx.data(Qt.DisplayRole)) + idx.data(Qt.ItemDataRole.DisplayRole)) self.__updateVisitCount(idx) def __openBookmarkInNewTab(self, act): @@ -181,7 +187,7 @@ self.newTab.emit( idx.data(BookmarksModel.UrlRole), - idx.data(Qt.DisplayRole)) + idx.data(Qt.ItemDataRole.DisplayRole)) self.__updateVisitCount(idx) def __openBookmarkInNewWindow(self, act): @@ -195,7 +201,7 @@ self.newWindow.emit( idx.data(BookmarksModel.UrlRole), - idx.data(Qt.DisplayRole)) + idx.data(Qt.ItemDataRole.DisplayRole)) self.__updateVisitCount(idx) def __openBookmarkInPrivateWindow(self, act):
--- a/eric6/WebBrowser/Bookmarks/XbelReader.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/Bookmarks/XbelReader.py Tue Mar 02 17:17:09 2021 +0100 @@ -114,7 +114,7 @@ folder = BookmarkNode(BookmarkNode.Folder, node) folder.expanded = self.attributes().value("folded") == "no" folder.added = QDateTime.fromString( - self.attributes().value("added"), Qt.ISODate) + self.attributes().value("added"), Qt.DateFormat.ISODate) while not self.atEnd(): self.readNext() @@ -170,7 +170,7 @@ """ sep = BookmarkNode(BookmarkNode.Separator, node) sep.added = QDateTime.fromString( - self.attributes().value("added"), Qt.ISODate) + self.attributes().value("added"), Qt.DateFormat.ISODate) # empty elements have a start and end element while not self.atEnd(): @@ -196,11 +196,11 @@ bookmark = BookmarkNode(BookmarkNode.Bookmark, node) bookmark.url = self.attributes().value("href") bookmark.added = QDateTime.fromString( - self.attributes().value("added"), Qt.ISODate) + self.attributes().value("added"), Qt.DateFormat.ISODate) bookmark.modified = QDateTime.fromString( - self.attributes().value("modified"), Qt.ISODate) + self.attributes().value("modified"), Qt.DateFormat.ISODate) bookmark.visited = QDateTime.fromString( - self.attributes().value("visited"), Qt.ISODate) + self.attributes().value("visited"), Qt.DateFormat.ISODate) try: bookmark.visitCount = int(self.attributes().value("visitCount")) except ValueError:
--- a/eric6/WebBrowser/Bookmarks/XbelWriter.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/Bookmarks/XbelWriter.py Tue Mar 02 17:17:09 2021 +0100 @@ -72,7 +72,8 @@ if node.type() == BookmarkNode.Folder: self.writeStartElement("folder") if node.added.isValid(): - self.writeAttribute("added", node.added.toString(Qt.ISODate)) + self.writeAttribute("added", + node.added.toString(Qt.DateFormat.ISODate)) self.writeAttribute("folded", node.expanded and "no" or "yes") self.writeTextElement("title", node.title) for child in node.children(): @@ -83,13 +84,14 @@ if node.url: self.writeAttribute("href", node.url) if node.added.isValid(): - self.writeAttribute("added", node.added.toString(Qt.ISODate)) + self.writeAttribute("added", + node.added.toString(Qt.DateFormat.ISODate)) if node.modified.isValid(): self.writeAttribute( - "modified", node.modified.toString(Qt.ISODate)) + "modified", node.modified.toString(Qt.DateFormat.ISODate)) if node.visited.isValid(): self.writeAttribute( - "visited", node.visited.toString(Qt.ISODate)) + "visited", node.visited.toString(Qt.DateFormat.ISODate)) self.writeAttribute("visitCount", str(node.visitCount)) self.writeTextElement("title", node.title) if node.desc: @@ -98,4 +100,5 @@ elif node.type() == BookmarkNode.Separator: self.writeEmptyElement("separator") if node.added.isValid(): - self.writeAttribute("added", node.added.toString(Qt.ISODate)) + self.writeAttribute("added", + node.added.toString(Qt.DateFormat.ISODate))
--- a/eric6/WebBrowser/CookieJar/CookieExceptionsModel.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/CookieJar/CookieExceptionsModel.py Tue Mar 02 17:17:09 2021 +0100 @@ -40,21 +40,26 @@ @param section section number (integer) @param orientation orientation (Qt.Orientation) - @param role role of the data to retrieve (integer) + @param role role of the data to retrieve (Qt.ItemDataRole) @return requested data """ - if role == Qt.SizeHintRole: + if role == Qt.ItemDataRole.SizeHintRole: fm = QFontMetrics(QFont()) height = fm.height() + fm.height() // 3 try: width = fm.horizontalAdvance( - self.headerData(section, orientation, Qt.DisplayRole)) + self.headerData(section, orientation, + Qt.ItemDataRole.DisplayRole)) except AttributeError: width = fm.width( - self.headerData(section, orientation, Qt.DisplayRole)) + self.headerData(section, orientation, + Qt.ItemDataRole.DisplayRole)) return QSize(width, height) - if orientation == Qt.Horizontal and role == Qt.DisplayRole: + if ( + orientation == Qt.Orientation.Horizontal and + role == Qt.ItemDataRole.DisplayRole + ): try: return self.__headers[section] except IndexError: @@ -73,7 +78,7 @@ if index.row() < 0 or index.row() >= self.rowCount(): return None - if role in (Qt.DisplayRole, Qt.EditRole): + if role in (Qt.ItemDataRole.DisplayRole, Qt.ItemDataRole.EditRole): row = index.row() if row < len(self.__allowedCookies): if index.column() == 0:
--- a/eric6/WebBrowser/CookieJar/CookieJar.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/CookieJar/CookieJar.py Tue Mar 02 17:17:09 2021 +0100 @@ -121,7 +121,8 @@ if self.__loaded: return - cookieSettings = QSettings(self.__cookiesFile, QSettings.IniFormat) + cookieSettings = QSettings(self.__cookiesFile, + QSettings.Format.IniFormat) # load exceptions self.__exceptionsBlock = Preferences.toList( @@ -152,7 +153,8 @@ if not self.__loaded: return - cookieSettings = QSettings(self.__cookiesFile, QSettings.IniFormat) + cookieSettings = QSettings(self.__cookiesFile, + QSettings.Format.IniFormat) cookieSettings.setValue("Exceptions/block", self.__exceptionsBlock) cookieSettings.setValue("Exceptions/allow", self.__exceptionsAllow)
--- a/eric6/WebBrowser/CookieJar/CookiesDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/CookieJar/CookiesDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -19,8 +19,8 @@ """ Class implementing a dialog to show all cookies. """ - DomainRole = Qt.UserRole + 1 - CookieRole = Qt.UserRole + 2 + DomainRole = Qt.ItemDataRole.UserRole + 1 + CookieRole = Qt.ItemDataRole.UserRole + 2 def __init__(self, cookieJar, parent=None): """ @@ -53,7 +53,8 @@ """ Private slot to resize the columns. """ - self.cookiesTree.header().resizeSections(QHeaderView.ResizeToContents) + self.cookiesTree.header().resizeSections( + QHeaderView.ResizeMode.ResizeToContents) self.cookiesTree.header().setStretchLastSection(True) def __cookieDomain(self, cookie):
--- a/eric6/WebBrowser/Download/DownloadItem.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/Download/DownloadItem.py Tue Mar 02 17:17:09 2021 +0100 @@ -59,7 +59,7 @@ self.setupUi(self) p = self.infoLabel.palette() - p.setColor(QPalette.Text, Qt.darkGray) + p.setColor(QPalette.ColorRole.Text, Qt.GlobalColor.darkGray) self.infoLabel.setPalette(p) self.progressBar.setMaximum(0) @@ -76,7 +76,7 @@ self.__state = DownloadItem.Downloading - icon = self.style().standardIcon(QStyle.SP_FileIcon) + icon = self.style().standardIcon(QStyle.StandardPixmap.SP_FileIcon) self.fileIcon.setPixmap(icon.pixmap(48, 48)) self.__downloadItem = downloadItem @@ -123,7 +123,7 @@ self.progressBar.setValue(0) if ( self.__downloadItem.state() == - QWebEngineDownloadItem.DownloadRequested + QWebEngineDownloadItem.DownloadState.DownloadRequested ): self.__getFileName() if not self.__fileName: @@ -143,11 +143,11 @@ return savePage = self.__downloadItem.type() == ( - QWebEngineDownloadItem.SavePage + QWebEngineDownloadItem.DownloadType.SavePage ) documentLocation = QStandardPaths.writableLocation( - QStandardPaths.DocumentsLocation) + QStandardPaths.StandardLocation.DocumentsLocation) downloadDirectory = ( WebBrowserWindow.downloadManager().downloadDirectory() ) @@ -175,7 +175,10 @@ "{0}://{1}".format(url.scheme(), url.authority()), self) - if dlg.exec() == QDialog.Rejected or dlg.getAction() == "cancel": + if ( + dlg.exec() == QDialog.DialogCode.Rejected or + dlg.getAction() == "cancel" + ): self.progressBar.setVisible(False) self.on_stopButton_clicked() self.filenameLabel.setText( @@ -199,7 +202,7 @@ self.__autoOpen = dlg.getAction() == "open" tempLocation = QStandardPaths.writableLocation( - QStandardPaths.TempLocation) + QStandardPaths.StandardLocation.TempLocation) fileName = ( tempLocation + '/' + QFileInfo(fileName).completeBaseName() @@ -486,7 +489,7 @@ self.__finishedDownloading = True noError = (self.__downloadItem.state() == - QWebEngineDownloadItem.DownloadCompleted) + QWebEngineDownloadItem.DownloadState.DownloadCompleted) self.progressBar.setVisible(False) self.pauseButton.setEnabled(False)
--- a/eric6/WebBrowser/Download/DownloadManager.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/Download/DownloadManager.py Tue Mar 02 17:17:09 2021 +0100 @@ -54,7 +54,7 @@ """ super(DownloadManager, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) self.__winTaskbarButton = None @@ -78,7 +78,8 @@ self.downloadsView.setAlternatingRowColors(True) self.downloadsView.horizontalHeader().setStretchLastSection(True) self.downloadsView.setModel(self.__model) - self.downloadsView.setContextMenuPolicy(Qt.CustomContextMenu) + self.downloadsView.setContextMenuPolicy( + Qt.ContextMenuPolicy.CustomContextMenu) self.downloadsView.customContextMenuRequested.connect( self.__customContextMenuRequested) @@ -318,7 +319,7 @@ self.__model.endInsertRows() self.downloadsView.setIndexWidget(self.__model.index(row, 0), itm) - icon = self.style().standardIcon(QStyle.SP_FileIcon) + icon = self.style().standardIcon(QStyle.StandardPixmap.SP_FileIcon) itm.setIcon(icon) self.downloadsView.setRowHeight( row, itm.sizeHint().height() * self.__rowHeightMultiplier) @@ -345,7 +346,7 @@ icon = self.__iconProvider.icon(QFileInfo(itm.fileName())) if icon.isNull(): - icon = self.style().standardIcon(QStyle.SP_FileIcon) + icon = self.style().standardIcon(QStyle.StandardPixmap.SP_FileIcon) itm.setIcon(icon) self.downloadsView.setRowHeight( @@ -703,7 +704,8 @@ """ itm = self.__currentItem() if itm is not None: - url = itm.getPageUrl().toDisplayString(QUrl.FullyDecoded) + url = itm.getPageUrl().toDisplayString( + QUrl.ComponentFormattingOption.FullyDecoded) QApplication.clipboard().setText(url) def __contextMenuSelectAll(self):
--- a/eric6/WebBrowser/Download/DownloadManagerButton.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/Download/DownloadManagerButton.py Tue Mar 02 17:17:09 2021 +0100 @@ -34,8 +34,8 @@ self.setObjectName("navigation_download_manager_button") self.setIcon(UI.PixmapCache.getIcon("downloads")) self.setToolTip(self.tr("Open Download Manager")) - self.setToolButtonStyle(Qt.ToolButtonIconOnly) - self.setFocusPolicy(Qt.NoFocus) + self.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonIconOnly) + self.setFocusPolicy(Qt.FocusPolicy.NoFocus) self.setAutoRaise(True) self.clicked.connect(self.__buttonClicked)
--- a/eric6/WebBrowser/Download/DownloadModel.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/Download/DownloadModel.py Tue Mar 02 17:17:09 2021 +0100 @@ -41,7 +41,7 @@ if index.row() < 0 or index.row() >= self.rowCount(index.parent()): return None - if role == Qt.ToolTipRole: + if role == Qt.ItemDataRole.ToolTipRole: if ( self.__manager.downloads()[index.row()] .downloadedSuccessfully() @@ -108,13 +108,13 @@ @rtype Qt.ItemFlags """ if index.row() < 0 or index.row() >= self.rowCount(index.parent()): - return Qt.NoItemFlags + return Qt.ItemFlag.NoItemFlags defaultFlags = QAbstractListModel.flags(self, index) itm = self.__manager.downloads()[index.row()] if itm.downloadedSuccessfully(): - return defaultFlags | Qt.ItemIsDragEnabled + return defaultFlags | Qt.ItemFlag.ItemIsDragEnabled return defaultFlags
--- a/eric6/WebBrowser/FeaturePermissions/FeaturePermissionBar.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/FeaturePermissions/FeaturePermissionBar.py Tue Mar 02 17:17:09 2021 +0100 @@ -43,23 +43,23 @@ self.__manager = manager self.__permissionFeatureTexts = { - QWebEnginePage.Geolocation: + QWebEnginePage.Feature.Geolocation: self.tr("{0} wants to use your position."), - QWebEnginePage.MediaAudioCapture: + QWebEnginePage.Feature.MediaAudioCapture: self.tr("{0} wants to use your microphone."), - QWebEnginePage.MediaVideoCapture: + QWebEnginePage.Feature.MediaVideoCapture: self.tr("{0} wants to use your camera."), - QWebEnginePage.MediaAudioVideoCapture: + QWebEnginePage.Feature.MediaAudioVideoCapture: self.tr("{0} wants to use your microphone and camera."), - QWebEnginePage.MouseLock: + QWebEnginePage.Feature.MouseLock: self.tr("{0} wants to lock your mouse."), } try: # these are defined as of Qt 5.10.0/PyQt 5.10.0 self.__permissionFeatureTexts.update({ - QWebEnginePage.DesktopVideoCapture: + QWebEnginePage.Feature.DesktopVideoCapture: self.tr("{0} wants to capture video of your screen."), - QWebEnginePage.DesktopAudioVideoCapture: + QWebEnginePage.Feature.DesktopAudioVideoCapture: self.tr("{0} wants to capture audio and video of your" " screen."), }) @@ -68,23 +68,24 @@ try: # this was re-added in Qt 5.13.0 self.__permissionFeatureTexts[ - QWebEnginePage.Notifications] = self.tr( + QWebEnginePage.Feature.Notifications] = self.tr( "{0} wants to use desktop notifications.") except AttributeError: pass self.__permissionFeatureIconNames = { - QWebEnginePage.Geolocation: "geolocation", - QWebEnginePage.MediaAudioCapture: "audiocapture", - QWebEnginePage.MediaVideoCapture: "camera", - QWebEnginePage.MediaAudioVideoCapture: "audio-video", - QWebEnginePage.MouseLock: "mouse", + QWebEnginePage.Feature.Geolocation: "geolocation", + QWebEnginePage.Feature.MediaAudioCapture: "audiocapture", + QWebEnginePage.Feature.MediaVideoCapture: "camera", + QWebEnginePage.Feature.MediaAudioVideoCapture: "audio-video", + QWebEnginePage.Feature.MouseLock: "mouse", } try: # these are defined as of Qt 5.10.0/PyQt 5.10.0 self.__permissionFeatureIconNames.update({ - QWebEnginePage.DesktopVideoCapture: "desktopVideoCapture", - QWebEnginePage.DesktopAudioVideoCapture: + QWebEnginePage.Feature.DesktopVideoCapture: + "desktopVideoCapture", + QWebEnginePage.Feature.DesktopAudioVideoCapture: "desktopAudioVideoCapture", }) except AttributeError: @@ -92,7 +93,7 @@ try: # this was re-added in Qt 5.13.0 self.__permissionFeatureIconNames[ - QWebEnginePage.Notifications] = "notification" + QWebEnginePage.Feature.Notifications] = "notification" except AttributeError: pass @@ -156,12 +157,12 @@ self.__page.setFeaturePermission( self.__origin, self.__feature, - QWebEnginePage.PermissionDeniedByUser) + QWebEnginePage.PermissionPolicy.PermissionDeniedByUser) if self.__rememberButton.isChecked(): self.__manager.rememberFeaturePermission( self.__page.url().host(), self.__feature, - QWebEnginePage.PermissionDeniedByUser) + QWebEnginePage.PermissionPolicy.PermissionDeniedByUser) self.hide() @@ -174,12 +175,12 @@ self.__page.setFeaturePermission( self.__origin, self.__feature, - QWebEnginePage.PermissionGrantedByUser) + QWebEnginePage.PermissionPolicy.PermissionGrantedByUser) if self.__rememberButton.isChecked(): self.__manager.rememberFeaturePermission( self.__page.url().host(), self.__feature, - QWebEnginePage.PermissionGrantedByUser) + QWebEnginePage.PermissionPolicy.PermissionGrantedByUser) self.hide() @@ -192,6 +193,6 @@ self.__page.setFeaturePermission( self.__origin, self.__feature, - QWebEnginePage.PermissionUnknown) + QWebEnginePage.PermissionPolicy.PermissionUnknown) self.hide()
--- a/eric6/WebBrowser/FeaturePermissions/FeaturePermissionManager.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/FeaturePermissions/FeaturePermissionManager.py Tue Mar 02 17:17:09 2021 +0100 @@ -31,96 +31,100 @@ super(FeaturePermissionManager, self).__init__(parent) self.__featurePermissions = { - QWebEnginePage.Geolocation: { - QWebEnginePage.PermissionGrantedByUser: [], - QWebEnginePage.PermissionDeniedByUser: [], + QWebEnginePage.Feature.Geolocation: { + QWebEnginePage.PermissionPolicy.PermissionGrantedByUser: [], + QWebEnginePage.PermissionPolicy.PermissionDeniedByUser: [], }, - QWebEnginePage.MediaAudioCapture: { - QWebEnginePage.PermissionGrantedByUser: [], - QWebEnginePage.PermissionDeniedByUser: [], + QWebEnginePage.Feature.MediaAudioCapture: { + QWebEnginePage.PermissionPolicy.PermissionGrantedByUser: [], + QWebEnginePage.PermissionPolicy.PermissionDeniedByUser: [], }, - QWebEnginePage.MediaVideoCapture: { - QWebEnginePage.PermissionGrantedByUser: [], - QWebEnginePage.PermissionDeniedByUser: [], + QWebEnginePage.Feature.MediaVideoCapture: { + QWebEnginePage.PermissionPolicy.PermissionGrantedByUser: [], + QWebEnginePage.PermissionPolicy.PermissionDeniedByUser: [], }, - QWebEnginePage.MediaAudioVideoCapture: { - QWebEnginePage.PermissionGrantedByUser: [], - QWebEnginePage.PermissionDeniedByUser: [], + QWebEnginePage.Feature.MediaAudioVideoCapture: { + QWebEnginePage.PermissionPolicy.PermissionGrantedByUser: [], + QWebEnginePage.PermissionPolicy.PermissionDeniedByUser: [], }, - QWebEnginePage.MouseLock: { - QWebEnginePage.PermissionGrantedByUser: [], - QWebEnginePage.PermissionDeniedByUser: [], + QWebEnginePage.Feature.MouseLock: { + QWebEnginePage.PermissionPolicy.PermissionGrantedByUser: [], + QWebEnginePage.PermissionPolicy.PermissionDeniedByUser: [], }, } try: # these are defined as of Qt 5.10.0/PyQt 5.10.0 self.__featurePermissions.update({ - QWebEnginePage.DesktopVideoCapture: { - QWebEnginePage.PermissionGrantedByUser: [], - QWebEnginePage.PermissionDeniedByUser: [], + QWebEnginePage.Feature.DesktopVideoCapture: { + QWebEnginePage.PermissionPolicy.PermissionGrantedByUser: + [], + QWebEnginePage.PermissionPolicy.PermissionDeniedByUser: + [], }, - QWebEnginePage.DesktopAudioVideoCapture: { - QWebEnginePage.PermissionGrantedByUser: [], - QWebEnginePage.PermissionDeniedByUser: [], + QWebEnginePage.Feature.DesktopAudioVideoCapture: { + QWebEnginePage.PermissionPolicy.PermissionGrantedByUser: + [], + QWebEnginePage.PermissionPolicy.PermissionDeniedByUser: + [], }, }) except AttributeError: pass try: # this was re-added in Qt 5.13.0 - self.__featurePermissions[QWebEnginePage.Notifications] = { - QWebEnginePage.PermissionGrantedByUser: [], - QWebEnginePage.PermissionDeniedByUser: [], + self.__featurePermissions[QWebEnginePage.Feature.Notifications] = { + QWebEnginePage.PermissionPolicy.PermissionGrantedByUser: [], + QWebEnginePage.PermissionPolicy.PermissionDeniedByUser: [], } except AttributeError: pass self.__featurePermissionsKeys = { - (QWebEnginePage.Geolocation, - QWebEnginePage.PermissionGrantedByUser): + (QWebEnginePage.Feature.Geolocation, + QWebEnginePage.PermissionPolicy.PermissionGrantedByUser): "GeolocationGranted", - (QWebEnginePage.Geolocation, - QWebEnginePage.PermissionDeniedByUser): + (QWebEnginePage.Feature.Geolocation, + QWebEnginePage.PermissionPolicy.PermissionDeniedByUser): "GeolocationDenied", - (QWebEnginePage.MediaAudioCapture, - QWebEnginePage.PermissionGrantedByUser): + (QWebEnginePage.Feature.MediaAudioCapture, + QWebEnginePage.PermissionPolicy.PermissionGrantedByUser): "MediaAudioCaptureGranted", - (QWebEnginePage.MediaAudioCapture, - QWebEnginePage.PermissionDeniedByUser): + (QWebEnginePage.Feature.MediaAudioCapture, + QWebEnginePage.PermissionPolicy.PermissionDeniedByUser): "MediaAudioCaptureDenied", - (QWebEnginePage.MediaVideoCapture, - QWebEnginePage.PermissionGrantedByUser): + (QWebEnginePage.Feature.MediaVideoCapture, + QWebEnginePage.PermissionPolicy.PermissionGrantedByUser): "MediaVideoCaptureGranted", - (QWebEnginePage.MediaVideoCapture, - QWebEnginePage.PermissionDeniedByUser): + (QWebEnginePage.Feature.MediaVideoCapture, + QWebEnginePage.PermissionPolicy.PermissionDeniedByUser): "MediaVideoCaptureDenied", - (QWebEnginePage.MediaAudioVideoCapture, - QWebEnginePage.PermissionGrantedByUser): + (QWebEnginePage.Feature.MediaAudioVideoCapture, + QWebEnginePage.PermissionPolicy.PermissionGrantedByUser): "MediaAudioVideoCaptureGranted", - (QWebEnginePage.MediaAudioVideoCapture, - QWebEnginePage.PermissionDeniedByUser): + (QWebEnginePage.Feature.MediaAudioVideoCapture, + QWebEnginePage.PermissionPolicy.PermissionDeniedByUser): "MediaAudioVideoCaptureDenied", - (QWebEnginePage.MouseLock, - QWebEnginePage.PermissionGrantedByUser): + (QWebEnginePage.Feature.MouseLock, + QWebEnginePage.PermissionPolicy.PermissionGrantedByUser): "MouseLockGranted", - (QWebEnginePage.MouseLock, - QWebEnginePage.PermissionDeniedByUser): + (QWebEnginePage.Feature.MouseLock, + QWebEnginePage.PermissionPolicy.PermissionDeniedByUser): "MouseLockDenied", } try: # these are defined as of Qt 5.10.0/PyQt 5.10.0 self.__featurePermissionsKeys.update({ - (QWebEnginePage.DesktopVideoCapture, - QWebEnginePage.PermissionGrantedByUser): + (QWebEnginePage.Feature.DesktopVideoCapture, + QWebEnginePage.PermissionPolicy.PermissionGrantedByUser): "DesktopVideoCaptureGranted", - (QWebEnginePage.DesktopVideoCapture, - QWebEnginePage.PermissionDeniedByUser): + (QWebEnginePage.Feature.DesktopVideoCapture, + QWebEnginePage.PermissionPolicy.PermissionDeniedByUser): "DesktopVideoCaptureDenied", - (QWebEnginePage.DesktopAudioVideoCapture, - QWebEnginePage.PermissionGrantedByUser): + (QWebEnginePage.Feature.DesktopAudioVideoCapture, + QWebEnginePage.PermissionPolicy.PermissionGrantedByUser): "DesktopAudioVideoCaptureGranted", - (QWebEnginePage.DesktopAudioVideoCapture, - QWebEnginePage.PermissionDeniedByUser): + (QWebEnginePage.Feature.DesktopAudioVideoCapture, + QWebEnginePage.PermissionPolicy.PermissionDeniedByUser): "DesktopAudioVideoCaptureDenied", }) except AttributeError: @@ -128,11 +132,11 @@ try: # this was re-added in Qt 5.13.0 self.__featurePermissionsKeys.update({ - (QWebEnginePage.Notifications, - QWebEnginePage.PermissionGrantedByUser): + (QWebEnginePage.Feature.Notifications, + QWebEnginePage.PermissionPolicy.PermissionGrantedByUser): "NotificationsGranted", - (QWebEnginePage.Notifications, - QWebEnginePage.PermissionDeniedByUser): + (QWebEnginePage.Feature.Notifications, + QWebEnginePage.PermissionPolicy.PermissionDeniedByUser): "NotificationsDenied", }) except AttributeError: @@ -233,7 +237,7 @@ from .FeaturePermissionsDialog import FeaturePermissionsDialog dlg = FeaturePermissionsDialog(self.__featurePermissions) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: newFeaturePermissions = dlg.getData() self.__featurePermissions = newFeaturePermissions self.__saveSettings()
--- a/eric6/WebBrowser/FeaturePermissions/FeaturePermissionsDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/FeaturePermissions/FeaturePermissionsDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -42,7 +42,7 @@ self.notifList = QTreeWidget() self.notifList.setAlternatingRowColors(True) self.notifList.setSelectionMode( - QAbstractItemView.ExtendedSelection) + QAbstractItemView.SelectionMode.ExtendedSelection) self.notifList.setRootIsDecorated(False) self.notifList.setItemsExpandable(False) self.notifList.setAllColumnsShowFocus(True) @@ -57,7 +57,8 @@ self.geoList = QTreeWidget() self.geoList.setAlternatingRowColors(True) - self.geoList.setSelectionMode(QAbstractItemView.ExtendedSelection) + self.geoList.setSelectionMode( + QAbstractItemView.SelectionMode.ExtendedSelection) self.geoList.setRootIsDecorated(False) self.geoList.setItemsExpandable(False) self.geoList.setAllColumnsShowFocus(True) @@ -72,7 +73,8 @@ self.micList = QTreeWidget() self.micList.setAlternatingRowColors(True) - self.micList.setSelectionMode(QAbstractItemView.ExtendedSelection) + self.micList.setSelectionMode( + QAbstractItemView.SelectionMode.ExtendedSelection) self.micList.setRootIsDecorated(False) self.micList.setItemsExpandable(False) self.micList.setAllColumnsShowFocus(True) @@ -87,7 +89,8 @@ self.camList = QTreeWidget() self.camList.setAlternatingRowColors(True) - self.camList.setSelectionMode(QAbstractItemView.ExtendedSelection) + self.camList.setSelectionMode( + QAbstractItemView.SelectionMode.ExtendedSelection) self.camList.setRootIsDecorated(False) self.camList.setItemsExpandable(False) self.camList.setAllColumnsShowFocus(True) @@ -102,7 +105,8 @@ self.micCamList = QTreeWidget() self.micCamList.setAlternatingRowColors(True) - self.micCamList.setSelectionMode(QAbstractItemView.ExtendedSelection) + self.micCamList.setSelectionMode( + QAbstractItemView.SelectionMode.ExtendedSelection) self.micCamList.setRootIsDecorated(False) self.micCamList.setItemsExpandable(False) self.micCamList.setAllColumnsShowFocus(True) @@ -118,7 +122,7 @@ self.mouseLockList = QTreeWidget() self.mouseLockList.setAlternatingRowColors(True) self.mouseLockList.setSelectionMode( - QAbstractItemView.ExtendedSelection) + QAbstractItemView.SelectionMode.ExtendedSelection) self.mouseLockList.setRootIsDecorated(False) self.mouseLockList.setItemsExpandable(False) self.mouseLockList.setAllColumnsShowFocus(True) @@ -136,7 +140,7 @@ self.deskVidList = QTreeWidget() self.deskVidList.setAlternatingRowColors(True) self.deskVidList.setSelectionMode( - QAbstractItemView.ExtendedSelection) + QAbstractItemView.SelectionMode.ExtendedSelection) self.deskVidList.setRootIsDecorated(False) self.deskVidList.setItemsExpandable(False) self.deskVidList.setAllColumnsShowFocus(True) @@ -152,7 +156,7 @@ self.deskAudVidList = QTreeWidget() self.deskAudVidList.setAlternatingRowColors(True) self.deskAudVidList.setSelectionMode( - QAbstractItemView.ExtendedSelection) + QAbstractItemView.SelectionMode.ExtendedSelection) self.deskAudVidList.setRootIsDecorated(False) self.deskAudVidList.setItemsExpandable(False) self.deskAudVidList.setAllColumnsShowFocus(True) @@ -183,24 +187,28 @@ self.setTabOrder(self.removeButton, self.removeAllButton) self.__permissionStrings = { - QWebEnginePage.PermissionGrantedByUser: self.tr("Allow"), - QWebEnginePage.PermissionDeniedByUser: self.tr("Deny"), + QWebEnginePage.PermissionPolicy.PermissionGrantedByUser: + self.tr("Allow"), + QWebEnginePage.PermissionPolicy.PermissionDeniedByUser: + self.tr("Deny"), } self.__permissionsLists = { - QWebEnginePage.Geolocation: self.geoList, - QWebEnginePage.MediaAudioCapture: self.micList, - QWebEnginePage.MediaVideoCapture: self.camList, - QWebEnginePage.MediaAudioVideoCapture: self.micCamList, - QWebEnginePage.MouseLock: self.mouseLockList, + QWebEnginePage.Feature.Geolocation: self.geoList, + QWebEnginePage.Feature.MediaAudioCapture: self.micList, + QWebEnginePage.Feature.MediaVideoCapture: self.camList, + QWebEnginePage.Feature.MediaAudioVideoCapture: self.micCamList, + QWebEnginePage.Feature.MouseLock: self.mouseLockList, } if hasattr(QWebEnginePage, "DesktopVideoCapture"): self.__permissionsLists.update({ - QWebEnginePage.DesktopVideoCapture: self.deskVidList, - QWebEnginePage.DesktopAudioVideoCapture: self.deskAudVidList, + QWebEnginePage.Feature.DesktopVideoCapture: + self.deskVidList, + QWebEnginePage.Feature.DesktopAudioVideoCapture: + self.deskAudVidList, }) if hasattr(QWebEnginePage, "Notifications"): - self.__permissionsLists[QWebEnginePage.Notifications] = ( + self.__permissionsLists[QWebEnginePage.Feature.Notifications] = ( self.notifList ) @@ -210,7 +218,7 @@ itm = QTreeWidgetItem( permissionsList, [host, self.__permissionStrings[permission]]) - itm.setData(0, Qt.UserRole, permission) + itm.setData(0, Qt.ItemDataRole.UserRole, permission) self.__previousCurrent = -1 self.tabWidget.currentChanged.connect(self.__currentTabChanged) @@ -285,13 +293,13 @@ featurePermissions = {} for feature, permissionsList in self.__permissionsLists.items(): featurePermissions[feature] = { - QWebEnginePage.PermissionGrantedByUser: [], - QWebEnginePage.PermissionDeniedByUser: [], + QWebEnginePage.PermissionPolicy.PermissionGrantedByUser: [], + QWebEnginePage.PermissionPolicy.PermissionDeniedByUser: [], } for row in range(permissionsList.topLevelItemCount()): itm = permissionsList.topLevelItem(row) host = itm.text(0) - permission = itm.data(0, Qt.UserRole) + permission = itm.data(0, Qt.ItemDataRole.UserRole) featurePermissions[feature][permission].append(host) return featurePermissions
--- a/eric6/WebBrowser/Feeds/FeedEditDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/Feeds/FeedEditDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -28,7 +28,8 @@ super(FeedEditDialog, self).__init__(parent) self.setupUi(self) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) self.titleEdit.setText(title) self.urlEdit.setText(urlString) @@ -51,7 +52,8 @@ enable = enable and bool(url.scheme()) enable = enable and bool(url.host()) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enable) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(enable) @pyqtSlot(str) def on_titleEdit_textChanged(self, txt):
--- a/eric6/WebBrowser/Feeds/FeedsDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/Feeds/FeedsDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -65,7 +65,8 @@ url = QUrl(urlString) if url.isRelative(): url = self.__browser.url().resolved(url) - urlString = url.toDisplayString(QUrl.FullyDecoded) + urlString = url.toDisplayString( + QUrl.ComponentFormattingOption.FullyDecoded) if not url.isValid(): return
--- a/eric6/WebBrowser/Feeds/FeedsManager.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/Feeds/FeedsManager.py Tue Mar 02 17:17:09 2021 +0100 @@ -38,8 +38,8 @@ newWindow = pyqtSignal(QUrl, str) newPrivateWindow = pyqtSignal(QUrl, str) - UrlStringRole = Qt.UserRole - ErrorDataRole = Qt.UserRole + 1 + UrlStringRole = Qt.ItemDataRole.UserRole + ErrorDataRole = Qt.ItemDataRole.UserRole + 1 def __init__(self, parent=None): """ @@ -49,7 +49,7 @@ """ super(FeedsManager, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) self.__wasShown = False self.__loaded = False @@ -58,7 +58,8 @@ # dict key is the id of the request object # dict value is a tuple of request and tree item - self.feedsTree.setContextMenuPolicy(Qt.CustomContextMenu) + self.feedsTree.setContextMenuPolicy( + Qt.ContextMenuPolicy.CustomContextMenu) self.feedsTree.customContextMenuRequested.connect( self.__customContextMenuRequested) self.feedsTree.itemActivated.connect(self.__itemActivated) @@ -175,7 +176,7 @@ from .FeedEditDialog import FeedEditDialog dlg = FeedEditDialog(origUrlString, origTitle) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: urlString, title = dlg.getData() for feed in self.__feeds: if feed[0] == urlString: @@ -280,7 +281,7 @@ topItem = self.__replies[id(reply)][1] del self.__replies[id(reply)] - if reply.error() == QNetworkReply.NoError: + if reply.error() == QNetworkReply.NetworkError.NoError: linkString = "" titleString = "" @@ -377,9 +378,15 @@ if self.feedsTree.indexOfTopLevelItem(itm) != -1: return - if QApplication.keyboardModifiers() & Qt.ControlModifier: + if ( + QApplication.keyboardModifiers() & + Qt.KeyboardModifier.ControlModifier + ): self.__openMessageInNewTab() - elif QApplication.keyboardModifiers() & Qt.ShiftModifier: + elif ( + QApplication.keyboardModifiers() & + Qt.KeyboardModifier.ShiftModifier + ): self.__openMessageInNewWindow() else: self.__openMessageInCurrentTab()
--- a/eric6/WebBrowser/GreaseMonkey/GreaseMonkeyConfiguration/GreaseMonkeyConfigurationDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/GreaseMonkey/GreaseMonkeyConfiguration/GreaseMonkeyConfigurationDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -25,9 +25,9 @@ """ Class implementing the GreaseMonkey scripts configuration dialog. """ - ScriptVersionRole = Qt.UserRole - ScriptDescriptionRole = Qt.UserRole + 1 - ScriptRole = Qt.UserRole + 2 + ScriptVersionRole = Qt.ItemDataRole.UserRole + ScriptDescriptionRole = Qt.ItemDataRole.UserRole + 1 + ScriptRole = Qt.ItemDataRole.UserRole + 2 def __init__(self, manager, parent=None): """ @@ -38,7 +38,7 @@ """ super(GreaseMonkeyConfigurationDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) self.iconLabel.setPixmap( UI.PixmapCache.getPixmap("greaseMonkey48")) @@ -104,11 +104,11 @@ itm.setData( GreaseMonkeyConfigurationDialog.ScriptDescriptionRole, script.description()) - itm.setFlags(itm.flags() | Qt.ItemIsUserCheckable) + itm.setFlags(itm.flags() | Qt.ItemFlag.ItemIsUserCheckable) if script.isEnabled(): - itm.setCheckState(Qt.Checked) + itm.setCheckState(Qt.CheckState.Checked) else: - itm.setCheckState(Qt.Unchecked) + itm.setCheckState(Qt.CheckState.Unchecked) itm.setData(GreaseMonkeyConfigurationDialog.ScriptRole, script) self.scriptsList.addItem(itm) @@ -124,8 +124,8 @@ continue if ( - topItem.checkState() == Qt.Unchecked and - bottomItem.checkState == Qt.Checked + topItem.checkState() == Qt.CheckState.Unchecked and + bottomItem.checkState == Qt.CheckState.Checked ): itm = self.scriptsList.takeItem(row + 1) self.scriptsList.insertItem(row, itm) @@ -174,7 +174,7 @@ if script is None: return - if itm.checkState() == Qt.Checked: + if itm.checkState() == Qt.CheckState.Checked: self.__manager.enableScript(script) else: self.__manager.disableScript(script)
--- a/eric6/WebBrowser/GreaseMonkey/GreaseMonkeyConfiguration/GreaseMonkeyConfigurationListDelegate.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/GreaseMonkey/GreaseMonkeyConfiguration/GreaseMonkeyConfigurationListDelegate.py Tue Mar 02 17:17:09 2021 +0100 @@ -73,11 +73,12 @@ titleMetrics = QFontMetrics(titleFont) if Globals.isWindowsPlatform(): - colorRole = QPalette.Text + colorRole = QPalette.ColorRole.Text else: colorRole = ( - QPalette.HighlightedText - if opt.state & QStyle.State_Selected else QPalette.Text + QPalette.ColorRole.HighlightedText + if opt.state & QStyle.StateFlag.State_Selected else + QPalette.ColorRole.Text ) leftPos = self.__padding @@ -87,7 +88,8 @@ ) # Draw background - style.drawPrimitive(QStyle.PE_PanelItemViewItem, opt, painter, widget) + style.drawPrimitive( + QStyle.PrimitiveElement.PE_PanelItemViewItem, opt, painter, widget) # Draw checkbox checkBoxYPos = ( @@ -95,17 +97,18 @@ GreaseMonkeyConfigurationListDelegate.CheckBoxSize // 2 ) opt2 = QStyleOptionViewItem(opt) - if opt2.checkState == Qt.Checked: - opt2.state |= QStyle.State_On + if opt2.checkState == Qt.CheckState.Checked: + opt2.state |= QStyle.StateFlag.State_On else: - opt2.state |= QStyle.State_Off + opt2.state |= QStyle.StateFlag.State_Off styleCheckBoxRect = style.subElementRect( - QStyle.SE_ViewItemCheckIndicator, opt2, widget) + QStyle.SubElement.SE_ViewItemCheckIndicator, opt2, widget) opt2.rect = QRect( leftPos, checkBoxYPos, styleCheckBoxRect.width(), styleCheckBoxRect.height()) - style.drawPrimitive(QStyle.PE_IndicatorViewItemCheck, opt2, painter, - widget) + style.drawPrimitive( + QStyle.PrimitiveElement.PE_IndicatorViewItemCheck, opt2, painter, + widget) leftPos = opt2.rect.right() + self.__padding # Draw icon @@ -113,13 +116,13 @@ iconRect = QRect(leftPos, iconYPos, GreaseMonkeyConfigurationListDelegate.IconSize, GreaseMonkeyConfigurationListDelegate.IconSize) - pixmap = index.data(Qt.DecorationRole).pixmap( + pixmap = index.data(Qt.ItemDataRole.DecorationRole).pixmap( GreaseMonkeyConfigurationListDelegate.IconSize) painter.drawPixmap(iconRect, pixmap) leftPos = iconRect.right() + self.__padding # Draw script name - name = index.data(Qt.DisplayRole) + name = index.data(Qt.ItemDataRole.DisplayRole) leftTitleEdge = leftPos + 2 rightTitleEdge = rightPos - self.__padding try: @@ -131,18 +134,22 @@ nameRect = QRect(leftTitleEdge, opt.rect.top() + self.__padding, rightTitleEdge - leftTitleEdge, titleMetrics.height()) painter.setFont(titleFont) - style.drawItemText(painter, nameRect, Qt.AlignLeft, opt.palette, True, - name, colorRole) + style.drawItemText( + painter, nameRect, + Qt.AlignmentFlag.AlignLeft, opt.palette, True, + name, colorRole) # Draw version - version = index.data(Qt.UserRole) + version = index.data(Qt.ItemDataRole.UserRole) versionRect = QRect( nameRect.x() + leftPosForVersion, nameRect.y(), rightTitleEdge - leftTitleEdge, titleMetrics.height()) versionFont = titleFont painter.setFont(versionFont) - style.drawItemText(painter, versionRect, Qt.AlignLeft, opt.palette, - True, version, colorRole) + style.drawItemText( + painter, versionRect, + Qt.AlignmentFlag.AlignLeft, opt.palette, + True, version, colorRole) # Draw description infoYPos = nameRect.bottom() + opt.fontMetrics.leading() @@ -150,10 +157,13 @@ nameRect.x(), infoYPos, nameRect.width(), opt.fontMetrics.height()) info = opt.fontMetrics.elidedText( - index.data(Qt.UserRole + 1), Qt.ElideRight, infoRect.width()) + index.data(Qt.ItemDataRole.UserRole + 1), + Qt.TextElideMode.ElideRight, infoRect.width()) painter.setFont(opt.font) - style.drawItemText(painter, infoRect, Qt.AlignLeft | Qt.TextSingleLine, - opt.palette, True, info, colorRole) + style.drawItemText( + painter, infoRect, + Qt.AlignmentFlag.AlignLeft | Qt.TextFlag.TextSingleLine, + opt.palette, True, info, colorRole) # Draw remove button removeIconYPos = ( @@ -183,7 +193,8 @@ widget.style() if widget is not None else QApplication.style() ) - padding = style.pixelMetric(QStyle.PM_FocusFrameHMargin) + 1 + padding = style.pixelMetric( + QStyle.PixelMetric.PM_FocusFrameHMargin) + 1 titleFont = opt.font titleFont.setBold(True)
--- a/eric6/WebBrowser/GreaseMonkey/GreaseMonkeyDownloader.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/GreaseMonkey/GreaseMonkeyDownloader.py Tue Mar 02 17:17:09 2021 +0100 @@ -70,7 +70,7 @@ self.deleteLater() self.__reply.deleteLater() - if self.__reply.error() != QNetworkReply.NoError: + if self.__reply.error() != QNetworkReply.NetworkError.NoError: self.error.emit() return @@ -104,7 +104,7 @@ self.deleteLater() self.__reply.deleteLater() - if self.__reply.error() != QNetworkReply.NoError: + if self.__reply.error() != QNetworkReply.NetworkError.NoError: self.error.emit() return @@ -117,7 +117,7 @@ settings = QSettings( os.path.join(self.__manager.requireScriptsDirectory(), "requires.ini"), - QSettings.IniFormat) + QSettings.Format.IniFormat) settings.beginGroup("Files") if not self.__fileName:
--- a/eric6/WebBrowser/GreaseMonkey/GreaseMonkeyJsObject.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/GreaseMonkey/GreaseMonkeyJsObject.py Tue Mar 02 17:17:09 2021 +0100 @@ -37,7 +37,7 @@ self.__settings.sync() self.__settings = None - self.__settings = QSettings(name, QSettings.IniFormat) + self.__settings = QSettings(name, QSettings.Format.IniFormat) @pyqtSlot(str, str, str) def getValue(self, nspace, name, dValue):
--- a/eric6/WebBrowser/GreaseMonkey/GreaseMonkeyManager.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/GreaseMonkey/GreaseMonkeyManager.py Tue Mar 02 17:17:09 2021 +0100 @@ -71,7 +71,7 @@ @type QUrl """ QMetaObject.invokeMethod( - self, "doDownloadScript", Qt.QueuedConnection, + self, "doDownloadScript", Qt.ConnectionType.QueuedConnection, Q_ARG(QUrl, url)) @pyqtSlot(QUrl) @@ -114,7 +114,7 @@ GreaseMonkeyAddScriptDialog ) dlg = GreaseMonkeyAddScriptDialog(self, script) - deleteScript = dlg.exec() != QDialog.Accepted + deleteScript = dlg.exec() != QDialog.DialogCode.Accepted else: E5MessageBox.information( None, @@ -166,7 +166,7 @@ settings = QSettings( os.path.join(self.requireScriptsDirectory(), "requires.ini"), - QSettings.IniFormat) + QSettings.Format.IniFormat) settings.beginGroup("Files") for url in urlList: if settings.contains(url): @@ -314,7 +314,7 @@ "GreaseMonkeyDisabledScripts") from .GreaseMonkeyScript import GreaseMonkeyScript - for fileName in scriptsDir.entryList(["*.js"], QDir.Files): + for fileName in scriptsDir.entryList(["*.js"], QDir.Filter.Files): absolutePath = scriptsDir.absoluteFilePath(fileName) script = GreaseMonkeyScript(self, absolutePath)
--- a/eric6/WebBrowser/GreaseMonkey/GreaseMonkeyScript.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/GreaseMonkey/GreaseMonkeyScript.py Tue Mar 02 17:17:09 2021 +0100 @@ -361,7 +361,7 @@ nspace = bytes(QCryptographicHash.hash( QByteArray(self.fullName().encode("utf-8")), - QCryptographicHash.Md4).toHex()).decode("ascii") + QCryptographicHash.Algorithm.Md4).toHex()).decode("ascii") valuesScript = values_js.format(nspace) self.__script = "(function(){{{0}\n{1}\n{2}\n}})();".format( valuesScript, self.__manager.requireScripts(self.__require), @@ -505,5 +505,5 @@ self.__iconReplies.remove(reply) reply.deleteLater() - if reply.error() == QNetworkReply.NoError: + if reply.error() == QNetworkReply.NetworkError.NoError: self.__icon = QPixmap.fromImage(QImage.fromData(reply.readAll()))
--- a/eric6/WebBrowser/History/HistoryCompleter.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/History/HistoryCompleter.py Tue Mar 02 17:17:09 2021 +0100 @@ -33,9 +33,10 @@ self.setShowGrid(False) - self.setSelectionBehavior(QAbstractItemView.SelectRows) - self.setSelectionMode(QAbstractItemView.SingleSelection) - self.setTextElideMode(Qt.ElideRight) + self.setSelectionBehavior( + QAbstractItemView.SelectionBehavior.SelectRows) + self.setSelectionMode(QAbstractItemView.SelectionMode.SingleSelection) + self.setTextElideMode(Qt.TextElideMode.ElideRight) metrics = self.fontMetrics() self.verticalHeader().setDefaultSectionSize(metrics.height()) @@ -83,7 +84,7 @@ self.setDynamicSortFilter(True) - def data(self, index, role=Qt.DisplayRole): + def data(self, index, role=Qt.ItemDataRole.DisplayRole): """ Public method to get data from the model. @@ -99,7 +100,7 @@ else: return "f" - if role == Qt.DisplayRole: + if role == Qt.ItemDataRole.DisplayRole: if index.column() == 0: role = HistoryModel.UrlStringRole else: @@ -243,8 +244,9 @@ # Since the completion role is faked, advantage of the sorted-model # optimizations in QCompleter can be taken. - self.setCaseSensitivity(Qt.CaseSensitive) - self.setModelSorting(QCompleter.CaseSensitivelySortedModel) + self.setCaseSensitivity(Qt.CaseSensitivity.CaseSensitive) + self.setModelSorting( + QCompleter.ModelSorting.CaseSensitivelySortedModel) self.__searchString = "" self.__filterTimer = QTimer(self)
--- a/eric6/WebBrowser/History/HistoryDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/History/HistoryDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -45,7 +45,7 @@ """ super(HistoryDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) self.__historyManager = manager if self.__historyManager is None: @@ -69,7 +69,8 @@ self.historyTree.header().resizeSection(0, header) self.historyTree.header().resizeSection(1, header) self.historyTree.header().setStretchLastSection(True) - self.historyTree.setContextMenuPolicy(Qt.CustomContextMenu) + self.historyTree.setContextMenuPolicy( + Qt.ContextMenuPolicy.CustomContextMenu) self.historyTree.activated.connect(self.__activated) self.historyTree.customContextMenuRequested.connect( @@ -128,9 +129,15 @@ @param idx reference to the entry index (QModelIndex) """ - if QApplication.keyboardModifiers() & Qt.ControlModifier: + if ( + QApplication.keyboardModifiers() & + Qt.KeyboardModifier.ControlModifier + ): self.__openHistoryInNewTab() - elif QApplication.keyboardModifiers() & Qt.ShiftModifier: + elif ( + QApplication.keyboardModifiers() & + Qt.KeyboardModifier.ShiftModifier + ): self.__openHistoryInNewWindow() else: self.__openHistoryInCurrentTab()
--- a/eric6/WebBrowser/History/HistoryFilterModel.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/History/HistoryFilterModel.py Tue Mar 02 17:17:09 2021 +0100 @@ -99,7 +99,7 @@ return self.sourceModel().rowCount() - self.__historyDict[url] - def data(self, index, role=Qt.DisplayRole): + def data(self, index, role=Qt.ItemDataRole.DisplayRole): """ Public method to get data from the model. @@ -144,13 +144,14 @@ self.dataChanged.emit( self.mapFromSource(topLeft), self.mapFromSource(bottomRight)) - def headerData(self, section, orientation, role=Qt.DisplayRole): + def headerData(self, section, orientation, + role=Qt.ItemDataRole.DisplayRole): """ Public method to get the header data. @param section section number (integer) @param orientation header orientation (Qt.Orientation) - @param role data role (integer) + @param role data role (Qt.ItemDataRole) @return header data """ return self.sourceModel().headerData(section, orientation, role)
--- a/eric6/WebBrowser/History/HistoryManager.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/History/HistoryManager.py Tue Mar 02 17:17:09 2021 +0100 @@ -447,7 +447,7 @@ historyFile = QFile(self.getFileName()) if not historyFile.exists(): return - if not historyFile.open(QIODevice.ReadOnly): + if not historyFile.open(QIODevice.OpenModeFlag.ReadOnly): E5MessageBox.warning( None, self.tr("Loading History"), @@ -463,8 +463,8 @@ needToSort = False lastInsertedItem = HistoryEntry() data = QByteArray(historyFile.readAll()) - stream = QDataStream(data, QIODevice.ReadOnly) - stream.setVersion(QDataStream.Qt_4_6) + stream = QDataStream(data, QIODevice.OpenModeFlag.ReadOnly) + stream.setVersion(QDataStream.Version.Qt_4_6) while not stream.atEnd(): ver = stream.readUInt32() if ver not in HISTORY_VERSIONS: @@ -536,7 +536,7 @@ opened = f.open() else: f = historyFile - opened = f.open(QIODevice.Append) + opened = f.open(QIODevice.OpenModeFlag.Append) if not opened: E5MessageBox.warning( @@ -550,8 +550,8 @@ for index in range(first, -1, -1): data = QByteArray() - stream = QDataStream(data, QIODevice.WriteOnly) - stream.setVersion(QDataStream.Qt_4_6) + stream = QDataStream(data, QIODevice.OpenModeFlag.WriteOnly) + stream.setVersion(QDataStream.Version.Qt_4_6) itm = self.__history[index] stream.writeUInt32(HISTORY_VERSION_60) stream.writeString(itm.url.encode("utf-8"))
--- a/eric6/WebBrowser/History/HistoryMenu.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/History/HistoryMenu.py Tue Mar 02 17:17:09 2021 +0100 @@ -321,11 +321,11 @@ @param idx index of the activated item (QModelIndex) """ - if self._keyboardModifiers & Qt.ControlModifier: + if self._keyboardModifiers & Qt.KeyboardModifier.ControlModifier: self.newTab.emit( idx.data(HistoryModel.UrlRole), idx.data(HistoryModel.TitleRole)) - elif self._keyboardModifiers & Qt.ShiftModifier: + elif self._keyboardModifiers & Qt.KeyboardModifier.ShiftModifier: self.newWindow.emit( idx.data(HistoryModel.UrlRole), idx.data(HistoryModel.TitleRole)) @@ -435,7 +435,8 @@ self.__closedTabsMenu.clear() index = 0 for tab in self.__tabWidget.closedTabsManager().allClosedTabs(): - title = fm.elidedText(tab.title, Qt.ElideRight, maxWidth) + title = fm.elidedText(tab.title, Qt.TextElideMode.ElideRight, + maxWidth) act = self.__closedTabsMenu.addAction( WebBrowser.WebBrowserWindow.WebBrowserWindow.icon(tab.url), title) @@ -499,11 +500,11 @@ @param idx index of the activated item (QModelIndex) """ - if self._keyboardModifiers & Qt.ControlModifier: + if self._keyboardModifiers & Qt.KeyboardModifier.ControlModifier: self.newTab.emit( idx.data(HistoryModel.UrlRole), idx.data(HistoryModel.TitleRole)) - elif self._keyboardModifiers & Qt.ShiftModifier: + elif self._keyboardModifiers & Qt.KeyboardModifier.ShiftModifier: self.newWindow.emit( idx.data(HistoryModel.UrlRole), idx.data(HistoryModel.TitleRole))
--- a/eric6/WebBrowser/History/HistoryModel.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/History/HistoryModel.py Tue Mar 02 17:17:09 2021 +0100 @@ -16,12 +16,12 @@ """ Class implementing the history model. """ - DateRole = Qt.UserRole + 1 - DateTimeRole = Qt.UserRole + 2 - UrlRole = Qt.UserRole + 3 - UrlStringRole = Qt.UserRole + 4 - TitleRole = Qt.UserRole + 5 - VisitCountRole = Qt.UserRole + 6 + DateRole = Qt.ItemDataRole.UserRole + 1 + DateTimeRole = Qt.ItemDataRole.UserRole + 2 + UrlRole = Qt.ItemDataRole.UserRole + 3 + UrlStringRole = Qt.ItemDataRole.UserRole + 4 + TitleRole = Qt.ItemDataRole.UserRole + 5 + VisitCountRole = Qt.ItemDataRole.UserRole + 6 MaxRole = VisitCountRole def __init__(self, historyManager, parent=None): @@ -70,23 +70,27 @@ idx = self.index(row, 0) self.dataChanged.emit(idx, idx) - def headerData(self, section, orientation, role=Qt.DisplayRole): + def headerData(self, section, orientation, + role=Qt.ItemDataRole.DisplayRole): """ Public method to get the header data. @param section section number (integer) @param orientation header orientation (Qt.Orientation) - @param role data role (integer) + @param role data role (Qt.ItemDataRole) @return header data """ - if orientation == Qt.Horizontal and role == Qt.DisplayRole: + if ( + orientation == Qt.Orientation.Horizontal and + role == Qt.ItemDataRole.DisplayRole + ): try: return self.__headers[section] except IndexError: pass return QAbstractTableModel.headerData(self, section, orientation, role) - def data(self, index, role=Qt.DisplayRole): + def data(self, index, role=Qt.ItemDataRole.DisplayRole): """ Public method to get data from the model. @@ -111,14 +115,14 @@ return itm.userTitle() elif role == self.VisitCountRole: return itm.visitCount - elif role in [Qt.DisplayRole, Qt.EditRole]: + elif role in [Qt.ItemDataRole.DisplayRole, Qt.ItemDataRole.EditRole]: if index.column() == 0: return itm.userTitle() elif index.column() == 1: return itm.url elif index.column() == 2: return itm.visitCount - elif role == Qt.DecorationRole: + elif role == Qt.ItemDataRole.DecorationRole: if index.column() == 0: return WebBrowser.WebBrowserWindow.WebBrowserWindow.icon( QUrl(itm.url))
--- a/eric6/WebBrowser/History/HistoryTreeModel.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/History/HistoryTreeModel.py Tue Mar 02 17:17:09 2021 +0100 @@ -34,18 +34,19 @@ self.setSourceModel(sourceModel) - def headerData(self, section, orientation, role=Qt.DisplayRole): + def headerData(self, section, orientation, + role=Qt.ItemDataRole.DisplayRole): """ Public method to get the header data. @param section section number (integer) @param orientation header orientation (Qt.Orientation) - @param role data role (integer) + @param role data role (Qt.ItemDataRole) @return header data """ return self.sourceModel().headerData(section, orientation, role) - def data(self, index, role=Qt.DisplayRole): + def data(self, index, role=Qt.ItemDataRole.DisplayRole): """ Public method to get data from the model. @@ -53,7 +54,7 @@ @param role data role (integer) @return history entry data """ - if role in [Qt.DisplayRole, Qt.EditRole]: + if role in [Qt.ItemDataRole.DisplayRole, Qt.ItemDataRole.EditRole]: start = index.internalId() if start == 0: offset = self.__sourceDateRow(index.row()) @@ -68,7 +69,7 @@ "%n item(s)", "", self.rowCount(index.sibling(index.row(), 0))) - elif role == Qt.DecorationRole: + elif role == Qt.ItemDataRole.DecorationRole: if index.column() == 0 and not index.parent().isValid(): return UI.PixmapCache.getIcon("history") @@ -226,9 +227,11 @@ @return flags (Qt.ItemFlags) """ if not index.isValid(): - return Qt.ItemFlags(Qt.NoItemFlags) + return Qt.ItemFlags(Qt.ItemFlag.NoItemFlags) return Qt.ItemFlags( - Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsDragEnabled) + Qt.ItemFlag.ItemIsSelectable | + Qt.ItemFlag.ItemIsEnabled | + Qt.ItemFlag.ItemIsDragEnabled) def setSourceModel(self, sourceModel): """
--- a/eric6/WebBrowser/Navigation/NavigationBar.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/Navigation/NavigationBar.py Tue Mar 02 17:17:09 2021 +0100 @@ -43,18 +43,20 @@ self.__mw = mainWindow self.__layout = QHBoxLayout(self) - margin = self.style().pixelMetric(QStyle.PM_ToolBarItemMargin, None, - self) + margin = self.style().pixelMetric( + QStyle.PixelMetric.PM_ToolBarItemMargin, None, self) self.__layout.setContentsMargins(margin, margin, margin, margin) self.__layout.setSpacing( - self.style().pixelMetric(QStyle.PM_ToolBarItemSpacing, None, self)) + self.style().pixelMetric( + QStyle.PixelMetric.PM_ToolBarItemSpacing, None, self)) self.setLayout(self.__layout) self.__backButton = E5ToolButton(self) self.__backButton.setObjectName("navigation_back_button") self.__backButton.setToolTip(self.tr("Move one screen backward")) - self.__backButton.setToolButtonStyle(Qt.ToolButtonIconOnly) - self.__backButton.setFocusPolicy(Qt.NoFocus) + self.__backButton.setToolButtonStyle( + Qt.ToolButtonStyle.ToolButtonIconOnly) + self.__backButton.setFocusPolicy(Qt.FocusPolicy.NoFocus) self.__backButton.setAutoRaise(True) self.__backButton.setIcon( UI.PixmapCache.getIcon("back")) @@ -63,8 +65,9 @@ self.__forwardButton = E5ToolButton(self) self.__forwardButton.setObjectName("navigation_forward_button") self.__forwardButton.setToolTip(self.tr("Move one screen forward")) - self.__forwardButton.setToolButtonStyle(Qt.ToolButtonIconOnly) - self.__forwardButton.setFocusPolicy(Qt.NoFocus) + self.__forwardButton.setToolButtonStyle( + Qt.ToolButtonStyle.ToolButtonIconOnly) + self.__forwardButton.setFocusPolicy(Qt.FocusPolicy.NoFocus) self.__forwardButton.setAutoRaise(True) self.__forwardButton.setIcon( UI.PixmapCache.getIcon("forward")) @@ -81,8 +84,9 @@ self.__homeButton = E5ToolButton(self) self.__homeButton.setObjectName("navigation_home_button") self.__homeButton.setToolTip(self.tr("Move to the initial screen")) - self.__homeButton.setToolButtonStyle(Qt.ToolButtonIconOnly) - self.__homeButton.setFocusPolicy(Qt.NoFocus) + self.__homeButton.setToolButtonStyle( + Qt.ToolButtonStyle.ToolButtonIconOnly) + self.__homeButton.setFocusPolicy(Qt.FocusPolicy.NoFocus) self.__homeButton.setAutoRaise(True) self.__homeButton.setIcon( UI.PixmapCache.getIcon("home")) @@ -93,8 +97,9 @@ self.__exitFullScreenButton.setIcon( UI.PixmapCache.getIcon("windowRestore")) self.__exitFullScreenButton.setToolTip(self.tr("Exit Fullscreen")) - self.__exitFullScreenButton.setToolButtonStyle(Qt.ToolButtonIconOnly) - self.__exitFullScreenButton.setFocusPolicy(Qt.NoFocus) + self.__exitFullScreenButton.setToolButtonStyle( + Qt.ToolButtonStyle.ToolButtonIconOnly) + self.__exitFullScreenButton.setFocusPolicy(Qt.FocusPolicy.NoFocus) self.__exitFullScreenButton.setAutoRaise(True) self.__exitFullScreenButton.clicked.connect(self.__mw.toggleFullScreen) self.__exitFullScreenButton.setVisible(False) @@ -106,9 +111,11 @@ "navigation_supermenu_button") self.__superMenuButton.setIcon(UI.PixmapCache.getIcon("superMenu")) self.__superMenuButton.setToolTip(self.tr("Main Menu")) - self.__superMenuButton.setPopupMode(QToolButton.InstantPopup) - self.__superMenuButton.setToolButtonStyle(Qt.ToolButtonIconOnly) - self.__superMenuButton.setFocusPolicy(Qt.NoFocus) + self.__superMenuButton.setPopupMode( + QToolButton.ToolButtonPopupMode.InstantPopup) + self.__superMenuButton.setToolButtonStyle( + Qt.ToolButtonStyle.ToolButtonIconOnly) + self.__superMenuButton.setFocusPolicy(Qt.FocusPolicy.NoFocus) self.__superMenuButton.setAutoRaise(True) self.__superMenuButton.setShowMenuInside(True) @@ -120,7 +127,8 @@ WebBrowserWebSearchWidget ) self.__searchEdit = WebBrowserWebSearchWidget(self.__mw, self) - sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred) + sizePolicy = QSizePolicy(QSizePolicy.Policy.Expanding, + QSizePolicy.Policy.Preferred) sizePolicy.setHorizontalStretch(2) sizePolicy.setVerticalStretch(0) self.__searchEdit.setSizePolicy(sizePolicy) @@ -128,7 +136,7 @@ self.__navigationSplitter.addWidget(self.__searchEdit) self.__navigationSplitter.setSizePolicy( - QSizePolicy.Expanding, QSizePolicy.Maximum) + QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Maximum) self.__navigationSplitter.setCollapsible(0, False) self.__layout.addLayout(self.__backNextLayout) @@ -139,7 +147,7 @@ self.__layout.addWidget(self.__exitFullScreenButton) self.__layout.addWidget(self.__superMenuButton) - self.setContextMenuPolicy(Qt.CustomContextMenu) + self.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu) self.customContextMenuRequested.connect(self.__contextMenuRequested) self.__backMenu = QMenu(self)
--- a/eric6/WebBrowser/Navigation/NavigationContainer.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/Navigation/NavigationContainer.py Tue Mar 02 17:17:09 2021 +0100 @@ -29,7 +29,8 @@ self.__layout.setSpacing(0) self.setLayout(self.__layout) - self.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Maximum) + self.setSizePolicy(QSizePolicy.Policy.Preferred, + QSizePolicy.Policy.Maximum) def addWidget(self, widget): """
--- a/eric6/WebBrowser/Navigation/ReloadStopButton.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/Navigation/ReloadStopButton.py Tue Mar 02 17:17:09 2021 +0100 @@ -34,8 +34,8 @@ super(ReloadStopButton, self).__init__(parent) self.setObjectName("navigation_reloadstop_button") - self.setToolButtonStyle(Qt.ToolButtonIconOnly) - self.setFocusPolicy(Qt.NoFocus) + self.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonIconOnly) + self.setFocusPolicy(Qt.FocusPolicy.NoFocus) self.setAutoRaise(True) self.__loading = False
--- a/eric6/WebBrowser/Network/EricSchemeHandler.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/Network/EricSchemeHandler.py Tue Mar 02 17:17:09 2021 +0100 @@ -112,8 +112,8 @@ contents = self.__errorPage() self.__buffer.setData(contents.encode("utf-8")) - self.__buffer.open(QIODevice.ReadOnly) - self.open(QIODevice.ReadOnly) + self.__buffer.open(QIODevice.OpenModeFlag.ReadOnly) + self.open(QIODevice.OpenModeFlag.ReadOnly) self.readyRead.emit()
--- a/eric6/WebBrowser/Network/NetworkManager.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/Network/NetworkManager.py Tue Mar 02 17:17:09 2021 +0100 @@ -152,7 +152,7 @@ from .SslErrorExceptionsDialog import SslErrorExceptionsDialog dlg = SslErrorExceptionsDialog(self.__permanentlyIgnoredSslErrors) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: self.__permanentlyIgnoredSslErrors = dlg.getSslErrorExceptions() self.changed.emit() @@ -302,7 +302,7 @@ ) if username: dlg.setData(username, password) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: username, password = dlg.getData() auth.setUser(username) auth.setPassword(password) @@ -327,11 +327,13 @@ """ html = getHtmlPage("authenticationErrorPage.html") html = html.replace("@IMAGE@", pixmapToDataUrl( - e5App().style().standardIcon(QStyle.SP_MessageBoxCritical).pixmap( - 48, 48)).toString()) + e5App().style().standardIcon( + QStyle.StandardPixmap.SP_MessageBoxCritical).pixmap(48, 48) + ).toString()) html = html.replace("@FAVICON@", pixmapToDataUrl( - e5App().style() .standardIcon(QStyle.SP_MessageBoxCritical).pixmap( - 16, 16)).toString()) + e5App().style() .standardIcon( + QStyle.StandardPixmap.SP_MessageBoxCritical).pixmap(16, 16) + ).toString()) html = html.replace("@TITLE@", self.tr("Authentication required")) html = html.replace("@H1@", self.tr("Authentication required")) html = html.replace( @@ -422,7 +424,9 @@ @rtype QNetworkReply """ req = QNetworkRequest(request) - req.setAttribute(QNetworkRequest.SpdyAllowedAttribute, True) - req.setAttribute(QNetworkRequest.FollowRedirectsAttribute, True) + req.setAttribute( + QNetworkRequest.Attribute.SpdyAllowedAttribute, True) + req.setAttribute( + QNetworkRequest.Attribute.FollowRedirectsAttribute, True) return super(NetworkManager, self).createRequest(op, req, data)
--- a/eric6/WebBrowser/Network/NetworkUrlInterceptor.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/Network/NetworkUrlInterceptor.py Tue Mar 02 17:17:09 2021 +0100 @@ -140,7 +140,7 @@ info.setHttpHeader(b"Referer", b"") elif (self.__sendReferer == 1 and info.navigationType() != - QWebEngineUrlRequestInfo.NavigationTypeLink): + QWebEngineUrlRequestInfo.NavigationType.NavigationTypeLink): # send referer header only on click info.setHttpHeader(b"Referer", b"") else: @@ -190,8 +190,10 @@ @return flag indicating that both URLs have the same origin @rtype bool """ - origin1 = url1.url(QUrl.RemoveUserInfo | QUrl.RemovePath) - origin2 = url2.url(QUrl.RemoveUserInfo | QUrl.RemovePath) + origin1 = url1.url(QUrl.UrlFormattingOption.RemoveUserInfo | + QUrl.UrlFormattingOption.RemovePath) + origin2 = url2.url(QUrl.UrlFormattingOption.RemoveUserInfo | + QUrl.UrlFormattingOption.RemovePath) return origin1 == origin2 @@ -210,7 +212,8 @@ if url.toString() in ("about:blank", "about:srcdoc"): return True - origin = url.adjusted(QUrl.RemoveUserInfo | QUrl.RemovePath) + origin = url.adjusted(QUrl.UrlFormattingOption.RemoveUserInfo | + QUrl.UrlFormattingOption.RemovePath) if origin.isEmpty() or origin.scheme() == "": return False @@ -242,12 +245,16 @@ if self.__refererTrimmingPolicy == 0: # send full URL (no trimming) (default) refererUrl = url.toEncoded( - QUrl.RemoveUserInfo | QUrl.RemoveFragment) + QUrl.UrlFormattingOption.RemoveUserInfo | + QUrl.UrlFormattingOption.RemoveFragment + ) elif self.__refererTrimmingPolicy == 1: # send the URL without its query string refererUrl = url.toEncoded( - QUrl.RemoveUserInfo | QUrl.RemoveFragment | - QUrl.RemoveQuery) + QUrl.UrlFormattingOption.RemoveUserInfo | + QUrl.UrlFormattingOption.RemoveFragment | + QUrl.UrlFormattingOption.RemoveQuery + ) else: # only send the origin (ensure trailing /) refererUrl = self.__refererOrigin(url) @@ -263,7 +270,10 @@ @return origin referer header URL @rtype QByteArray or bytes """ - referer = url.toEncoded(QUrl.RemoveUserInfo | QUrl.RemovePath) + referer = url.toEncoded( + QUrl.UrlFormattingOption.RemoveUserInfo | + QUrl.UrlFormattingOption.RemovePath + ) if not referer.endsWith(b"/"): referer += b"/"
--- a/eric6/WebBrowser/Network/ProtocolHandlerManagerDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/Network/ProtocolHandlerManagerDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -28,7 +28,7 @@ """ super(ProtocolHandlerManagerDialog, self).__init__(parent) self.setupUi(self) - self.setAttribute(Qt.WA_DeleteOnClose) + self.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose) self.__manager = manager handlers = self.__manager.protocolHandlers()
--- a/eric6/WebBrowser/Network/QtHelpSchemeHandler.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/Network/QtHelpSchemeHandler.py Tue Mar 02 17:17:09 2021 +0100 @@ -86,7 +86,7 @@ self.__replies.append(reply) job.reply(reply.mimeType(), reply) else: - job.fail(QWebEngineUrlRequestJob.UrlInvalid) + job.fail(QWebEngineUrlRequestJob.Error.UrlInvalid) def __replyClosed(self, reply): """ @@ -172,8 +172,8 @@ with E5MutexLocker(self.__mutex): self.__buffer.setData(data) - self.__buffer.open(QIODevice.ReadOnly) - self.open(QIODevice.ReadOnly) + self.__buffer.open(QIODevice.OpenModeFlag.ReadOnly) + self.open(QIODevice.OpenModeFlag.ReadOnly) self.readyRead.emit()
--- a/eric6/WebBrowser/Network/SendRefererWhitelistDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/Network/SendRefererWhitelistDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -32,7 +32,8 @@ Preferences.getWebBrowser("SendRefererWhitelist"), self) self.__model.sort(0) self.__proxyModel = QSortFilterProxyModel(self) - self.__proxyModel.setFilterCaseSensitivity(Qt.CaseInsensitive) + self.__proxyModel.setFilterCaseSensitivity( + Qt.CaseSensitivity.CaseInsensitive) self.__proxyModel.setSourceModel(self.__model) self.whitelist.setModel(self.__proxyModel) @@ -51,7 +52,7 @@ self, self.tr("Send Referer Whitelist"), self.tr("Enter host name to add to the whitelist:"), - QLineEdit.Normal) + QLineEdit.EchoMode.Normal) if ok and host != "" and host not in self.__model.stringList(): self.__model.insertRow(self.__model.rowCount()) self.__model.setData(
--- a/eric6/WebBrowser/Network/SslErrorExceptionsDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/Network/SslErrorExceptionsDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -31,45 +31,47 @@ self.setupUi(self) self.__errorDescriptions = { - QWebEngineCertificateError.SslPinnedKeyNotInCertificateChain: + QWebEngineCertificateError.Error.SslPinnedKeyNotInCertificateChain: self.tr("The certificate did not match the built-in public" " keys pinned for the host name."), - QWebEngineCertificateError.CertificateCommonNameInvalid: + QWebEngineCertificateError.Error.CertificateCommonNameInvalid: self.tr("The certificate's common name did not match the" " host name."), - QWebEngineCertificateError.CertificateDateInvalid: + QWebEngineCertificateError.Error.CertificateDateInvalid: self.tr("The certificate is not valid at the current date" " and time."), - QWebEngineCertificateError.CertificateAuthorityInvalid: + QWebEngineCertificateError.Error.CertificateAuthorityInvalid: self.tr("The certificate is not signed by a trusted" " authority."), - QWebEngineCertificateError.CertificateContainsErrors: + QWebEngineCertificateError.Error.CertificateContainsErrors: self.tr("The certificate contains errors."), - QWebEngineCertificateError.CertificateNoRevocationMechanism: + QWebEngineCertificateError.Error.CertificateNoRevocationMechanism: self.tr("The certificate has no mechanism for determining if" " it has been revoked."), - QWebEngineCertificateError.CertificateUnableToCheckRevocation: + QWebEngineCertificateError.Error + .CertificateUnableToCheckRevocation: self.tr("Revocation information for the certificate is" " not available."), - QWebEngineCertificateError.CertificateRevoked: + QWebEngineCertificateError.Error.CertificateRevoked: self.tr("The certificate has been revoked."), - QWebEngineCertificateError.CertificateInvalid: + QWebEngineCertificateError.Error.CertificateInvalid: self.tr("The certificate is invalid."), - QWebEngineCertificateError.CertificateWeakSignatureAlgorithm: + QWebEngineCertificateError.Error.CertificateWeakSignatureAlgorithm: self.tr("The certificate is signed using a weak signature" " algorithm."), - QWebEngineCertificateError.CertificateNonUniqueName: + QWebEngineCertificateError.Error.CertificateNonUniqueName: self.tr("The host name specified in the certificate is" " not unique."), - QWebEngineCertificateError.CertificateWeakKey: + QWebEngineCertificateError.Error.CertificateWeakKey: self.tr("The certificate contains a weak key."), - QWebEngineCertificateError.CertificateNameConstraintViolation: + QWebEngineCertificateError.Error + .CertificateNameConstraintViolation: self.tr("The certificate claimed DNS names that are in" " violation of name constraints."), } try: self.__errorDescriptions[ - QWebEngineCertificateError.CertificateValidityTooLong + QWebEngineCertificateError.Error.CertificateValidityTooLong ] = self.tr( "The certificate has a validity period that is too long." ) @@ -78,7 +80,8 @@ pass try: self.__errorDescriptions[ - QWebEngineCertificateError.CertificateTransparencyRequired + QWebEngineCertificateError.Error + .CertificateTransparencyRequired ] = self.tr( "Certificate Transparency was required for this" " connection, but the server did not provide" @@ -101,7 +104,7 @@ self.errorsTree.expandAll() for i in range(self.errorsTree.columnCount()): self.errorsTree.resizeColumnToContents(i) - self.errorsTree.sortItems(0, Qt.AscendingOrder) + self.errorsTree.sortItems(0, Qt.SortOrder.AscendingOrder) self.__setRemoveButtons()
--- a/eric6/WebBrowser/OpenSearch/OpenSearchDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/OpenSearch/OpenSearchDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -105,7 +105,7 @@ engineName = osm.allEnginesNames()[row] engine = osm.engine(engineName) dlg = OpenSearchEditDialog(engine, self) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: osm.enginesChanged() def __selectionChanged(self, selected, deselected):
--- a/eric6/WebBrowser/OpenSearch/OpenSearchEngine.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/OpenSearch/OpenSearchEngine.py Tue Mar 02 17:17:09 2021 +0100 @@ -58,8 +58,8 @@ self.__searchMethod = "get" self.__suggestionsMethod = "get" self.__requestMethods = { - "get": QNetworkAccessManager.GetOperation, - "post": QNetworkAccessManager.PostOperation, + "get": QNetworkAccessManager.Operation.GetOperation, + "post": QNetworkAccessManager.Operation.PostOperation, } self.__replies = [] @@ -395,7 +395,7 @@ """ if not self._imageUrl: imageBuffer = QBuffer() - imageBuffer.open(QIODevice.ReadWrite) + imageBuffer.open(QIODevice.OpenModeFlag.ReadWrite) if image.save(imageBuffer, "PNG"): self._imageUrl = "data:image/png;base64,{0}".format( bytes(imageBuffer.buffer().toBase64()).decode()) @@ -483,7 +483,10 @@ """ Private slot to receive the suggestions. """ - if self.__suggestionsReply.error() == QNetworkReply.NoError: + if ( + self.__suggestionsReply.error() == + QNetworkReply.NetworkError.NoError + ): buffer = bytes(self.__suggestionsReply.readAll()) response = Utilities.decodeBytes(buffer) response = response.strip()
--- a/eric6/WebBrowser/OpenSearch/OpenSearchEngineModel.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/OpenSearch/OpenSearchEngineModel.py Tue Mar 02 17:17:09 2021 +0100 @@ -98,9 +98,16 @@ @return flags (Qt.ItemFlags) """ if index.column() == 1: - return Qt.ItemIsEnabled | Qt.ItemIsSelectable | Qt.ItemIsEditable + return ( + Qt.ItemFlag.ItemIsEnabled | + Qt.ItemFlag.ItemIsSelectable | + Qt.ItemFlag.ItemIsEditable + ) else: - return Qt.ItemIsEnabled | Qt.ItemIsSelectable + return ( + Qt.ItemFlag.ItemIsEnabled | + Qt.ItemFlag.ItemIsSelectable + ) def data(self, index, role): """ @@ -120,10 +127,10 @@ return None if index.column() == 0: - if role == Qt.DisplayRole: + if role == Qt.ItemDataRole.DisplayRole: return engine.name() - elif role == Qt.DecorationRole: + elif role == Qt.ItemDataRole.DecorationRole: image = engine.image() if image.isNull(): from WebBrowser.WebBrowserWindow import WebBrowserWindow @@ -132,7 +139,7 @@ icon = QIcon(QPixmap.fromImage(image)) return icon - elif role == Qt.ToolTipRole: + elif role == Qt.ItemDataRole.ToolTipRole: description = self.tr( "<strong>Description:</strong> {0}" ).format(engine.description()) @@ -143,9 +150,9 @@ return description elif index.column() == 1: - if role in [Qt.EditRole, Qt.DisplayRole]: + if role in [Qt.ItemDataRole.EditRole, Qt.ItemDataRole.DisplayRole]: return ",".join(self.__manager.keywordsForEngine(engine)) - elif role == Qt.ToolTipRole: + elif role == Qt.ItemDataRole.ToolTipRole: return self.tr( "Comma-separated list of keywords that may" " be entered in the location bar followed by search terms" @@ -153,7 +160,7 @@ return None - def setData(self, index, value, role=Qt.EditRole): + def setData(self, index, value, role=Qt.ItemDataRole.EditRole): """ Public method to set the data of a model cell. @@ -168,7 +175,7 @@ if index.row() >= self.rowCount() or index.row() < 0: return False - if role != Qt.EditRole: + if role != Qt.ItemDataRole.EditRole: return False engineName = self.__manager.allEnginesNames()[index.row()] @@ -178,16 +185,20 @@ return True - def headerData(self, section, orientation, role=Qt.DisplayRole): + def headerData(self, section, orientation, + role=Qt.ItemDataRole.DisplayRole): """ Public method to get the header data. @param section section number (integer) @param orientation header orientation (Qt.Orientation) - @param role data role (integer) + @param role data role (Qt.ItemDataRole) @return header data """ - if orientation == Qt.Horizontal and role == Qt.DisplayRole: + if ( + orientation == Qt.Orientation.Horizontal and + role == Qt.ItemDataRole.DisplayRole + ): try: return self.__headers[section] except IndexError:
--- a/eric6/WebBrowser/OpenSearch/OpenSearchManager.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/OpenSearch/OpenSearchManager.py Tue Mar 02 17:17:09 2021 +0100 @@ -189,7 +189,7 @@ @return flag indicating success (boolean) """ file_ = QFile(filename) - if not file_.open(QIODevice.ReadOnly): + if not file_.open(QIODevice.OpenModeFlag.ReadOnly): return False from .OpenSearchReader import OpenSearchReader @@ -270,7 +270,7 @@ view, self.tr("Engine name"), self.tr("Enter a name for the engine"), - QLineEdit.Normal) + QLineEdit.EchoMode.Normal) if not ok: return @@ -281,7 +281,8 @@ engine.setName(engineName) engine.setDescription(engineName) engine.setSearchUrlTemplate( - actionUrl.toDisplayString(QUrl.FullyDecoded)) + actionUrl.toDisplayString( + QUrl.ComponentFormattingOption.FullyDecoded)) engine.setImage(view.icon().pixmap(16, 16).toImage()) self.__addEngineByEngine(engine) @@ -354,7 +355,7 @@ fileName = qdir.filePath(name) file = QFile(fileName) - if not file.open(QIODevice.WriteOnly): + if not file.open(QIODevice.OpenModeFlag.WriteOnly): continue writer.write(file, engine) @@ -432,7 +433,7 @@ ): engineFile = QFile(os.path.join(defaultEnginesDirectory, engineFileName)) - if not engineFile.open(QIODevice.ReadOnly): + if not engineFile.open(QIODevice.OpenModeFlag.ReadOnly): continue engine = reader.read(engineFile) self.__addEngineByEngine(engine) @@ -479,7 +480,7 @@ if reply in self.__replies: self.__replies.remove(reply) - if reply.error() == QNetworkReply.NoError: + if reply.error() == QNetworkReply.NetworkError.NoError: from .OpenSearchReader import OpenSearchReader reader = OpenSearchReader() engine = reader.read(reply)
--- a/eric6/WebBrowser/OpenSearch/OpenSearchReader.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/OpenSearch/OpenSearchReader.py Tue Mar 02 17:17:09 2021 +0100 @@ -24,7 +24,7 @@ self.clear() if not device.isOpen(): - device.open(QIODevice.ReadOnly) + device.open(QIODevice.OpenModeFlag.ReadOnly) self.setDevice(device) return self.__read()
--- a/eric6/WebBrowser/OpenSearch/OpenSearchWriter.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/OpenSearch/OpenSearchWriter.py Tue Mar 02 17:17:09 2021 +0100 @@ -34,7 +34,7 @@ return False if not device.isOpen(): - if not device.open(QIODevice.WriteOnly): + if not device.open(QIODevice.OpenModeFlag.WriteOnly): return False self.setDevice(device)
--- a/eric6/WebBrowser/PageScreenDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/PageScreenDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -30,7 +30,7 @@ """ super(PageScreenDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) self.__view = view self.__createPixmap() @@ -53,7 +53,7 @@ ) if res is not None: image = QImage(QSize(res["width"], self.__view.height()), - QImage.Format_ARGB32) + QImage.Format.Format_ARGB32) painter = QPainter(image) self.__view.render(painter) painter.end() @@ -114,8 +114,12 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Cancel): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel + ): self.reject() - elif button == self.buttonBox.button(QDialogButtonBox.Save): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Save + ): if self.__savePageScreen(): self.accept()
--- a/eric6/WebBrowser/Passwords/PasswordManager.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/Passwords/PasswordManager.py Tue Mar 02 17:17:09 2021 +0100 @@ -49,7 +49,7 @@ # setup userscript to monitor forms script = QWebEngineScript() script.setName("_eric_passwordmonitor") - script.setInjectionPoint(QWebEngineScript.DocumentReady) + script.setInjectionPoint(QWebEngineScript.InjectionPoint.DocumentReady) script.setWorldId(WebBrowserPage.SafeJsWorld) script.setRunsOnSubFrames(True) script.setSourceCode(Scripts.setupFormObserver()) @@ -180,7 +180,7 @@ reader = PasswordReader() self.__logins, self.__loginForms, self.__never = reader.read( loginFile) - if reader.error() != QXmlStreamReader.NoError: + if reader.error() != QXmlStreamReader.Error.NoError: E5MessageBox.warning( None, self.tr("Loading login data"),
--- a/eric6/WebBrowser/Passwords/PasswordModel.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/Passwords/PasswordModel.py Tue Mar 02 17:17:09 2021 +0100 @@ -131,7 +131,7 @@ if siteInfo is None: return None - if role == Qt.DisplayRole: + if role == Qt.ItemDataRole.DisplayRole: if index.column() == 0: return site elif index.column() in [1, 2]: @@ -139,16 +139,20 @@ return None - def headerData(self, section, orientation, role=Qt.DisplayRole): + def headerData(self, section, orientation, + role=Qt.ItemDataRole.DisplayRole): """ Public method to get the header data. @param section section number (integer) @param orientation header orientation (Qt.Orientation) - @param role data role (integer) + @param role data role (Qt.ItemDataRole) @return header data """ - if orientation == Qt.Horizontal and role == Qt.DisplayRole: + if ( + orientation == Qt.Orientation.Horizontal and + role == Qt.ItemDataRole.DisplayRole + ): try: return self.__headers[section] except IndexError:
--- a/eric6/WebBrowser/PersonalInformationManager/PersonalInformationManager.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/PersonalInformationManager/PersonalInformationManager.py Tue Mar 02 17:17:09 2021 +0100 @@ -126,7 +126,7 @@ """ from .PersonalDataDialog import PersonalDataDialog dlg = PersonalDataDialog() - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: dlg.storeData() self.__loadSettings() @@ -198,8 +198,10 @@ if view is None: return False - isEnter = evt.key() in [Qt.Key_Return, Qt.Key_Enter] - isControlModifier = evt.modifiers() & Qt.ControlModifier + isEnter = evt.key() in [Qt.Key.Key_Return, Qt.Key.Key_Enter] + isControlModifier = ( + evt.modifiers() & Qt.KeyboardModifier.ControlModifier + ) if not isEnter or not isControlModifier: return False
--- a/eric6/WebBrowser/QtHelp/HelpDocsInstaller.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/QtHelp/HelpDocsInstaller.py Tue Mar 02 17:17:09 2021 +0100 @@ -60,7 +60,7 @@ """ Public method to start the installation procedure. """ - self.start(QThread.LowPriority) + self.start(QThread.Priority.LowPriority) def run(self): """ @@ -119,7 +119,7 @@ dt = QDateTime() if len(lst) and lst[0]: - dt = QDateTime.fromString(lst[0], Qt.ISODate) + dt = QDateTime.fromString(lst[0], Qt.DateFormat.ISODate) qchFile = "" if len(lst) == 2: @@ -127,10 +127,12 @@ if version == 4: docsPath = QDir( - QLibraryInfo.location(QLibraryInfo.DocumentationPath) + + QLibraryInfo.location( + QLibraryInfo.LibraryLocation.DocumentationPath) + QDir.separator() + "qch") elif version == 5: - docsPath = QLibraryInfo.location(QLibraryInfo.DocumentationPath) + docsPath = QLibraryInfo.location( + QLibraryInfo.LibraryLocation.DocumentationPath) if ( not os.path.isdir(docsPath) or len(QDir(docsPath).entryList(["*.qch"])) == 0 @@ -148,7 +150,7 @@ if not files: engine.setCustomValue( versionKey, - QDateTime().toString(Qt.ISODate) + '|') + QDateTime().toString(Qt.DateFormat.ISODate) + '|') return False for f in files: @@ -162,8 +164,8 @@ if ( dt.isValid() and namespace in engine.registeredDocumentations() and - (fi.lastModified().toString(Qt.ISODate) == - dt.toString(Qt.ISODate)) and + (fi.lastModified().toString(Qt.DateFormat.ISODate) == + dt.toString(Qt.DateFormat.ISODate)) and qchFile == fi.absoluteFilePath() ): return False @@ -182,7 +184,7 @@ engine.setCustomValue( versionKey, - fi.lastModified().toString(Qt.ISODate) + '|' + + fi.lastModified().toString(Qt.DateFormat.ISODate) + '|' + fi.absoluteFilePath()) return True @@ -201,7 +203,7 @@ dt = QDateTime() if len(lst) and lst[0]: - dt = QDateTime.fromString(lst[0], Qt.ISODate) + dt = QDateTime.fromString(lst[0], Qt.DateFormat.ISODate) qchFile = "" if len(lst) == 2: @@ -212,7 +214,7 @@ files = docsPath.entryList(["*.qch"]) if not files: engine.setCustomValue( - versionKey, QDateTime().toString(Qt.ISODate) + '|') + versionKey, QDateTime().toString(Qt.DateFormat.ISODate) + '|') return False for f in files: @@ -226,8 +228,8 @@ if ( dt.isValid() and namespace in engine.registeredDocumentations() and - (fi.lastModified().toString(Qt.ISODate) == - dt.toString(Qt.ISODate)) and + (fi.lastModified().toString(Qt.DateFormat.ISODate) == + dt.toString(Qt.DateFormat.ISODate)) and qchFile == fi.absoluteFilePath() ): return False @@ -246,7 +248,7 @@ engine.setCustomValue( versionKey, - fi.lastModified().toString(Qt.ISODate) + '|' + + fi.lastModified().toString(Qt.DateFormat.ISODate) + '|' + fi.absoluteFilePath()) return True
--- a/eric6/WebBrowser/QtHelp/HelpIndexWidget.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/QtHelp/HelpIndexWidget.py Tue Mar 02 17:17:09 2021 +0100 @@ -55,7 +55,8 @@ self.__layout.addWidget(self.__searchEdit) self.__index = self.__engine.indexWidget() - self.__index.setContextMenuPolicy(Qt.CustomContextMenu) + self.__index.setContextMenuPolicy( + Qt.ContextMenuPolicy.CustomContextMenu) self.__engine.indexModel().indexCreationStarted.connect( self.__disableSearchEdit) @@ -85,13 +86,18 @@ modifiers = QApplication.keyboardModifiers() if not url.isEmpty() and url.isValid(): if ( - modifiers & (Qt.ControlModifier | Qt.ShiftModifier) == - (Qt.ControlModifier | Qt.ShiftModifier) + modifiers & ( + Qt.KeyboardModifier.ControlModifier | + Qt.KeyboardModifier.ShiftModifier + ) == ( + Qt.KeyboardModifier.ControlModifier | + Qt.KeyboardModifier.ShiftModifier + ) ): self.newBackgroundTab.emit(url) - elif modifiers & Qt.ControlModifier: + elif modifiers & Qt.KeyboardModifier.ControlModifier: self.newTab.emit(url) - elif modifiers & Qt.ShiftModifier: + elif modifiers & Qt.KeyboardModifier.ShiftModifier: self.newWindow.emit(url) else: self.openUrl.emit(url) @@ -127,7 +133,7 @@ link = QUrl() from .HelpTopicDialog import HelpTopicDialog dlg = HelpTopicDialog(self, keyword, links) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: link = dlg.link() return link @@ -161,7 +167,7 @@ @param evt reference to the focus event object (QFocusEvent) """ - if evt.reason() != Qt.MouseFocusReason: + if evt.reason() != Qt.FocusReason.MouseFocusReason: self.__searchEdit.selectAll() self.__searchEdit.setFocus() @@ -175,20 +181,20 @@ """ if ( self.__searchEdit and watched == self.__searchEdit and - event.type() == QEvent.KeyPress + event.type() == QEvent.Type.KeyPress ): idx = self.__index.currentIndex() - if event.key() == Qt.Key_Up: + if event.key() == Qt.Key.Key_Up: idx = self.__index.model().index( idx.row() - 1, idx.column(), idx.parent()) if idx.isValid(): self.__index.setCurrentIndex(idx) - elif event.key() == Qt.Key_Down: + elif event.key() == Qt.Key.Key_Down: idx = self.__index.model().index( idx.row() + 1, idx.column(), idx.parent()) if idx.isValid(): self.__index.setCurrentIndex(idx) - elif event.key() == Qt.Key_Escape: + elif event.key() == Qt.Key.Key_Escape: self.escapePressed.emit() return QWidget.eventFilter(self, watched, event) @@ -212,7 +218,7 @@ act = menu.exec() model = self.__index.model() if model is not None: - keyword = model.data(idx, Qt.DisplayRole) + keyword = model.data(idx, Qt.ItemDataRole.DisplayRole) links = model.linksForKeyword(keyword) if len(links) == 1: link = QUrl(links[list(links.keys())[0]])
--- a/eric6/WebBrowser/QtHelp/HelpSearchWidget.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/QtHelp/HelpSearchWidget.py Tue Mar 02 17:17:09 2021 +0100 @@ -73,7 +73,7 @@ """ Private slot to handle the start of a search. """ - QApplication.setOverrideCursor(Qt.WaitCursor) + QApplication.setOverrideCursor(Qt.CursorShape.WaitCursor) def __searchingFinished(self, hits): """ @@ -95,17 +95,22 @@ buttons = QApplication.mouseButtons() modifiers = QApplication.keyboardModifiers() - if buttons & Qt.MidButton: + if buttons & Qt.MouseButton.MidButton: self.newTab.emit(url) else: if ( - modifiers & (Qt.ControlModifier | Qt.ShiftModifier) == - (Qt.ControlModifier | Qt.ShiftModifier) + modifiers & ( + Qt.KeyboardModifier.ControlModifier | + Qt.KeyboardModifier.ShiftModifier + ) == ( + Qt.KeyboardModifier.ControlModifier | + Qt.KeyboardModifier.ShiftModifier + ) ): self.newBackgroundTab.emit(url) - elif modifiers & Qt.ControlModifier: + elif modifiers & Qt.KeyboardModifier.ControlModifier: self.newTab.emit(url) - elif modifiers & Qt.ShiftModifier: + elif modifiers & Qt.KeyboardModifier.ShiftModifier: self.newWindow.emit(url) else: self.openUrl.emit(url) @@ -116,7 +121,7 @@ @param evt reference to the key press event (QKeyEvent) """ - if evt.key() == Qt.Key_Escape: + if evt.key() == Qt.Key.Key_Escape: self.escapePressed.emit() else: evt.ignore()
--- a/eric6/WebBrowser/QtHelp/HelpTocWidget.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/QtHelp/HelpTocWidget.py Tue Mar 02 17:17:09 2021 +0100 @@ -41,7 +41,8 @@ self.__expandDepth = -2 self.__tocWidget = self.__engine.contentWidget() - self.__tocWidget.setContextMenuPolicy(Qt.CustomContextMenu) + self.__tocWidget.setContextMenuPolicy( + Qt.ContextMenuPolicy.CustomContextMenu) self.__tocWidget.setSortingEnabled(True) self.__layout = QVBoxLayout(self) @@ -66,17 +67,22 @@ buttons = QApplication.mouseButtons() modifiers = QApplication.keyboardModifiers() - if buttons & Qt.MidButton: + if buttons & Qt.MouseButton.MidButton: self.newTab.emit(url) else: if ( - modifiers & (Qt.ControlModifier | Qt.ShiftModifier) == - (Qt.ControlModifier | Qt.ShiftModifier) + modifiers & ( + Qt.KeyboardModifier.ControlModifier | + Qt.KeyboardModifier.ShiftModifier + ) == ( + Qt.KeyboardModifier.ControlModifier | + Qt.KeyboardModifier.ShiftModifier + ) ): self.newBackgroundTab.emit(url) - elif modifiers & Qt.ControlModifier: + elif modifiers & Qt.KeyboardModifier.ControlModifier: self.newTab.emit(url) - elif modifiers & Qt.ShiftModifier: + elif modifiers & Qt.KeyboardModifier.ShiftModifier: self.newWindow.emit(url) else: self.openUrl.emit(url) @@ -85,7 +91,7 @@ """ Private slot to be run after the contents was generated. """ - self.__tocWidget.sortByColumn(0, Qt.AscendingOrder) + self.__tocWidget.sortByColumn(0, Qt.SortOrder.AscendingOrder) self.__expandTOC() def __expandTOC(self): @@ -114,7 +120,7 @@ @param evt reference to the focus event object (QFocusEvent) """ - if evt.reason() != Qt.MouseFocusReason: + if evt.reason() != Qt.FocusReason.MouseFocusReason: self.__tocWidget.setFocus() def keyPressEvent(self, evt): @@ -123,7 +129,7 @@ @param evt reference to the key press event (QKeyEvent) """ - if evt.key() == Qt.Key_Escape: + if evt.key() == Qt.Key.Key_Escape: self.escapePressed.emit() def syncToContent(self, url):
--- a/eric6/WebBrowser/QtHelp/QtHelpDocumentationDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/QtHelp/QtHelpDocumentationDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -130,7 +130,7 @@ self.__pluginHelpDocuments, QtHelpDocumentationSelectionDialog.AddMode, self) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: documents = dlg.getData() if not documents: return @@ -170,7 +170,9 @@ ) continue - if len(self.documentsList.findItems(ns, Qt.MatchFixedString)): + if len(self.documentsList.findItems( + ns, Qt.MatchFlag.MatchFixedString + )): E5MessageBox.warning( self, self.tr("Add Documentation"), @@ -230,7 +232,7 @@ if self.documentsList.count(): self.documentsList.setCurrentRow( - 0, QItemSelectionModel.ClearAndSelect) + 0, QItemSelectionModel.SelectionFlag.ClearAndSelect) def hasDocumentationChanges(self): """ @@ -297,24 +299,26 @@ self.filtersList.addItems(sorted(self.__filterMap.keys())) for attr in helpEngineCore.filterAttributes(): QTreeWidgetItem(self.attributesList, [attr]) - self.attributesList.sortItems(0, Qt.AscendingOrder) + self.attributesList.sortItems(0, Qt.SortOrder.AscendingOrder) if selectedFiltersText or currentFilterText or selectedAttributesText: # restore the selected filters for txt in selectedFiltersText: - items = self.filtersList.findItems(txt, Qt.MatchExactly) + items = self.filtersList.findItems( + txt, Qt.MatchFlag.MatchExactly) for itm in items: itm.setSelected(True) # restore the current filter if currentFilterText: items = self.filtersList.findItems(currentFilterText, - Qt.MatchExactly) + Qt.MatchFlag.MatchExactly) if items: self.filtersList.setCurrentItem( - items[0], QItemSelectionModel.NoUpdate) + items[0], QItemSelectionModel.SelectionFlag.NoUpdate) # restore the selected attributes for txt in selectedAttributesText: - items = self.attributesList.findItems(txt, Qt.MatchExactly, 0) + items = self.attributesList.findItems( + txt, Qt.MatchFlag.MatchExactly, 0) for itm in items: itm.setSelected(True) elif self.__filterMap: @@ -335,9 +339,9 @@ for index in range(0, self.attributesList.topLevelItemCount()): itm = self.attributesList.topLevelItem(index) if itm.text(0) in checkedList: - itm.setCheckState(0, Qt.Checked) + itm.setCheckState(0, Qt.CheckState.Checked) else: - itm.setCheckState(0, Qt.Unchecked) + itm.setCheckState(0, Qt.CheckState.Unchecked) @pyqtSlot() def on_filtersList_itemSelectionChanged(self): @@ -365,7 +369,7 @@ newAtts = [] for index in range(0, self.attributesList.topLevelItemCount()): itm = self.attributesList.topLevelItem(index) - if itm.checkState(0) == Qt.Checked: + if itm.checkState(0) == Qt.CheckState.Checked: newAtts.append(itm.text(0)) self.__filterMap[customFilter] = newAtts @@ -386,7 +390,7 @@ None, self.tr("Add Filter"), self.tr("Filter name:"), - QLineEdit.Normal) + QLineEdit.EchoMode.Normal) if not customFilter: return @@ -395,7 +399,7 @@ self.filtersList.addItem(customFilter) itm = self.filtersList.findItems( - customFilter, Qt.MatchCaseSensitive)[0] + customFilter, Qt.MatchFlag.MatchCaseSensitive)[0] self.filtersList.setCurrentItem(itm) @pyqtSlot() @@ -424,7 +428,7 @@ if self.filtersList.count(): self.filtersList.setCurrentRow( - 0, QItemSelectionModel.ClearAndSelect) + 0, QItemSelectionModel.SelectionFlag.ClearAndSelect) @pyqtSlot() def on_removeAttributesButton_clicked(self):
--- a/eric6/WebBrowser/QtHelp/QtHelpDocumentationSelectionDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/QtHelp/QtHelpDocumentationSelectionDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -46,19 +46,22 @@ self.setupUi(self) if mode == QtHelpDocumentationSelectionDialog.AddMode: - self.buttonBox.button(QDialogButtonBox.Close).hide() + self.buttonBox.button(QDialogButtonBox.StandardButton.Close).hide() else: - self.buttonBox.button(QDialogButtonBox.Ok).hide() - self.buttonBox.button(QDialogButtonBox.Cancel).hide() + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).hide() + self.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).hide() for category in helpDocuments: parentItem = QTreeWidgetItem(self.documentationList, [category]) for document in helpDocuments[category]: item = QTreeWidgetItem(parentItem, [os.path.basename(document)]) - item.setData(0, Qt.UserRole, document) - parentItem.setData(0, Qt.UserRole, os.path.dirname(document)) - self.documentationList.sortItems(0, Qt.AscendingOrder) + item.setData(0, Qt.ItemDataRole.UserRole, document) + parentItem.setData(0, Qt.ItemDataRole.UserRole, + os.path.dirname(document)) + self.documentationList.sortItems(0, Qt.SortOrder.AscendingOrder) self.on_documentationList_itemSelectionChanged() @@ -95,7 +98,7 @@ continue category = itm.parent() - fileName = itm.data(0, Qt.UserRole) + fileName = itm.data(0, Qt.ItemDataRole.UserRole) try: os.remove(fileName) except OSError as err: @@ -155,7 +158,7 @@ @param category reference to the category item @type QTreeWidgetItem """ - categoryDir = category.data(0, Qt.UserRole) + categoryDir = category.data(0, Qt.ItemDataRole.UserRole) shutil.rmtree(categoryDir, True) self.documentationList.takeTopLevelItem( @@ -175,11 +178,11 @@ # it is a category item; add all files of that category for childIndex in range(item.childCount()): child = item.child(childIndex) - fileName = child.data(0, Qt.UserRole) + fileName = child.data(0, Qt.ItemDataRole.UserRole) if fileName: documents.add(fileName) else: - fileName = item.data(0, Qt.UserRole) + fileName = item.data(0, Qt.ItemDataRole.UserRole) if fileName: documents.add(fileName) return documents
--- a/eric6/WebBrowser/SafeBrowsing/SafeBrowsingAPIClient.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/SafeBrowsing/SafeBrowsingAPIClient.py Tue Mar 02 17:17:09 2021 +0100 @@ -82,12 +82,13 @@ reply = WebBrowserWindow.networkManager().get(req) while reply.isRunning(): - QCoreApplication.processEvents(QEventLoop.AllEvents, 200) + QCoreApplication.processEvents( + QEventLoop.ProcessEventsFlag.AllEvents, 200) # max. 200 ms processing res = None error = "" - if reply.error() != QNetworkReply.NoError: + if reply.error() != QNetworkReply.NetworkError.NoError: error = reply.errorString() self.networkError.emit(error) else: @@ -139,16 +140,18 @@ url = QUrl(self.GsbUrlTemplate.format("threatListUpdates:fetch", self.__apiKey)) req = QNetworkRequest(url) - req.setHeader(QNetworkRequest.ContentTypeHeader, "application/json") + req.setHeader(QNetworkRequest.KnownHeaders.ContentTypeHeader, + "application/json") reply = WebBrowserWindow.networkManager().post(req, data) while reply.isRunning(): - QCoreApplication.processEvents(QEventLoop.AllEvents, 200) + QCoreApplication.processEvents( + QEventLoop.ProcessEventsFlag.AllEvents, 200) # max. 200 ms processing res = None error = "" - if reply.error() != QNetworkReply.NoError: + if reply.error() != QNetworkReply.NetworkError.NoError: error = reply.errorString() self.networkError.emit(error) else: @@ -212,15 +215,17 @@ url = QUrl(self.GsbUrlTemplate.format("fullHashes:find", self.__apiKey)) req = QNetworkRequest(url) - req.setHeader(QNetworkRequest.ContentTypeHeader, "application/json") + req.setHeader(QNetworkRequest.KnownHeaders.ContentTypeHeader, + "application/json") reply = WebBrowserWindow.networkManager().post(req, data) while reply.isRunning(): - QCoreApplication.processEvents(QEventLoop.AllEvents, 200) + QCoreApplication.processEvents( + QEventLoop.ProcessEventsFlag.AllEvents, 200) # max. 200 ms processing res = [] - if reply.error() != QNetworkReply.NoError: + if reply.error() != QNetworkReply.NetworkError.NoError: self.networkError.emit(reply.errorString()) else: res = self.__extractData(reply) @@ -297,7 +302,9 @@ # sanitize the URL by removing user info and query data url = url.adjusted( - QUrl.RemoveUserInfo | QUrl.RemoveQuery | QUrl.RemoveFragment + QUrl.UrlFormattingOption.RemoveUserInfo | + QUrl.UrlFormattingOption.RemoveQuery | + QUrl.UrlFormattingOption.RemoveFragment ) urlStr = url.toString() @@ -333,15 +340,17 @@ url = QUrl(self.GsbUrlTemplate.format("threatMatches:find", self.__apiKey)) req = QNetworkRequest(url) - req.setHeader(QNetworkRequest.ContentTypeHeader, "application/json") + req.setHeader(QNetworkRequest.KnownHeaders.ContentTypeHeader, + "application/json") reply = WebBrowserWindow.networkManager().post(req, data) while reply.isRunning(): - QCoreApplication.processEvents(QEventLoop.AllEvents, 200) + QCoreApplication.processEvents( + QEventLoop.ProcessEventsFlag.AllEvents, 200) # max. 200 ms processing threats = [] - if reply.error() != QNetworkReply.NoError: + if reply.error() != QNetworkReply.NetworkError.NoError: error = reply.errorString() self.networkError.emit(error) else:
--- a/eric6/WebBrowser/SafeBrowsing/SafeBrowsingCache.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/SafeBrowsing/SafeBrowsingCache.py Tue Mar 02 17:17:09 2021 +0100 @@ -196,8 +196,9 @@ query.prepare( queryStr.format(",".join(["?"] * len(hashValues)))) for hashValue in hashValues: - query.addBindValue(QByteArray(hashValue), - QSql.In | QSql.Binary) + query.addBindValue( + QByteArray(hashValue), + QSql.ParamTypeFlag.In | QSql.ParamTypeFlag.Binary) query.exec() @@ -209,8 +210,9 @@ threatList = ThreatList(threatType, platformType, threatEntryType) output.append((threatList, hasExpired)) - QCoreApplication.processEvents(QEventLoop.AllEvents, - self.maxProcessEventsTime) + QCoreApplication.processEvents( + QEventLoop.ProcessEventsFlag.AllEvents, + self.maxProcessEventsTime) del query finally: db.commit() @@ -255,8 +257,9 @@ threatList = ThreatList(threatType, platformType, threatEntryType) output.append((threatList, fullHash, negativeCacheExpired)) - QCoreApplication.processEvents(QEventLoop.AllEvents, - self.maxProcessEventsTime) + QCoreApplication.processEvents( + QEventLoop.ProcessEventsFlag.AllEvents, + self.maxProcessEventsTime) del query finally: db.commit() @@ -299,8 +302,9 @@ try: query = QSqlQuery(db) query.prepare(insertQueryStr) - query.addBindValue(QByteArray(hashValue), - QSql.In | QSql.Binary) + query.addBindValue( + QByteArray(hashValue), + QSql.ParamTypeFlag.In | QSql.ParamTypeFlag.Binary) query.addBindValue(threatList.threatType) query.addBindValue(threatList.platformType) query.addBindValue(threatList.threatEntryType) @@ -310,8 +314,9 @@ query = QSqlQuery(db) query.prepare(updateQueryStr) - query.addBindValue(QByteArray(hashValue), - QSql.In | QSql.Binary) + query.addBindValue( + QByteArray(hashValue), + QSql.ParamTypeFlag.In | QSql.ParamTypeFlag.Binary) query.addBindValue(threatList.threatType) query.addBindValue(threatList.platformType) query.addBindValue(threatList.threatEntryType) @@ -400,8 +405,9 @@ try: query = QSqlQuery(db) query.prepare(queryStr) - query.addBindValue(QByteArray(hashPrefix), - QSql.In | QSql.Binary) + query.addBindValue( + QByteArray(hashPrefix), + QSql.ParamTypeFlag.In | QSql.ParamTypeFlag.Binary) query.addBindValue(threatList.threatType) query.addBindValue(threatList.platformType) query.addBindValue(threatList.threatEntryType) @@ -440,8 +446,9 @@ threatList = ThreatList(threatType, platformType, threatEntryType) output.append((threatList, clientState)) - QCoreApplication.processEvents(QEventLoop.AllEvents, - self.maxProcessEventsTime) + QCoreApplication.processEvents( + QEventLoop.ProcessEventsFlag.AllEvents, + self.maxProcessEventsTime) del query finally: db.commit() @@ -550,7 +557,8 @@ db = QSqlDatabase.database(self.__connectionName) if db.isOpen(): db.transaction() - sha256Hash = QCryptographicHash(QCryptographicHash.Sha256) + sha256Hash = QCryptographicHash( + QCryptographicHash.Algorithm.Sha256) try: query = QSqlQuery(db) query.prepare(queryStr) @@ -562,8 +570,9 @@ while query.next(): # __IGNORE_WARNING_M523__ sha256Hash.addData(query.value(0)) - QCoreApplication.processEvents(QEventLoop.AllEvents, - self.maxProcessEventsTime) + QCoreApplication.processEvents( + QEventLoop.ProcessEventsFlag.AllEvents, + self.maxProcessEventsTime) del query finally: db.commit() @@ -595,16 +604,18 @@ for prefix in prefixes: query = QSqlQuery(db) query.prepare(queryStr) - query.addBindValue(QByteArray(prefix), - QSql.In | QSql.Binary) + query.addBindValue( + QByteArray(prefix), + QSql.ParamTypeFlag.In | QSql.ParamTypeFlag.Binary) query.addBindValue(prefix[:4].hex()) query.addBindValue(threatList.threatType) query.addBindValue(threatList.platformType) query.addBindValue(threatList.threatEntryType) query.exec() del query - QCoreApplication.processEvents(QEventLoop.AllEvents, - self.maxProcessEventsTime) + QCoreApplication.processEvents( + QEventLoop.ProcessEventsFlag.AllEvents, + self.maxProcessEventsTime) finally: db.commit() @@ -646,8 +657,9 @@ prefix = bytes(query.value(0)) output.append(prefix) index += 1 - QCoreApplication.processEvents(QEventLoop.AllEvents, - self.maxProcessEventsTime) + QCoreApplication.processEvents( + QEventLoop.ProcessEventsFlag.AllEvents, + self.maxProcessEventsTime) del query finally: db.commit() @@ -692,12 +704,15 @@ query.addBindValue(threatList.platformType) query.addBindValue(threatList.threatEntryType) for prefix in removeBatch: - query.addBindValue(QByteArray(prefix), - QSql.In | QSql.Binary) + query.addBindValue( + QByteArray(prefix), + QSql.ParamTypeFlag.In | + QSql.ParamTypeFlag.Binary) query.exec() del query QCoreApplication.processEvents( - QEventLoop.AllEvents, self.maxProcessEventsTime) + QEventLoop.ProcessEventsFlag.AllEvents, + self.maxProcessEventsTime) finally: db.commit()
--- a/eric6/WebBrowser/SafeBrowsing/SafeBrowsingDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/SafeBrowsing/SafeBrowsingDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -36,7 +36,7 @@ """ super(SafeBrowsingDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) self.__manager = manager self.__manager.progressMessage.connect(self.__setProgressMessage) @@ -99,7 +99,9 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Close): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() @pyqtSlot()
--- a/eric6/WebBrowser/SafeBrowsing/SafeBrowsingInfoWidget.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/SafeBrowsing/SafeBrowsingInfoWidget.py Tue Mar 02 17:17:09 2021 +0100 @@ -34,13 +34,14 @@ iconLabel = QLabel(self) iconLabel.setPixmap(UI.PixmapCache.getPixmap("safeBrowsing48")) - layout.addWidget(iconLabel, 0, Qt.AlignTop) + layout.addWidget(iconLabel, 0, Qt.AlignmentFlag.AlignTop) infoLabel = QLabel(self) infoLabel.setWordWrap(True) - infoLabel.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) + infoLabel.setSizePolicy(QSizePolicy.Policy.Expanding, + QSizePolicy.Policy.Expanding) infoLabel.setText(info) - layout.addWidget(infoLabel, 0, Qt.AlignTop) + layout.addWidget(infoLabel, 0, Qt.AlignmentFlag.AlignTop) def showAt(self, pos): """
--- a/eric6/WebBrowser/SafeBrowsing/SafeBrowsingLabel.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/SafeBrowsing/SafeBrowsingLabel.py Tue Mar 02 17:17:09 2021 +0100 @@ -29,8 +29,8 @@ """ super(SafeBrowsingLabel, self).__init__(parent) - self.setFocusPolicy(Qt.NoFocus) - self.setCursor(Qt.PointingHandCursor) + self.setFocusPolicy(Qt.FocusPolicy.NoFocus) + self.setCursor(Qt.CursorShape.PointingHandCursor) self.setStyleSheet(SafeBrowsingLabel.nokStyle) @@ -46,7 +46,7 @@ @param evt reference to the mouse event (QMouseEvent) """ - if evt.button() == Qt.LeftButton: + if evt.button() == Qt.MouseButton.LeftButton: self.clicked.emit(evt.globalPos()) else: super(SafeBrowsingLabel, self).mouseReleaseEvent(evt) @@ -57,7 +57,7 @@ @param evt reference to the mouse event (QMouseEvent) """ - if evt.button() == Qt.LeftButton: + if evt.button() == Qt.MouseButton.LeftButton: self.clicked.emit(evt.globalPos()) else: super(SafeBrowsingLabel, self).mouseDoubleClickEvent(evt)
--- a/eric6/WebBrowser/SearchWidget.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/SearchWidget.py Tue Mar 02 17:17:09 2021 +0100 @@ -37,10 +37,12 @@ self.findNextButton.setIcon(UI.PixmapCache.getIcon("1rightarrow")) self.__defaultBaseColor = ( - self.findtextCombo.lineEdit().palette().color(QPalette.Base) + self.findtextCombo.lineEdit().palette().color( + QPalette.ColorRole.Base) ) self.__defaultTextColor = ( - self.findtextCombo.lineEdit().palette().color(QPalette.Text) + self.findtextCombo.lineEdit().palette().color( + QPalette.ColorRole.Text) ) self.__findHistory = [] @@ -205,10 +207,10 @@ @param event reference to the key press event (QKeyEvent) """ - if event.key() == Qt.Key_Escape: + if event.key() == Qt.Key.Key_Escape: cb = self.__mainWindow.currentBrowser() if cb: - cb.setFocus(Qt.ActiveWindowFocusReason) + cb.setFocus(Qt.FocusReason.ActiveWindowFocusReason) event.accept() self.__resetSearch() self.close() @@ -223,10 +225,10 @@ le = self.findtextCombo.lineEdit() p = le.palette() if error: - p.setBrush(QPalette.Base, QBrush(QColor("#FF6666"))) - p.setBrush(QPalette.Text, QBrush(QColor("#000000"))) + p.setBrush(QPalette.ColorRole.Base, QBrush(QColor("#FF6666"))) + p.setBrush(QPalette.ColorRole.Text, QBrush(QColor("#000000"))) else: - p.setBrush(QPalette.Base, self.__defaultBaseColor) - p.setBrush(QPalette.Text, self.__defaultTextColor) + p.setBrush(QPalette.ColorRole.Base, self.__defaultBaseColor) + p.setBrush(QPalette.ColorRole.Text, self.__defaultTextColor) le.setPalette(p) le.update()
--- a/eric6/WebBrowser/Session/SessionManager.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/Session/SessionManager.py Tue Mar 02 17:17:09 2021 +0100 @@ -308,7 +308,7 @@ return sessionFilesInfoList = QDir(self.getSessionsDirectory()).entryInfoList( - ["*.json"], QDir.Files, QDir.Time) + ["*.json"], QDir.Filter.Files, QDir.SortFlag.Time) for sessionFileInfo in sessionFilesInfoList: sessionData = self.readSessionFromFile( @@ -495,7 +495,7 @@ WebBrowserWindow.getWindow(), title, self.tr("Please enter a new name:"), - QLineEdit.Normal, + QLineEdit.EchoMode.Normal, suggestedName) if not ok: @@ -543,7 +543,7 @@ WebBrowserWindow.getWindow(), self.tr("Save Session"), self.tr("Please enter a name for the session:"), - QLineEdit.Normal, + QLineEdit.EchoMode.Normal, self.tr("Saved Session ({0})").format( QDateTime.currentDateTime().toString("yyyy-MM-dd HH-mm-ss"))) @@ -632,7 +632,7 @@ WebBrowserWindow.getWindow(), self.tr("New Session"), self.tr("Please enter a name for the new session:"), - QLineEdit.Normal, + QLineEdit.EchoMode.Normal, self.tr("New Session ({0})").format( QDateTime.currentDateTime().toString("yyyy-MM-dd HH-mm-ss"))) @@ -687,11 +687,13 @@ if self.__sessionMetaData: # skip, if no session file available dlg = QDialog(WebBrowserWindow.getWindow(), - Qt.WindowStaysOnTopHint) + Qt.WindowType.WindowStaysOnTopHint) lbl = QLabel(self.tr("Please select the startup session:")) combo = QComboBox(dlg) buttonBox = QDialogButtonBox( - QDialogButtonBox.Ok | QDialogButtonBox.Cancel, dlg) + QDialogButtonBox.StandardButton.Ok | + QDialogButtonBox.StandardButton.Cancel, + dlg) buttonBox.accepted.connect(dlg.accept) buttonBox.rejected.connect(dlg.reject) @@ -714,7 +716,7 @@ ) combo.setCurrentIndex(0) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: session = combo.currentData() if session is None: self.__lastActiveSession = self.__sessionDefault
--- a/eric6/WebBrowser/Session/SessionManagerDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/Session/SessionManagerDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -20,10 +20,10 @@ """ Class implementing a dialog to manage sessions. """ - SessionFileRole = Qt.UserRole - BackupSessionRole = Qt.UserRole + 1 - ActiveSessionRole = Qt.UserRole + 2 - DefaultSessionRole = Qt.UserRole + 3 + SessionFileRole = Qt.ItemDataRole.UserRole + BackupSessionRole = Qt.ItemDataRole.UserRole + 1 + ActiveSessionRole = Qt.ItemDataRole.UserRole + 2 + DefaultSessionRole = Qt.ItemDataRole.UserRole + 3 def __init__(self, parent=None): """ @@ -34,7 +34,7 @@ """ super(SessionManagerDialog, self).__init__(parent) self.setupUi(self) - self.setAttribute(Qt.WA_DeleteOnClose) + self.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose) self.newButton.clicked.connect(self.__newSession) self.renameButton.clicked.connect(self.__renameSession) @@ -114,8 +114,8 @@ font = itm.font(0) if isBackup: - color = self.palette().color(QPalette.Disabled, - QPalette.WindowText) + color = self.palette().color(QPalette.ColorGroup.Disabled, + QPalette.ColorRole.WindowText) itm.setForeground(0, color) itm.setForeground(1, color)
--- a/eric6/WebBrowser/SiteInfo/SiteInfoDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/SiteInfo/SiteInfoDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -48,7 +48,7 @@ """ super(SiteInfoDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) # put icons self.tabWidget.setTabIcon( @@ -167,7 +167,8 @@ if self.imagesTree.columnWidth(0) > 300: self.imagesTree.setColumnWidth(0, 300) self.imagesTree.setCurrentItem(self.imagesTree.topLevelItem(0)) - self.imagesTree.setContextMenuPolicy(Qt.CustomContextMenu) + self.imagesTree.setContextMenuPolicy( + Qt.ContextMenuPolicy.CustomContextMenu) self.imagesTree.customContextMenuRequested.connect( self.__imagesTreeContextMenuRequested) @@ -243,7 +244,7 @@ """ Private slot handling the loading of an image. """ - if self.__imageReply.error() != QNetworkReply.NoError: + if self.__imageReply.error() != QNetworkReply.NetworkError.NoError: return data = self.__imageReply.readAll()
--- a/eric6/WebBrowser/SiteInfo/SiteInfoWidget.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/SiteInfo/SiteInfoWidget.py Tue Mar 02 17:17:09 2021 +0100 @@ -43,19 +43,21 @@ titleLabel = QLabel(self) titleLabel.setText(self.tr("<b>Site {0}</b>").format(url.host())) - layout.addWidget(titleLabel, rows, 0, 1, -1, Qt.AlignCenter) + layout.addWidget(titleLabel, rows, 0, 1, -1, + Qt.AlignmentFlag.AlignCenter) rows += 1 line = QFrame(self) line.setLineWidth(1) - line.setFrameStyle(QFrame.HLine | QFrame.Sunken) + line.setFrameStyle(QFrame.Shape.HLine | QFrame.Shadow.Sunken) layout.addWidget(line, rows, 0, 1, -1) rows += 1 secureIcon = QLabel() - layout.addWidget(secureIcon, rows, 0, Qt.AlignCenter) + layout.addWidget(secureIcon, rows, 0, Qt.AlignmentFlag.AlignCenter) secureLabel = QLabel() - secureLabel.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred) + secureLabel.setSizePolicy(QSizePolicy.Policy.Expanding, + QSizePolicy.Policy.Preferred) layout.addWidget(secureLabel, rows, 1) if url.scheme() in ["https"]: if WebBrowserWindow.networkManager().isInsecureHost(url.host()): @@ -79,10 +81,10 @@ visits = WebBrowserWindow.historyManager().siteVisitsCount( url.scheme(), url.host()) historyIcon = QLabel() - layout.addWidget(historyIcon, rows, 0, Qt.AlignCenter) + layout.addWidget(historyIcon, rows, 0, Qt.AlignmentFlag.AlignCenter) historyLabel = QLabel() - historyLabel.setSizePolicy(QSizePolicy.Expanding, - QSizePolicy.Preferred) + historyLabel.setSizePolicy(QSizePolicy.Policy.Expanding, + QSizePolicy.Policy.Preferred) layout.addWidget(historyLabel, rows, 1) if visits > 3: historyLabel.setText( @@ -112,7 +114,7 @@ line = QFrame(self) line.setLineWidth(1) - line.setFrameStyle(QFrame.HLine | QFrame.Sunken) + line.setFrameStyle(QFrame.Shape.HLine | QFrame.Shadow.Sunken) layout.addWidget(line, rows, 0, 1, -1) rows += 1 @@ -129,8 +131,8 @@ protocolHandlerLabel = QLabel( self.tr("Register as <b>{0}</b> links handler.") .format(scheme), self) - protocolHandlerLabel.setSizePolicy(QSizePolicy.Expanding, - QSizePolicy.Preferred) + protocolHandlerLabel.setSizePolicy(QSizePolicy.Policy.Expanding, + QSizePolicy.Policy.Preferred) horizontalLayout.addWidget(protocolHandlerLabel) protocolHandlerButton = QPushButton(self.tr("Register"), self) @@ -142,13 +144,14 @@ protocolHandlerLine = QFrame(self) protocolHandlerLine.setLineWidth(1) - protocolHandlerLine.setFrameStyle(QFrame.HLine | QFrame.Sunken) + protocolHandlerLine.setFrameStyle( + QFrame.Shape.HLine | QFrame.Shadow.Sunken) layout.addWidget(protocolHandlerLine, rows, 0, 1, -1) rows += 1 horizontalLayout = QHBoxLayout() spacerItem = QSpacerItem( - 40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) + 40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum) horizontalLayout.addItem(spacerItem) moreButton = QPushButton(self.tr("More..."), self) horizontalLayout.addWidget(moreButton)
--- a/eric6/WebBrowser/SpeedDial/PageThumbnailer.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/SpeedDial/PageThumbnailer.py Tue Mar 02 17:17:09 2021 +0100 @@ -35,7 +35,7 @@ self.__url = QUrl() self.__view = QWebEngineView() - self.__view.setAttribute(Qt.WA_DontShowOnScreen) + self.__view.setAttribute(Qt.WidgetAttribute.WA_DontShowOnScreen) self.__view.resize(1920, 1080) self.__view.show() @@ -122,13 +122,14 @@ """ self.__title = self.__view.title() - image = QImage(self.__view.size(), QImage.Format_ARGB32) + image = QImage(self.__view.size(), QImage.Format.Format_ARGB32) painter = QPainter(image) self.__view.render(painter) painter.end() - scaledImage = image.scaled(self.__size, - Qt.KeepAspectRatioByExpanding, - Qt.SmoothTransformation) + scaledImage = image.scaled( + self.__size, + Qt.AspectRatioMode.KeepAspectRatioByExpanding, + Qt.TransformationMode.SmoothTransformation) self.thumbnailCreated.emit(QPixmap.fromImage(scaledImage))
--- a/eric6/WebBrowser/SpeedDial/SpeedDial.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/SpeedDial/SpeedDial.py Tue Mar 02 17:17:09 2021 +0100 @@ -103,7 +103,8 @@ return os.path.join( self.__thumbnailsDirectory, str(QCryptographicHash.hash(QByteArray(url.encode("utf-8")), - QCryptographicHash.Md5).toHex(), encoding="utf-8") + ".png") + QCryptographicHash.Algorithm.Md5).toHex(), encoding="utf-8" + ) + ".png") def initialScript(self): """
--- 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(
--- a/eric6/WebBrowser/StatusBar/ImagesIcon.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/StatusBar/ImagesIcon.py Tue Mar 02 17:17:09 2021 +0100 @@ -66,7 +66,7 @@ menu.addAction(self.tr("Current Page Settings")).setFont(boldFont) if self._testCurrentPageWebAttribute( - QWebEngineSettings.AutoLoadImages): + QWebEngineSettings.WebAttribute.AutoLoadImages): menu.addAction(self.tr("Disable loading images (temporarily)"), self.__toggleLoadingImages) else: @@ -88,11 +88,11 @@ Private slot to update the icon. """ if self._testCurrentPageWebAttribute( - QWebEngineSettings.AutoLoadImages): + QWebEngineSettings.WebAttribute.AutoLoadImages): self.setGraphicsEffect(None) else: effect = QGraphicsColorizeEffect(self) - effect.setColor(Qt.gray) + effect.setColor(Qt.GlobalColor.gray) self.setGraphicsEffect(effect) @pyqtSlot() @@ -104,9 +104,9 @@ return current = self._testCurrentPageWebAttribute( - QWebEngineSettings.AutoLoadImages) - self._setCurrentPageWebAttribute(QWebEngineSettings.AutoLoadImages, - not current) + QWebEngineSettings.WebAttribute.AutoLoadImages) + self._setCurrentPageWebAttribute( + QWebEngineSettings.WebAttribute.AutoLoadImages, not current) if current: # reload page upon disabling loading images @@ -124,7 +124,7 @@ """ from WebBrowser.WebBrowserWindow import WebBrowserWindow WebBrowserWindow.webSettings().setAttribute( - QWebEngineSettings.AutoLoadImages, enable) + QWebEngineSettings.WebAttribute.AutoLoadImages, enable) Preferences.setWebBrowser("AutoLoadImages", enable) Preferences.syncPreferences()
--- a/eric6/WebBrowser/StatusBar/JavaScriptIcon.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/StatusBar/JavaScriptIcon.py Tue Mar 02 17:17:09 2021 +0100 @@ -68,7 +68,7 @@ menu.addAction(self.tr("Current Page Settings")).setFont(boldFont) if self._testCurrentPageWebAttribute( - QWebEngineSettings.JavascriptEnabled): + QWebEngineSettings.WebAttribute.JavascriptEnabled): act = menu.addAction(self.tr("Disable JavaScript (temporarily)"), self.__toggleJavaScript) else: @@ -93,11 +93,11 @@ Private slot to update the icon. """ if self._testCurrentPageWebAttribute( - QWebEngineSettings.JavascriptEnabled): + QWebEngineSettings.WebAttribute.JavascriptEnabled): self.setGraphicsEffect(None) else: effect = QGraphicsColorizeEffect(self) - effect.setColor(Qt.gray) + effect.setColor(Qt.GlobalColor.gray) self.setGraphicsEffect(effect) @pyqtSlot() @@ -110,9 +110,9 @@ return current = self._testCurrentPageWebAttribute( - QWebEngineSettings.JavascriptEnabled) - self._setCurrentPageWebAttribute(QWebEngineSettings.JavascriptEnabled, - not current) + QWebEngineSettings.WebAttribute.JavascriptEnabled) + self._setCurrentPageWebAttribute( + QWebEngineSettings.WebAttribute.JavascriptEnabled, not current) self.__settings[page] = not current page.navigationRequestAccepted.connect( @@ -132,7 +132,7 @@ """ from .JavaScriptSettingsDialog import JavaScriptSettingsDialog dlg = JavaScriptSettingsDialog(self._window) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: self._window.preferencesChanged() QTimer.singleShot(500, self.__updateIcon) @@ -156,5 +156,5 @@ else: enable = self.__settings[page] if isMainFrame: - page.settings().setAttribute(QWebEngineSettings.JavascriptEnabled, - enable) + page.settings().setAttribute( + QWebEngineSettings.WebAttribute.JavascriptEnabled, enable)
--- a/eric6/WebBrowser/Sync/SyncAssistantDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/Sync/SyncAssistantDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -42,15 +42,15 @@ SyncDirectorySettingsPage(self)) self.setPage(SyncGlobals.PageCheck, SyncCheckPage(self)) - self.setPixmap(QWizard.LogoPixmap, + self.setPixmap(QWizard.WizardPixmap.LogoPixmap, UI.PixmapCache.getPixmap("ericWeb48")) - self.setPixmap(QWizard.WatermarkPixmap, + self.setPixmap(QWizard.WizardPixmap.WatermarkPixmap, UI.PixmapCache.getPixmap("eric256")) - self.setPixmap(QWizard.BackgroundPixmap, + self.setPixmap(QWizard.WizardPixmap.BackgroundPixmap, UI.PixmapCache.getPixmap("eric256")) self.setMinimumSize(650, 450) if Globals.isWindowsPlatform(): - self.setWizardStyle(QWizard.ModernStyle) + self.setWizardStyle(QWizard.WizardStyle.ModernStyle) - self.setOption(QWizard.NoCancelButtonOnLastPage, True) + self.setOption(QWizard.WizardOption.NoCancelButtonOnLastPage, True)
--- a/eric6/WebBrowser/TabManager/TabManagerWidget.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/TabManager/TabManagerWidget.py Tue Mar 02 17:17:09 2021 +0100 @@ -41,8 +41,8 @@ GroupByDomain = 1 GroupByHost = 2 - WebBrowserRole = Qt.UserRole + 1 - WebWindowRole = Qt.UserRole + 2 + WebBrowserRole = Qt.ItemDataRole.UserRole + 1 + WebWindowRole = Qt.ItemDataRole.UserRole + 2 groupTypeChanged = pyqtSignal(int) @@ -60,14 +60,15 @@ @type bool """ super(TabManagerWidget, self).__init__(parent) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) self.__layout = QVBoxLayout(self) self.__layout.setContentsMargins(0, 0, 0, 0) self.__tree = QTreeWidget(self) self.__tree.setHeaderHidden(True) self.__tree.setExpandsOnDoubleClick(False) - self.__tree.setContextMenuPolicy(Qt.CustomContextMenu) + self.__tree.setContextMenuPolicy( + Qt.ContextMenuPolicy.CustomContextMenu) self.__layout.addWidget(self.__tree) self.setWindowTitle(self.tr("Tab Manager")) @@ -244,11 +245,13 @@ itm = QTreeWidgetItem(parentItem) flags = itm.flags() if parent: - flags |= Qt.ItemIsUserCheckable + flags |= Qt.ItemFlag.ItemIsUserCheckable else: - flags |= Qt.ItemIsUserCheckable | Qt.ItemIsTristate + flags |= ( + Qt.ItemFlag.ItemIsUserCheckable | Qt.ItemFlag.ItemIsTristate + ) itm.setFlags(itm.flags() | flags) - itm.setCheckState(0, Qt.Unchecked) + itm.setCheckState(0, Qt.CheckState.Unchecked) return itm @@ -369,12 +372,12 @@ selectedBrowsers = [] for index in range(self.__tree.topLevelItemCount()): winItem = self.__tree.topLevelItem(index) - if winItem.checkState(0) == Qt.Unchecked: + if winItem.checkState(0) == Qt.CheckState.Unchecked: continue for row in range(winItem.childCount()): tabItem = winItem.child(row) - if tabItem.checkState(0) == Qt.Unchecked: + if tabItem.checkState(0) == Qt.CheckState.Unchecked: continue selectedBrowsers.append( tabItem.data(0, TabManagerWidget.WebBrowserRole)) @@ -399,7 +402,7 @@ if tabItem.data(0, TabManagerWidget.WebBrowserRole) in ( selectedBrowsers ): - tabItem.setCheckState(0, Qt.Checked) + tabItem.setCheckState(0, Qt.CheckState.Checked) self.__tree.expandAll() self.__isRefreshing = False @@ -421,12 +424,12 @@ for index in range(self.__tree.topLevelItemCount()): winItem = self.__tree.topLevelItem(index) - if winItem.checkState(0) == Qt.Unchecked: + if winItem.checkState(0) == Qt.CheckState.Unchecked: continue for row in range(winItem.childCount()): tabItem = winItem.child(row) - if tabItem.checkState(0) == Qt.Unchecked: + if tabItem.checkState(0) == Qt.CheckState.Unchecked: continue mainWin = tabItem.data(0, TabManagerWidget.WebWindowRole) @@ -434,7 +437,7 @@ selectedBrowsers[mainWin].append(browser) - winItem.setCheckState(0, Qt.Unchecked) + winItem.setCheckState(0, Qt.CheckState.Unchecked) if selectedBrowsers: if command == "closeSelection": @@ -488,7 +491,7 @@ selected = False for topRow in range(self.__tree.topLevelItemCount()): topItm = self.__tree.topLevelItem(topRow) - if topItm.checkState(0) != Qt.Unchecked: + if topItm.checkState(0) != Qt.CheckState.Unchecked: selected = True break @@ -583,7 +586,8 @@ window = icon.parentWidget() if window is not None: - titleBarHeight = self.style().pixelMetric(QStyle.PM_TitleBarHeight) + titleBarHeight = self.style().pixelMetric( + QStyle.PixelMetric.PM_TitleBarHeight) y = max(0, window.frameGeometry().top() + titleBarHeight + 1)
--- a/eric6/WebBrowser/Tools/PrintToPdfDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/Tools/PrintToPdfDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -42,7 +42,7 @@ "All Files (*)")) if not os.path.isabs(filePath): documentsPath = QStandardPaths.writableLocation( - QStandardPaths.DocumentsLocation) + QStandardPaths.StandardLocation.DocumentsLocation) if documentsPath: filePath = os.path.join(documentsPath, filePath) else: @@ -50,7 +50,8 @@ self.pdfFilePicker.setText(filePath, toNative=True) self.__currentPageLayout = QPageLayout( - QPageSize(QPageSize.A4), QPageLayout.Portrait, + QPageSize(QPageSize.PageSizeId.A4), + QPageLayout.Orientation.Portrait, QMarginsF(0.0, 0.0, 0.0, 0.0)) self.__updatePageLayoutLabel() @@ -64,7 +65,7 @@ printer.setPageLayout(self.__currentPageLayout) dlg = QPageSetupDialog(printer, self) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: self.__currentPageLayout = printer.pageLayout() self.__updatePageLayoutLabel() @@ -72,7 +73,10 @@ """ Private method to update the page layout label. """ - if self.__currentPageLayout.orientation() == QPageLayout.Portrait: + if ( + self.__currentPageLayout.orientation() == + QPageLayout.Orientation.Portrait + ): orientation = self.tr("Portrait") else: orientation = self.tr("Landscape")
--- a/eric6/WebBrowser/Tools/Scripts.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/Tools/Scripts.py Tue Mar 02 17:17:09 2021 +0100 @@ -270,7 +270,9 @@ values = "" query = QUrlQuery(data) - for name, value in query.queryItems(QUrl.FullyDecoded): + for name, value in query.queryItems( + QUrl.ComponentFormattingOption.FullyDecoded + ): value = value.replace("'", "\\'") name = name.replace("'", "\\'") values += valueSource.format(name, value)
--- a/eric6/WebBrowser/Tools/WebBrowserTools.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/Tools/WebBrowserTools.py Tue Mar 02 17:17:09 2021 +0100 @@ -107,8 +107,12 @@ @param url URL (QUrl) @return file name (string) """ - fileName = url.toString(QUrl.RemoveFragment | QUrl.RemoveQuery | - QUrl.RemoveScheme | QUrl.RemovePort) + fileName = url.toString( + QUrl.UrlFormattingOption.RemoveFragment | + QUrl.UrlFormattingOption.RemoveQuery | + QUrl.UrlFormattingOption.RemoveScheme | + QUrl.UrlFormattingOption.RemovePort + ) if fileName.find("/") != -1: pos = fileName.rfind("/") fileName = fileName[pos:] @@ -171,7 +175,7 @@ """ byteArray = QByteArray() buffer = QBuffer(byteArray) - buffer.open(QIODevice.WriteOnly) + buffer.open(QIODevice.OpenModeFlag.WriteOnly) if pixmap.save(buffer, "PNG"): return buffer.buffer().toBase64()
--- a/eric6/WebBrowser/Tools/WebHitTestResult.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/Tools/WebHitTestResult.py Tue Mar 02 17:17:09 2021 +0100 @@ -126,10 +126,15 @@ self.__isContentEditable = data.isContentEditable() self.__isContentSelected = bool(data.selectedText()) - if data.mediaType() == QWebEngineContextMenuData.MediaTypeImage: + if ( + data.mediaType() == + QWebEngineContextMenuData.MediaType.MediaTypeImage + ): self.__imageUrl = data.mediaUrl() - elif data.mediaType() in [QWebEngineContextMenuData.MediaTypeAudio, - QWebEngineContextMenuData.MediaTypeVideo]: + elif data.mediaType() in [ + QWebEngineContextMenuData.MediaType.MediaTypeAudio, + QWebEngineContextMenuData.MediaType.MediaTypeVideo + ]: self.__mediaUrl = data.mediaUrl() def baseUrl(self):
--- a/eric6/WebBrowser/Tools/WebIconDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/Tools/WebIconDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -31,7 +31,7 @@ for url, icon in iconsDB.items(): QListWidgetItem(icon, url, self.iconsList) - self.iconsList.sortItems(Qt.AscendingOrder) + self.iconsList.sortItems(Qt.SortOrder.AscendingOrder) self.__setRemoveButtons()
--- a/eric6/WebBrowser/Tools/WebIconProvider.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/Tools/WebIconProvider.py Tue Mar 02 17:17:09 2021 +0100 @@ -114,7 +114,7 @@ for url, icon in self.__iconsDB.items(): ba = QByteArray() buffer = QBuffer(ba) - buffer.open(QIODevice.WriteOnly) + buffer.open(QIODevice.OpenModeFlag.WriteOnly) icon.pixmap(32).toImage().save(buffer, "PNG") db[url] = bytes(buffer.data()).decode(self.__encoding) @@ -157,8 +157,12 @@ @return string representation of the URL @rtype str """ - return url.toString(QUrl.PrettyDecoded | QUrl.RemoveUserInfo | - QUrl.RemoveFragment | QUrl.RemovePath) + return url.toString( + QUrl.ComponentFormattingOption.PrettyDecoded | + QUrl.UrlFormattingOption.RemoveUserInfo | + QUrl.UrlFormattingOption.RemoveFragment | + QUrl.UrlFormattingOption.RemovePath + ) def iconForUrl(self, url): """ @@ -225,7 +229,7 @@ from .WebIconDialog import WebIconDialog dlg = WebIconDialog(self.__iconsDB) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: changed = False urls = dlg.getUrls() for url in list(self.__iconsDB.keys())[:]:
--- a/eric6/WebBrowser/UrlBar/FavIconLabel.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/UrlBar/FavIconLabel.py Tue Mar 02 17:17:09 2021 +0100 @@ -27,8 +27,8 @@ self.__browser = None self.__dragStartPos = QPoint() - self.setFocusPolicy(Qt.NoFocus) - self.setCursor(Qt.ArrowCursor) + self.setFocusPolicy(Qt.FocusPolicy.NoFocus) + self.setCursor(Qt.CursorShape.ArrowCursor) self.setMinimumSize(16, 16) self.resize(16, 16) @@ -65,7 +65,7 @@ @param evt reference to the mouse event (QMouseEvent) """ - if evt.button() == Qt.LeftButton: + if evt.button() == Qt.MouseButton.LeftButton: self.__dragStartPos = evt.pos() super(FavIconLabel, self).mousePressEvent(evt) @@ -75,7 +75,7 @@ @param evt reference to the mouse event (QMouseEvent) """ - if evt.button() == Qt.LeftButton: + if evt.button() == Qt.MouseButton.LeftButton: self.__showPopup(evt.globalPos()) super(FavIconLabel, self).mouseReleaseEvent(evt) @@ -86,7 +86,7 @@ @param evt reference to the mouse event (QMouseEvent) """ if ( - evt.button() == Qt.LeftButton and + evt.button() == Qt.MouseButton.LeftButton and ((evt.pos() - self.__dragStartPos).manhattanLength() > QApplication.startDragDistance()) and self.__browser is not None
--- a/eric6/WebBrowser/UrlBar/SslLabel.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/UrlBar/SslLabel.py Tue Mar 02 17:17:09 2021 +0100 @@ -27,7 +27,7 @@ """ super(SslLabel, self).__init__(parent) - self.setFocusPolicy(Qt.NoFocus) + self.setFocusPolicy(Qt.FocusPolicy.NoFocus) def setValidity(self, valid): """
--- a/eric6/WebBrowser/UrlBar/StackedUrlBar.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/UrlBar/StackedUrlBar.py Tue Mar 02 17:17:09 2021 +0100 @@ -22,7 +22,8 @@ """ super(StackedUrlBar, self).__init__(parent) - sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred) + sizePolicy = QSizePolicy(QSizePolicy.Policy.Expanding, + QSizePolicy.Policy.Preferred) sizePolicy.setHorizontalStretch(6) sizePolicy.setVerticalStretch(0) self.setSizePolicy(sizePolicy)
--- a/eric6/WebBrowser/UrlBar/UrlBar.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/UrlBar/UrlBar.py Tue Mar 02 17:17:09 2021 +0100 @@ -52,7 +52,7 @@ self.__bmActiveIcon = UI.PixmapCache.getIcon("bookmark16") self.__bmInactiveIcon = QIcon( - self.__bmActiveIcon.pixmap(16, 16, QIcon.Disabled)) + self.__bmActiveIcon.pixmap(16, 16, QIcon.Mode.Disabled)) self.__safeBrowsingLabel = SafeBrowsingLabel(self) self.addWidget(self.__safeBrowsingLabel, E5LineEdit.LeftSide) @@ -205,7 +205,7 @@ ) url = self.__browser.url() dlg = BookmarkActionSelectionDialog(url) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: action = dlg.getAction() if action == BookmarkActionSelectionDialog.AddBookmark: self.__browser.addBookmark() @@ -235,12 +235,13 @@ @param evt reference to the paint event (QPaintEvent) """ - foregroundColor = QApplication.palette().color(QPalette.Text) + foregroundColor = QApplication.palette().color(QPalette.ColorRole.Text) if self.__privateMode: backgroundColor = Preferences.getWebBrowser("PrivateModeUrlColor") else: - backgroundColor = QApplication.palette().color(QPalette.Base) + backgroundColor = QApplication.palette().color( + QPalette.ColorRole.Base) if self.__browser is not None: p = self.palette() @@ -261,10 +262,11 @@ "SecureUrlColor") if progress == 0 or progress == 100: - p.setBrush(QPalette.Base, backgroundColor) - p.setBrush(QPalette.Text, foregroundColor) + p.setBrush(QPalette.ColorRole.Base, backgroundColor) + p.setBrush(QPalette.ColorRole.Text, foregroundColor) else: - highlight = QApplication.palette().color(QPalette.Highlight) + highlight = QApplication.palette().color( + QPalette.ColorRole.Highlight) r = (highlight.red() + 2 * backgroundColor.red()) // 3 g = (highlight.green() + 2 * backgroundColor.green()) // 3 b = (highlight.blue() + 2 * backgroundColor.blue()) // 3 @@ -283,7 +285,7 @@ gradient.setColorAt(0, loadingColor) gradient.setColorAt(progress / 100.0 - 0.000001, loadingColor) gradient.setColorAt(progress / 100.0, backgroundColor) - p.setBrush(QPalette.Base, gradient) + p.setBrush(QPalette.ColorRole.Base, gradient) self.setPalette(p) @@ -305,12 +307,12 @@ @param evt reference to the mouse event (QMouseEvent) """ - if evt.button() == Qt.XButton1: + if evt.button() == Qt.MouseButton.XButton1: self.__mw.currentBrowser().triggerPageAction( - QWebEnginePage.Back) - elif evt.button() == Qt.XButton2: + QWebEnginePage.WebAction.Back) + elif evt.button() == Qt.MouseButton.XButton2: self.__mw.currentBrowser().triggerPageAction( - QWebEnginePage.Forward) + QWebEnginePage.WebAction.Forward) else: super(UrlBar, self).mousePressEvent(evt) @@ -320,7 +322,7 @@ @param evt reference to the mouse event (QMouseEvent) """ - if evt.button() == Qt.LeftButton: + if evt.button() == Qt.MouseButton.LeftButton: self.selectAll() else: E5LineEdit.mouseDoubleClickEvent(self, evt) @@ -331,7 +333,7 @@ @param evt reference to the key press event (QKeyEvent) """ - if evt.key() == Qt.Key_Escape: + if evt.key() == Qt.Key.Key_Escape: if self.__browser is not None: self.setText( str(self.__browser.url().toEncoded(), encoding="utf-8")) @@ -343,16 +345,24 @@ currentText = self.text().strip() if ( - evt.key() in [Qt.Key_Enter, Qt.Key_Return] and + evt.key() in [Qt.Key.Key_Enter, Qt.Key.Key_Return] and not currentText.lower().startswith(("http://", "https://")) ): append = "" - if evt.modifiers() == Qt.KeyboardModifiers(Qt.ControlModifier): + if evt.modifiers() == Qt.KeyboardModifiers( + Qt.KeyboardModifier.ControlModifier + ): append = ".com" + elif ( + evt.modifiers() == Qt.KeyboardModifiers( + Qt.KeyboardModifier.ControlModifier | + Qt.KeyboardModifier.ShiftModifier + ) + ): + append = ".org" elif evt.modifiers() == Qt.KeyboardModifiers( - Qt.ControlModifier | Qt.ShiftModifier): - append = ".org" - elif evt.modifiers() == Qt.KeyboardModifiers(Qt.ShiftModifier): + Qt.KeyboardModifier.ShiftModifier + ): append = ".net" if append != "": @@ -390,7 +400,7 @@ url = mimeData.urls()[0] elif mimeData.hasText(): url = QUrl.fromEncoded(mimeData.text().encode("utf-8"), - QUrl.TolerantMode) + QUrl.ParsingMode.TolerantMode) if url.isEmpty() or not url.isValid(): E5LineEdit.dropEvent(self, evt) @@ -443,11 +453,12 @@ sslCertificate = self.__browser.page().getSslCertificate() if sslCertificate is not None: org = Utilities.decodeString(", ".join( - sslCertificate.subjectInfo(QSslCertificate.Organization))) + sslCertificate.subjectInfo( + QSslCertificate.SubjectInfo.Organization))) if org == "": cn = Utilities.decodeString(", ".join( sslCertificate.subjectInfo( - QSslCertificate.CommonName))) + QSslCertificate.SubjectInfo.CommonName))) if cn != "": org = cn.split(".", 1)[1] if org == "":
--- a/eric6/WebBrowser/UserAgent/UserAgentManager.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/UserAgent/UserAgentManager.py Tue Mar 02 17:17:09 2021 +0100 @@ -80,7 +80,7 @@ from .UserAgentReader import UserAgentReader reader = UserAgentReader() self.__agents = reader.read(agentFile) - if reader.error() != QXmlStreamReader.NoError: + if reader.error() != QXmlStreamReader.Error.NoError: E5MessageBox.warning( None, self.tr("Loading user agent data"),
--- a/eric6/WebBrowser/UserAgent/UserAgentMenu.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/UserAgent/UserAgentMenu.py Tue Mar 02 17:17:09 2021 +0100 @@ -101,7 +101,7 @@ self, self.tr("Custom user agent"), self.tr("User agent:"), - QLineEdit.Normal, + QLineEdit.EchoMode.Normal, WebBrowserPage.userAgent(resolveEmpty=True)) if ok: if self.__url: @@ -130,7 +130,7 @@ """ defaultUserAgents = QFile(os.path.join( os.path.dirname(__file__), "UserAgentDefaults.xml")) - defaultUserAgents.open(QIODevice.ReadOnly) + defaultUserAgents.open(QIODevice.OpenModeFlag.ReadOnly) menuStack = [] isChecked = False
--- a/eric6/WebBrowser/UserAgent/UserAgentModel.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/UserAgent/UserAgentModel.py Tue Mar 02 17:17:09 2021 +0100 @@ -107,7 +107,7 @@ if userAgent is None: return None - if role == Qt.DisplayRole: + if role == Qt.ItemDataRole.DisplayRole: if index.column() == 0: return host elif index.column() == 1: @@ -115,16 +115,20 @@ return None - def headerData(self, section, orientation, role=Qt.DisplayRole): + def headerData(self, section, orientation, + role=Qt.ItemDataRole.DisplayRole): """ Public method to get the header data. @param section section number (integer) @param orientation header orientation (Qt.Orientation) - @param role data role (integer) + @param role data role (Qt.ItemDataRole) @return header data """ - if orientation == Qt.Horizontal and role == Qt.DisplayRole: + if ( + orientation == Qt.Orientation.Horizontal and + role == Qt.ItemDataRole.DisplayRole + ): try: return self.__headers[section] except IndexError:
--- a/eric6/WebBrowser/VirusTotal/VirusTotalApi.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/VirusTotal/VirusTotalApi.py Tue Mar 02 17:17:09 2021 +0100 @@ -114,7 +114,7 @@ else: urlStr = self.GetFileReportPattern.format(protocol) request = QNetworkRequest(QUrl(urlStr)) - request.setHeader(QNetworkRequest.ContentTypeHeader, + request.setHeader(QNetworkRequest.KnownHeaders.ContentTypeHeader, "application/x-www-form-urlencoded") params = QByteArray("apikey={0}&resource={1}".format( key, self.TestServiceKeyScanID).encode("utf-8")) @@ -138,7 +138,7 @@ res = False msg = "" - if reply.error() == QNetworkReply.NoError: + if reply.error() == QNetworkReply.NetworkError.NoError: res = True elif reply.error() == self.ServiceCode_InvalidKey: res = False @@ -156,7 +156,7 @@ @param url url to be scanned (QUrl) """ request = QNetworkRequest(QUrl(self.ScanUrlUrl)) - request.setHeader(QNetworkRequest.ContentTypeHeader, + request.setHeader(QNetworkRequest.KnownHeaders.ContentTypeHeader, "application/x-www-form-urlencoded") params = QByteArray("apikey={0}&url=".format( Preferences.getWebBrowser("VirusTotalServiceKey")) @@ -177,7 +177,7 @@ @param reply reference to the network reply @type QNetworkReply """ - if reply.error() == QNetworkReply.NoError: + if reply.error() == QNetworkReply.NetworkError.NoError: result = json.loads(str(reply.readAll(), "utf-8")) if result["response_code"] == self.ServiceResult_ItemPresent: self.urlScanReport.emit(result["permalink"]) @@ -203,7 +203,7 @@ @param scanId ID of the scan to get the report URL for (string) """ request = QNetworkRequest(QUrl(self.GetUrlReportUrl)) - request.setHeader(QNetworkRequest.ContentTypeHeader, + request.setHeader(QNetworkRequest.KnownHeaders.ContentTypeHeader, "application/x-www-form-urlencoded") params = QByteArray("apikey={0}&resource={1}".format( Preferences.getWebBrowser("VirusTotalServiceKey"), scanId) @@ -225,7 +225,7 @@ @type QNetworkReply request. """ - if reply.error() == QNetworkReply.NoError: + if reply.error() == QNetworkReply.NetworkError.NoError: result = json.loads(str(reply.readAll(), "utf-8")) if "filescan_id" in result and result["filescan_id"] is not None: self.__getFileScanReportUrl(result["filescan_id"]) @@ -239,7 +239,7 @@ @param scanId ID of the scan to get the report URL for (string) """ request = QNetworkRequest(QUrl(self.GetFileReportUrl)) - request.setHeader(QNetworkRequest.ContentTypeHeader, + request.setHeader(QNetworkRequest.KnownHeaders.ContentTypeHeader, "application/x-www-form-urlencoded") params = QByteArray("apikey={0}&resource={1}".format( Preferences.getWebBrowser("VirusTotalServiceKey"), scanId) @@ -261,7 +261,7 @@ @param reply reference to the network reply @type QNetworkReply """ - if reply.error() == QNetworkReply.NoError: + if reply.error() == QNetworkReply.NetworkError.NoError: result = json.loads(str(reply.readAll(), "utf-8")) self.fileScanReport.emit(result["permalink"]) self.__replies.remove(reply) @@ -301,7 +301,7 @@ @param reply reference to the network reply @type QNetworkReply """ - if reply.error() == QNetworkReply.NoError: + if reply.error() == QNetworkReply.NetworkError.NoError: result = json.loads(str(reply.readAll(), "utf-8")) if result["response_code"] == 0: E5MessageBox.information( @@ -363,7 +363,7 @@ @param reply reference to the network reply @type QNetworkReply """ - if reply.error() == QNetworkReply.NoError: + if reply.error() == QNetworkReply.NetworkError.NoError: result = json.loads(str(reply.readAll(), "utf-8")) if result["response_code"] == 0: E5MessageBox.information(
--- a/eric6/WebBrowser/VirusTotal/VirusTotalDomainReportDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/VirusTotal/VirusTotalDomainReportDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -45,7 +45,7 @@ """ super(VirusTotalDomainReportDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) self.headerLabel.setText( self.tr("<b>Report for domain {0}</b>").format(domain)) @@ -60,7 +60,7 @@ ) self.resolutionsList.resizeColumnToContents(0) self.resolutionsList.resizeColumnToContents(1) - self.resolutionsList.sortByColumn(0, Qt.AscendingOrder) + self.resolutionsList.sortByColumn(0, Qt.SortOrder.AscendingOrder) if not urls: self.detectedUrlsGroup.setVisible(False) @@ -75,7 +75,7 @@ self.urlsList.resizeColumnToContents(0) self.urlsList.resizeColumnToContents(1) self.urlsList.resizeColumnToContents(2) - self.urlsList.sortByColumn(0, Qt.AscendingOrder) + self.urlsList.sortByColumn(0, Qt.SortOrder.AscendingOrder) if not subdomains: self.subdomainsGroup.setVisible(False)
--- a/eric6/WebBrowser/VirusTotal/VirusTotalIpReportDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/VirusTotal/VirusTotalIpReportDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -36,7 +36,7 @@ """ super(VirusTotalIpReportDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) self.headerLabel.setText( self.tr("<b>Report for IP {0}</b>").format(ip)) @@ -52,7 +52,7 @@ ) self.resolutionsList.resizeColumnToContents(0) self.resolutionsList.resizeColumnToContents(1) - self.resolutionsList.sortByColumn(0, Qt.AscendingOrder) + self.resolutionsList.sortByColumn(0, Qt.SortOrder.AscendingOrder) if not urls: self.detectedUrlsGroup.setVisible(False) @@ -67,4 +67,4 @@ self.urlsList.resizeColumnToContents(0) self.urlsList.resizeColumnToContents(1) self.urlsList.resizeColumnToContents(2) - self.urlsList.sortByColumn(0, Qt.AscendingOrder) + self.urlsList.sortByColumn(0, Qt.SortOrder.AscendingOrder)
--- a/eric6/WebBrowser/WebBrowserJavaScriptConsole.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/WebBrowserJavaScriptConsole.py Tue Mar 02 17:17:09 2021 +0100 @@ -25,7 +25,7 @@ """ super(WebBrowserJavaScriptConsole, self).__init__(parent) self.setAcceptRichText(False) - self.setLineWrapMode(QTextEdit.NoWrap) + self.setLineWrapMode(QTextEdit.LineWrapMode.NoWrap) self.setReadOnly(True) # create the context menu @@ -35,13 +35,16 @@ self.__menu.addSeparator() self.__menu.addAction(self.tr('Select All'), self.selectAll) - self.setContextMenuPolicy(Qt.CustomContextMenu) + self.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu) self.customContextMenuRequested.connect(self.__handleShowContextMenu) self.__levelStrings = { - QWebEnginePage.InfoMessageLevel: self.tr("Info"), - QWebEnginePage.WarningMessageLevel: self.tr("Warning"), - QWebEnginePage.ErrorMessageLevel: self.tr("Error"), + QWebEnginePage.JavaScriptConsoleMessageLevel.InfoMessageLevel: + self.tr("Info"), + QWebEnginePage.JavaScriptConsoleMessageLevel.WarningMessageLevel: + self.tr("Warning"), + QWebEnginePage.JavaScriptConsoleMessageLevel.ErrorMessageLevel: + self.tr("Error"), } def __handleShowContextMenu(self, coord): @@ -60,7 +63,7 @@ @param txt text to insert (string) """ tc = self.textCursor() - tc.movePosition(QTextCursor.End) + tc.movePosition(QTextCursor.MoveOperation.End) self.setTextCursor(tc) self.insertPlainText(txt) self.ensureCursorVisible() @@ -71,12 +74,12 @@ @param evt key press event (QKeyEvent) """ - if evt.modifiers() == Qt.ControlModifier: - if evt.key() == Qt.Key_C: + if evt.modifiers() == Qt.KeyboardModifier.ControlModifier: + if evt.key() == Qt.Key.Key_C: self.copy() evt.accept() return - elif evt.key() == Qt.Key_A: + elif evt.key() == Qt.Key.Key_A: self.selectAll() evt.accept() return
--- a/eric6/WebBrowser/WebBrowserLanguagesDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/WebBrowserLanguagesDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -38,7 +38,8 @@ self.__model.setStringList(languages) allLanguages = [] - for index in range(QLocale.C + 1, QLocale.LastLanguage + 1): + for index in range(QLocale.Language.C + 1, + QLocale.Language.LastLanguage + 1): allLanguages += self.expand(QLocale.Language(index)) self.__allLanguagesModel = QStringListModel() self.__allLanguagesModel.setStringList(allLanguages) @@ -168,7 +169,7 @@ """ allLanguages = [] countries = [loc.country() for loc in QLocale.matchingLocales( - language, QLocale.AnyScript, QLocale.AnyCountry)] + language, QLocale.Script.AnyScript, QLocale.Country.AnyCountry)] languageString = ( "{0} [{1}]" ).format(
--- a/eric6/WebBrowser/WebBrowserPage.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/WebBrowserPage.py Tue Mar 02 17:17:09 2021 +0100 @@ -57,8 +57,8 @@ @signal sslConfigurationChanged() emitted to indicate a change of the stored SSL configuration data """ - SafeJsWorld = QWebEngineScript.ApplicationWorld - UnsafeJsWorld = QWebEngineScript.MainWorld + SafeJsWorld = QWebEngineScript.ScriptWorldId.ApplicationWorld + UnsafeJsWorld = QWebEngineScript.ScriptWorldId.MainWorld safeBrowsingAbort = pyqtSignal() safeBrowsingBad = pyqtSignal(str, str) @@ -146,11 +146,14 @@ try: # PyQtWebEngine >= 5.14.0 navigationType = type_ in [ - QWebEnginePage.NavigationTypeLinkClicked, - QWebEnginePage.NavigationTypeRedirect + QWebEnginePage.NavigationType.NavigationTypeLinkClicked, + QWebEnginePage.NavigationType.NavigationTypeRedirect ] except AttributeError: - navigationType = type_ == QWebEnginePage.NavigationTypeLinkClicked + navigationType = ( + type_ == + QWebEnginePage.NavigationType.NavigationTypeLinkClicked + ) if navigationType and url.toString().endswith(".user.js"): WebBrowserWindow.greaseMonkeyManager().downloadScript(url) return False @@ -211,13 +214,13 @@ isWeb = url.scheme() in ("http", "https", "ftp", "ftps", "file") globalJsEnabled = WebBrowserWindow.webSettings().testAttribute( - QWebEngineSettings.JavascriptEnabled) + QWebEngineSettings.WebAttribute.JavascriptEnabled) if isWeb: enable = globalJsEnabled else: enable = True self.settings().setAttribute( - QWebEngineSettings.JavascriptEnabled, enable) + QWebEngineSettings.WebAttribute.JavascriptEnabled, enable) self.__channelUrl = url self.__setupChannelTimer.start() @@ -238,9 +241,9 @@ url.scheme() == "eric" and not self.isJavaScriptEnabled() ): - self.settings().setAttribute(QWebEngineSettings.JavascriptEnabled, - True) - self.triggerAction(QWebEnginePage.Reload) + self.settings().setAttribute( + QWebEngineSettings.WebAttribute.JavascriptEnabled, True) + self.triggerAction(QWebEnginePage.WebAction.Reload) @classmethod def userAgent(cls, resolveEmpty=False): @@ -294,7 +297,8 @@ manager = WebBrowserWindow.featurePermissionManager() manager.requestFeaturePermission(self, url, feature) - def execJavaScript(self, script, worldId=QWebEngineScript.MainWorld, + def execJavaScript(self, script, + worldId=QWebEngineScript.ScriptWorldId.MainWorld, timeout=500): """ Public method to execute a JavaScript function synchroneously. @@ -302,7 +306,7 @@ @param script JavaScript script source to be executed @type str @param worldId ID to run the script under - @type int + @type QWebEngineScript.ScriptWorldId @param timeout max. time the script is given to execute @type int @return result of the script @@ -353,7 +357,7 @@ @rtype bool """ return self.settings().testAttribute( - QWebEngineSettings.JavascriptEnabled) + QWebEngineSettings.WebAttribute.JavascriptEnabled) def scroll(self, x, y): """
--- a/eric6/WebBrowser/WebBrowserSnap.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/WebBrowserSnap.py Tue Mar 02 17:17:09 2021 +0100 @@ -22,7 +22,10 @@ """ pageImage = __render(view, view.width(), view.height()) return pageImage.scaled( - w, h, Qt.IgnoreAspectRatio, Qt.SmoothTransformation) + w, h, + Qt.AspectRatioMode.IgnoreAspectRatio, + Qt.TransformationMode.SmoothTransformation + ) def __render(view, w, h): @@ -36,7 +39,7 @@ """ # create the page image pageImage = QPixmap(w, h) - pageImage.fill(Qt.transparent) + pageImage.fill(Qt.GlobalColor.transparent) # render it p = QPainter(pageImage)
--- a/eric6/WebBrowser/WebBrowserTabBar.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/WebBrowserTabBar.py Tue Mar 02 17:17:09 2021 +0100 @@ -57,8 +57,8 @@ h = int(w * currentBrowser.height() / currentBrowser.width()) self.__previewPopup = E5PassivePopup(self) - self.__previewPopup.setFrameShape(QFrame.StyledPanel) - self.__previewPopup.setFrameShadow(QFrame.Plain) + self.__previewPopup.setFrameShape(QFrame.Shape.StyledPanel) + self.__previewPopup.setFrameShadow(QFrame.Shadow.Plain) self.__previewPopup.setFixedSize(w, h) self.__previewPopup.setCustomData("index", index) @@ -66,7 +66,8 @@ label.setPixmap(preview.scaled(w, h)) self.__previewPopup.setView(label) - self.__previewPopup.layout().setAlignment(Qt.AlignTop) + self.__previewPopup.layout().setAlignment( + Qt.AlignmentFlag.AlignTop) self.__previewPopup.layout().setContentsMargins(0, 0, 0, 0) tr = self.tabRect(index) @@ -106,7 +107,7 @@ if ( tabIndex != -1 and tabIndex != self.currentIndex() and - evt.buttons() == Qt.NoButton + evt.buttons() == Qt.MouseButton.NoButton ): if ( self.__previewPopup is None or @@ -157,7 +158,7 @@ @return flag indicating, if the event was handled (boolean) """ if ( - evt.type() == QEvent.ToolTip and + evt.type() == QEvent.Type.ToolTip and Preferences.getWebBrowser("ShowPreview") ): # suppress tool tips if we are showing previews
--- a/eric6/WebBrowser/WebBrowserTabWidget.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/WebBrowserTabWidget.py Tue Mar 02 17:17:09 2021 +0100 @@ -91,7 +91,7 @@ self.setUsesScrollButtons(True) self.setDocumentMode(True) - self.setElideMode(Qt.ElideNone) + self.setElideMode(Qt.TextElideMode.ElideNone) from .ClosedTabsManager import ClosedTabsManager self.__closedTabsManager = ClosedTabsManager(self) @@ -104,7 +104,7 @@ self.__tabContextMenuIndex = -1 self.currentChanged[int].connect(self.__currentChanged) - self.setTabContextMenuPolicy(Qt.CustomContextMenu) + self.setTabContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu) self.customTabContextMenuRequested.connect(self.__showContextMenu) self.__rightCornerWidget = QWidget(self) @@ -121,7 +121,8 @@ UI.PixmapCache.getIcon("1downarrow")) self.__navigationButton.setToolTip( self.tr("Show a navigation menu")) - self.__navigationButton.setPopupMode(QToolButton.InstantPopup) + self.__navigationButton.setPopupMode( + QToolButton.ToolButtonPopupMode.InstantPopup) self.__navigationButton.setMenu(self.__navigationMenu) self.__navigationButton.setEnabled(False) self.__rightCornerWidgetLayout.addWidget(self.__navigationButton) @@ -134,7 +135,8 @@ self.__closedTabsButton.setIcon(UI.PixmapCache.getIcon("trash")) self.__closedTabsButton.setToolTip( self.tr("Show a navigation menu for closed tabs")) - self.__closedTabsButton.setPopupMode(QToolButton.InstantPopup) + self.__closedTabsButton.setPopupMode( + QToolButton.ToolButtonPopupMode.InstantPopup) self.__closedTabsButton.setMenu(self.__closedTabsMenu) self.__closedTabsButton.setEnabled(False) self.__rightCornerWidgetLayout.addWidget(self.__closedTabsButton) @@ -142,13 +144,14 @@ self.setTabsClosable(True) self.tabCloseRequested.connect(self.closeBrowserAt) - self.setCornerWidget(self.__rightCornerWidget, Qt.TopRightCorner) + self.setCornerWidget( + self.__rightCornerWidget, Qt.Corner.TopRightCorner) self.__newTabButton = QToolButton(self) self.__newTabButton.setIcon(UI.PixmapCache.getIcon("plus")) self.__newTabButton.setToolTip( self.tr("Open a new web browser tab")) - self.setCornerWidget(self.__newTabButton, Qt.TopLeftCorner) + self.setCornerWidget(self.__newTabButton, Qt.Corner.TopLeftCorner) self.__newTabButton.clicked.connect(self.__newBrowser) self.__initTabContextMenu() @@ -350,7 +353,7 @@ if page.isAudioMuted() or ( not page.isAudioMuted() and recentlyAudible): pix = QPixmap(32, 32) - pix.fill(Qt.transparent) + pix.fill(Qt.GlobalColor.transparent) painter = QPainter(pix) icon.paint(painter, 0, 0, 22, 22) if page.isAudioMuted(): @@ -476,7 +479,10 @@ if linkName: browser.setSource(QUrl(linkName)) if not browser.documentTitle(): - self.setTabText(index, self.__elide(linkName, Qt.ElideMiddle)) + self.setTabText( + index, + self.__elide(linkName, Qt.TextElideMode.ElideMiddle) + ) self.setTabToolTip(index, linkName) else: self.setTabText( @@ -644,21 +650,21 @@ if browser is None: browser = self.currentBrowser() - printer = QPrinter(mode=QPrinter.HighResolution) + printer = QPrinter(mode=QPrinter.PrinterMode.HighResolution) if Preferences.getPrinter("ColorMode"): - printer.setColorMode(QPrinter.Color) + printer.setColorMode(QPrinter.ColorMode.Color) else: - printer.setColorMode(QPrinter.GrayScale) + printer.setColorMode(QPrinter.ColorMode.GrayScale) if Preferences.getPrinter("FirstPageFirst"): - printer.setPageOrder(QPrinter.FirstPageFirst) + printer.setPageOrder(QPrinter.PageOrder.FirstPageFirst) else: - printer.setPageOrder(QPrinter.LastPageFirst) + printer.setPageOrder(QPrinter.PageOrder.LastPageFirst) printer.setPageMargins( Preferences.getPrinter("LeftMargin") * 10, Preferences.getPrinter("TopMargin") * 10, Preferences.getPrinter("RightMargin") * 10, Preferences.getPrinter("BottomMargin") * 10, - QPrinter.Millimeter + QPrinter.Unit.Millimeter ) printerName = Preferences.getPrinter("PrinterName") if printerName: @@ -668,13 +674,17 @@ printer.setDocName(documentName) printDialog = QPrintDialog(printer, self) - printDialog.setOptions(QAbstractPrintDialog.PrintToFile | - QAbstractPrintDialog.PrintShowPageSize) + printDialog.setOptions( + QAbstractPrintDialog.PrintDialogOption.PrintToFile | + QAbstractPrintDialog.PrintDialogOption.PrintShowPageSize + ) if not Globals.isWindowsPlatform(): if isCupsAvailable(): - printDialog.setOption(QAbstractPrintDialog.PrintCollateCopies) - printDialog.setOption(QAbstractPrintDialog.PrintPageRange) - if printDialog.exec() == QDialog.Accepted: + printDialog.setOption( + QAbstractPrintDialog.PrintDialogOption.PrintCollateCopies) + printDialog.setOption( + QAbstractPrintDialog.PrintDialogOption.PrintPageRange) + if printDialog.exec() == QDialog.DialogCode.Accepted: browser.page().execPrintPage(printer, 10 * 1000) @pyqtSlot() @@ -696,7 +706,7 @@ if not name: name = "printout.pdf" dlg = PrintToPdfDialog(name, self) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: filePath, pageLayout = dlg.getData() if filePath: if os.path.exists(filePath): @@ -716,21 +726,21 @@ lambda pdf: self.__pdfGeneratedForSave(filePath, pdf), pageLayout) elif Globals.isLinuxPlatform(): - printer = QPrinter(mode=QPrinter.HighResolution) + printer = QPrinter(mode=QPrinter.PrinterMode.HighResolution) if Preferences.getPrinter("ColorMode"): - printer.setColorMode(QPrinter.Color) + printer.setColorMode(QPrinter.ColorMode.Color) else: - printer.setColorMode(QPrinter.GrayScale) + printer.setColorMode(QPrinter.ColorMode.GrayScale) printerName = Preferences.getPrinter("PrinterName") if printerName: printer.setPrinterName(printerName) - printer.setOutputFormat(QPrinter.PdfFormat) + printer.setOutputFormat(QPrinter.OutputFormat.PdfFormat) if name: printer.setOutputFileName(name) printer.setResolution(Preferences.getPrinter("Resolution")) printDialog = QPrintDialog(printer, self) - if printDialog.exec() == QDialog.Accepted: + if printDialog.exec() == QDialog.DialogCode.Accepted: browser.render(printer) def __pdfGeneratedForSave(self, filePath, pdfData): @@ -749,7 +759,7 @@ if pdfFile.open(QFile.WriteOnly): pdfFile.write(pdfData) pdfFile.close() - if pdfFile.error() != QFileDevice.NoError: + if pdfFile.error() != QFileDevice.FileError.NoError: E5MessageBox.critical( self, self.tr("Print to PDF"), @@ -771,21 +781,21 @@ if browser is None: browser = self.currentBrowser() - printer = QPrinter(mode=QPrinter.HighResolution) + printer = QPrinter(mode=QPrinter.PrinterMode.HighResolution) if Preferences.getPrinter("ColorMode"): - printer.setColorMode(QPrinter.Color) + printer.setColorMode(QPrinter.ColorMode.Color) else: - printer.setColorMode(QPrinter.GrayScale) + printer.setColorMode(QPrinter.ColorMode.GrayScale) if Preferences.getPrinter("FirstPageFirst"): - printer.setPageOrder(QPrinter.FirstPageFirst) + printer.setPageOrder(QPrinter.PageOrder.FirstPageFirst) else: - printer.setPageOrder(QPrinter.LastPageFirst) + printer.setPageOrder(QPrinter.PageOrder.LastPageFirst) printer.setPageMargins( Preferences.getPrinter("LeftMargin") * 10, Preferences.getPrinter("TopMargin") * 10, Preferences.getPrinter("RightMargin") * 10, Preferences.getPrinter("BottomMargin") * 10, - QPrinter.Millimeter + QPrinter.Unit.Millimeter ) printerName = Preferences.getPrinter("PrinterName") if printerName: @@ -842,7 +852,7 @@ self.titleChanged.emit(browser, title) - def __elide(self, txt, mode=Qt.ElideRight, length=40): + def __elide(self, txt, mode=Qt.TextElideMode.ElideRight, length=40): """ Private method to elide some text. @@ -851,13 +861,13 @@ @param length amount of characters to be used (integer) @return the elided text (string) """ - if mode == Qt.ElideNone or len(txt) < length: + if mode == Qt.TextElideMode.ElideNone or len(txt) < length: return txt - elif mode == Qt.ElideLeft: + elif mode == Qt.TextElideMode.ElideLeft: return "...{0}".format(txt[-length:]) - elif mode == Qt.ElideMiddle: + elif mode == Qt.TextElideMode.ElideMiddle: return "{0}...{1}".format(txt[:length // 2], txt[-(length // 2):]) - elif mode == Qt.ElideRight: + elif mode == Qt.TextElideMode.ElideRight: return "{0}...".format(txt[:length]) else: # just in case @@ -1023,7 +1033,7 @@ @type UrlBar """ url = self.__guessUrlFromPath(edit.text()) - if e5App().keyboardModifiers() == Qt.AltModifier: + if e5App().keyboardModifiers() == Qt.KeyboardModifier.AltModifier: self.newBrowser(url) else: self.currentBrowser().setSource(url) @@ -1072,7 +1082,8 @@ return url urlString = Preferences.getWebBrowser("DefaultScheme") + path.strip() - url = QUrl.fromEncoded(urlString.encode("utf-8"), QUrl.TolerantMode) + url = QUrl.fromEncoded(urlString.encode("utf-8"), + QUrl.ParsingMode.TolerantMode) return url @@ -1143,7 +1154,8 @@ self.__closedTabsMenu.clear() index = 0 for tab in self.__closedTabsManager.allClosedTabs(): - title = fm.elidedText(tab.title, Qt.ElideRight, maxWidth) + title = fm.elidedText(tab.title, Qt.TextElideMode.ElideRight, + maxWidth) act = self.__closedTabsMenu.addAction( self.__mainWindow.icon(tab.url), title) act.setData(index)
--- a/eric6/WebBrowser/WebBrowserView.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/WebBrowserView.py Tue Mar 02 17:17:09 2021 +0100 @@ -137,7 +137,7 @@ if self.parentWidget() is not None: self.parentWidget().installEventFilter(self) - self.grabGesture(Qt.PinchGesture) + self.grabGesture(Qt.GestureType.PinchGesture) def __createNewPage(self): """ @@ -176,10 +176,10 @@ """ Private slot to set widget that receives input events. """ - self.grabGesture(Qt.PinchGesture) + self.grabGesture(Qt.GestureType.PinchGesture) self.__rwhvqt = self.focusProxy() if self.__rwhvqt: - self.__rwhvqt.grabGesture(Qt.PinchGesture) + self.__rwhvqt.grabGesture(Qt.GestureType.PinchGesture) self.__rwhvqt.installEventFilter(self) else: print("Focus proxy is null!") # __IGNORE_WARNING_M801__ @@ -220,7 +220,7 @@ if ( self.__page is not None and not self.__page.acceptNavigationRequest( - url, QWebEnginePage.NavigationTypeTyped, True) + url, QWebEnginePage.NavigationType.NavigationTypeTyped, True) ): return @@ -330,14 +330,14 @@ """ Public slot to move backwards in history. """ - self.triggerPageAction(QWebEnginePage.Back) + self.triggerPageAction(QWebEnginePage.WebAction.Back) self.__urlChanged(self.history().currentItem().url()) def forward(self): """ Public slot to move forward in history. """ - self.triggerPageAction(QWebEnginePage.Forward) + self.triggerPageAction(QWebEnginePage.WebAction.Forward) self.__urlChanged(self.history().currentItem().url()) def home(self): @@ -352,56 +352,56 @@ """ Public slot to reload the current page. """ - self.triggerPageAction(QWebEnginePage.Reload) + self.triggerPageAction(QWebEnginePage.WebAction.Reload) def reloadBypassingCache(self): """ Public slot to reload the current page bypassing the cache. """ - self.triggerPageAction(QWebEnginePage.ReloadAndBypassCache) + self.triggerPageAction(QWebEnginePage.WebAction.ReloadAndBypassCache) def copy(self): """ Public slot to copy the selected text. """ - self.triggerPageAction(QWebEnginePage.Copy) + self.triggerPageAction(QWebEnginePage.WebAction.Copy) def cut(self): """ Public slot to cut the selected text. """ - self.triggerPageAction(QWebEnginePage.Cut) + self.triggerPageAction(QWebEnginePage.WebAction.Cut) def paste(self): """ Public slot to paste text from the clipboard. """ - self.triggerPageAction(QWebEnginePage.Paste) + self.triggerPageAction(QWebEnginePage.WebAction.Paste) def undo(self): """ Public slot to undo the last edit action. """ - self.triggerPageAction(QWebEnginePage.Undo) + self.triggerPageAction(QWebEnginePage.WebAction.Undo) def redo(self): """ Public slot to redo the last edit action. """ - self.triggerPageAction(QWebEnginePage.Redo) + self.triggerPageAction(QWebEnginePage.WebAction.Redo) def selectAll(self): """ Public slot to select all text. """ - self.triggerPageAction(QWebEnginePage.SelectAll) + self.triggerPageAction(QWebEnginePage.WebAction.SelectAll) def unselect(self): """ Public slot to clear the current selection. """ try: - self.triggerPageAction(QWebEnginePage.Unselect) + self.triggerPageAction(QWebEnginePage.WebAction.Unselect) except AttributeError: # prior to 5.7.0 self.page().runJavaScript( @@ -519,9 +519,9 @@ """ findFlags = QWebEnginePage.FindFlags() if case: - findFlags |= QWebEnginePage.FindCaseSensitively + findFlags |= QWebEnginePage.FindFlag.FindCaseSensitively if backwards: - findFlags |= QWebEnginePage.FindBackward + findFlags |= QWebEnginePage.FindFlag.FindBackward if callback is None: self.findText(txt, findFlags) @@ -1176,19 +1176,19 @@ """ Private slot to download a link and save it to disk. """ - self.triggerPageAction(QWebEnginePage.DownloadLinkToDisk) + self.triggerPageAction(QWebEnginePage.WebAction.DownloadLinkToDisk) def __downloadImage(self): """ Private slot to download an image and save it to disk. """ - self.triggerPageAction(QWebEnginePage.DownloadImageToDisk) + self.triggerPageAction(QWebEnginePage.WebAction.DownloadImageToDisk) def __copyImage(self): """ Private slot to copy an image to the clipboard. """ - self.triggerPageAction(QWebEnginePage.CopyImageToClipboard) + self.triggerPageAction(QWebEnginePage.WebAction.CopyImageToClipboard) def __blockImage(self, act): """ @@ -1215,19 +1215,19 @@ """ Private slot to download a media and save it to disk. """ - self.triggerPageAction(QWebEnginePage.DownloadMediaToDisk) + self.triggerPageAction(QWebEnginePage.WebAction.DownloadMediaToDisk) def __pauseMedia(self): """ Private slot to pause or play the selected media. """ - self.triggerPageAction(QWebEnginePage.ToggleMediaPlayPause) + self.triggerPageAction(QWebEnginePage.WebAction.ToggleMediaPlayPause) def __muteMedia(self): """ Private slot to (un)mute the selected media. """ - self.triggerPageAction(QWebEnginePage.ToggleMediaMute) + self.triggerPageAction(QWebEnginePage.WebAction.ToggleMediaMute) def __virusTotal(self, act): """ @@ -1374,7 +1374,7 @@ if ( not evt.isAccepted() and evt.source() != self and - evt.possibleActions() & Qt.CopyAction + evt.possibleActions() & Qt.DropAction.CopyAction ): url = QUrl() if len(evt.mimeData().urls()) > 0: @@ -1398,11 +1398,11 @@ self.__mw.setEventMouseButtons(evt.buttons()) self.__mw.setEventKeyboardModifiers(evt.modifiers()) - if evt.button() == Qt.XButton1: - self.pageAction(QWebEnginePage.Back).trigger() + if evt.button() == Qt.MouseButton.XButton1: + self.pageAction(QWebEnginePage.WebAction.Back).trigger() evt.accept() - elif evt.button() == Qt.XButton2: - self.pageAction(QWebEnginePage.Forward).trigger() + elif evt.button() == Qt.MouseButton.XButton2: + self.pageAction(QWebEnginePage.WebAction.Forward).trigger() evt.accept() def _mouseReleaseEvent(self, evt): @@ -1419,16 +1419,18 @@ self.__page.event(evt) if ( not evt.isAccepted() and - self.__mw.eventMouseButtons() & Qt.MidButton + self.__mw.eventMouseButtons() & Qt.MouseButton.MidButton ): - url = QUrl(QApplication.clipboard().text(QClipboard.Selection)) + url = QUrl(QApplication.clipboard().text( + QClipboard.Mode.Selection)) if ( not url.isEmpty() and url.isValid() and url.scheme() != "" ): - self.__mw.setEventMouseButtons(Qt.NoButton) - self.__mw.setEventKeyboardModifiers(Qt.NoModifier) + self.__mw.setEventMouseButtons(Qt.MouseButton.NoButton) + self.__mw.setEventKeyboardModifiers( + Qt.KeyboardModifier.NoModifier) self.setSource(url) evt.setAccepted(accepted) @@ -1459,14 +1461,14 @@ return delta = evt.angleDelta().y() - if evt.modifiers() & Qt.ControlModifier: + if evt.modifiers() & Qt.KeyboardModifier.ControlModifier: if delta < 0: self.zoomOut() elif delta > 0: self.zoomIn() evt.accept() - elif evt.modifiers() & Qt.ShiftModifier: + elif evt.modifiers() & Qt.KeyboardModifier.ShiftModifier: if delta < 0: self.backward() elif delta > 0: @@ -1483,34 +1485,34 @@ evt.accept() return - if evt.key() == Qt.Key_ZoomIn: + if evt.key() == Qt.Key.Key_ZoomIn: self.zoomIn() evt.accept() - elif evt.key() == Qt.Key_ZoomOut: + elif evt.key() == Qt.Key.Key_ZoomOut: self.zoomOut() evt.accept() - elif evt.key() == Qt.Key_Plus: - if evt.modifiers() & Qt.ControlModifier: + elif evt.key() == Qt.Key.Key_Plus: + if evt.modifiers() & Qt.KeyboardModifier.ControlModifier: self.zoomIn() evt.accept() - elif evt.key() == Qt.Key_Minus: - if evt.modifiers() & Qt.ControlModifier: + elif evt.key() == Qt.Key.Key_Minus: + if evt.modifiers() & Qt.KeyboardModifier.ControlModifier: self.zoomOut() evt.accept() - elif evt.key() == Qt.Key_0: - if evt.modifiers() & Qt.ControlModifier: + elif evt.key() == Qt.Key.Key_0: + if evt.modifiers() & Qt.KeyboardModifier.ControlModifier: self.zoomReset() evt.accept() - elif evt.key() == Qt.Key_M: - if evt.modifiers() & Qt.ControlModifier: + elif evt.key() == Qt.Key.Key_M: + if evt.modifiers() & Qt.KeyboardModifier.ControlModifier: self.__muteMedia() evt.accept() - elif evt.key() == Qt.Key_Backspace: + elif evt.key() == Qt.Key.Key_Backspace: pos = QCursor.pos() pos = self.mapFromGlobal(pos) hitTest = self.page().hitTestContent(pos) if not hitTest.isContentEditable(): - self.pageAction(QWebEnginePage.Back).trigger() + self.pageAction(QWebEnginePage.WebAction.Back).trigger() evt.accept() def _keyReleaseEvent(self, evt): @@ -1519,9 +1521,9 @@ @param evt reference to the key event (QKeyEvent) """ - if evt.key() == Qt.Key_Escape: + if evt.key() == Qt.Key.Key_Escape: if self.isFullScreen(): - self.triggerPageAction(QWebEnginePage.ExitFullScreen) + self.triggerPageAction(QWebEnginePage.WebAction.ExitFullScreen) evt.accept() self.requestFullScreen(False) @@ -1531,11 +1533,11 @@ @param evt reference to the gesture event (QGestureEvent """ - pinch = evt.gesture(Qt.PinchGesture) + pinch = evt.gesture(Qt.GestureType.PinchGesture) if pinch: - if pinch.state() == Qt.GestureStarted: + if pinch.state() == Qt.GestureState.GestureStarted: pinch.setTotalScaleFactor(self.__currentZoom / 100.0) - elif pinch.state() == Qt.GestureUpdated: + elif pinch.state() == Qt.GestureState.GestureUpdated: scaleFactor = pinch.totalScaleFactor() self.setZoomValue(int(scaleFactor * 100)) evt.accept() @@ -1553,37 +1555,41 @@ """ if ( obj is self and - evt.type() == QEvent.ParentChange and + evt.type() == QEvent.Type.ParentChange and self.parentWidget() is not None ): self.parentWidget().installEventFilter(self) # find the render widget receiving events for the web page - if obj is self and evt.type() == QEvent.ChildAdded: + if obj is self and evt.type() == QEvent.Type.ChildAdded: QTimer.singleShot(0, self.__setRwhvqt) # forward events to WebBrowserView if ( obj is self.__rwhvqt and - evt.type() in [QEvent.KeyPress, QEvent.KeyRelease, - QEvent.MouseButtonPress, QEvent.MouseButtonRelease, - QEvent.MouseMove, QEvent.Wheel, QEvent.Gesture] + evt.type() in [QEvent.Type.KeyPress, + QEvent.Type.KeyRelease, + QEvent.Type.MouseButtonPress, + QEvent.Type.MouseButtonRelease, + QEvent.Type.MouseMove, + QEvent.Type.Wheel, + QEvent.Type.Gesture] ): wasAccepted = evt.isAccepted() evt.setAccepted(False) - if evt.type() == QEvent.KeyPress: + if evt.type() == QEvent.Type.KeyPress: self._keyPressEvent(evt) - elif evt.type() == QEvent.KeyRelease: + elif evt.type() == QEvent.Type.KeyRelease: self._keyReleaseEvent(evt) - elif evt.type() == QEvent.MouseButtonPress: + elif evt.type() == QEvent.Type.MouseButtonPress: self._mousePressEvent(evt) - elif evt.type() == QEvent.MouseButtonRelease: + elif evt.type() == QEvent.Type.MouseButtonRelease: self._mouseReleaseEvent(evt) - elif evt.type() == QEvent.MouseMove: + elif evt.type() == QEvent.Type.MouseMove: self._mouseMoveEvent(evt) - elif evt.type() == QEvent.Wheel: + elif evt.type() == QEvent.Type.Wheel: self._wheelEvent(evt) - elif evt.type() == QEvent.Gesture: + elif evt.type() == QEvent.Type.Gesture: self._gestureEvent(evt) ret = evt.isAccepted() evt.setAccepted(wasAccepted) @@ -1591,13 +1597,13 @@ if ( obj is self.parentWidget() and - evt.type() in [QEvent.KeyPress, QEvent.KeyRelease] + evt.type() in [QEvent.Type.KeyPress, QEvent.Type.KeyRelease] ): wasAccepted = evt.isAccepted() evt.setAccepted(False) - if evt.type() == QEvent.KeyPress: + if evt.type() == QEvent.Type.KeyPress: self._keyPressEvent(evt) - elif evt.type() == QEvent.KeyRelease: + elif evt.type() == QEvent.Type.KeyRelease: self._keyReleaseEvent(evt) ret = evt.isAccepted() evt.setAccepted(wasAccepted) @@ -1605,15 +1611,19 @@ # block already handled events if obj is self: - if evt.type() in [QEvent.KeyPress, QEvent.KeyRelease, - QEvent.MouseButtonPress, - QEvent.MouseButtonRelease, - QEvent.MouseMove, QEvent.Wheel, QEvent.Gesture]: + if evt.type() in [QEvent.Type.KeyPress, + QEvent.Type.KeyRelease, + QEvent.Type.MouseButtonPress, + QEvent.Type.MouseButtonRelease, + QEvent.Type.MouseMove, + QEvent.Type.Wheel, + QEvent.Type.Gesture]: return True - elif evt.type() == QEvent.Hide: + elif evt.type() == QEvent.Type.Hide: if self.isFullScreen(): - self.triggerPageAction(QWebEnginePage.ExitFullScreen) + self.triggerPageAction( + QWebEnginePage.WebAction.ExitFullScreen) return super(WebBrowserView, self).eventFilter(obj, evt) @@ -1624,7 +1634,7 @@ @param evt reference to the event (QEvent) @return flag indicating, if the event was handled (boolean) """ - if evt.type() == QEvent.Gesture: + if evt.type() == QEvent.Type.Gesture: self._gestureEvent(evt) return True @@ -1725,7 +1735,8 @@ titleStr = url.host() if not titleStr: - titleStr = url.toString(QUrl.RemoveFragment) + titleStr = url.toString( + QUrl.UrlFormattingOption.RemoveFragment) if not titleStr or titleStr == "about:blank": titleStr = self.tr("Empty Page") @@ -1753,7 +1764,11 @@ @param exitCode exit code of the process @type int """ - if status == QWebEnginePage.NormalTerminationStatus: + if ( + status == + QWebEnginePage.RenderProcessTerminationStatus + .NormalTerminationStatus + ): return QTimer.singleShot(0, lambda: self.__showTabCrashPage(status)) @@ -1770,19 +1785,29 @@ html = getHtmlPage("tabCrashPage.html") html = html.replace("@IMAGE@", pixmapToDataUrl( - e5App().style().standardIcon(QStyle.SP_MessageBoxWarning).pixmap( - 48, 48)).toString()) + e5App().style().standardIcon( + QStyle.StandardPixmap.SP_MessageBoxWarning).pixmap(48, 48) + ).toString()) html = html.replace("@FAVICON@", pixmapToDataUrl( - e5App().style() .standardIcon(QStyle.SP_MessageBoxWarning).pixmap( - 16, 16)).toString()) + e5App().style() .standardIcon( + QStyle.StandardPixmap.SP_MessageBoxWarning).pixmap(16, 16) + ).toString()) html = html.replace( "@TITLE@", self.tr("Render Process terminated abnormally")) html = html.replace( "@H1@", self.tr("Render Process terminated abnormally")) - if status == QWebEnginePage.CrashedTerminationStatus: + if ( + status == + QWebEnginePage.RenderProcessTerminationStatus + .CrashedTerminationStatus + ): msg = self.tr("The render process crashed while" " loading this page.") - elif status == QWebEnginePage.KilledTerminationStatus: + elif ( + status == + QWebEnginePage.RenderProcessTerminationStatus + .KilledTerminationStatus + ): msg = self.tr("The render process was killed.") else: msg = self.tr("The render process terminated while" @@ -1909,7 +1934,7 @@ @rtype tuple of (str, QWebEngineDownloadItem.SavePageFormat) """ documentLocation = QStandardPaths.writableLocation( - QStandardPaths.DocumentsLocation) + QStandardPaths.StandardLocation.DocumentsLocation) filterList = [ self.tr("Web Archive (*.mhtml *.mht)"), self.tr("HTML File (*.html *.htm)"), @@ -1934,7 +1959,7 @@ defaultFileName += ".mhtml" fileName = "" - saveFormat = QWebEngineDownloadItem.MimeHtmlSaveFormat + saveFormat = QWebEngineDownloadItem.SavePageFormat.MimeHtmlSaveFormat fileName, selectedFilter = E5FileDialog.getSaveFileNameAndFilter( None, @@ -1945,11 +1970,18 @@ if fileName: index = filterList.index(selectedFilter) if index == 0: - saveFormat = QWebEngineDownloadItem.MimeHtmlSaveFormat + saveFormat = ( + QWebEngineDownloadItem.SavePageFormat.MimeHtmlSaveFormat + ) elif index == 1: - saveFormat = QWebEngineDownloadItem.SingleHtmlSaveFormat + saveFormat = ( + QWebEngineDownloadItem.SavePageFormat.SingleHtmlSaveFormat + ) else: - saveFormat = QWebEngineDownloadItem.CompleteHtmlSaveFormat + saveFormat = ( + QWebEngineDownloadItem.SavePageFormat + .CompleteHtmlSaveFormat + ) extension = os.path.splitext(fileName)[1] if not extension: @@ -1975,10 +2007,10 @@ (QWebEnginePage.WebWindowType) @return reference to the created browser window (WebBrowserView) """ - if windowType in [QWebEnginePage.WebBrowserTab, - QWebEnginePage.WebDialog]: + if windowType in [QWebEnginePage.WebWindowType.WebBrowserTab, + QWebEnginePage.WebWindowType.WebDialog]: return self.__mw.newTab(addNextTo=self) - elif windowType == QWebEnginePage.WebBrowserWindow: + elif windowType == QWebEnginePage.WebWindowType.WebBrowserWindow: return self.__mw.newWindow().currentBrowser() else: return self.__mw.newTab(addNextTo=self, background=True) @@ -2147,10 +2179,10 @@ # 3. page history historyArray = QByteArray() - stream = QDataStream(historyArray, QIODevice.WriteOnly) + stream = QDataStream(historyArray, QIODevice.OpenModeFlag.WriteOnly) stream << page.history() sessionData["History"] = str( - historyArray.toBase64(QByteArray.Base64UrlEncoding), + historyArray.toBase64(QByteArray.Base64Option.Base64UrlEncoding), encoding="ascii") sessionData["HistoryIndex"] = page.history().currentItemIndex() @@ -2160,7 +2192,7 @@ # 5. web icon iconArray = QByteArray() - stream = QDataStream(iconArray, QIODevice.WriteOnly) + stream = QDataStream(iconArray, QIODevice.OpenModeFlag.WriteOnly) stream << page.icon() sessionData["Icon"] = str(iconArray.toBase64(), encoding="ascii") @@ -2182,8 +2214,8 @@ if "History" in sessionData: historyArray = QByteArray.fromBase64( sessionData["History"].encode("ascii"), - QByteArray.Base64UrlEncoding) - stream = QDataStream(historyArray, QIODevice.ReadOnly) + QByteArray.Base64Option.Base64UrlEncoding) + stream = QDataStream(historyArray, QIODevice.OpenModeFlag.ReadOnly) stream >> page.history() if "HistoryIndex" in sessionData: @@ -2224,7 +2256,7 @@ if "Icon" in sessionData: iconArray = QByteArray.fromBase64( sessionData["Icon"].encode("ascii")) - stream = QDataStream(iconArray, QIODevice.ReadOnly) + stream = QDataStream(iconArray, QIODevice.OpenModeFlag.ReadOnly) icon = QIcon() stream >> icon else: @@ -2323,7 +2355,7 @@ E5SslCertificateSelectionDialog ) dlg = E5SslCertificateSelectionDialog(certificates, self) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: certificate = dlg.getSelectedCertificate() if certificate is None:
--- a/eric6/WebBrowser/WebBrowserWebSearchWidget.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/WebBrowserWebSearchWidget.py Tue Mar 02 17:17:09 2021 +0100 @@ -69,7 +69,7 @@ self.__completer = QCompleter() self.__completer.setModel(self.__model) self.__completer.setCompletionMode( - QCompleter.UnfilteredPopupCompletion) + QCompleter.CompletionMode.UnfilteredPopupCompletion) self.__completer.setWidget(self) self.__searchButton.clicked.connect(self.__searchButtonClicked) @@ -406,11 +406,11 @@ @param evt reference to the mouse event (QMouseEvent) """ - if evt.button() == Qt.XButton1: + if evt.button() == Qt.MouseButton.XButton1: self.__mw.currentBrowser().triggerPageAction( - QWebEnginePage.Back) - elif evt.button() == Qt.XButton2: + QWebEnginePage.WebAction.Back) + elif evt.button() == Qt.MouseButton.XButton2: self.__mw.currentBrowser().triggerPageAction( - QWebEnginePage.Forward) + QWebEnginePage.WebAction.Forward) else: super(WebBrowserWebSearchWidget, self).mousePressEvent(evt)
--- a/eric6/WebBrowser/WebBrowserWindow.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/WebBrowserWindow.py Tue Mar 02 17:17:09 2021 +0100 @@ -157,8 +157,8 @@ self.__shortcutsDialog = None - self.__eventMouseButtons = Qt.NoButton - self.__eventKeyboardModifiers = Qt.NoModifier + self.__eventMouseButtons = Qt.MouseButton.NoButton + self.__eventKeyboardModifiers = Qt.KeyboardModifier.NoModifier WebBrowserWindow.setUseQtHelp(qthelp or bool(searchWord)) @@ -166,7 +166,7 @@ self.networkManager() self.__htmlFullScreen = False - self.__windowStates = Qt.WindowNoState + self.__windowStates = Qt.WindowState.WindowNoState self.__isClosing = False from .SearchWidget import SearchWidget @@ -244,7 +244,7 @@ layout.addWidget(self.__tabWidget) layout.addWidget(self.__searchWidget) self.__tabWidget.setSizePolicy( - QSizePolicy.Preferred, QSizePolicy.Expanding) + QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Expanding) centralWidget.setLayout(layout) self.setCentralWidget(centralWidget) self.__searchWidget.hide() @@ -255,14 +255,16 @@ self.__tocDock = QDockWidget(self.tr("Contents"), self) self.__tocDock.setObjectName("TocWindow") self.__tocDock.setWidget(self.__tocWindow) - self.addDockWidget(Qt.LeftDockWidgetArea, self.__tocDock) + self.addDockWidget(Qt.DockWidgetArea.LeftDockWidgetArea, + self.__tocDock) # setup the index widget self.__indexWindow = HelpIndexWidget(self.__helpEngine) self.__indexDock = QDockWidget(self.tr("Index"), self) self.__indexDock.setObjectName("IndexWindow") self.__indexDock.setWidget(self.__indexWindow) - self.addDockWidget(Qt.LeftDockWidgetArea, self.__indexDock) + self.addDockWidget(Qt.DockWidgetArea.LeftDockWidgetArea, + self.__indexDock) # setup the search widget self.__searchWord = searchWord @@ -277,7 +279,8 @@ self.__searchDock = QDockWidget(self.tr("Search"), self) self.__searchDock.setObjectName("SearchWindow") self.__searchDock.setWidget(self.__searchWindow) - self.addDockWidget(Qt.LeftDockWidgetArea, self.__searchDock) + self.addDockWidget(Qt.DockWidgetArea.LeftDockWidgetArea, + self.__searchDock) # JavaScript Console window from .WebBrowserJavaScriptConsole import WebBrowserJavaScriptConsole @@ -286,9 +289,10 @@ self.tr("JavaScript Console")) self.__javascriptConsoleDock.setObjectName("JavascriptConsole") self.__javascriptConsoleDock.setAllowedAreas( - Qt.BottomDockWidgetArea | Qt.TopDockWidgetArea) + Qt.DockWidgetArea.BottomDockWidgetArea | + Qt.DockWidgetArea.TopDockWidgetArea) self.__javascriptConsoleDock.setWidget(self.__javascriptConsole) - self.addDockWidget(Qt.BottomDockWidgetArea, + self.addDockWidget(Qt.DockWidgetArea.BottomDockWidgetArea, self.__javascriptConsoleDock) if Preferences.getWebBrowser("SaveGeometry"): @@ -514,137 +518,138 @@ settings = self.webSettings() settings.setFontFamily( - QWebEngineSettings.StandardFont, + QWebEngineSettings.FontFamily.StandardFont, Preferences.getWebBrowser("StandardFontFamily")) settings.setFontFamily( - QWebEngineSettings.FixedFont, + QWebEngineSettings.FontFamily.FixedFont, Preferences.getWebBrowser("FixedFontFamily")) settings.setFontFamily( - QWebEngineSettings.SerifFont, + QWebEngineSettings.FontFamily.SerifFont, Preferences.getWebBrowser("SerifFontFamily")) settings.setFontFamily( - QWebEngineSettings.SansSerifFont, + QWebEngineSettings.FontFamily.SansSerifFont, Preferences.getWebBrowser("SansSerifFontFamily")) settings.setFontFamily( - QWebEngineSettings.CursiveFont, + QWebEngineSettings.FontFamily.CursiveFont, Preferences.getWebBrowser("CursiveFontFamily")) settings.setFontFamily( - QWebEngineSettings.FantasyFont, + QWebEngineSettings.FontFamily.FantasyFont, Preferences.getWebBrowser("FantasyFontFamily")) settings.setFontSize( - QWebEngineSettings.DefaultFontSize, + QWebEngineSettings.FontSize.DefaultFontSize, Preferences.getWebBrowser("DefaultFontSize")) settings.setFontSize( - QWebEngineSettings.DefaultFixedFontSize, + QWebEngineSettings.FontSize.DefaultFixedFontSize, Preferences.getWebBrowser("DefaultFixedFontSize")) settings.setFontSize( - QWebEngineSettings.MinimumFontSize, + QWebEngineSettings.FontSize.MinimumFontSize, Preferences.getWebBrowser("MinimumFontSize")) settings.setFontSize( - QWebEngineSettings.MinimumLogicalFontSize, + QWebEngineSettings.FontSize.MinimumLogicalFontSize, Preferences.getWebBrowser("MinimumLogicalFontSize")) styleSheet = Preferences.getWebBrowser("UserStyleSheet") self.__setUserStyleSheet(styleSheet) settings.setAttribute( - QWebEngineSettings.AutoLoadImages, + QWebEngineSettings.WebAttribute.AutoLoadImages, Preferences.getWebBrowser("AutoLoadImages")) settings.setAttribute( - QWebEngineSettings.JavascriptEnabled, + QWebEngineSettings.WebAttribute.JavascriptEnabled, Preferences.getWebBrowser("JavaScriptEnabled")) # JavaScript is needed for the web browser functionality settings.setAttribute( - QWebEngineSettings.JavascriptCanOpenWindows, + QWebEngineSettings.WebAttribute.JavascriptCanOpenWindows, Preferences.getWebBrowser("JavaScriptCanOpenWindows")) settings.setAttribute( - QWebEngineSettings.JavascriptCanAccessClipboard, + QWebEngineSettings.WebAttribute.JavascriptCanAccessClipboard, Preferences.getWebBrowser("JavaScriptCanAccessClipboard")) settings.setAttribute( - QWebEngineSettings.PluginsEnabled, + QWebEngineSettings.WebAttribute.PluginsEnabled, Preferences.getWebBrowser("PluginsEnabled")) if self.isPrivate(): settings.setAttribute( - QWebEngineSettings.LocalStorageEnabled, False) + QWebEngineSettings.WebAttribute.LocalStorageEnabled, False) else: settings.setAttribute( - QWebEngineSettings.LocalStorageEnabled, + QWebEngineSettings.WebAttribute.LocalStorageEnabled, Preferences.getWebBrowser("LocalStorageEnabled")) settings.setDefaultTextEncoding( Preferences.getWebBrowser("DefaultTextEncoding")) settings.setAttribute( - QWebEngineSettings.SpatialNavigationEnabled, + QWebEngineSettings.WebAttribute.SpatialNavigationEnabled, Preferences.getWebBrowser("SpatialNavigationEnabled")) settings.setAttribute( - QWebEngineSettings.LinksIncludedInFocusChain, + QWebEngineSettings.WebAttribute.LinksIncludedInFocusChain, Preferences.getWebBrowser("LinksIncludedInFocusChain")) settings.setAttribute( - QWebEngineSettings.LocalContentCanAccessRemoteUrls, + QWebEngineSettings.WebAttribute.LocalContentCanAccessRemoteUrls, Preferences.getWebBrowser("LocalContentCanAccessRemoteUrls")) settings.setAttribute( - QWebEngineSettings.LocalContentCanAccessFileUrls, + QWebEngineSettings.WebAttribute.LocalContentCanAccessFileUrls, Preferences.getWebBrowser("LocalContentCanAccessFileUrls")) settings.setAttribute( - QWebEngineSettings.XSSAuditingEnabled, + QWebEngineSettings.WebAttribute.XSSAuditingEnabled, Preferences.getWebBrowser("XSSAuditingEnabled")) settings.setAttribute( - QWebEngineSettings.ScrollAnimatorEnabled, + QWebEngineSettings.WebAttribute.ScrollAnimatorEnabled, Preferences.getWebBrowser("ScrollAnimatorEnabled")) settings.setAttribute( - QWebEngineSettings.ErrorPageEnabled, + QWebEngineSettings.WebAttribute.ErrorPageEnabled, Preferences.getWebBrowser("ErrorPageEnabled")) settings.setAttribute( - QWebEngineSettings.FullScreenSupportEnabled, + QWebEngineSettings.WebAttribute.FullScreenSupportEnabled, Preferences.getWebBrowser("FullScreenSupportEnabled")) settings.setAttribute( - QWebEngineSettings.ScreenCaptureEnabled, + QWebEngineSettings.WebAttribute.ScreenCaptureEnabled, Preferences.getWebBrowser("ScreenCaptureEnabled")) settings.setAttribute( - QWebEngineSettings.WebGLEnabled, + QWebEngineSettings.WebAttribute.WebGLEnabled, Preferences.getWebBrowser("WebGLEnabled")) settings.setAttribute( - QWebEngineSettings.FocusOnNavigationEnabled, + QWebEngineSettings.WebAttribute.FocusOnNavigationEnabled, Preferences.getWebBrowser("FocusOnNavigationEnabled")) settings.setAttribute( - QWebEngineSettings.PrintElementBackgrounds, + QWebEngineSettings.WebAttribute.PrintElementBackgrounds, Preferences.getWebBrowser("PrintElementBackgrounds")) settings.setAttribute( - QWebEngineSettings.AllowRunningInsecureContent, + QWebEngineSettings.WebAttribute.AllowRunningInsecureContent, Preferences.getWebBrowser("AllowRunningInsecureContent")) settings.setAttribute( - QWebEngineSettings.AllowGeolocationOnInsecureOrigins, + QWebEngineSettings.WebAttribute.AllowGeolocationOnInsecureOrigins, Preferences.getWebBrowser("AllowGeolocationOnInsecureOrigins")) settings.setAttribute( - QWebEngineSettings.AllowWindowActivationFromJavaScript, + QWebEngineSettings.WebAttribute + .AllowWindowActivationFromJavaScript, Preferences.getWebBrowser( "AllowWindowActivationFromJavaScript")) settings.setAttribute( - QWebEngineSettings.ShowScrollBars, + QWebEngineSettings.WebAttribute.ShowScrollBars, Preferences.getWebBrowser("ShowScrollBars")) settings.setAttribute( - QWebEngineSettings.PlaybackRequiresUserGesture, + QWebEngineSettings.WebAttribute.PlaybackRequiresUserGesture, Preferences.getWebBrowser( "PlaybackRequiresUserGesture")) settings.setAttribute( - QWebEngineSettings.JavascriptCanPaste, + QWebEngineSettings.WebAttribute.JavascriptCanPaste, Preferences.getWebBrowser( "JavaScriptCanPaste")) settings.setAttribute( - QWebEngineSettings.WebRTCPublicInterfacesOnly, + QWebEngineSettings.WebAttribute.WebRTCPublicInterfacesOnly, Preferences.getWebBrowser( "WebRTCPublicInterfacesOnly")) settings.setAttribute( - QWebEngineSettings.DnsPrefetchEnabled, + QWebEngineSettings.WebAttribute.DnsPrefetchEnabled, Preferences.getWebBrowser( "DnsPrefetchEnabled")) try: # Qt 5.13 settings.setAttribute( - QWebEngineSettings.PdfViewerEnabled, + QWebEngineSettings.WebAttribute.PdfViewerEnabled, Preferences.getWebBrowser( "PdfViewerEnabled")) except (AttributeError, KeyError): @@ -2339,7 +2344,7 @@ vttb = self.addToolBar(self.tr("VirusTotal")) vttb.setObjectName("VirusTotalToolBar") vttb.setIconSize(UI.Config.ToolBarIconSize) - vttb.setToolButtonStyle(Qt.ToolButtonTextBesideIcon) + vttb.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon) vttb.addAction(self.virustotalScanCurrentAct) vttb.addAction(self.virustotalIpReportAct) vttb.addAction(self.virustotalDomainReportAct) @@ -2984,7 +2989,7 @@ """ if self.__htmlFullScreen: self.currentBrowser().triggerPageAction( - QWebEnginePage.ExitFullScreen) + QWebEnginePage.WebAction.ExitFullScreen) return if self.isFullScreen(): @@ -3170,7 +3175,7 @@ dlg.showConfigurationPageByName("empty") dlg.exec() QApplication.processEvents() - if dlg.result() == QDialog.Accepted: + if dlg.result() == QDialog.DialogCode.Accepted: dlg.setPreferences() Preferences.syncPreferences() self.preferencesChanged() @@ -3198,11 +3203,13 @@ profile = self.webProfile() if not self.isPrivate(): if Preferences.getWebBrowser("DiskCacheEnabled"): - profile.setHttpCacheType(QWebEngineProfile.DiskHttpCache) + profile.setHttpCacheType( + QWebEngineProfile.HttpCacheType.DiskHttpCache) profile.setHttpCacheMaximumSize( Preferences.getWebBrowser("DiskCacheSize") * 1024 * 1024) else: - profile.setHttpCacheType(QWebEngineProfile.MemoryHttpCache) + profile.setHttpCacheType( + QWebEngineProfile.HttpCacheType.MemoryHttpCache) profile.setHttpCacheMaximumSize(0) try: @@ -3480,8 +3487,8 @@ self.__indexingProgress = QWidget() layout = QHBoxLayout(self.__indexingProgress) layout.setContentsMargins(0, 0, 0, 0) - sizePolicy = QSizePolicy(QSizePolicy.Preferred, - QSizePolicy.Maximum) + sizePolicy = QSizePolicy(QSizePolicy.Policy.Preferred, + QSizePolicy.Policy.Maximum) label = QLabel(self.tr("Updating search index")) label.setSizePolicy(sizePolicy) @@ -3519,7 +3526,7 @@ ): self.__searchDock.show() self.__searchDock.raise_() - query = QHelpSearchQuery(QHelpSearchQuery.DEFAULT, + query = QHelpSearchQuery(QHelpSearchQuery.FieldName.DEFAULT, [self.__searchWord]) self.__searchEngine.search([query]) self.__searchWord = None @@ -3623,7 +3630,7 @@ WebBrowserClearPrivateDataDialog ) dlg = WebBrowserClearPrivateDataDialog(self) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: # browsing history, search history, favicons, disk cache, cookies, # passwords, web databases, downloads, zoom values, SSL error # exceptions, history period @@ -4342,10 +4349,12 @@ @param evt reference to the mouse event (QMouseEvent) """ - if evt.button() == Qt.XButton1: - self.currentBrowser().triggerPageAction(QWebEnginePage.Back) - elif evt.button() == Qt.XButton2: - self.currentBrowser().triggerPageAction(QWebEnginePage.Forward) + if evt.button() == Qt.MouseButton.XButton1: + self.currentBrowser().triggerPageAction( + QWebEnginePage.WebAction.Back) + elif evt.button() == Qt.MouseButton.XButton2: + self.currentBrowser().triggerPageAction( + QWebEnginePage.WebAction.Forward) else: super(WebBrowserWindow, self).mousePressEvent(evt) @@ -4461,35 +4470,39 @@ number = -1 key = evt.key() - if key == Qt.Key_1: + if key == Qt.Key.Key_1: number = 1 - elif key == Qt.Key_2: + elif key == Qt.Key.Key_2: number = 2 - elif key == Qt.Key_3: + elif key == Qt.Key.Key_3: number = 3 - elif key == Qt.Key_4: + elif key == Qt.Key.Key_4: number = 4 - elif key == Qt.Key_5: + elif key == Qt.Key.Key_5: number = 5 - elif key == Qt.Key_6: + elif key == Qt.Key.Key_6: number = 6 - elif key == Qt.Key_7: + elif key == Qt.Key.Key_7: number = 7 - elif key == Qt.Key_8: + elif key == Qt.Key.Key_8: number = 8 - elif key == Qt.Key_9: + elif key == Qt.Key.Key_9: number = 9 - elif key == Qt.Key_0: + elif key == Qt.Key.Key_0: number = 10 if number != -1: - if evt.modifiers() == Qt.KeyboardModifiers(Qt.AltModifier): + if evt.modifiers() == Qt.KeyboardModifiers( + Qt.KeyboardModifier.AltModifier + ): if number == 10: number = self.__tabWidget.count() self.__tabWidget.setCurrentIndex(number - 1) return - if evt.modifiers() == Qt.KeyboardModifiers(Qt.MetaModifier): + if evt.modifiers() == Qt.KeyboardModifiers( + Qt.KeyboardModifier.MetaModifier + ): url = self.speedDial().urlForShortcut(number - 1) if url.isValid(): self.__linkActivated(url) @@ -4506,10 +4519,10 @@ @return flag indicating a handled event @rtype bool """ - if evt.type() == QEvent.WindowStateChange: + if evt.type() == QEvent.Type.WindowStateChange: if ( - not bool(evt.oldState() & Qt.WindowFullScreen) and - bool(self.windowState() & Qt.WindowFullScreen) + not bool(evt.oldState() & Qt.WindowState.WindowFullScreen) and + bool(self.windowState() & Qt.WindowState.WindowFullScreen) ): # enter full screen mode self.__windowStates = evt.oldState() @@ -4526,8 +4539,8 @@ self.__navigationContainer.hide() elif ( - bool(evt.oldState() & Qt.WindowFullScreen) and - not bool(self.windowState() & Qt.WindowFullScreen) + bool(evt.oldState() & Qt.WindowState.WindowFullScreen) and + not bool(self.windowState() & Qt.WindowState.WindowFullScreen) ): # leave full screen mode self.setWindowState(self.__windowStates) @@ -4605,7 +4618,7 @@ self, self.tr("IP Address Report"), self.tr("Enter a valid IPv4 address in dotted quad notation:"), - QLineEdit.Normal) + QLineEdit.EchoMode.Normal) if ok and ip: if ip.count(".") == 3: self.__virusTotal.getIpAddressReport(ip) @@ -4624,7 +4637,7 @@ self, self.tr("Domain Report"), self.tr("Enter a valid domain name:"), - QLineEdit.Normal) + QLineEdit.EchoMode.Normal) if ok and domain: self.__virusTotal.getDomainReport(domain) @@ -4662,7 +4675,8 @@ script = QWebEngineScript() script.setName(name) - script.setInjectionPoint(QWebEngineScript.DocumentCreation) + script.setInjectionPoint( + QWebEngineScript.InjectionPoint.DocumentCreation) script.setWorldId(WebBrowserPage.SafeJsWorld) script.setRunsOnSubFrames(True) script.setSourceCode(Scripts.setStyleSheet(userStyle)) @@ -4763,7 +4777,7 @@ if not private: if Preferences.getWebBrowser("DiskCacheEnabled"): cls._webProfile.setHttpCacheType( - QWebEngineProfile.DiskHttpCache) + QWebEngineProfile.HttpCacheType.DiskHttpCache) cls._webProfile.setHttpCacheMaximumSize( Preferences.getWebBrowser("DiskCacheSize") * 1024 * 1024) @@ -4771,13 +4785,14 @@ Utilities.getConfigDir(), "web_browser")) else: cls._webProfile.setHttpCacheType( - QWebEngineProfile.MemoryHttpCache) + QWebEngineProfile.HttpCacheType.MemoryHttpCache) cls._webProfile.setHttpCacheMaximumSize(0) cls._webProfile.setPersistentStoragePath(os.path.join( Utilities.getConfigDir(), "web_browser", "persistentstorage")) cls._webProfile.setPersistentCookiesPolicy( - QWebEngineProfile.AllowPersistentCookies) + QWebEngineProfile.PersistentCookiesPolicy + .AllowPersistentCookies) try: cls._webProfile.setSpellCheckEnabled( @@ -4794,7 +4809,8 @@ # WebChannel for SafeJsWorld script = QWebEngineScript() script.setName("_eric_webchannel") - script.setInjectionPoint(QWebEngineScript.DocumentCreation) + script.setInjectionPoint( + QWebEngineScript.InjectionPoint.DocumentCreation) script.setWorldId(WebBrowserPage.SafeJsWorld) script.setRunsOnSubFrames(True) script.setSourceCode(Scripts.setupWebChannel(script.worldId())) @@ -4803,7 +4819,8 @@ # WebChannel for UnsafeJsWorld script2 = QWebEngineScript() script2.setName("_eric_webchannel2") - script2.setInjectionPoint(QWebEngineScript.DocumentCreation) + script2.setInjectionPoint( + QWebEngineScript.InjectionPoint.DocumentCreation) script2.setWorldId(WebBrowserPage.UnsafeJsWorld) script2.setRunsOnSubFrames(True) script2.setSourceCode(Scripts.setupWebChannel(script2.worldId())) @@ -4812,7 +4829,8 @@ # document.window object addons script3 = QWebEngineScript() script3.setName("_eric_window_object") - script3.setInjectionPoint(QWebEngineScript.DocumentCreation) + script3.setInjectionPoint( + QWebEngineScript.InjectionPoint.DocumentCreation) script3.setWorldId(WebBrowserPage.UnsafeJsWorld) script3.setRunsOnSubFrames(True) script3.setSourceCode(Scripts.setupWindowObject())
--- a/eric6/WebBrowser/WebInspector.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/WebInspector.py Tue Mar 02 17:17:09 2021 +0100 @@ -102,7 +102,7 @@ """ from WebBrowser.WebBrowserWindow import WebBrowserWindow if not WebBrowserWindow.webSettings().testAttribute( - QWebEngineSettings.JavascriptEnabled): + QWebEngineSettings.WebAttribute.JavascriptEnabled): return False return True @@ -112,7 +112,8 @@ Private slot handling the finished signal. """ if self.__inspectElement: - self.__view.triggerPageAction(QWebEnginePage.InspectElement) + self.__view.triggerPageAction( + QWebEnginePage.WebAction.InspectElement) self.__inspectElement = False
--- a/eric6/WebBrowser/ZoomManager/ZoomValuesModel.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/WebBrowser/ZoomManager/ZoomValuesModel.py Tue Mar 02 17:17:09 2021 +0100 @@ -107,7 +107,7 @@ if siteInfo is None: return None - if role == Qt.DisplayRole: + if role == Qt.ItemDataRole.DisplayRole: if index.column() == 0: return site elif index.column() == 1: @@ -115,16 +115,20 @@ return None - def headerData(self, section, orientation, role=Qt.DisplayRole): + def headerData(self, section, orientation, + role=Qt.ItemDataRole.DisplayRole): """ Public method to get the header data. @param section section number (integer) @param orientation header orientation (Qt.Orientation) - @param role data role (integer) + @param role data role (Qt.ItemDataRole) @return header data """ - if orientation == Qt.Horizontal and role == Qt.DisplayRole: + if ( + orientation == Qt.Orientation.Horizontal and + role == Qt.ItemDataRole.DisplayRole + ): try: return self.__headers[section] except IndexError:
--- a/eric6/eric6.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/eric6.py Tue Mar 02 17:17:09 2021 +0100 @@ -78,8 +78,8 @@ settingsDir = os.path.expanduser(arg.replace("--settings=", "")) if not os.path.isdir(settingsDir): os.makedirs(settingsDir) - QSettings.setPath(QSettings.IniFormat, QSettings.UserScope, - settingsDir) + QSettings.setPath( + QSettings.Format.IniFormat, QSettings.Scope.UserScope, settingsDir) sys.argv.remove(arg) # make Third-Party package available as a packages repository @@ -385,7 +385,8 @@ # get the Qt translations directory qtTransDir = Preferences.getQtTranslationsDir() if not qtTransDir: - qtTransDir = QLibraryInfo.location(QLibraryInfo.TranslationsPath) + qtTransDir = QLibraryInfo.location( + QLibraryInfo.LibraryLocation.TranslationsPath) # Load translation files and install them loc = Startup.loadTranslators(qtTransDir, app, ("qscintilla",))
--- a/eric6/eric6_browser.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/eric6_browser.py Tue Mar 02 17:17:09 2021 +0100 @@ -40,8 +40,8 @@ SettingsDir = os.path.expanduser(arg.replace("--settings=", "")) if not os.path.isdir(SettingsDir): os.makedirs(SettingsDir) - QSettings.setPath(QSettings.IniFormat, QSettings.UserScope, - SettingsDir) + QSettings.setPath( + QSettings.Format.IniFormat, QSettings.Scope.UserScope, SettingsDir) sys.argv.remove(arg) # make ThirdParty package available as a packages repository @@ -165,13 +165,13 @@ scheme = QWebEngineUrlScheme(b"eric") scheme.setSyntax(QWebEngineUrlScheme.Syntax.Path) - scheme.setFlags(QWebEngineUrlScheme.SecureScheme | - QWebEngineUrlScheme.ContentSecurityPolicyIgnored) + scheme.setFlags(QWebEngineUrlScheme.Flag.SecureScheme | + QWebEngineUrlScheme.Flag.ContentSecurityPolicyIgnored) QWebEngineUrlScheme.registerScheme(scheme) if "--qthelp" in sys.argv: scheme = QWebEngineUrlScheme(b"qthelp") scheme.setSyntax(QWebEngineUrlScheme.Syntax.Path) - scheme.setFlags(QWebEngineUrlScheme.SecureScheme) + scheme.setFlags(QWebEngineUrlScheme.Flag.SecureScheme) QWebEngineUrlScheme.registerScheme(scheme) app = E5Application(sys.argv)
--- a/eric6/eric6_compare.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/eric6_compare.py Tue Mar 02 17:17:09 2021 +0100 @@ -28,8 +28,8 @@ settingsDir = os.path.expanduser(arg.replace("--settings=", "")) if not os.path.isdir(settingsDir): os.makedirs(settingsDir) - QSettings.setPath(QSettings.IniFormat, QSettings.UserScope, - settingsDir) + QSettings.setPath( + QSettings.Format.IniFormat, QSettings.Scope.UserScope, settingsDir) sys.argv.remove(arg) from Globals import AppInfo
--- a/eric6/eric6_configure.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/eric6_configure.py Tue Mar 02 17:17:09 2021 +0100 @@ -26,8 +26,8 @@ settingsDir = os.path.expanduser(arg.replace("--settings=", "")) if not os.path.isdir(settingsDir): os.makedirs(settingsDir) - QSettings.setPath(QSettings.IniFormat, QSettings.UserScope, - settingsDir) + QSettings.setPath( + QSettings.Format.IniFormat, QSettings.Scope.UserScope, settingsDir) sys.argv.remove(arg) # make ThirdParty package available as a packages repository
--- a/eric6/eric6_diff.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/eric6_diff.py Tue Mar 02 17:17:09 2021 +0100 @@ -28,8 +28,8 @@ settingsDir = os.path.expanduser(arg.replace("--settings=", "")) if not os.path.isdir(settingsDir): os.makedirs(settingsDir) - QSettings.setPath(QSettings.IniFormat, QSettings.UserScope, - settingsDir) + QSettings.setPath( + QSettings.Format.IniFormat, QSettings.Scope.UserScope, settingsDir) sys.argv.remove(arg) from Globals import AppInfo
--- a/eric6/eric6_editor.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/eric6_editor.py Tue Mar 02 17:17:09 2021 +0100 @@ -28,8 +28,8 @@ settingsDir = os.path.expanduser(arg.replace("--settings=", "")) if not os.path.isdir(settingsDir): os.makedirs(settingsDir) - QSettings.setPath(QSettings.IniFormat, QSettings.UserScope, - settingsDir) + QSettings.setPath( + QSettings.Format.IniFormat, QSettings.Scope.UserScope, settingsDir) sys.argv.remove(arg) # make ThirdParty package available as a packages repository
--- a/eric6/eric6_hexeditor.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/eric6_hexeditor.py Tue Mar 02 17:17:09 2021 +0100 @@ -28,8 +28,8 @@ settingsDir = os.path.expanduser(arg.replace("--settings=", "")) if not os.path.isdir(settingsDir): os.makedirs(settingsDir) - QSettings.setPath(QSettings.IniFormat, QSettings.UserScope, - settingsDir) + QSettings.setPath( + QSettings.Format.IniFormat, QSettings.Scope.UserScope, settingsDir) sys.argv.remove(arg) from Globals import AppInfo
--- a/eric6/eric6_iconeditor.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/eric6_iconeditor.py Tue Mar 02 17:17:09 2021 +0100 @@ -28,8 +28,8 @@ settingsDir = os.path.expanduser(arg.replace("--settings=", "")) if not os.path.isdir(settingsDir): os.makedirs(settingsDir) - QSettings.setPath(QSettings.IniFormat, QSettings.UserScope, - settingsDir) + QSettings.setPath( + QSettings.Format.IniFormat, QSettings.Scope.UserScope, settingsDir) sys.argv.remove(arg) from Globals import AppInfo
--- a/eric6/eric6_plugininstall.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/eric6_plugininstall.py Tue Mar 02 17:17:09 2021 +0100 @@ -27,8 +27,8 @@ settingsDir = os.path.expanduser(arg.replace("--settings=", "")) if not os.path.isdir(settingsDir): os.makedirs(settingsDir) - QSettings.setPath(QSettings.IniFormat, QSettings.UserScope, - settingsDir) + QSettings.setPath( + QSettings.Format.IniFormat, QSettings.Scope.UserScope, settingsDir) sys.argv.remove(arg) from Globals import AppInfo
--- a/eric6/eric6_pluginrepository.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/eric6_pluginrepository.py Tue Mar 02 17:17:09 2021 +0100 @@ -27,8 +27,8 @@ settingsDir = os.path.expanduser(arg.replace("--settings=", "")) if not os.path.isdir(settingsDir): os.makedirs(settingsDir) - QSettings.setPath(QSettings.IniFormat, QSettings.UserScope, - settingsDir) + QSettings.setPath( + QSettings.Format.IniFormat, QSettings.Scope.UserScope, settingsDir) sys.argv.remove(arg) from Globals import AppInfo
--- a/eric6/eric6_pluginuninstall.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/eric6_pluginuninstall.py Tue Mar 02 17:17:09 2021 +0100 @@ -27,8 +27,8 @@ settingsDir = os.path.expanduser(arg.replace("--settings=", "")) if not os.path.isdir(settingsDir): os.makedirs(settingsDir) - QSettings.setPath(QSettings.IniFormat, QSettings.UserScope, - settingsDir) + QSettings.setPath( + QSettings.Format.IniFormat, QSettings.Scope.UserScope, settingsDir) sys.argv.remove(arg) from Globals import AppInfo
--- a/eric6/eric6_qregularexpression.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/eric6_qregularexpression.py Tue Mar 02 17:17:09 2021 +0100 @@ -28,8 +28,8 @@ settingsDir = os.path.expanduser(arg.replace("--settings=", "")) if not os.path.isdir(settingsDir): os.makedirs(settingsDir) - QSettings.setPath(QSettings.IniFormat, QSettings.UserScope, - settingsDir) + QSettings.setPath( + QSettings.Format.IniFormat, QSettings.Scope.UserScope, settingsDir) sys.argv.remove(arg) from Globals import AppInfo
--- a/eric6/eric6_re.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/eric6_re.py Tue Mar 02 17:17:09 2021 +0100 @@ -28,8 +28,8 @@ settingsDir = os.path.expanduser(arg.replace("--settings=", "")) if not os.path.isdir(settingsDir): os.makedirs(settingsDir) - QSettings.setPath(QSettings.IniFormat, QSettings.UserScope, - settingsDir) + QSettings.setPath( + QSettings.Format.IniFormat, QSettings.Scope.UserScope, settingsDir) sys.argv.remove(arg) from Globals import AppInfo
--- a/eric6/eric6_shell.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/eric6_shell.py Tue Mar 02 17:17:09 2021 +0100 @@ -29,8 +29,8 @@ settingsDir = os.path.expanduser(arg.replace("--settings=", "")) if not os.path.isdir(settingsDir): os.makedirs(settingsDir) - QSettings.setPath(QSettings.IniFormat, QSettings.UserScope, - settingsDir) + QSettings.setPath( + QSettings.Format.IniFormat, QSettings.Scope.UserScope, settingsDir) sys.argv.remove(arg) from Globals import AppInfo
--- a/eric6/eric6_snap.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/eric6_snap.py Tue Mar 02 17:17:09 2021 +0100 @@ -27,8 +27,8 @@ settingsDir = os.path.expanduser(arg.replace("--settings=", "")) if not os.path.isdir(settingsDir): os.makedirs(settingsDir) - QSettings.setPath(QSettings.IniFormat, QSettings.UserScope, - settingsDir) + QSettings.setPath( + QSettings.Format.IniFormat, QSettings.Scope.UserScope, settingsDir) sys.argv.remove(arg) from Globals import AppInfo
--- a/eric6/eric6_sqlbrowser.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/eric6_sqlbrowser.py Tue Mar 02 17:17:09 2021 +0100 @@ -27,8 +27,8 @@ settingsDir = os.path.expanduser(arg.replace("--settings=", "")) if not os.path.isdir(settingsDir): os.makedirs(settingsDir) - QSettings.setPath(QSettings.IniFormat, QSettings.UserScope, - settingsDir) + QSettings.setPath( + QSettings.Format.IniFormat, QSettings.Scope.UserScope, settingsDir) sys.argv.remove(arg) from Globals import AppInfo
--- a/eric6/eric6_tray.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/eric6_tray.py Tue Mar 02 17:17:09 2021 +0100 @@ -30,8 +30,8 @@ SettingsDir = os.path.expanduser(arg.replace("--settings=", "")) if not os.path.isdir(SettingsDir): os.makedirs(SettingsDir) - QSettings.setPath(QSettings.IniFormat, QSettings.UserScope, - SettingsDir) + QSettings.setPath( + QSettings.Format.IniFormat, QSettings.Scope.UserScope, SettingsDir) sys.argv.remove(arg) from Globals import AppInfo
--- a/eric6/eric6_trpreviewer.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/eric6_trpreviewer.py Tue Mar 02 17:17:09 2021 +0100 @@ -28,8 +28,8 @@ settingsDir = os.path.expanduser(arg.replace("--settings=", "")) if not os.path.isdir(settingsDir): os.makedirs(settingsDir) - QSettings.setPath(QSettings.IniFormat, QSettings.UserScope, - settingsDir) + QSettings.setPath( + QSettings.Format.IniFormat, QSettings.Scope.UserScope, settingsDir) sys.argv.remove(arg) from E5Gui.E5Application import E5Application
--- a/eric6/eric6_uipreviewer.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/eric6_uipreviewer.py Tue Mar 02 17:17:09 2021 +0100 @@ -28,8 +28,8 @@ settingsDir = os.path.expanduser(arg.replace("--settings=", "")) if not os.path.isdir(settingsDir): os.makedirs(settingsDir) - QSettings.setPath(QSettings.IniFormat, QSettings.UserScope, - settingsDir) + QSettings.setPath( + QSettings.Format.IniFormat, QSettings.Scope.UserScope, settingsDir) sys.argv.remove(arg) from Globals import AppInfo
--- a/eric6/eric6_unittest.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/eric6_unittest.py Tue Mar 02 17:17:09 2021 +0100 @@ -28,8 +28,8 @@ settingsDir = os.path.expanduser(arg.replace("--settings=", "")) if not os.path.isdir(settingsDir): os.makedirs(settingsDir) - QSettings.setPath(QSettings.IniFormat, QSettings.UserScope, - settingsDir) + QSettings.setPath( + QSettings.Format.IniFormat, QSettings.Scope.UserScope, settingsDir) sys.argv.remove(arg) from Globals import AppInfo