From 8f23dea4a2c61c6aa37c4509fcd78e94f2dc1142 Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Sat, 12 Nov 2022 17:44:08 +0100 Subject: Update to PyQt6 --- muddle/gui.py | 64 +++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 36 insertions(+), 28 deletions(-) (limited to 'muddle/gui.py') diff --git a/muddle/gui.py b/muddle/gui.py index 3d39cec..0d85bbe 100644 --- a/muddle/gui.py +++ b/muddle/gui.py @@ -12,45 +12,51 @@ import html import logging import tempfile -from PyQt5 import uic -from PyQt5.QtGui import QFont, QIcon, QStandardItemModel, QStandardItem -from PyQt5.Qt import QStyle +from PyQt6 import uic +from PyQt6.QtGui import ( + QFileSystemModel, + QFont, + QIcon, + QStandardItem, + QStandardItemModel, +) -from PyQt5.QtCore import ( - Qt, + +from PyQt6.QtCore import ( QDir, - QThread, - QSignalBlocker, - pyqtSlot, - pyqtSignal, + QModelIndex, QObject, QRegularExpression, - QModelIndex, + QSignalBlocker, QSortFilterProxyModel, + QThread, + Qt, + pyqtSignal, + pyqtSlot, ) -from PyQt5.QtWidgets import ( +from PyQt6.QtWidgets import ( QApplication, - QMainWindow, - QWidget, - QTreeView, - QTreeWidget, - QTreeWidgetItem, - QTreeWidgetItemIterator, - QHeaderView, + QCheckBox, + QFileDialog, QGridLayout, QHBoxLayout, - QPushButton, + QHeaderView, QLineEdit, + QMainWindow, + QPlainTextEdit, QProgressBar, + QPushButton, + QStyle, QTabWidget, - QPlainTextEdit, - QFileSystemModel, - QFileDialog, - QCheckBox, + QTreeView, + QTreeWidget, + QTreeWidgetItem, + QTreeWidgetItemIterator, + QWidget, ) -import moodle +from . import moodle log = logging.getLogger("muddle.gui") @@ -327,9 +333,10 @@ class MuddleWindow(QMainWindow): moodleTreeView = self.findChild(QTreeView, "moodleTree") moodleTreeView.setModel(self.filterModel) moodleTreeView.setSortingEnabled(True) - moodleTreeView.sortByColumn(0, Qt.AscendingOrder) + # FIXME: Broken by upgrade to PyQt6 + # moodleTreeView.sortByColumn(0, Qt.AscendingOrder) ## TODO: change with minimumSize (?) - moodleTreeView.header().setSectionResizeMode(0, QHeaderView.ResizeToContents) + # moodleTreeView.header().setSectionResizeMode(0, QHeaderView.ResizeToContents) moodleTreeView.doubleClicked.connect(self.onMoodleTreeViewDoubleClicked) ## refresh moodle treeview @@ -369,7 +376,8 @@ class MuddleWindow(QMainWindow): localTreeView = self.findChild(QTreeView, "localTab") localTreeView.setModel(self.fileSystemModel) localTreeView.setRootIndex(self.fileSystemModel.index(QDir.homePath())) - localTreeView.header().setSectionResizeMode(0, QHeaderView.ResizeToContents) + # FIXME: Broken by upgrade to PyQt6 + # localTreeView.header().setSectionResizeMode(0, QHeaderView.ResizeToContents) downloadPathEdit = self.findChild(QLineEdit, "downloadPathEdit") downloadPathEdit.setText(self.downloadPath) @@ -497,4 +505,4 @@ class MuddleWindow(QMainWindow): def start(config): app = QApplication(sys.argv) ex = MuddleWindow(config) - sys.exit(app.exec_()) + sys.exit(app.exec()) -- cgit v1.2.1