Skip to content

toolbar

Classes:

DebugToolbar

DebugToolbar(main: MainWindow)

Bases: AbstractToolbar

Methods:

Attributes:

Source code
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
def __init__(self, main: MainWindow) -> None:
    from ...utils import debug

    super().__init__(main, DebugSettings(self))

    self.debug_logging_enabled = False
    self.setup_ui()

    if self.settings.DEBUG_TOOLBAR_BUTTONS_PRINT_STATE:
        self.filter = debug.EventFilter(main)

        self.main.toolbars.main.widget.installEventFilter(self.filter)  # type: ignore

        for toolbar in self.main.toolbars:
            toolbar.widget.installEventFilter(self.filter)  # type: ignore

    self.set_qobject_names()

class_storable_attrs class-attribute instance-attribute

class_storable_attrs = tuple[str, ...](('settings', 'visibility'))

debug_logging_enabled instance-attribute

debug_logging_enabled = False

filter instance-attribute

filter = EventFilter(main)

hlayout instance-attribute

hlayout: HBoxLayout

is_notches_visible property

is_notches_visible: bool

main instance-attribute

main: MainWindow = main

name instance-attribute

name: str = __name__[:-7]

notches_changed class-attribute instance-attribute

notches_changed = pyqtSignal(ExtendedWidget)

num_keys class-attribute instance-attribute

num_keys = [
    Key_1,
    Key_2,
    Key_3,
    Key_4,
    Key_5,
    Key_6,
    Key_7,
    Key_8,
    Key_9,
    Key_0,
]

settings instance-attribute

settings: DebugSettings

storable_attrs class-attribute instance-attribute

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

toggle_button instance-attribute

toggle_button = PushButton(name, self, checkable=True, clicked=on_toggle)

visibility instance-attribute

visibility = False

vlayout instance-attribute

vlayout: VBoxLayout

break_button_clicked

break_button_clicked(checked: bool | None = None) -> None
Source code
77
78
def break_button_clicked(self, checked: bool | None = None) -> None:
    breakpoint()

exec_button_clicked

exec_button_clicked(checked: bool | None = None) -> None
Source code
71
72
73
74
75
def exec_button_clicked(self, checked: bool | None = None) -> None:
    try:
        exec(self.exec_lineedit.text())
    except BaseException as e:
        logging.error(e)

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)

on_current_frame_changed

on_current_frame_changed(frame: Frame) -> None
Source code
471
472
def on_current_frame_changed(self, frame: Frame) -> None:
    pass

on_current_output_changed

on_current_output_changed(index: int, prev_index: int) -> None
Source code
474
475
def on_current_output_changed(self, index: int, prev_index: int) -> None:
    pass

on_toggle

on_toggle(new_state: bool) -> None
Source code
461
462
463
464
465
466
467
468
469
def on_toggle(self, new_state: bool) -> None:
    if new_state == self.visibility:
        return

    # invoking order matters
    self.setVisible(new_state)
    self.visibility = new_state
    self.toggle_button.setChecked(new_state)
    self.resize_main_window(new_state)

resize_main_window

resize_main_window(expanding: bool) -> None
Source code
481
482
483
484
485
486
487
488
489
def resize_main_window(self, expanding: bool) -> None:
    if self.main.windowState() in {Qt.WindowState.WindowMaximized, Qt.WindowState.WindowFullScreen}:
        return

    if expanding:
        self.main.resize(self.main.width(), self.main.height() + self.height() + round(6 * self.main.display_scale))
    if not expanding:
        self.main.resize(self.main.width(), self.main.height() - self.height() - round(6 * self.main.display_scale))
        self.main.timeline.update()

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_ui

setup_ui() -> None
Source code
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
def setup_ui(self) -> None:
    super().setup_ui()

    self.exec_lineedit = LineEdit(
        'Python statement in context of DebugToolbar.exec_button_clicked()',
        self, editingFinished=self.exec_button_clicked
    )

    self.hlayout.addWidgets([
        PushButton('Test', self, clicked=self.test_button_clicked),
        PushButton('Break', self),
        self.exec_lineedit,
        PushButton('Exec', self, clicked=self.exec_button_clicked)
    ])

    self.hlayout.addStretch()

    debug_logging_label = QLabel("Debug Logging")
    self.hlayout.addWidget(debug_logging_label)

    self.debug_logging_switch = Switch(10, 22, checked=self.debug_logging_enabled, clicked=self.toggle_debug_logging)
    self.hlayout.addWidget(self.debug_logging_switch)

test_button_clicked

test_button_clicked(checked: bool | None = None) -> None
Source code
67
68
69
def test_button_clicked(self, checked: bool | None = None) -> None:
    from vstools.utils.vs_proxy import clear_cache
    clear_cache()

toggle_debug_logging

toggle_debug_logging(checked: bool) -> None
Source code
80
81
82
83
84
85
def toggle_debug_logging(self, checked: bool) -> None:
    self.debug_logging_enabled = checked

    logging.getLogger().setLevel(logging.DEBUG if checked else logging.INFO)

    logging.info(f"Debug logging {'enabled' if checked else 'disabled'}")