qcanvas 1.0.6a6__py3-none-any.whl → 1.0.6a7__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 -5
- 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/_ui_settings.py +2 -10
- qcanvas/util/themes.py +24 -0
- {qcanvas-1.0.6a6.dist-info → qcanvas-1.0.6a7.dist-info}/METADATA +1 -1
- {qcanvas-1.0.6a6.dist-info → qcanvas-1.0.6a7.dist-info}/RECORD +10 -8
- {qcanvas-1.0.6a6.dist-info → qcanvas-1.0.6a7.dist-info}/WHEEL +0 -0
- {qcanvas-1.0.6a6.dist-info → qcanvas-1.0.6a7.dist-info}/entry_points.txt +0 -0
qcanvas/app_start/__init__.py
CHANGED
|
@@ -8,6 +8,7 @@ from qtpy.QtWidgets import QApplication
|
|
|
8
8
|
import qcanvas.backend_connectors.qcanvas_task_master as task_master
|
|
9
9
|
from qcanvas.ui.main_ui.qcanvas_window import QCanvasWindow
|
|
10
10
|
from qcanvas.ui.setup import SetupDialog, setup_checker
|
|
11
|
+
from qcanvas.util import themes, settings
|
|
11
12
|
|
|
12
13
|
main_window = None
|
|
13
14
|
setup_window = None
|
|
@@ -24,11 +25,7 @@ def launch():
|
|
|
24
25
|
app.setApplicationName("QCanvas")
|
|
25
26
|
|
|
26
27
|
task_master.register()
|
|
27
|
-
|
|
28
|
-
# qdarktheme.setup_theme(
|
|
29
|
-
# "auto",
|
|
30
|
-
# custom_colors={"primary": "e02424"},
|
|
31
|
-
# )
|
|
28
|
+
themes.apply(settings.ui.theme)
|
|
32
29
|
|
|
33
30
|
event_loop = QEventLoop(app)
|
|
34
31
|
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
|
|
|
@@ -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,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=5LyGhovVY_hUtOd8rncyfDjYpGOsBkHy89Sot3vOhvk,1060
|
|
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
59
|
qcanvas/util/settings/_mapped_setting.py,sha256=Z6635FfDll9cCLfSkVg-unsDLvUWuKT5MmxJEiUkd2k,1823
|
|
59
|
-
qcanvas/util/settings/_ui_settings.py,sha256=
|
|
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.6a7.dist-info/METADATA,sha256=nxnUZeZmEZ-1eSn5fFVm8wl9j05vJ8VNjjuTVeKH17Q,1652
|
|
65
|
+
qcanvas-1.0.6a7.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
66
|
+
qcanvas-1.0.6a7.dist-info/entry_points.txt,sha256=46VbnhQ9w2CYdfhYcPfWgjXYHjsKshu0asQ1B_sAMac,44
|
|
67
|
+
qcanvas-1.0.6a7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|