vsview-split-planes 0.3.0__tar.gz → 0.4.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.
@@ -380,3 +380,4 @@ docs/assets/raws
380
380
 
381
381
  # Local AGENTS.md
382
382
  AGENTS.md
383
+ .vitest/
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: vsview-split-planes
3
- Version: 0.3.0
3
+ Version: 0.4.0
4
4
  Summary: A vsview plugin displaying video clips' constituent planes
5
5
  Project-URL: Documentation, https://jaded-encoding-thaumaturgy.github.io/vs-view/plugins/second-party/#split-planes
6
6
  Project-URL: Source Code, https://github.com/Jaded-Encoding-Thaumaturgy/vs-view/tree/main/src/plugins/split-planes
@@ -3,7 +3,7 @@ from typing import Annotated, Any, Literal, assert_never, override
3
3
 
4
4
  from jetpytools import fallback
5
5
  from pydantic import BaseModel
6
- from PySide6.QtCore import QSignalBlocker, Slot
6
+ from PySide6.QtCore import QSignalBlocker, QTimer, Slot
7
7
  from PySide6.QtWidgets import QBoxLayout, QDoubleSpinBox, QHBoxLayout, QLabel, QVBoxLayout, QWidget, QWidgetAction
8
8
  from vapoursynth import VideoNode
9
9
  from vstools import scale_mask, stack_planes
@@ -46,9 +46,9 @@ class GlobalSettings(BaseModel):
46
46
  label="Offset chroma",
47
47
  items=[("Fixed", 0.0), ("Min", "min"), ("Max", "max")],
48
48
  tooltip="Apply chroma plane offsetting\n"
49
- '- "min": match luma minimum\n'
50
- '- "max": match luma maximum\n'
51
- "- Fixed: use a custom float value",
49
+ "- Fixed: no offset. Set a custom value from the view context menu\n"
50
+ "- Min: move each chroma plane so its frame minimum sits at the lowest chroma value of the format\n"
51
+ "- Max: move each chroma plane so its frame maximum sits at the peak chroma value of the format",
52
52
  ),
53
53
  ] = 0.0
54
54
  mode: Annotated[
@@ -104,11 +104,19 @@ class SplitPlanesPlugin(WidgetPluginBase[GlobalSettings, LocalSettings]):
104
104
  self.current_layout.setSpacing(0)
105
105
  self.current_layout.addWidget(self.view)
106
106
 
107
+ self._applied_settings = self.settings.global_.model_dump()
107
108
  self.api.globalSettingsChanged.connect(self.on_settings_changed)
108
109
 
109
110
  @Slot()
110
111
  def on_settings_changed(self) -> None:
111
- self.view.autofit = fallback(self.settings.local_.autofit, self.settings.global_.autofit)
112
+ if (current := self.settings.global_.model_dump()) == self._applied_settings:
113
+ return
114
+
115
+ if current["autofit"] != self._applied_settings["autofit"]:
116
+ self.view.set_autofit(fallback(self.settings.local_.autofit, self.settings.global_.autofit))
117
+
118
+ self._applied_settings = current
119
+
112
120
  self.view.refresh()
113
121
  self.view.sync_offset_controls_from_settings()
114
122
 
@@ -161,6 +169,9 @@ class SplitPlanesView(PluginGraphicsView):
161
169
  action.setDefaultWidget(self._offset_container)
162
170
  self.context_menu.addAction(action)
163
171
 
172
+ self._offset_timer = QTimer(self, singleShot=True, interval=300)
173
+ self._offset_timer.timeout.connect(self._apply_offset_spinbox)
174
+
164
175
  # Connect signals
165
176
  self.offset_segment.segmentChanged.connect(self.on_offset_segment_changed)
166
177
  self.offset_spinbox.valueChanged.connect(self.on_offset_spinbox_changed)
@@ -168,8 +179,7 @@ class SplitPlanesView(PluginGraphicsView):
168
179
  # Set initial state from global settings
169
180
  self.sync_offset_controls_from_settings()
170
181
 
171
- if self.settings.local_.autofit:
172
- self.autofit_action.trigger()
182
+ self.set_autofit(fallback(self.settings.local_.autofit, self.settings.global_.autofit))
173
183
 
174
184
  @override
175
185
  def get_node(self, clip: VideoNode) -> VideoNode:
@@ -227,8 +237,12 @@ class SplitPlanesView(PluginGraphicsView):
227
237
 
228
238
  @Slot(float)
229
239
  def on_offset_spinbox_changed(self, value: float) -> None:
240
+ self._offset_timer.start()
241
+
242
+ @Slot()
243
+ def _apply_offset_spinbox(self) -> None:
230
244
  if self.offset_segment.index == 0:
231
- self.settings.local_.offset_chroma = value
245
+ self.settings.local_.offset_chroma = self.offset_spinbox.value()
232
246
  self.refresh()
233
247
 
234
248
  @override