Jaded-Encoding-Thaumaturgy / vs-preview

Previewer for VapourSynth scripts.
Apache License 2.0
57 stars 16 forks source link

Make plugins able to have notches #95

Closed jsaowji closed 1 year ago

jsaowji commented 1 year ago

Example:

from __future__ import annotations

from PyQt6.QtWidgets import QTableView
from ..core import Frame
from .abstract import AbstractPlugin
from PyQt6.QtGui import QColor
from PyQt6.QtCore import Qt

from typing import cast
from ..core import Notches,VBoxLayout, PushButton
__all__ = [
    'Plugin'
]
class Plugin(AbstractPlugin, QTableView):
    _plugin_name = 'Test notches'
    __slots__ = (

    )

    def on_current_frame_changed(self, frame: Frame) -> None:
        pass

    def get_notches(self) -> Notches:
        marks = Notches()
        marks.add(Frame(15), cast(QColor, Qt.GlobalColor.darkCyan))
        marks.add(Frame(30), cast(QColor, Qt.GlobalColor.darkCyan))

        return marks

    def is_notches_visible(self) -> bool:
        return self.isVisible()

    def setup_ui(self) -> None:
        VBoxLayout(self, [
            PushButton("Hello"),
        ])