aboutsummaryrefslogtreecommitdiffstats
path: root/muddle
diff options
context:
space:
mode:
authorNao Pross <np@0hm.ch>2022-11-12 17:44:08 +0100
committerNao Pross <np@0hm.ch>2022-11-12 17:44:08 +0100
commit8f23dea4a2c61c6aa37c4509fcd78e94f2dc1142 (patch)
tree2b1b46cbd3ef0e03bb60203839e926b016877d67 /muddle
parentContinue refractor of muddle.moodle (diff)
downloadMuddle-8f23dea4a2c61c6aa37c4509fcd78e94f2dc1142.tar.gz
Muddle-8f23dea4a2c61c6aa37c4509fcd78e94f2dc1142.zip
Update to PyQt6
Diffstat (limited to 'muddle')
-rw-r--r--muddle/__main__.py6
-rw-r--r--muddle/gui.py64
-rw-r--r--muddle/moodle.py2
3 files changed, 40 insertions, 32 deletions
diff --git a/muddle/__main__.py b/muddle/__main__.py
index bed4ddc..25b243a 100644
--- a/muddle/__main__.py
+++ b/muddle/__main__.py
@@ -11,9 +11,9 @@ import platform
import pathlib
import json
-import moodle
-import gui
-import paths
+from . import moodle
+from . import gui
+from . import paths
MUDDLE_VERSION = "0.1.0"
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())
diff --git a/muddle/moodle.py b/muddle/moodle.py
index 8146fd4..a9a2c4c 100644
--- a/muddle/moodle.py
+++ b/muddle/moodle.py
@@ -15,7 +15,7 @@ def get_token(url, user, password):
"password": password,
"service": "moodle_mobile_app"
}
- log.debug(f"requesting token with POST to {api_url} with DATA {data}")
+ log.debug(f"requesting token with POST to {url} with DATA {data}")
return requests.post(token_url, data=data)