Пример #1
0
    def __init__(self, main_window: AbstractMainWindow) -> None:
        from vspreview.toolbars import (
            DebugToolbar,
            MiscToolbar,
            PlaybackToolbar,
            SceningToolbar,
            BenchmarkToolbar,
            PipetteToolbar,
        )

        self.main = MainToolbar(main_window)
        self.main.setObjectName('Toolbars.main')

        self.misc = MiscToolbar(main_window)
        self.playback = PlaybackToolbar(main_window)
        self.scening = SceningToolbar(main_window)
        self.pipette = PipetteToolbar(main_window)
        self.benchmark = BenchmarkToolbar(main_window)
        self.debug = DebugToolbar(main_window)

        self.misc.setObjectName('Toolbars.misc')
        self.playback.setObjectName('Toolbars.playback')
        self.scening.setObjectName('Toolbars.scening')
        self.pipette.setObjectName('Toolbars.pipette')
        self.benchmark.setObjectName('Toolbars.benchmark')
        self.debug.setObjectName('Toolbars.debug')
Пример #2
0
class Toolbars(AbstractToolbars):
    yaml_tag = '!Toolbars'

    def __init__(self, main_window: AbstractMainWindow) -> None:
        from vspreview.toolbars import (
            DebugToolbar,
            MiscToolbar,
            PlaybackToolbar,
            SceningToolbar,
            BenchmarkToolbar,
            PipetteToolbar,
        )

        self.main = MainToolbar(main_window)
        self.main.setObjectName('Toolbars.main')

        self.misc = MiscToolbar(main_window)
        self.playback = PlaybackToolbar(main_window)
        self.scening = SceningToolbar(main_window)
        self.pipette = PipetteToolbar(main_window)
        self.benchmark = BenchmarkToolbar(main_window)
        self.debug = DebugToolbar(main_window)

        self.misc.setObjectName('Toolbars.misc')
        self.playback.setObjectName('Toolbars.playback')
        self.scening.setObjectName('Toolbars.scening')
        self.pipette.setObjectName('Toolbars.pipette')
        self.benchmark.setObjectName('Toolbars.benchmark')
        self.debug.setObjectName('Toolbars.debug')

    def __getstate__(self) -> Mapping[str, Mapping[str, Any]]:
        return {
            toolbar_name: getattr(self, toolbar_name).__getstate__()
            for toolbar_name in self.all_toolbars_names
        }

    def __setstate__(self, state: Mapping[str, Mapping[str, Any]]) -> None:
        for toolbar_name in self.all_toolbars_names:
            try:
                storage = state[toolbar_name]
                if not isinstance(storage, Mapping):
                    raise TypeError
                getattr(self, toolbar_name).__setstate__(storage)
            except (KeyError, TypeError):
                logging.warning(
                    f'Storage loading: failed to parse storage of {toolbar_name}.'
                )
Пример #3
0
    def __init__(self, main_window: AbstractMainWindow) -> None:
        from vspreview.toolbars import DebugToolbar, MiscToolbar, PlaybackToolbar, SceningToolbar

        self.main = MainToolbar(main_window)

        self.misc = MiscToolbar(main_window)
        self.playback = PlaybackToolbar(main_window)
        self.scening = SceningToolbar(main_window)
        self.debug = DebugToolbar(main_window)