vsview-graph 0.1.0__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.
vsview_graph/theme.py ADDED
@@ -0,0 +1,48 @@
1
+ from PySide6.QtGui import QPalette
2
+
3
+ from .bridge import ThemeTokens
4
+
5
+
6
+ def extract_theme_tokens(palette: QPalette) -> ThemeTokens:
7
+ window_color = palette.color(QPalette.ColorRole.Window)
8
+ is_dark = window_color.lightnessF() < 0.5
9
+
10
+ base_color = palette.color(QPalette.ColorRole.Base)
11
+ text_color = palette.color(QPalette.ColorRole.WindowText)
12
+ highlight_color = palette.color(QPalette.ColorRole.Highlight)
13
+
14
+ if is_dark:
15
+ surface = base_color if base_color.name() != window_color.name() else window_color.lighter(115)
16
+ surface_elevated = surface.lighter(115)
17
+ surface_hover = surface.lighter(130)
18
+ border = window_color.lighter(210)
19
+ text_secondary = palette.color(QPalette.ColorRole.PlaceholderText)
20
+ if text_secondary.alpha() == 0 or text_secondary.name() == text_color.name():
21
+ text_secondary = text_color.darker(140)
22
+ text_muted = text_color.darker(190)
23
+ else:
24
+ surface = base_color if base_color.name() != window_color.name() else window_color.darker(105)
25
+ surface_elevated = surface.darker(108)
26
+ surface_hover = surface.darker(115)
27
+ border = window_color.darker(120)
28
+ text_secondary = palette.color(QPalette.ColorRole.PlaceholderText)
29
+ if text_secondary.alpha() == 0 or text_secondary.name() == text_color.name():
30
+ text_secondary = text_color.lighter(140)
31
+ text_muted = text_color.lighter(190)
32
+
33
+ return {
34
+ "isDark": is_dark,
35
+ "bg": window_color.name(),
36
+ "surface": surface.name(),
37
+ "surfaceElevated": surface_elevated.name(),
38
+ "surfaceHover": surface_hover.name(),
39
+ "border": border.name(),
40
+ "textPrimary": text_color.name(),
41
+ "textSecondary": text_secondary.name(),
42
+ "textMuted": text_muted.name(),
43
+ "accent": highlight_color.name() if highlight_color.isValid() else "#38bdf8",
44
+ "accentAmber": "#f59e0b",
45
+ "accentEmerald": "#10b981",
46
+ # Qt has no error role in QPalette, so alerts use a fixed readable red.
47
+ "danger": "#ef4444",
48
+ }
vsview_graph/web.py ADDED
@@ -0,0 +1,27 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import ClassVar, override
4
+
5
+ from PySide6.QtCore import QEvent
6
+
7
+ from vsview.api import BaseWebEngineView
8
+
9
+ from .bridge import GraphBridge, PyToJsCommand
10
+ from .theme import extract_theme_tokens
11
+
12
+
13
+ class GraphWebView(BaseWebEngineView[GraphBridge]):
14
+ logger_name: ClassVar[str] = "vsview_graph_js"
15
+
16
+ @override
17
+ def changeEvent(self, event: QEvent) -> None:
18
+ super().changeEvent(event)
19
+ if event.type() == QEvent.Type.PaletteChange:
20
+ self.sync_theme()
21
+
22
+ def sync_theme(self) -> bool:
23
+ if not self.bridge.is_ready:
24
+ return False
25
+ tokens = extract_theme_tokens(self.palette())
26
+ self.bridge.dispatch(PyToJsCommand.THEME_UPDATE, tokens)
27
+ return True
@@ -0,0 +1,78 @@
1
+ # Licenses
2
+
3
+ The app bundles dependencies which contain the following licenses:
4
+
5
+ ## cytoscape-dagre - 4.1.0 (MIT)
6
+
7
+ Copyright (c) 2016-2018, 2020, 2022, 2026, The Cytoscape Consortium.
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
10
+ this software and associated documentation files (the “Software”), to deal in
11
+ the Software without restriction, including without limitation the rights to
12
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
13
+ of the Software, and to permit persons to whom the Software is furnished to do
14
+ so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all
17
+ copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ SOFTWARE.
26
+
27
+ ## cytoscape - 3.35.0 (MIT)
28
+
29
+ Copyright (c) 2016-2026, The Cytoscape Consortium.
30
+
31
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
32
+ this software and associated documentation files (the “Software”), to deal in
33
+ the Software without restriction, including without limitation the rights to
34
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
35
+ of the Software, and to permit persons to whom the Software is furnished to do
36
+ so, subject to the following conditions:
37
+
38
+ The above copyright notice and this permission notice shall be included in all
39
+ copies or substantial portions of the Software.
40
+
41
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
42
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
43
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
44
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
45
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
46
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
47
+ SOFTWARE.
48
+
49
+ ## lit-html - 3.3.3 (BSD-3-Clause)
50
+
51
+ BSD 3-Clause License
52
+
53
+ Copyright (c) 2017 Google LLC. All rights reserved.
54
+
55
+ Redistribution and use in source and binary forms, with or without
56
+ modification, are permitted provided that the following conditions are met:
57
+
58
+ 1. Redistributions of source code must retain the above copyright notice, this
59
+ list of conditions and the following disclaimer.
60
+
61
+ 2. Redistributions in binary form must reproduce the above copyright notice,
62
+ this list of conditions and the following disclaimer in the documentation
63
+ and/or other materials provided with the distribution.
64
+
65
+ 3. Neither the name of the copyright holder nor the names of its
66
+ contributors may be used to endorse or promote products derived from
67
+ this software without specific prior written permission.
68
+
69
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
70
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
71
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
72
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
73
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
74
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
75
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
76
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
77
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
78
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.