Skip to content

settings

Classes:

MainSettings

MainSettings(parent: type[AbstractToolbar] | AbstractToolbar)

Bases: AbstractToolbarSettings

Methods:

Attributes:

Source code
393
394
395
396
def __init__(self, parent: type[AbstractToolbar] | AbstractToolbar) -> None:
    self.parent_toolbar_type = parent if isinstance(parent, type) else parent.__class__

    super().__init__()

INSTANT_FRAME_UPDATE class-attribute instance-attribute

INSTANT_FRAME_UPDATE = False

STORAGE_BACKUPS_COUNT class-attribute instance-attribute

STORAGE_BACKUPS_COUNT = 2

SYNC_OUTPUTS class-attribute instance-attribute

SYNC_OUTPUTS = True

autosave_interval property

autosave_interval: Time

base_ppi property

base_ppi: int

color_management property

color_management: bool

dark_theme_enabled property

dark_theme_enabled: bool

dragnavigator_timeout property

dragnavigator_timeout: int

dragtimeline_timeout property

dragtimeline_timeout: int

force_old_storages_removal property

force_old_storages_removal: int

hlayout instance-attribute

hlayout: HBoxLayout

opengl_rendering_enabled property

opengl_rendering_enabled: bool

output_index property

output_index: int

output_primaries_zimg property

output_primaries_zimg: int

parent_toolbar_type instance-attribute

parent_toolbar_type = parent if isinstance(parent, type) else __class__

plugins_bar_save_behaviour property

plugins_bar_save_behaviour: int

png_compression_level property

png_compression_level: int

statusbar_message_timeout property

statusbar_message_timeout: Time

storable_attrs class-attribute

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

timeline_label_notches_margin property

timeline_label_notches_margin: int

usable_cpus_count property

usable_cpus_count: int

vlayout instance-attribute

vlayout: VBoxLayout

zoom_default_index property

zoom_default_index: int

zoom_levels property writable

zoom_levels: list[float]

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

get_usable_cpus_count staticmethod

get_usable_cpus_count() -> int
Source code
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
@staticmethod
def get_usable_cpus_count() -> int:
    from os import getpid
    try:
        from win32.win32api import OpenProcess  # type: ignore
        from win32.win32process import GetProcessAffinityMask  # type: ignore
        from win32con import PROCESS_QUERY_LIMITED_INFORMATION  # type: ignore
        proc_mask, _ = GetProcessAffinityMask(OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, False, getpid()))
        cpus = [i for i in range(64) if (1 << i) & proc_mask]
        return len(cpus)
    except Exception:
        try:
            from os import sched_getaffinity  # type: ignore
            return len(sched_getaffinity(getpid()))
        except Exception:
            return cpu_count()

set_defaults

set_defaults() -> None
Source code
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
def set_defaults(self) -> None:
    self.autosave_control.setValue(Time(seconds=30))
    self.base_ppi_spinbox.setValue(96)
    self.dark_theme_checkbox.setChecked(True)
    self.opengl_rendering_checkbox.setChecked(False)
    self.output_index_spinbox.setValue(0)
    self.png_compressing_spinbox.setValue(0)
    self.statusbar_timeout_control.setValue(Time(seconds=2.5))
    self.timeline_notches_margin_spinbox.setValue(20)
    self.force_old_storages_removal_checkbox.setChecked(False)
    self.usable_cpus_spinbox.setValue(self.get_usable_cpus_count())
    self.dragnavigator_timeout_spinbox.setValue(250)
    self.dragtimeline_timeout_spinbox.setValue(40)

    self.zoom_levels = [50 * (2 ** i) for i in range(8)]
    self.zoom_level_default_combobox.setCurrentIndex(1)
    self.color_management_checkbox.setChecked(self.color_management_checkbox.isVisible())
    self.plugins_save_position_combobox.setCurrentIndex(2)

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
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
def setup_ui(self) -> None:
    super().setup_ui()

    self.autosave_control = TimeEdit(self)

    self.base_ppi_spinbox = SpinBox(
        self, 1, 999, valueChanged=lambda: hasattr(main_window(), 'timeline') and main_window().timeline.set_sizes()
    )

    self.dark_theme_checkbox = CheckBox('Dark theme', self, clicked=lambda: main_window().apply_stylesheet())

    self.opengl_rendering_checkbox = CheckBox('OpenGL rendering', self)

    self.force_old_storages_removal_checkbox = CheckBox('Remove old storages', self)

    self.output_index_spinbox = SpinBox(self, 0, 65535)

    self.png_compressing_spinbox = SpinBox(self, 0, 100)

    self.statusbar_timeout_control = TimeEdit(self)

    self.timeline_notches_margin_spinbox = SpinBox(self, 1, 9999, '%')

    self.usable_cpus_spinbox = SpinBox(self, 1, self.get_usable_cpus_count())

    self.zoom_levels_combobox = ComboBox[int](editable=True, insertPolicy=QComboBox.InsertPolicy.NoInsert)
    self.zoom_levels_lineedit = self.zoom_levels_combobox.lineEdit()

    self.zoom_levels_lineedit.returnPressed.connect(self.zoom_levels_combobox_on_add)
    QShortcut(  # type: ignore
        QKeyCombination(Qt.Modifier.CTRL, Qt.Key.Key_Delete).toCombined(), self.zoom_levels_combobox,
        activated=partial(self.zoom_levels_combobox_on_remove, True)
    )

    self.zoom_level_default_combobox = ComboBox[int]()

    self.dragnavigator_timeout_spinbox = SpinBox(self, 0, 1000 * 60 * 5)
    self.dragtimeline_timeout_spinbox = SpinBox(self, 0, 500)

    self.primaries_combobox = ComboBox[str](
        model=GeneralModel[str]([
            'sRGB', 'DCI-P3'
        ], False)
    )

    self.color_management_checkbox = CheckBox('Color management', self)

    self.plugins_save_position_combobox = ComboBox[str](model=GeneralModel[str](['no', 'global', 'local']))

    HBoxLayout(self.vlayout, [QLabel('Autosave interval (0 - disable)'), self.autosave_control])

    HBoxLayout(self.vlayout, [QLabel('Base PPI'), self.base_ppi_spinbox])

    HBoxLayout(self.vlayout, [self.dark_theme_checkbox, self.force_old_storages_removal_checkbox])
    HBoxLayout(self.vlayout, [self.opengl_rendering_checkbox])

    HBoxLayout(self.vlayout, [QLabel('Default output index'), self.output_index_spinbox])

    HBoxLayout(self.vlayout, [QLabel('PNG compression level (0 (max) - 100 (min))'), self.png_compressing_spinbox])

    HBoxLayout(self.vlayout, [QLabel('Status bar message timeout'), self.statusbar_timeout_control])

    HBoxLayout(self.vlayout, [
        QLabel('Timeline label notches margin', self), self.timeline_notches_margin_spinbox
    ])

    HBoxLayout(self.vlayout, [QLabel('Usable CPUs count'), self.usable_cpus_spinbox])

    HBoxLayout(self.vlayout, [
        VBoxLayout([
            QLabel('Zoom Levels'),
            HBoxLayout([
                self.zoom_levels_combobox,
                PushButton('❌', clicked=self.zoom_levels_combobox_on_remove, maximumWidth=18),
                PushButton('✔️', clicked=self.zoom_levels_combobox_on_add, maximumWidth=18),
            ])
        ]),
        VBoxLayout([QLabel('Default Zoom Level'), self.zoom_level_default_combobox])
    ])

    HBoxLayout(self.vlayout, [QLabel('Drag Navigator Timeout (ms)'), self.dragnavigator_timeout_spinbox])

    HBoxLayout(self.vlayout, [QLabel('Drag Timeline Timeout (ms)'), self.dragtimeline_timeout_spinbox])

    HBoxLayout(self.vlayout, [QLabel('Output Primaries'), self.primaries_combobox])

    HBoxLayout(self.vlayout, [QLabel('Save Plugins Bar Position'), self.plugins_save_position_combobox])

    if sys.platform == 'win32':
        HBoxLayout(self.vlayout, [self.color_management_checkbox])

zoom_levels_combobox_on_add

zoom_levels_combobox_on_add() -> None
Source code
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
def zoom_levels_combobox_on_add(self) -> None:
    try:
        new_value = int(self.zoom_levels_lineedit.text())
    except ValueError:
        return

    if not new_value:
        return

    zoom_levels = [x * 100 for x in self.zoom_levels]

    if new_value in zoom_levels:
        return

    self.zoom_levels = [*zoom_levels, new_value]

zoom_levels_combobox_on_remove

zoom_levels_combobox_on_remove(checkFocus: bool = False) -> None
Source code
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
def zoom_levels_combobox_on_remove(self, checkFocus: bool = False) -> None:
    if checkFocus and not self.zoom_levels_lineedit.hasFocus():
        return

    try:
        old_value = int(self.zoom_levels_lineedit.text())
    except ValueError:
        return

    if not old_value:
        return

    zoom_levels = [x * 100 for x in self.zoom_levels]

    if old_value not in zoom_levels:
        return

    self.zoom_levels = [x for x in zoom_levels if round(x) != round(old_value)]

WindowSettings