qcanvas 1.0.6a6__py3-none-any.whl → 1.0.6a8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of qcanvas might be problematic. Click here for more details.
- qcanvas/app_start/__init__.py +2 -6
- qcanvas/ui/main_ui/options/theme_selection_menu.py +44 -0
- qcanvas/ui/main_ui/qcanvas_window.py +2 -0
- qcanvas/util/paths.py +2 -2
- qcanvas/util/settings/_mapped_setting.py +3 -5
- qcanvas/util/settings/_ui_settings.py +2 -10
- qcanvas/util/themes.py +24 -0
- {qcanvas-1.0.6a6.dist-info → qcanvas-1.0.6a8.dist-info}/METADATA +2 -3
- {qcanvas-1.0.6a6.dist-info → qcanvas-1.0.6a8.dist-info}/RECORD +11 -9
- {qcanvas-1.0.6a6.dist-info → qcanvas-1.0.6a8.dist-info}/WHEEL +0 -0
- {qcanvas-1.0.6a6.dist-info → qcanvas-1.0.6a8.dist-info}/entry_points.txt +0 -0
qcanvas/app_start/__init__.py
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import asyncio
|
|
2
2
|
import sys
|
|
3
3
|
|
|
4
|
-
import qdarktheme
|
|
5
4
|
from qasync import QEventLoop
|
|
6
5
|
from qtpy.QtWidgets import QApplication
|
|
7
6
|
|
|
8
7
|
import qcanvas.backend_connectors.qcanvas_task_master as task_master
|
|
9
8
|
from qcanvas.ui.main_ui.qcanvas_window import QCanvasWindow
|
|
10
9
|
from qcanvas.ui.setup import SetupDialog, setup_checker
|
|
10
|
+
from qcanvas.util import themes, settings
|
|
11
11
|
|
|
12
12
|
main_window = None
|
|
13
13
|
setup_window = None
|
|
@@ -24,11 +24,7 @@ def launch():
|
|
|
24
24
|
app.setApplicationName("QCanvas")
|
|
25
25
|
|
|
26
26
|
task_master.register()
|
|
27
|
-
|
|
28
|
-
# qdarktheme.setup_theme(
|
|
29
|
-
# "auto",
|
|
30
|
-
# custom_colors={"primary": "e02424"},
|
|
31
|
-
# )
|
|
27
|
+
themes.apply(settings.ui.theme)
|
|
32
28
|
|
|
33
29
|
event_loop = QEventLoop(app)
|
|
34
30
|
asyncio.set_event_loop(event_loop)
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
|
|
3
|
+
from qtpy.QtCore import Slot
|
|
4
|
+
from qtpy.QtGui import QAction
|
|
5
|
+
from qtpy.QtGui import QActionGroup
|
|
6
|
+
from qtpy.QtWidgets import QMenu
|
|
7
|
+
|
|
8
|
+
from qcanvas.util import themes, settings
|
|
9
|
+
|
|
10
|
+
_logger = logging.getLogger(__name__)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class _ThemeAction(QAction):
|
|
14
|
+
def __init__(self, theme_text: str, theme_name: str, parent: QMenu):
|
|
15
|
+
super().__init__(theme_text, parent)
|
|
16
|
+
self._theme_name = theme_name
|
|
17
|
+
self.setCheckable(True)
|
|
18
|
+
self.setChecked(self._theme_name == settings.ui.theme)
|
|
19
|
+
self.triggered.connect(self._change_theme)
|
|
20
|
+
|
|
21
|
+
@Slot()
|
|
22
|
+
def _change_theme(self) -> None:
|
|
23
|
+
settings.ui.theme = self._theme_name
|
|
24
|
+
themes.apply(self._theme_name)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class ThemeSelectionMenu(QMenu):
|
|
28
|
+
|
|
29
|
+
def __init__(self, parent: QMenu):
|
|
30
|
+
super().__init__("Theme", parent)
|
|
31
|
+
|
|
32
|
+
action_group = QActionGroup(self)
|
|
33
|
+
|
|
34
|
+
auto_theme = _ThemeAction("Auto", "auto", self)
|
|
35
|
+
light_theme = _ThemeAction("Light", "light", self)
|
|
36
|
+
dark_theme = _ThemeAction("Dark", "dark", self)
|
|
37
|
+
native_theme = _ThemeAction("Native (requires restart)", "native", self)
|
|
38
|
+
|
|
39
|
+
actions = [auto_theme, light_theme, dark_theme, native_theme]
|
|
40
|
+
|
|
41
|
+
self.addActions(actions)
|
|
42
|
+
|
|
43
|
+
for theme in actions:
|
|
44
|
+
action_group.addAction(theme)
|
|
@@ -17,6 +17,7 @@ from qcanvas.ui.course_viewer import CourseTree
|
|
|
17
17
|
from qcanvas.ui.main_ui.course_viewer_container import CourseViewerContainer
|
|
18
18
|
from qcanvas.ui.main_ui.options.quick_sync_option import QuickSyncOption
|
|
19
19
|
from qcanvas.ui.main_ui.options.sync_on_start_option import SyncOnStartOption
|
|
20
|
+
from qcanvas.ui.main_ui.options.theme_selection_menu import ThemeSelectionMenu
|
|
20
21
|
from qcanvas.ui.main_ui.status_bar_progress_display import StatusBarProgressDisplay
|
|
21
22
|
from qcanvas.util import paths, settings
|
|
22
23
|
from qcanvas.util.qurl_util import file_url
|
|
@@ -100,6 +101,7 @@ class QCanvasWindow(QMainWindow):
|
|
|
100
101
|
|
|
101
102
|
options_menu.addAction(QuickSyncOption(options_menu))
|
|
102
103
|
options_menu.addAction(SyncOnStartOption(options_menu))
|
|
104
|
+
options_menu.addMenu(ThemeSelectionMenu(self))
|
|
103
105
|
|
|
104
106
|
def _restore_window_position(self):
|
|
105
107
|
if settings.ui.last_geometry is not None:
|
qcanvas/util/paths.py
CHANGED
|
@@ -35,8 +35,8 @@ def root() -> Path:
|
|
|
35
35
|
elif _is_running_as_pyinstaller:
|
|
36
36
|
root_path = platformdirs.user_data_path("QCanvasReborn", "QCanvasTeam")
|
|
37
37
|
|
|
38
|
-
print("Root path
|
|
39
|
-
_logger.debug("Root path ", root_path.absolute())
|
|
38
|
+
print("Root path", root_path.absolute())
|
|
39
|
+
_logger.debug("Root path %s", root_path.absolute())
|
|
40
40
|
return root_path
|
|
41
41
|
|
|
42
42
|
|
|
@@ -5,10 +5,8 @@ from qtpy.QtCore import QSettings
|
|
|
5
5
|
|
|
6
6
|
_logger = logging.getLogger(__name__)
|
|
7
7
|
|
|
8
|
-
T = TypeVar("T")
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
class MappedSetting(Generic[T]):
|
|
9
|
+
class MappedSetting[T]:
|
|
12
10
|
"""
|
|
13
11
|
Acts as a proxy for a named value in a QSettings object.
|
|
14
12
|
Stores the value in memory when initialised and updates it accordingly, to protect it from changes on disk.
|
|
@@ -48,7 +46,7 @@ class BoolSetting(MappedSetting[bool]):
|
|
|
48
46
|
def __init__(self, default: bool = False):
|
|
49
47
|
super().__init__(default)
|
|
50
48
|
|
|
51
|
-
|
|
49
|
+
@override
|
|
52
50
|
def _read(self) -> bool:
|
|
53
51
|
try:
|
|
54
52
|
# noinspection PyTypeChecker
|
|
@@ -57,7 +55,7 @@ class BoolSetting(MappedSetting[bool]):
|
|
|
57
55
|
except:
|
|
58
56
|
return self.default
|
|
59
57
|
|
|
60
|
-
|
|
58
|
+
@override
|
|
61
59
|
def _write(self, value: object) -> None:
|
|
62
60
|
if not isinstance(value, bool):
|
|
63
61
|
raise TypeError()
|
|
@@ -3,22 +3,14 @@ import logging
|
|
|
3
3
|
from qtpy.QtCore import QByteArray, QSettings
|
|
4
4
|
|
|
5
5
|
from qcanvas.util.settings._mapped_setting import MappedSetting
|
|
6
|
+
from qcanvas.util.themes import ensure_theme_is_valid, default_theme
|
|
6
7
|
|
|
7
8
|
_logger = logging.getLogger(__name__)
|
|
8
9
|
|
|
9
|
-
_default_theme = "auto"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
def ensure_theme_is_valid(theme: str) -> str:
|
|
13
|
-
if theme not in ["auto", "light", "dark", "native"]:
|
|
14
|
-
return _default_theme
|
|
15
|
-
else:
|
|
16
|
-
return theme
|
|
17
|
-
|
|
18
10
|
|
|
19
11
|
class ThemeSetting(MappedSetting):
|
|
20
12
|
def __init__(self):
|
|
21
|
-
super().__init__(default=
|
|
13
|
+
super().__init__(default=default_theme)
|
|
22
14
|
|
|
23
15
|
def __get__(self, instance, owner):
|
|
24
16
|
return ensure_theme_is_valid(super().__get__(instance, owner))
|
qcanvas/util/themes.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
|
|
3
|
+
import qdarktheme
|
|
4
|
+
|
|
5
|
+
_logger = logging.getLogger(__name__)
|
|
6
|
+
|
|
7
|
+
default_theme = "auto"
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def ensure_theme_is_valid(theme: str) -> str:
|
|
11
|
+
if theme not in ["auto", "light", "dark", "native"]:
|
|
12
|
+
return default_theme
|
|
13
|
+
else:
|
|
14
|
+
return theme
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def apply(theme: str) -> None:
|
|
18
|
+
theme = ensure_theme_is_valid(theme)
|
|
19
|
+
|
|
20
|
+
if theme != "native":
|
|
21
|
+
qdarktheme.setup_theme(
|
|
22
|
+
theme,
|
|
23
|
+
custom_colors={"primary": "e02424"},
|
|
24
|
+
)
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: qcanvas
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.6a8
|
|
4
4
|
Summary: QCanvas is a desktop client for Canvas LMS.
|
|
5
5
|
Author: QCanvas
|
|
6
6
|
Author-email: QCanvas@noreply.codeberg.org
|
|
7
|
-
Requires-Python: >=3.
|
|
7
|
+
Requires-Python: >=3.12,<3.13
|
|
8
8
|
Classifier: Programming Language :: Python :: 3
|
|
9
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
10
9
|
Classifier: Programming Language :: Python :: 3.12
|
|
11
10
|
Requires-Dist: aiosqlite (>=0.20.0,<0.21.0)
|
|
12
11
|
Requires-Dist: asynctaskpool (>=0.2.1,<0.3.0)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
qcanvas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
qcanvas/app_start/__init__.py,sha256=
|
|
2
|
+
qcanvas/app_start/__init__.py,sha256=6FC-OYO8yXXjBDKJ_JXjzbqHUjnvJ5VmOs76gzPSnn0,1042
|
|
3
3
|
qcanvas/backend_connectors/__init__.py,sha256=Wj8cmxQng3SSlmlXJyzHaPmvxbkauwsxINckPb7WuHc,108
|
|
4
4
|
qcanvas/backend_connectors/frontend_resource_manager.py,sha256=EpwsVzA4b6M9y5twn9cG_GujwzwmKxBfdgqPCQ8tB3I,2131
|
|
5
5
|
qcanvas/backend_connectors/qcanvas_task_master.py,sha256=CTPBvf_9w-livscKNspnd98mNvFLYTYHef0RQSUkfFc,742
|
|
@@ -36,7 +36,8 @@ qcanvas/ui/main_ui/course_viewer_container.py,sha256=PgqgWoUdP1QoLt1ZSGke6sCLko8
|
|
|
36
36
|
qcanvas/ui/main_ui/options/__init__.py,sha256=SlfWUzk6_E5uM9GIV-y9BVeKMwqn3pRx_xWhMyb1dfI,54
|
|
37
37
|
qcanvas/ui/main_ui/options/quick_sync_option.py,sha256=qEfmtLllO32ejc-bydCvFRjal5RUlk2HtC5Ld4mT7ss,753
|
|
38
38
|
qcanvas/ui/main_ui/options/sync_on_start_option.py,sha256=zFFAAyGZEa6qBchJJIm7bJpOwxcntnto9Ee-lzCiHX4,731
|
|
39
|
-
qcanvas/ui/main_ui/
|
|
39
|
+
qcanvas/ui/main_ui/options/theme_selection_menu.py,sha256=P_Eqc5XTd0USqQo-QYCVRB5Dzi1j3o93S8JR8SAliC4,1285
|
|
40
|
+
qcanvas/ui/main_ui/qcanvas_window.py,sha256=sgoLGTDjj6cLKhkQvqXJ8WdIDqs94WEcT2iyEoJSYiU,7556
|
|
40
41
|
qcanvas/ui/main_ui/status_bar_progress_display.py,sha256=SVjPawDL79jLcgSfpxhCYr8qhbggWx3niYFdKhEocuo,4854
|
|
41
42
|
qcanvas/ui/memory_tree/__init__.py,sha256=-XLitM6teC0zmwPrGf-Q-A53-zgmIPASExdOtaLIvPU,107
|
|
42
43
|
qcanvas/ui/memory_tree/_tree_memory.py,sha256=CMKfCnrHj22ervaq7xB5U4AiKijYvghUK5ZL0MJIFmQ,1805
|
|
@@ -51,15 +52,16 @@ qcanvas/util/fe_resource_manager.py,sha256=5YO549oBpSgcthD9hxm8trnjHEfudltkh-Sfq
|
|
|
51
52
|
qcanvas/util/html_cleaner.py,sha256=O9_PhvZZw3RcPjdXZagAbNmp8Hfyq9fydBH-ee-DfII,615
|
|
52
53
|
qcanvas/util/layouts.py,sha256=7wQ0-DAbRHPPcfVIQoOmVhPdhGqcF-6qWE1-P86e7ys,1351
|
|
53
54
|
qcanvas/util/logs.py,sha256=VZKFITiW2WR2POEFVv5GRpEXic23Pzjehry-vH3g3Gk,138
|
|
54
|
-
qcanvas/util/paths.py,sha256=
|
|
55
|
+
qcanvas/util/paths.py,sha256=uEV4AJFaWtP7hbie7H6-MYnCUE4_IJl0fkuxuZVMffA,1306
|
|
55
56
|
qcanvas/util/qurl_util.py,sha256=NkskYvrMQJuYWMNF4DFQ4J5-YM5CGl5gHQKxJaAhHBE,197
|
|
56
57
|
qcanvas/util/settings/__init__.py,sha256=ivc8bczhQdEJsWse6fc81Xyz0i2YX57pL4UubM3NJfw,228
|
|
57
58
|
qcanvas/util/settings/_client_settings.py,sha256=HxGH9eOCdBj8wYboGhzNX0LFw_bmzF-Vwo44y1W0EqY,1036
|
|
58
|
-
qcanvas/util/settings/_mapped_setting.py,sha256=
|
|
59
|
-
qcanvas/util/settings/_ui_settings.py,sha256=
|
|
59
|
+
qcanvas/util/settings/_mapped_setting.py,sha256=1zQAfXxWB9yUtWCBObnOZl7EQ22bS-4u2yGGGSdhKJo,1792
|
|
60
|
+
qcanvas/util/settings/_ui_settings.py,sha256=tuzrIZ0H66pDA0hSlynuKXsk0w-MAPVU8qCxjdVjRAs,804
|
|
61
|
+
qcanvas/util/themes.py,sha256=BE6lMf0lVE-0G_QYhK5emMdtKG4lUJw76HFX4go7R80,473
|
|
60
62
|
qcanvas/util/ui_tools.py,sha256=bSM1xrmZPn847YEbXAC9VIAv--8hMLMWrsEMWGA5p3E,916
|
|
61
63
|
qcanvas/util/url_checker.py,sha256=03jqnQ1_GOlCJyRHrlMbSQE9QsHrVNsg0kFsA8oKP60,361
|
|
62
|
-
qcanvas-1.0.
|
|
63
|
-
qcanvas-1.0.
|
|
64
|
-
qcanvas-1.0.
|
|
65
|
-
qcanvas-1.0.
|
|
64
|
+
qcanvas-1.0.6a8.dist-info/METADATA,sha256=Jeyv9u6rbWDNN02YjetmmvYyABG2J6oAoWKx-AAzytM,1601
|
|
65
|
+
qcanvas-1.0.6a8.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
66
|
+
qcanvas-1.0.6a8.dist-info/entry_points.txt,sha256=46VbnhQ9w2CYdfhYcPfWgjXYHjsKshu0asQ1B_sAMac,44
|
|
67
|
+
qcanvas-1.0.6a8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|