Fix PyQt6 compatibility issues in usb_creator_gui.py

- Fix Qt.AlignCenter -> Qt.AlignmentFlag.AlignCenter (line 227)
- Fix QLineEdit.Password -> QLineEdit.EchoMode.Password (password fields)
- Fix QMessageBox constants to use StandardButton enum
- Fix app.exec_() -> app.exec() for PyQt6 compatibility
- Resolves AttributeError issues on Windows with PyQt6
parent 731abab5
......@@ -224,7 +224,7 @@ class USBCreatorApp(QMainWindow):
# Header
header = QLabel("MBetter Live USB Creator")
header.setAlignment(Qt.AlignCenter)
header.setAlignment(Qt.AlignmentFlag.AlignCenter)
header.setStyleSheet("font-size: 18px; font-weight: bold; margin: 10px;")
layout.addWidget(header)
......@@ -285,9 +285,9 @@ class USBCreatorApp(QMainWindow):
layout = QFormLayout(group)
self.password_input = QLineEdit()
self.password_input.setEchoMode(QLineEdit.Password)
self.password_input.setEchoMode(QLineEdit.EchoMode.Password)
self.password_confirm = QLineEdit()
self.password_confirm.setEchoMode(QLineEdit.Password)
self.password_confirm.setEchoMode(QLineEdit.EchoMode.Password)
layout.addRow("New Password:", self.password_input)
layout.addRow("Confirm Password:", self.password_confirm)
......@@ -535,9 +535,9 @@ class USBCreatorApp(QMainWindow):
msg += "\nContinue?"
reply = QMessageBox.question(self, "Confirm USB Creation", msg,
QMessageBox.Yes | QMessageBox.No)
QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No)
if reply == QMessageBox.Yes:
if reply == QMessageBox.StandardButton.Yes:
# Disable UI and start worker thread
self.create_button.setEnabled(False)
self.progress_bar.setValue(0)
......@@ -567,10 +567,10 @@ class USBCreatorApp(QMainWindow):
def cancel_operation(self):
if self.worker_thread and self.worker_thread.isRunning():
reply = QMessageBox.question(self, "Cancel Operation",
reply = QMessageBox.question(self, "Cancel Operation",
"Cancel the USB creation process?",
QMessageBox.Yes | QMessageBox.No)
if reply == QMessageBox.Yes:
QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No)
if reply == QMessageBox.StandardButton.Yes:
self.worker_thread.terminate()
self.create_button.setEnabled(True)
self.statusBar().showMessage("Operation cancelled")
......@@ -594,7 +594,7 @@ def main():
window = USBCreatorApp()
window.show()
sys.exit(app.exec_())
sys.exit(app.exec())
if __name__ == '__main__':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment