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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159 | def setup_ui(self) -> None:
super().setup_ui()
self.reload_script_button = PushButton(
'Reload Script', self, clicked=self.main.reload_script, hidden=not self.main.reload_enabled
)
self.save_storage_button = PushButton(
'Save Storage', self, clicked=partial(self.main.dump_storage_async)
)
self.autosave_checkbox = CheckBox('Autosave', self, checked=True)
self.copy_frame_button = PushButton('Copy Frame', self, clicked=self.copy_frame_to_clipboard)
self.save_frame_as_button = PushButton('Save Frame as', self, clicked=self.on_save_frame_as_clicked)
self.save_template_lineedit = LineEdit(
self.settings.SAVE_TEMPLATE, self, text=self.settings.SAVE_TEMPLATE,
tooltip='''
Available placeholders:
{format}, {fps_den}, {fps_num}, {frame},
{height}, {index}, {node_name}, {matrix},
{primaries}, {range}, {script_name}, {total_frames},
{transfer}, {width}.
Frame props can be accessed as well using their names.
'''.replace(' ' * 16, ' ').strip()
)
first_layer = [self.autosave_checkbox, self.get_separator()]
if 'debug' in self.main.toolbars.toolbar_names:
self.show_debug_checkbox = CheckBox('Show Debug Toolbar', self, stateChanged=self.on_show_debug_changed)
first_layer.append(self.show_debug_checkbox)
self.__slots__ = tuple([*self.__slots__, 'show_debug_checkbox']) # type: ignore
VBoxLayout(self.hlayout, [
HBoxLayout([*first_layer, Stretch()]),
HBoxLayout([
*(
[self.reload_script_button, self.get_separator()]
if self.main.reload_enabled else
[]
),
self.save_storage_button, self.get_separator(),
self.copy_frame_button, Stretch()
]),
HBoxLayout([self.save_frame_as_button, self.save_template_lineedit, Stretch()])
])
self.hlayout.addStretch()
self.hlayout.addStretch()
self.ar_active_switch = Switch(
10, checked=False, clicked=lambda active: (ArInfo.active.__set__(ArInfo, active), self.update_sar()),
tooltip='Toggle respect SAR properties'
)
self.crop_active_switch = Switch(10, 22, checked=True, clicked=self.crop_active_onchange)
self.crop_top_spinbox = SpinBox(None, 0, 2 ** 16, valueChanged=self.crop_top_onchange)
self.crop_left_spinbox = SpinBox(None, 0, 2 ** 16, valueChanged=self.crop_left_onchange)
self.crop_bottom_spinbox = SpinBox(None, 0, 2 ** 16, valueChanged=self.crop_bottom_onchange)
self.crop_right_spinbox = SpinBox(None, 0, 2 ** 16, valueChanged=self.crop_right_onchange)
self.crop_width_spinbox = SpinBox(None, 1, 2 ** 16, valueChanged=self.crop_width_onchange)
self.crop_height_spinbox = SpinBox(None, 1, 2 ** 16, valueChanged=self.crop_height_onchange)
self.crop_copycommand_button = PushButton('Copy cropping command', clicked=self.crop_copycommand_onclick)
self.crop_mode_combox = ComboBox[str](
self, model=GeneralModel[str](['relative', 'absolute']),
currentIndex=0, sizeAdjustPolicy=QComboBox.SizeAdjustPolicy.AdjustToContents
)
self.crop_mode_combox.currentIndexChanged.connect(self.crop_mode_onchange)
self.crop_active_switch.click()
HBoxLayout(self.hlayout, [
VBoxLayout([
HBoxLayout([
QLabel('Toggle SAR'), self.ar_active_switch,
], spacing=0)
]),
VBoxLayout([
HBoxLayout([
QLabel('Top'), self.crop_top_spinbox, QSpacerItem(35, 10)
], alignment=Qt.AlignmentFlag.AlignCenter, spacing=0),
HBoxLayout([
QLabel('Left'), self.crop_left_spinbox,
self.crop_active_switch,
self.crop_right_spinbox, QLabel('Right')
], alignment=Qt.AlignmentFlag.AlignCenter, spacing=5),
HBoxLayout([
QLabel('Bottom'), self.crop_bottom_spinbox, QSpacerItem(51, 10)
], alignment=Qt.AlignmentFlag.AlignCenter, spacing=0)
]),
VBoxLayout([
HBoxLayout([QLabel('Cropping Type:'), self.crop_mode_combox]),
HBoxLayout([
QLabel('Width'), self.crop_width_spinbox,
QLabel('Height'), self.crop_height_spinbox
], spacing=0),
HBoxLayout([self.crop_copycommand_button])
])
])
|