diff -r 7d955b1995d5 -r eb28b4b6f7f5 ProjectPyramid/PyramidRoutesDialog.py --- a/ProjectPyramid/PyramidRoutesDialog.py Sat May 29 15:05:16 2021 +0200 +++ b/ProjectPyramid/PyramidRoutesDialog.py Tue Jun 01 19:37:46 2021 +0200 @@ -9,12 +9,12 @@ import os -from PyQt5.QtCore import QProcess, QTimer, pyqtSlot, Qt, QCoreApplication -from PyQt5.QtWidgets import ( +from PyQt6.QtCore import pyqtSlot, Qt, QProcess, QTimer, QCoreApplication +from PyQt6.QtWidgets import ( QDialog, QDialogButtonBox, QLineEdit, QTreeWidgetItem ) -from E5Gui import E5MessageBox +from EricWidgets import EricMessageBox from .Ui_PyramidRoutesDialog import Ui_PyramidRoutesDialog @@ -31,14 +31,17 @@ Constructor @param project reference to the project object - (ProjectPyramid.Project.Project) - @param parent reference to the parent widget (QWidget) + @type Project + @param parent reference to the parent widget + @type QWidget """ super().__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.__project = project self.proc = None @@ -54,7 +57,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) @@ -67,11 +70,15 @@ self.__processBuffer() - 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): """ @@ -79,19 +86,28 @@ @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): """ Private slot connected to the finished signal. - @param exitCode exit code of the process (integer) - @param exitStatus exit status of the process (QProcess.ExitStatus) + @param exitCode exit code of the process + @type int + @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 + ) self.finish() def __processBuffer(self): @@ -130,8 +146,10 @@ """ Public slot used to start the process. - @param projectPath path to the Pyramid project (string) + @param projectPath path to the Pyramid project + @type str @return flag indicating a successful start of the process + @rtype bool """ QTreeWidgetItem(self.routes, [self.tr("Getting routes...")]) self.routes.setHeaderHidden(True) @@ -140,11 +158,15 @@ self.normal = False self.intercept = 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.Cancel).setFocus( - Qt.OtherFocusReason) + 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.buttonBox.button( + QDialogButtonBox.StandardButton.Cancel).setFocus( + Qt.FocusReason.OtherFocusReason) self.proc = QProcess() @@ -163,7 +185,7 @@ if not procStarted: self.buttonBox.setFocus() self.inputGroup.setEnabled(False) - E5MessageBox.critical( + EricMessageBox.critical( self, self.tr('Process Generation Error'), self.tr( @@ -209,12 +231,13 @@ """ Private slot to handle the password checkbox toggled. - @param isOn flag indicating the status of the check box (boolean) + @param isOn flag indicating the status of the check box + @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): @@ -244,7 +267,8 @@ """ Protected slot to handle a key press event. - @param evt the key press event (QKeyEvent) + @param evt the key press event + @type QKeyEvent """ if self.intercept: self.intercept = False