Skip to content

utils

Classes:

LazyMapPluginVideoOutputs

LazyMapPluginVideoOutputs(
    main: MainWindow | None, func: Callable[[VideoNode], VideoNode]
)

Bases: PluginVideoOutputs

Attributes:

Source code
50
51
52
def __init__(self, main: MainWindow | None, func: Callable[[vs.VideoNode], vs.VideoNode]) -> None:
    super().__init__(main)
    self.func = func

current property

current: VideoOutput

func instance-attribute

func = func

main instance-attribute

main = main or main_window()

prepared property

prepared: VideoNode

source property

source: VideoNode

MappedNodesPlugin

MappedNodesPlugin(main: MainWindow)

Bases: AbstractPlugin

Methods:

Attributes:

Source code
62
63
64
65
def __init__(self, main: MainWindow) -> None:
    super().__init__(main)

    self.outputs = LazyMapPluginVideoOutputs(main, self.get_node)

hlayout instance-attribute

hlayout: HBoxLayout

index class-attribute instance-attribute

index: int = -1

is_notches_visible property

is_notches_visible: bool

main instance-attribute

main = main

notches_changed class-attribute instance-attribute

notches_changed = pyqtSignal(ExtendedWidget)

on_first_load class-attribute instance-attribute

on_first_load = pyqtSignal()

outputs instance-attribute

outputs = LazyMapPluginVideoOutputs(main, get_node)

settings instance-attribute

settings: PluginSettings

shortcuts instance-attribute

shortcuts: list[PluginShortcut] = []

storable_attrs class-attribute

storable_attrs: tuple[str, ...] = ()

vlayout instance-attribute

vlayout: VBoxLayout

add_shortcut

add_shortcut(
    name: str,
    parent: QObject | str,
    /,
    handler: Callable[[], None] | str,
    key: QKeySequence | None = None,
    description: str | None = None,
) -> None
add_shortcut(key: Key | int, handler: Callable[[], None]) -> None
add_shortcut(
    name_or_key: Any,
    parent_or_handler: Any,
    /,
    handler: Callable[[], None] | str = "",
    key: QKeySequence | None = None,
    description: str | None = None,
) -> None
Source code
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
def add_shortcut(
    self,
    name_or_key: Any,
    parent_or_handler: Any,
    /,
    handler: Callable[[], None] | str = "",
    key: QKeySequence | None = None,
    description: str | None = None
) -> None:
    if isinstance(name_or_key, str) and isinstance(parent_or_handler, (QObject | str)):
        name, parent, handler = name_or_key, parent_or_handler, handler
    else:
        name, parent, = f"shortcut_{self.__legacy_counter_shortcuts}", cast(QObject, self), 
        handler, key = parent_or_handler, QKeySequence(name_or_key)
        description = f"Shortcut {self.__legacy_counter_shortcuts}"
        self.__legacy_counter_shortcuts += 1

    self.shortcuts.append(PluginShortcut(name, parent, handler, key, description))

add_shortcuts

add_shortcuts() -> None
Source code
193
194
def add_shortcuts(self) -> None:
    ...

first_load

first_load() -> bool
Source code
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
def first_load(self) -> bool:
    if not self._first_load_done:
        self.setup_ui()

        self.setup_shortcuts()

        self.set_qobject_names()

        self.on_first_load.emit()  # type: ignore

        self._first_load_done = True

        return True

    return False

get_node

get_node(node: VideoNode) -> VideoNode
get_node(node: VideoNode) -> VideoOutputNode
get_node(node: VideoNode) -> VideoNode | VideoOutputNode
get_node(node: VideoNode) -> VideoNode | VideoOutputNode
Source code
79
80
def get_node(self, node: vs.VideoNode) -> vs.VideoNode | VideoOutputNode:
    raise NotImplementedError

get_notches

get_notches() -> Notches
Source code
405
406
407
def get_notches(self) -> Notches:
    from .custom import Notches
    return Notches()

get_separator

get_separator(horizontal: bool = False) -> QFrame
Source code
318
319
320
321
322
def get_separator(self, horizontal: bool = False) -> QFrame:
    separator = QFrame(self)
    separator.setFrameShape(QFrame.Shape.HLine if horizontal else QFrame.Shape.VLine)
    separator.setFrameShadow(QFrame.Shadow.Sunken)
    return separator

init_notches

init_notches(main: MainWindow = ...) -> None
Source code
402
403
def init_notches(self, main: MainWindow = ...) -> None:
    self.notches_changed.connect(main.timeline.update_notches)

init_outputs

init_outputs() -> None
Source code
82
83
84
85
def init_outputs(self) -> None:
    assert self.main.outputs

    self.outputs.clear()

on_current_frame_changed

on_current_frame_changed(frame: Frame) -> None
Source code
92
93
def on_current_frame_changed(self, frame: Frame) -> None:
    raise NotImplementedError

on_current_output_changed

on_current_output_changed(index: int, prev_index: int) -> None
Source code
199
200
def on_current_output_changed(self, index: int, prev_index: int) -> None:
    ...

reset

reset() -> None
Source code
87
88
89
90
def reset(self) -> None:
    self.init_outputs()

    self.on_current_frame_changed(self.main.current_output.last_showed_frame)

set_qobject_names

set_qobject_names() -> None
Source code
279
280
281
282
283
284
285
286
287
288
289
290
291
292
def set_qobject_names(self) -> None:
    if not hasattr(self, '__slots__'):
        return

    slots = list(self.__slots__)

    if isinstance(self, AbstractToolbar) and 'main' in slots:
        slots.remove('main')

    for attr_name in slots:
        attr = getattr(self, attr_name)
        if not isinstance(attr, QObject):
            continue
        attr.setObjectName(type(self).__name__ + '.' + attr_name)

setup_shortcuts

setup_shortcuts() -> None
Source code
149
150
def setup_shortcuts(self) -> None:
    self.main.shortcuts.sections_plugins[self._config.namespace].setup_shortcuts()

setup_ui

setup_ui() -> None
Source code
314
315
316
def setup_ui(self) -> None:
    self.vlayout = VBoxLayout(self)
    self.hlayout = HBoxLayout(self.vlayout)

MappedNodesViewPlugin

MappedNodesViewPlugin(main: MainWindow)

Bases: MappedNodesPlugin, PluginGraphicsView

Methods:

Attributes:

Source code
62
63
64
65
def __init__(self, main: MainWindow) -> None:
    super().__init__(main)

    self.outputs = LazyMapPluginVideoOutputs(main, self.get_node)

WHEEL_STEP class-attribute instance-attribute

WHEEL_STEP = 15 * 8

angleRemainder instance-attribute

angleRemainder = 0

app instance-attribute

app = instance()

auto_fit_button instance-attribute

auto_fit_button = CheckBox('Auto-fit', self, clicked=auto_fit_button_clicked)

autofit property writable

autofit: bool

content_height property

content_height: int

content_width property

content_width: int

controls instance-attribute

controls = QFrame()

currentZoom instance-attribute

currentZoom = 0.0

current_scene property

current_scene: GraphicsImageItem

dragEvent class-attribute instance-attribute

dragEvent = pyqtSignal(DragEventType)

drag_mode instance-attribute

drag_mode: DragMode = dragMode()

graphics_scene instance-attribute

graphics_scene = GraphicsScene(self)

hlayout instance-attribute

hlayout: HBoxLayout

index class-attribute instance-attribute

index: int = -1

is_notches_visible property

is_notches_visible: bool

last_positions class-attribute instance-attribute

last_positions = (0, 0)

main instance-attribute

main = main

mouseMoved class-attribute instance-attribute

mouseMoved = pyqtSignal(QMouseEvent)

mousePressed class-attribute instance-attribute

mousePressed = pyqtSignal(QMouseEvent)

mouseReleased class-attribute instance-attribute

mouseReleased = pyqtSignal(QMouseEvent)

notches_changed class-attribute instance-attribute

notches_changed = pyqtSignal(ExtendedWidget)

on_first_load class-attribute instance-attribute

on_first_load = pyqtSignal()

outputs instance-attribute

outputs = LazyMapPluginVideoOutputs(main, get_node)

plugin instance-attribute

settings instance-attribute

settings: PluginSettings

shortcuts instance-attribute

shortcuts: list[PluginShortcut] = []

storable_attrs class-attribute

storable_attrs: tuple[str, ...] = ()

underReload class-attribute instance-attribute

underReload = False

vlayout instance-attribute

vlayout: VBoxLayout

wheelScrolled class-attribute instance-attribute

wheelScrolled = pyqtSignal(int)

zoomValue instance-attribute

zoomValue = 0.0

zoom_combobox instance-attribute

zoom_combobox = ComboBox[float](self, minimumContentsLength=4)

add_shortcut

add_shortcut(
    name: str,
    parent: QObject | str,
    /,
    handler: Callable[[], None] | str,
    key: QKeySequence | None = None,
    description: str | None = None,
) -> None
add_shortcut(key: Key | int, handler: Callable[[], None]) -> None
add_shortcut(
    name_or_key: Any,
    parent_or_handler: Any,
    /,
    handler: Callable[[], None] | str = "",
    key: QKeySequence | None = None,
    description: str | None = None,
) -> None
Source code
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
def add_shortcut(
    self,
    name_or_key: Any,
    parent_or_handler: Any,
    /,
    handler: Callable[[], None] | str = "",
    key: QKeySequence | None = None,
    description: str | None = None
) -> None:
    if isinstance(name_or_key, str) and isinstance(parent_or_handler, (QObject | str)):
        name, parent, handler = name_or_key, parent_or_handler, handler
    else:
        name, parent, = f"shortcut_{self.__legacy_counter_shortcuts}", cast(QObject, self), 
        handler, key = parent_or_handler, QKeySequence(name_or_key)
        description = f"Shortcut {self.__legacy_counter_shortcuts}"
        self.__legacy_counter_shortcuts += 1

    self.shortcuts.append(PluginShortcut(name, parent, handler, key, description))

add_shortcuts

add_shortcuts() -> None
Source code
193
194
def add_shortcuts(self) -> None:
    ...

afterReload

afterReload() -> None
Source code
371
372
373
374
375
def afterReload(self) -> None:
    self.underReload = False
    self.verticalScrollBar().setValue(self.last_positions[0])
    self.horizontalScrollBar().setValue(self.last_positions[1])
    self.setTransformationAnchor(QGraphicsView.ViewportAnchor.AnchorUnderMouse)

auto_fit_button_clicked

auto_fit_button_clicked(checked: bool) -> None
Source code
212
213
def auto_fit_button_clicked(self, checked: bool) -> None:
    self.autofit = checked

beforeReload

beforeReload() -> None
Source code
366
367
368
369
def beforeReload(self) -> None:
    self.underReload = True
    self.setTransformationAnchor(QGraphicsView.ViewportAnchor.AnchorViewCenter)
    self.last_positions = (self.verticalScrollBar().value(), self.horizontalScrollBar().value())

bind_to

bind_to(other_view: GraphicsView, *, mutual: bool = True) -> None
Source code
241
242
243
244
245
def bind_to(self, other_view: GraphicsView, *, mutual: bool = True) -> None:
    self.main.bound_graphics_views[other_view].add(self)

    if mutual:
        self.main.bound_graphics_views[self].add(other_view)

event

event(event: QEvent) -> bool
Source code
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
def event(self, event: QEvent) -> bool:
    if self.underReload:
        event.ignore()
        return False

    if isinstance(event, QNativeGestureEvent):
        typ = event.gestureType()
        if typ == Qt.NativeGestureType.BeginNativeGesture:
            self.zoomValue = 0.0
        elif typ == Qt.NativeGestureType.ZoomNativeGesture:
            self.zoomValue += event.value()
        if typ == Qt.NativeGestureType.EndNativeGesture:
            self.wheelScrolled.emit(-1 if self.zoomValue < 0 else 1)

    return super().event(event)

first_load

first_load() -> bool
Source code
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
def first_load(self) -> bool:
    if not self._first_load_done:
        self.setup_ui()

        self.setup_shortcuts()

        self.set_qobject_names()

        self.on_first_load.emit()  # type: ignore

        self._first_load_done = True

        return True

    return False

get_node

get_node(node: VideoNode) -> VideoNode
get_node(node: VideoNode) -> VideoOutputNode
get_node(node: VideoNode) -> VideoNode | VideoOutputNode
get_node(node: VideoNode) -> VideoNode | VideoOutputNode
Source code
79
80
def get_node(self, node: vs.VideoNode) -> vs.VideoNode | VideoOutputNode:
    raise NotImplementedError

get_notches

get_notches() -> Notches
Source code
405
406
407
def get_notches(self) -> Notches:
    from .custom import Notches
    return Notches()

get_separator

get_separator(horizontal: bool = False) -> QFrame
Source code
318
319
320
321
322
def get_separator(self, horizontal: bool = False) -> QFrame:
    separator = QFrame(self)
    separator.setFrameShape(QFrame.Shape.HLine if horizontal else QFrame.Shape.VLine)
    separator.setFrameShadow(QFrame.Shadow.Sunken)
    return separator

init_notches

init_notches(main: MainWindow = ...) -> None
Source code
402
403
def init_notches(self, main: MainWindow = ...) -> None:
    self.notches_changed.connect(main.timeline.update_notches)

init_outputs

init_outputs() -> None
Source code
82
83
84
85
def init_outputs(self) -> None:
    assert self.main.outputs

    self.outputs.clear()

mouseMoveEvent

mouseMoveEvent(event: QMouseEvent) -> None
Source code
330
331
332
333
334
335
336
337
338
339
def mouseMoveEvent(self, event: QMouseEvent) -> None:
    if self.underReload or self.autofit:
        return event.ignore()

    super().mouseMoveEvent(event)

    if self.hasMouseTracking():
        self.mouseMoved.emit(event)

    self.dragEvent.emit(DragEventType.move)

mousePressEvent

mousePressEvent(event: QMouseEvent) -> None
Source code
341
342
343
344
345
346
347
348
349
350
351
352
def mousePressEvent(self, event: QMouseEvent) -> None:
    if self.underReload or self.autofit:
        return event.ignore()

    if event.button() == Qt.MouseButton.LeftButton:
        self.drag_mode = self.dragMode()
        self.setDragMode(QGraphicsView.DragMode.ScrollHandDrag)

    super().mousePressEvent(event)

    self.mousePressed.emit(event)
    self.dragEvent.emit(DragEventType.start)

mouseReleaseEvent

mouseReleaseEvent(event: QMouseEvent) -> None
Source code
354
355
356
357
358
359
360
361
362
363
364
def mouseReleaseEvent(self, event: QMouseEvent) -> None:
    if self.underReload or self.autofit:
        return event.ignore()

    super().mouseReleaseEvent(event)

    if event.button() == Qt.MouseButton.LeftButton:
        self.setDragMode(self.drag_mode)

    self.mouseReleased.emit(event)
    self.dragEvent.emit(DragEventType.stop)

on_current_frame_changed

on_current_frame_changed(frame: Frame) -> None
Source code
136
137
def on_current_frame_changed(self, frame: Frame) -> None:
    self.outputs.current.render_frame(frame, None, None, self.current_scene)

on_current_output_changed

on_current_output_changed(index: int, prev_index: int) -> None
Source code
199
200
def on_current_output_changed(self, index: int, prev_index: int) -> None:
    ...

on_wheel_scrolled

on_wheel_scrolled(steps: int) -> None
Source code
247
248
249
250
251
252
253
254
255
def on_wheel_scrolled(self, steps: int) -> None:
    new_index = self.zoom_combobox.currentIndex() + steps

    if new_index < 0:
        new_index = 0
    elif new_index >= len(self.main.settings.zoom_levels):
        new_index = len(self.main.settings.zoom_levels) - 1

    self.zoom_combobox.setCurrentIndex(new_index)

propagate_move_event

propagate_move_event(_: Any = None) -> None
Source code
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
def propagate_move_event(self, _: Any = None) -> None:
    scrollbarW, scrollbarH = self.horizontalScrollBar(), self.verticalScrollBar()

    if not any({scrollbarW.isVisible(), scrollbarH.isVisible()}):
        return

    widthMax, heightMax = scrollbarW.maximum(), scrollbarH.maximum()

    for view in self.main.bound_graphics_views[self] - {self}:
        if view.isVisible():
            wBar, hBar = view.horizontalScrollBar(), view.verticalScrollBar()

            if widthMax:
                wBar.setValue(int(scrollbarW.value() * wBar.maximum() / widthMax))

            if heightMax:
                hBar.setValue(int(scrollbarH.value() * hBar.maximum() / heightMax))

reset

reset() -> None
Source code
87
88
89
90
def reset(self) -> None:
    self.init_outputs()

    self.on_current_frame_changed(self.main.current_output.last_showed_frame)

resizeEvent

resizeEvent(event: QResizeEvent) -> None
Source code
377
378
379
def resizeEvent(self, event: QResizeEvent) -> None:
    super().resizeEvent(event)
    self.setZoom(None)

setZoom

setZoom(value: float | None) -> None
Source code
257
258
259
def setZoom(self, value: float | None) -> None:
    for view in self.main.bound_graphics_views[self]:
        view._setZoom(value)

set_qobject_names

set_qobject_names() -> None
Source code
279
280
281
282
283
284
285
286
287
288
289
290
291
292
def set_qobject_names(self) -> None:
    if not hasattr(self, '__slots__'):
        return

    slots = list(self.__slots__)

    if isinstance(self, AbstractToolbar) and 'main' in slots:
        slots.remove('main')

    for attr_name in slots:
        attr = getattr(self, attr_name)
        if not isinstance(attr, QObject):
            continue
        attr.setObjectName(type(self).__name__ + '.' + attr_name)

setup_shortcuts

setup_shortcuts() -> None
Source code
149
150
def setup_shortcuts(self) -> None:
    self.main.shortcuts.sections_plugins[self._config.namespace].setup_shortcuts()

setup_ui

setup_ui() -> None
Source code
314
315
316
def setup_ui(self) -> None:
    self.vlayout = VBoxLayout(self)
    self.hlayout = HBoxLayout(self.vlayout)

setup_view

setup_view() -> None
Source code
234
235
236
237
238
239
def setup_view(self) -> None:
    for item in self.graphics_scene.graphics_items:
        item.hide()

    self.current_scene.show()
    self.graphics_scene.setSceneRect(QRectF(self.current_scene.pixmap().rect()))

wheelEvent

wheelEvent(event: QWheelEvent) -> None
Source code
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
def wheelEvent(self, event: QWheelEvent) -> None:
    if self.underReload or self.autofit:
        return event.ignore()

    assert self.app

    modifier = event.modifiers()
    mouse = event.buttons()

    self.propagate_move_event()

    if modifier == Qt.KeyboardModifier.ControlModifier or mouse in {
        Qt.MouseButton.RightButton, Qt.MouseButton.MiddleButton
    }:
        angleDelta = event.angleDelta().y()

        # check if wheel wasn't rotated the other way since last rotation
        if self.angleRemainder * angleDelta < 0:
            self.angleRemainder = 0

        self.angleRemainder += angleDelta

        if abs(self.angleRemainder) >= self.WHEEL_STEP:
            self.wheelScrolled.emit(self.angleRemainder // self.WHEEL_STEP)
            self.angleRemainder %= self.WHEEL_STEP
        return
    elif modifier == Qt.KeyboardModifier.NoModifier:
        self.verticalScrollBar().setValue(self.verticalScrollBar().value() - event.angleDelta().y())
        self.horizontalScrollBar().setValue(self.horizontalScrollBar().value() - event.angleDelta().x())
        return
    elif modifier == Qt.KeyboardModifier.ShiftModifier:
        self.verticalScrollBar().setValue(self.verticalScrollBar().value() - event.angleDelta().x())
        self.horizontalScrollBar().setValue(self.horizontalScrollBar().value() - event.angleDelta().y())
        return

    event.ignore()

PluginGraphicsView

PluginGraphicsView(
    main: MainWindow | MappedNodesPlugin,
    plugin: MappedNodesPlugin | None = None,
    parent: QWidget | None = None,
)

Bases: GraphicsView

Methods:

Attributes:

Source code
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
def __init__(
    self, main: MainWindow | MappedNodesPlugin, plugin: MappedNodesPlugin | None = None,
    parent: QWidget | None = None
) -> None:
    if isinstance(main, MappedNodesPlugin):
        plugin = main
        main = main.main

    super().__init__(main, parent)

    if plugin:
        self.plugin = plugin
        self.setSizePolicy(QSizePolicy.Policy.Maximum, QSizePolicy.Policy.Maximum)
    elif isinstance(self, MappedNodesPlugin):
        self.plugin = self
    else:
        raise RuntimeError('This GraphicsView has to be bound to a MappedNodesPlugin!')

    if isinstance(self, AbstractPlugin):
        self.plugin.on_first_load.connect(PluginGraphicsView.first_load.__get__(self))
    else:
        self.plugin.on_first_load.connect(self.first_load)

WHEEL_STEP class-attribute instance-attribute

WHEEL_STEP = 15 * 8

angleRemainder instance-attribute

angleRemainder = 0

app instance-attribute

app = instance()

auto_fit_button instance-attribute

auto_fit_button = CheckBox('Auto-fit', self, clicked=auto_fit_button_clicked)

autofit property writable

autofit: bool

content_height property

content_height: int

content_width property

content_width: int

controls instance-attribute

controls = QFrame()

currentZoom instance-attribute

currentZoom = 0.0

current_scene property

current_scene: GraphicsImageItem

dragEvent class-attribute instance-attribute

dragEvent = pyqtSignal(DragEventType)

drag_mode instance-attribute

drag_mode: DragMode = dragMode()

graphics_scene instance-attribute

graphics_scene = GraphicsScene(self)

last_positions class-attribute instance-attribute

last_positions = (0, 0)

main instance-attribute

main: MainWindow = main

mouseMoved class-attribute instance-attribute

mouseMoved = pyqtSignal(QMouseEvent)

mousePressed class-attribute instance-attribute

mousePressed = pyqtSignal(QMouseEvent)

mouseReleased class-attribute instance-attribute

mouseReleased = pyqtSignal(QMouseEvent)

plugin instance-attribute

underReload class-attribute instance-attribute

underReload = False

wheelScrolled class-attribute instance-attribute

wheelScrolled = pyqtSignal(int)

zoomValue instance-attribute

zoomValue = 0.0

zoom_combobox instance-attribute

zoom_combobox = ComboBox[float](self, minimumContentsLength=4)

afterReload

afterReload() -> None
Source code
371
372
373
374
375
def afterReload(self) -> None:
    self.underReload = False
    self.verticalScrollBar().setValue(self.last_positions[0])
    self.horizontalScrollBar().setValue(self.last_positions[1])
    self.setTransformationAnchor(QGraphicsView.ViewportAnchor.AnchorUnderMouse)

auto_fit_button_clicked

auto_fit_button_clicked(checked: bool) -> None
Source code
212
213
def auto_fit_button_clicked(self, checked: bool) -> None:
    self.autofit = checked

beforeReload

beforeReload() -> None
Source code
366
367
368
369
def beforeReload(self) -> None:
    self.underReload = True
    self.setTransformationAnchor(QGraphicsView.ViewportAnchor.AnchorViewCenter)
    self.last_positions = (self.verticalScrollBar().value(), self.horizontalScrollBar().value())

bind_to

bind_to(other_view: GraphicsView, *, mutual: bool = True) -> None
Source code
241
242
243
244
245
def bind_to(self, other_view: GraphicsView, *, mutual: bool = True) -> None:
    self.main.bound_graphics_views[other_view].add(self)

    if mutual:
        self.main.bound_graphics_views[self].add(other_view)

event

event(event: QEvent) -> bool
Source code
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
def event(self, event: QEvent) -> bool:
    if self.underReload:
        event.ignore()
        return False

    if isinstance(event, QNativeGestureEvent):
        typ = event.gestureType()
        if typ == Qt.NativeGestureType.BeginNativeGesture:
            self.zoomValue = 0.0
        elif typ == Qt.NativeGestureType.ZoomNativeGesture:
            self.zoomValue += event.value()
        if typ == Qt.NativeGestureType.EndNativeGesture:
            self.wheelScrolled.emit(-1 if self.zoomValue < 0 else 1)

    return super().event(event)

first_load

first_load() -> None
Source code
122
123
124
def first_load(self) -> None:
    self.graphics_scene.init_scenes()
    self.setup_view()

mouseMoveEvent

mouseMoveEvent(event: QMouseEvent) -> None
Source code
330
331
332
333
334
335
336
337
338
339
def mouseMoveEvent(self, event: QMouseEvent) -> None:
    if self.underReload or self.autofit:
        return event.ignore()

    super().mouseMoveEvent(event)

    if self.hasMouseTracking():
        self.mouseMoved.emit(event)

    self.dragEvent.emit(DragEventType.move)

mousePressEvent

mousePressEvent(event: QMouseEvent) -> None
Source code
341
342
343
344
345
346
347
348
349
350
351
352
def mousePressEvent(self, event: QMouseEvent) -> None:
    if self.underReload or self.autofit:
        return event.ignore()

    if event.button() == Qt.MouseButton.LeftButton:
        self.drag_mode = self.dragMode()
        self.setDragMode(QGraphicsView.DragMode.ScrollHandDrag)

    super().mousePressEvent(event)

    self.mousePressed.emit(event)
    self.dragEvent.emit(DragEventType.start)

mouseReleaseEvent

mouseReleaseEvent(event: QMouseEvent) -> None
Source code
354
355
356
357
358
359
360
361
362
363
364
def mouseReleaseEvent(self, event: QMouseEvent) -> None:
    if self.underReload or self.autofit:
        return event.ignore()

    super().mouseReleaseEvent(event)

    if event.button() == Qt.MouseButton.LeftButton:
        self.setDragMode(self.drag_mode)

    self.mouseReleased.emit(event)
    self.dragEvent.emit(DragEventType.stop)

on_wheel_scrolled

on_wheel_scrolled(steps: int) -> None
Source code
247
248
249
250
251
252
253
254
255
def on_wheel_scrolled(self, steps: int) -> None:
    new_index = self.zoom_combobox.currentIndex() + steps

    if new_index < 0:
        new_index = 0
    elif new_index >= len(self.main.settings.zoom_levels):
        new_index = len(self.main.settings.zoom_levels) - 1

    self.zoom_combobox.setCurrentIndex(new_index)

propagate_move_event

propagate_move_event(_: Any = None) -> None
Source code
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
def propagate_move_event(self, _: Any = None) -> None:
    scrollbarW, scrollbarH = self.horizontalScrollBar(), self.verticalScrollBar()

    if not any({scrollbarW.isVisible(), scrollbarH.isVisible()}):
        return

    widthMax, heightMax = scrollbarW.maximum(), scrollbarH.maximum()

    for view in self.main.bound_graphics_views[self] - {self}:
        if view.isVisible():
            wBar, hBar = view.horizontalScrollBar(), view.verticalScrollBar()

            if widthMax:
                wBar.setValue(int(scrollbarW.value() * wBar.maximum() / widthMax))

            if heightMax:
                hBar.setValue(int(scrollbarH.value() * hBar.maximum() / heightMax))

resizeEvent

resizeEvent(event: QResizeEvent) -> None
Source code
377
378
379
def resizeEvent(self, event: QResizeEvent) -> None:
    super().resizeEvent(event)
    self.setZoom(None)

setZoom

setZoom(value: float | None) -> None
Source code
257
258
259
def setZoom(self, value: float | None) -> None:
    for view in self.main.bound_graphics_views[self]:
        view._setZoom(value)

setup_view

setup_view() -> None
Source code
234
235
236
237
238
239
def setup_view(self) -> None:
    for item in self.graphics_scene.graphics_items:
        item.hide()

    self.current_scene.show()
    self.graphics_scene.setSceneRect(QRectF(self.current_scene.pixmap().rect()))

wheelEvent

wheelEvent(event: QWheelEvent) -> None
Source code
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
def wheelEvent(self, event: QWheelEvent) -> None:
    if self.underReload or self.autofit:
        return event.ignore()

    assert self.app

    modifier = event.modifiers()
    mouse = event.buttons()

    self.propagate_move_event()

    if modifier == Qt.KeyboardModifier.ControlModifier or mouse in {
        Qt.MouseButton.RightButton, Qt.MouseButton.MiddleButton
    }:
        angleDelta = event.angleDelta().y()

        # check if wheel wasn't rotated the other way since last rotation
        if self.angleRemainder * angleDelta < 0:
            self.angleRemainder = 0

        self.angleRemainder += angleDelta

        if abs(self.angleRemainder) >= self.WHEEL_STEP:
            self.wheelScrolled.emit(self.angleRemainder // self.WHEEL_STEP)
            self.angleRemainder %= self.WHEEL_STEP
        return
    elif modifier == Qt.KeyboardModifier.NoModifier:
        self.verticalScrollBar().setValue(self.verticalScrollBar().value() - event.angleDelta().y())
        self.horizontalScrollBar().setValue(self.horizontalScrollBar().value() - event.angleDelta().x())
        return
    elif modifier == Qt.KeyboardModifier.ShiftModifier:
        self.verticalScrollBar().setValue(self.verticalScrollBar().value() - event.angleDelta().x())
        self.horizontalScrollBar().setValue(self.horizontalScrollBar().value() - event.angleDelta().y())
        return

    event.ignore()

PluginVideoOutputs

PluginVideoOutputs(main: MainWindow | None = None)

Bases: vs_object, dict[VideoOutput, VideoOutput]

Attributes:

Source code
24
25
def __init__(self, main: MainWindow | None = None) -> None:
    self.main = main or main_window()

current property

current: VideoOutput

main instance-attribute

main = main or main_window()

prepared property

prepared: VideoNode

source property

source: VideoNode