vsview-split-planes 0.1.0__tar.gz

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.
@@ -0,0 +1,220 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ # Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ # poetry.lock
109
+ # poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ # pdm.lock
116
+ # pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ # pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # Redis
135
+ *.rdb
136
+ *.aof
137
+ *.pid
138
+
139
+ # RabbitMQ
140
+ mnesia/
141
+ rabbitmq/
142
+ rabbitmq-data/
143
+
144
+ # ActiveMQ
145
+ activemq-data/
146
+
147
+ # SageMath parsed files
148
+ *.sage.py
149
+
150
+ # Environments
151
+ .env
152
+ .envrc
153
+ .venv
154
+ env/
155
+ venv/
156
+ ENV/
157
+ env.bak/
158
+ venv.bak/
159
+
160
+ # Spyder project settings
161
+ .spyderproject
162
+ .spyproject
163
+
164
+ # Rope project settings
165
+ .ropeproject
166
+
167
+ # mkdocs documentation
168
+ /site
169
+
170
+ # mypy
171
+ .mypy_cache/
172
+ .dmypy.json
173
+ dmypy.json
174
+
175
+ # Pyre type checker
176
+ .pyre/
177
+
178
+ # pytype static type analyzer
179
+ .pytype/
180
+
181
+ # Cython debug symbols
182
+ cython_debug/
183
+
184
+ # PyCharm
185
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
186
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
187
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
188
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
189
+ # .idea/
190
+
191
+ # Abstra
192
+ # Abstra is an AI-powered process automation framework.
193
+ # Ignore directories containing user credentials, local state, and settings.
194
+ # Learn more at https://abstra.io/docs
195
+ .abstra/
196
+
197
+ # Visual Studio Code
198
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
199
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
200
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
201
+ # you could uncomment the following to ignore the entire vscode folder
202
+ # .vscode/
203
+
204
+ # Ruff stuff:
205
+ .ruff_cache/
206
+
207
+ # PyPI configuration file
208
+ .pypirc
209
+
210
+ # Marimo
211
+ marimo/_static/
212
+ marimo/_lsp/
213
+ __marimo__/
214
+
215
+ # Streamlit
216
+ .streamlit/secrets.toml
217
+
218
+ # vsjet
219
+ .vsjet/
220
+ src/vsview/global_settings.json
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Jaded Encoding Thaumaturgy
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,55 @@
1
+ Metadata-Version: 2.4
2
+ Name: vsview-split-planes
3
+ Version: 0.1.0
4
+ Summary: A vsview plugin displaying video clips' constituent planes
5
+ Project-URL: Source Code, https://github.com/Jaded-Encoding-Thaumaturgy/vs-view/tree/main/src/plugins/split-planes
6
+ Project-URL: Bug Tracker, https://github.com/Jaded-Encoding-Thaumaturgy/vs-view/issues
7
+ Project-URL: Contact, https://discord.gg/XTpc6Fa9eB
8
+ License: MIT License
9
+
10
+ Copyright (c) 2025 Jaded Encoding Thaumaturgy
11
+
12
+ Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ of this software and associated documentation files (the "Software"), to deal
14
+ in the Software without restriction, including without limitation the rights
15
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ copies of the Software, and to permit persons to whom the Software is
17
+ furnished to do so, subject to the following conditions:
18
+
19
+ The above copyright notice and this permission notice shall be included in all
20
+ copies or substantial portions of the Software.
21
+
22
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ SOFTWARE.
29
+ License-File: LICENSE
30
+ Classifier: License :: OSI Approved :: MIT License
31
+ Classifier: Operating System :: OS Independent
32
+ Classifier: Programming Language :: Python :: 3
33
+ Classifier: Programming Language :: Python :: 3.12
34
+ Classifier: Programming Language :: Python :: 3.13
35
+ Classifier: Programming Language :: Python :: 3.14
36
+ Classifier: Typing :: Typed
37
+ Requires-Python: >=3.12
38
+ Requires-Dist: vsjetpack>=1.1.0
39
+ Requires-Dist: vsview
40
+ Description-Content-Type: text/markdown
41
+
42
+ # vsview-split-planes
43
+
44
+ A [vsview](https://github.com/Jaded-Encoding-Thaumaturgy/vs-view) plugin displaying video clips' constituent planes.
45
+
46
+ ## Requirements
47
+
48
+ - [vsview](https://github.com/Jaded-Encoding-Thaumaturgy/vs-view)
49
+ - [vsjetpack](https://github.com/Jaded-Encoding-Thaumaturgy/vs-jetpack) 1.1.0 or later
50
+
51
+ ## Installation
52
+
53
+ ```bash
54
+ pip install vsview-split-planes
55
+ ```
@@ -0,0 +1,14 @@
1
+ # vsview-split-planes
2
+
3
+ A [vsview](https://github.com/Jaded-Encoding-Thaumaturgy/vs-view) plugin displaying video clips' constituent planes.
4
+
5
+ ## Requirements
6
+
7
+ - [vsview](https://github.com/Jaded-Encoding-Thaumaturgy/vs-view)
8
+ - [vsjetpack](https://github.com/Jaded-Encoding-Thaumaturgy/vs-jetpack) 1.1.0 or later
9
+
10
+ ## Installation
11
+
12
+ ```bash
13
+ pip install vsview-split-planes
14
+ ```
@@ -0,0 +1,42 @@
1
+ [build-system]
2
+ requires = ["hatchling", "versioningit"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "vsview-split-planes"
7
+ dynamic = ["version"]
8
+ description = "A vsview plugin displaying video clips' constituent planes"
9
+ readme = "README.md"
10
+ license = { file = "LICENSE" }
11
+ requires-python = ">=3.12"
12
+ classifiers = [
13
+ "License :: OSI Approved :: MIT License",
14
+ "Programming Language :: Python :: 3",
15
+ "Programming Language :: Python :: 3.12",
16
+ "Programming Language :: Python :: 3.13",
17
+ "Programming Language :: Python :: 3.14",
18
+ "Operating System :: OS Independent",
19
+ "Typing :: Typed",
20
+ ]
21
+ dependencies = ["vsview", "vsjetpack>=1.1.0"]
22
+
23
+ [project.entry-points.vsview]
24
+ vsview_split_planes = "vsview_split_planes"
25
+
26
+ [project.urls]
27
+ "Source Code" = "https://github.com/Jaded-Encoding-Thaumaturgy/vs-view/tree/main/src/plugins/split-planes"
28
+ "Bug Tracker" = "https://github.com/Jaded-Encoding-Thaumaturgy/vs-view/issues"
29
+ "Contact" = "https://discord.gg/XTpc6Fa9eB"
30
+
31
+ [tool.uv.sources]
32
+ vsview = { workspace = true }
33
+
34
+ [tool.hatch.version]
35
+ source = "versioningit"
36
+
37
+ [tool.versioningit.vcs]
38
+ match = ["split-planes/v*"]
39
+ default-tag = "split-planes/v0.0.0"
40
+
41
+ [tool.versioningit.tag2version]
42
+ rmprefix = "split-planes/v"
@@ -0,0 +1,246 @@
1
+ from math import copysign
2
+ from typing import Annotated, Any, Literal, assert_never
3
+
4
+ from jetpytools import fallback
5
+ from pydantic import BaseModel
6
+ from PySide6.QtWidgets import QBoxLayout, QDoubleSpinBox, QHBoxLayout, QLabel, QVBoxLayout, QWidget, QWidgetAction
7
+ from vapoursynth import VideoNode
8
+ from vstools import scale_mask, stack_planes
9
+
10
+ from vsview.api import (
11
+ Checkbox,
12
+ Dropdown,
13
+ LocalSettingsModel,
14
+ PluginAPI,
15
+ PluginGraphicsView,
16
+ PluginSettings,
17
+ SegmentedControl,
18
+ Spin,
19
+ WidgetPluginBase,
20
+ hookimpl,
21
+ )
22
+
23
+
24
+ class GlobalSettings(BaseModel):
25
+ autofit: Annotated[
26
+ bool,
27
+ Checkbox(
28
+ label="Auto fit",
29
+ text="Enable autofit by default",
30
+ tooltip="Enable autofit by default when opening the plugin tab",
31
+ ),
32
+ ] = False
33
+
34
+ shift_float_chroma: Annotated[
35
+ bool,
36
+ Checkbox(
37
+ label="Shift float chroma",
38
+ text="",
39
+ tooltip="If checked, shift U and V by +0.5 when working in float YUV formats",
40
+ ),
41
+ ] = True
42
+ offset_chroma: Annotated[
43
+ float | Literal["min", "max"],
44
+ Dropdown(
45
+ label="Offset chroma",
46
+ items=[("Fixed", 0.0), ("Min", "min"), ("Max", "max")],
47
+ tooltip="Apply chroma plane offseting\n"
48
+ '- "min": match luma minimum\n'
49
+ '- "max": match luma maximum\n'
50
+ "- Fixed: use a custom float value",
51
+ ),
52
+ ] = 0.0
53
+ mode: Annotated[
54
+ Literal["h", "v"],
55
+ Dropdown(
56
+ label="Mode",
57
+ items=[("Horizontal", "h"), ("Vertical", "v")],
58
+ tooltip="Stacking direction",
59
+ ),
60
+ ] = "h"
61
+ write_plane_name: Annotated[
62
+ bool,
63
+ Checkbox(
64
+ label="Write plane name",
65
+ text="",
66
+ tooltip='If checked, overlays the short plane name ("Y", "U", "V", "R", "G", ...) on each plane.',
67
+ ),
68
+ ] = True
69
+ alignment: Annotated[
70
+ int,
71
+ Spin(
72
+ label="Alignment",
73
+ min=1,
74
+ max=9,
75
+ tooltip='Text alignment for plane labels (only used if "Write plane name" is checked`).',
76
+ ),
77
+ ] = 7
78
+ scale: Annotated[
79
+ int,
80
+ Spin(
81
+ label="Scale",
82
+ min=1,
83
+ tooltip='Font scale for plane labels (only used if "Write plane name" is checked`).',
84
+ ),
85
+ ] = 1
86
+
87
+
88
+ class LocalSettings(LocalSettingsModel):
89
+ autofit: bool | None = None
90
+ offset_chroma: float | Literal["min", "max"] | None = None
91
+
92
+
93
+ class SplitPlanesPlugin(WidgetPluginBase[GlobalSettings, LocalSettings]):
94
+ identifier = "jet_vsview_split_planes"
95
+ display_name = "Split Planes"
96
+
97
+ def __init__(self, parent: QWidget, api: PluginAPI) -> None:
98
+ super().__init__(parent, api)
99
+
100
+ self.view = SplitPlanesView(self, self.api, self.settings)
101
+ self.current_layout = QHBoxLayout(self)
102
+ self.current_layout.setContentsMargins(0, 0, 0, 0)
103
+ self.current_layout.setSpacing(0)
104
+ self.current_layout.addWidget(self.view)
105
+
106
+ self.api.globalSettingsChanged.connect(self.on_settings_changed)
107
+
108
+ def on_settings_changed(self) -> None:
109
+ self.view.autofit = fallback(self.settings.local_.autofit, self.settings.global_.autofit)
110
+ self.view.refresh()
111
+ self.view.sync_offset_controls_from_settings()
112
+
113
+
114
+ class SplitPlanesView(PluginGraphicsView):
115
+ def __init__(
116
+ self, parent: QWidget, api: PluginAPI, settings: PluginSettings[GlobalSettings, LocalSettings]
117
+ ) -> None:
118
+ super().__init__(parent, api)
119
+ self.settings = settings
120
+
121
+ self.context_menu.addSeparator()
122
+
123
+ # Container widget for the offset chroma controls
124
+ self._offset_container = QWidget(self.context_menu)
125
+ layout = QVBoxLayout(self._offset_container)
126
+ layout.setContentsMargins(8, 4, 8, 4)
127
+ layout.setSpacing(4)
128
+
129
+ # Label
130
+ label = QLabel("Offset Chroma", self._offset_container)
131
+ layout.addWidget(label)
132
+
133
+ # Segmented control for Min/Max/Fixed
134
+ self.offset_segment = SegmentedControl(
135
+ ["Fixed", "Min", "Max"],
136
+ self._offset_container,
137
+ QBoxLayout.Direction.LeftToRight,
138
+ )
139
+ layout.addWidget(self.offset_segment)
140
+
141
+ # Spinbox for "Fixed" mode
142
+ self.fixed_spinbox_container = QWidget(self._offset_container)
143
+ spinbox_layout = QHBoxLayout(self.fixed_spinbox_container)
144
+ spinbox_layout.setContentsMargins(0, 0, 0, 0)
145
+ spinbox_layout.setSpacing(4)
146
+
147
+ self.offset_spinbox = QDoubleSpinBox(self.fixed_spinbox_container)
148
+ self.offset_spinbox.setRange(-1.0, 1.0)
149
+ self.offset_spinbox.setSingleStep(0.1)
150
+ self.offset_spinbox.setDecimals(3)
151
+ self.offset_spinbox.setValue(0.0)
152
+ self.offset_spinbox.setToolTip("Fixed offset value for chroma planes")
153
+ spinbox_layout.addWidget(self.offset_spinbox)
154
+
155
+ layout.addWidget(self.fixed_spinbox_container)
156
+
157
+ # Add container to context menu via QWidgetAction
158
+ action = QWidgetAction(self.context_menu)
159
+ action.setDefaultWidget(self._offset_container)
160
+ self.context_menu.addAction(action)
161
+
162
+ # Connect signals
163
+ self.offset_segment.segmentChanged.connect(self.on_offset_segment_changed)
164
+ self.offset_spinbox.valueChanged.connect(self.on_offset_spinbox_changed)
165
+
166
+ # Set initial state from global settings
167
+ self.sync_offset_controls_from_settings()
168
+
169
+ if self.settings.local_.autofit:
170
+ self.autofit_action.trigger()
171
+
172
+ def parent(self) -> SplitPlanesPlugin:
173
+ if isinstance(parent := super().parent(), SplitPlanesPlugin):
174
+ return parent
175
+
176
+ raise NotImplementedError
177
+
178
+ def get_node(self, clip: VideoNode) -> VideoNode:
179
+ if (offset_chroma := self.settings.local_.offset_chroma) is None:
180
+ offset = False
181
+ elif isinstance(offset_chroma, (float, int)):
182
+ offset = scale_mask(abs(offset_chroma), 32, clip)
183
+ offset = copysign(offset, offset_chroma)
184
+ else:
185
+ offset = offset_chroma
186
+
187
+ return stack_planes(
188
+ clip,
189
+ self.settings.global_.shift_float_chroma,
190
+ offset,
191
+ self.settings.global_.mode,
192
+ self.settings.global_.write_plane_name,
193
+ self.settings.global_.alignment,
194
+ self.settings.global_.scale,
195
+ )
196
+
197
+ def sync_offset_controls_from_settings(self) -> None:
198
+ match offset := self.settings.local_.offset_chroma:
199
+ case int() | float() | None:
200
+ self.offset_segment.index = 0
201
+ self.fixed_spinbox_container.setEnabled(True)
202
+ self.offset_spinbox.setValue(float(offset or 0))
203
+ case "min":
204
+ self.offset_segment.index = 1
205
+ self.fixed_spinbox_container.setEnabled(False)
206
+ case "max":
207
+ self.offset_segment.index = 2
208
+ self.fixed_spinbox_container.setEnabled(False)
209
+ case _:
210
+ assert_never(offset)
211
+
212
+ def on_offset_segment_changed(self, index: int) -> None:
213
+ self.fixed_spinbox_container.setEnabled(index == 0)
214
+ parent = self.parent()
215
+
216
+ match index:
217
+ case 0:
218
+ parent.update_local_settings(offset_chroma=self.offset_spinbox.value())
219
+ case 1:
220
+ parent.update_local_settings(offset_chroma="min")
221
+ case 2:
222
+ parent.update_local_settings(offset_chroma="max")
223
+ case _:
224
+ raise NotImplementedError
225
+
226
+ self.refresh()
227
+
228
+ def on_offset_spinbox_changed(self, value: float) -> None:
229
+ if self.offset_segment.index == 0:
230
+ self.parent().update_local_settings(offset_chroma=value)
231
+ self.refresh()
232
+
233
+ def _on_autofit_action(self) -> None:
234
+ super()._on_autofit_action()
235
+
236
+ self.parent().update_local_settings(autofit=self.autofit)
237
+
238
+
239
+ @hookimpl
240
+ def vsview_register_toolpanel() -> type[WidgetPluginBase[Any, Any]]:
241
+ return SplitPlanesPlugin
242
+
243
+
244
+ @hookimpl
245
+ def vsview_register_tooldock() -> type[WidgetPluginBase[Any, Any]]:
246
+ return SplitPlanesPlugin