Skip to content

abstract

Classes:

AbstractPlugin

AbstractPlugin(main: MainWindow)

Bases: ExtendedWidgetBase, NotchProvider

Methods:

Attributes:

Source code
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
def __init__(self, main: MainWindow) -> None:
    try:
        super().__init__(main)  # type: ignore
        self.init_notches(main)

        assert isinstance(self, QWidget)
    except TypeError as e:
        print('\tMake sure you\'re inheriting a QWidget!\n')

        raise e

    self.main = main

    self.setSizePolicy(QSizePolicy.Policy.Maximum, QSizePolicy.Policy.Maximum)

    self._first_load_done = False

    self.shortcuts = []
    self.__legacy_counter_shortcuts = 0
    self.add_shortcuts()

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()

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_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
146
147
def init_outputs(self) -> None:
    ...

on_current_frame_changed

on_current_frame_changed(frame: Frame) -> None
Source code
196
197
def on_current_frame_changed(self, frame: Frame) -> None:
    ...

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:
    ...

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)

FileResolvePluginConfig

Bases: _BasePluginConfig, NamedTuple

Attributes:

display_name instance-attribute

display_name: str

namespace instance-attribute

namespace: str

settings_type class-attribute instance-attribute

FileResolverPlugin

Methods:

Attributes:

settings instance-attribute

settings: PluginSettings

temp_handles class-attribute instance-attribute

temp_handles = set[SPath]()

can_run_file

can_run_file(filepath: Path) -> bool
Source code
221
222
def can_run_file(self, filepath: Path) -> bool:
    raise NotImplementedError

cleanup

cleanup() -> None
Source code
227
228
229
230
231
232
233
234
235
236
237
238
def cleanup(self) -> None:
    for file in self.temp_handles:
        try:
            if not file.exists():
                continue

            if file.is_dir():
                file.rmdirs(True)
            else:
                file.unlink(True)
        except PermissionError:
            continue

get_extensions

get_extensions() -> Iterable[str]
Source code
218
219
def get_extensions(self) -> Iterable[str]:
    return []

get_temp_path

get_temp_path(is_folder: bool = False) -> SPath
Source code
240
241
242
243
244
245
246
247
248
249
250
251
252
def get_temp_path(self, is_folder: bool = False) -> SPath:
    from tempfile import mkdtemp, mkstemp

    if is_folder:
        temp = mkdtemp()
    else:
        temp = mkstemp()[1]

    temp_path = SPath(temp)

    self.temp_handles.add(temp_path)

    return temp_path

resolve_path

resolve_path(filepath: Path) -> ResolvedScript
Source code
224
225
def resolve_path(self, filepath: Path) -> ResolvedScript:
    raise NotImplementedError

PluginConfig

Bases: _BasePluginConfig, NamedTuple

Attributes:

display_name instance-attribute

display_name: str

namespace instance-attribute

namespace: str

settings_type class-attribute instance-attribute

visible_in_tab class-attribute instance-attribute

visible_in_tab: bool = True

PluginSettings

PluginSettings(plugin: AbstractPlugin)

Bases: QYAMLObject

Attributes:

Source code
43
44
45
46
47
def __init__(self, plugin: AbstractPlugin) -> None:
    self.plugin = plugin
    self.local = SettingsNamespace()
    self.globals = SettingsNamespace()
    self.fired_events = [False, False]

fired_events instance-attribute

fired_events = [False, False]

globals instance-attribute

globals = SettingsNamespace()

local instance-attribute

plugin instance-attribute

plugin = plugin

PluginShortcut

Bases: NamedTuple

Attributes:

description class-attribute instance-attribute

description: str | None = None

handler instance-attribute

handler: Callable[[], None] | str

key class-attribute instance-attribute

key: QKeySequence | None = None

name instance-attribute

name: str

parent instance-attribute

parent: QObject | str

ResolvedScript

Bases: NamedTuple

Attributes:

arguments class-attribute instance-attribute

arguments: dict[str, Any] = {}

display_name instance-attribute

display_name: str

path instance-attribute

path: Path

reload_enabled class-attribute instance-attribute

reload_enabled: bool = True

SettingsNamespace

Bases: dict[str, Any]