sticker-convert 2.8.12__py3-none-any.whl → 2.17.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sticker_convert/__main__.py +24 -24
- sticker_convert/auth/__init__.py +0 -0
- sticker_convert/auth/auth_base.py +19 -0
- sticker_convert/auth/auth_discord.py +149 -0
- sticker_convert/{utils/auth/get_kakao_auth.py → auth/auth_kakao_android_login.py} +331 -300
- sticker_convert/auth/auth_kakao_desktop_login.py +327 -0
- sticker_convert/auth/auth_kakao_desktop_memdump.py +281 -0
- sticker_convert/{utils/auth/get_line_auth.py → auth/auth_line.py} +98 -80
- sticker_convert/auth/auth_signal.py +139 -0
- sticker_convert/auth/auth_telethon.py +161 -0
- sticker_convert/auth/auth_viber.py +250 -0
- sticker_convert/auth/telegram_api.py +736 -0
- sticker_convert/cli.py +623 -509
- sticker_convert/converter.py +1093 -962
- sticker_convert/definitions.py +11 -0
- sticker_convert/downloaders/download_band.py +111 -0
- sticker_convert/downloaders/download_base.py +171 -130
- sticker_convert/downloaders/download_discord.py +92 -0
- sticker_convert/downloaders/download_kakao.py +417 -255
- sticker_convert/downloaders/download_line.py +484 -472
- sticker_convert/downloaders/download_ogq.py +80 -0
- sticker_convert/downloaders/download_signal.py +108 -92
- sticker_convert/downloaders/download_telegram.py +56 -130
- sticker_convert/downloaders/download_viber.py +121 -95
- sticker_convert/gui.py +788 -795
- sticker_convert/gui_components/frames/comp_frame.py +180 -165
- sticker_convert/gui_components/frames/config_frame.py +156 -113
- sticker_convert/gui_components/frames/control_frame.py +32 -30
- sticker_convert/gui_components/frames/cred_frame.py +232 -162
- sticker_convert/gui_components/frames/input_frame.py +139 -137
- sticker_convert/gui_components/frames/output_frame.py +112 -110
- sticker_convert/gui_components/frames/right_clicker.py +25 -23
- sticker_convert/gui_components/windows/advanced_compression_window.py +757 -715
- sticker_convert/gui_components/windows/base_window.py +7 -2
- sticker_convert/gui_components/windows/discord_get_auth_window.py +79 -0
- sticker_convert/gui_components/windows/kakao_get_auth_window.py +511 -186
- sticker_convert/gui_components/windows/line_get_auth_window.py +94 -102
- sticker_convert/gui_components/windows/signal_get_auth_window.py +84 -135
- sticker_convert/gui_components/windows/viber_get_auth_window.py +168 -0
- sticker_convert/ios-message-stickers-template/.github/FUNDING.yml +3 -3
- sticker_convert/ios-message-stickers-template/.gitignore +0 -0
- sticker_convert/ios-message-stickers-template/README.md +10 -10
- sticker_convert/ios-message-stickers-template/stickers/Info.plist +43 -43
- sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Info.plist +31 -31
- sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/Contents.json +6 -6
- sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/Sticker Pack.stickerpack/Contents.json +20 -20
- sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/Sticker Pack.stickerpack/Sticker 1.sticker/Contents.json +9 -9
- sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/Sticker Pack.stickerpack/Sticker 1.sticker/Sticker 1.png +0 -0
- sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/Sticker Pack.stickerpack/Sticker 2.sticker/Contents.json +9 -9
- sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/Sticker Pack.stickerpack/Sticker 2.sticker/Sticker 2.png +0 -0
- sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/Sticker Pack.stickerpack/Sticker 3.sticker/Contents.json +9 -9
- sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/Sticker Pack.stickerpack/Sticker 3.sticker/Sticker 3.png +0 -0
- sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/App-Store-1024x1024pt.png +0 -0
- sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/Contents.json +91 -91
- sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/Messages-App-Store-1024x768pt.png +0 -0
- sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/Messages-iPad-67x50pt@2x.png +0 -0
- sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/Messages-iPad-Pro-74x55pt@2x.png +0 -0
- sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/Messages-iPhone-60x45pt@2x.png +0 -0
- sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/Messages-iPhone-60x45pt@3x.png +0 -0
- sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/Messages27x20pt@2x.png +0 -0
- sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/Messages27x20pt@3x.png +0 -0
- sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/Messages32x24pt@2x.png +0 -0
- sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/Messages32x24pt@3x.png +0 -0
- sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/iPad-Settings-29pt@2x.png +0 -0
- sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/iPhone-Settings-29pt@3x.png +0 -0
- sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/iPhone-settings-29pt@2x.png +0 -0
- sticker_convert/ios-message-stickers-template/stickers.xcodeproj/project.pbxproj +364 -364
- sticker_convert/ios-message-stickers-template/stickers.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -7
- sticker_convert/ios-message-stickers-template/stickers.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -8
- sticker_convert/ios-message-stickers-template/stickers.xcodeproj/project.xcworkspace/xcuserdata/niklaspeterson.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- sticker_convert/ios-message-stickers-template/stickers.xcodeproj/xcuserdata/niklaspeterson.xcuserdatad/xcschemes/xcschememanagement.plist +14 -14
- sticker_convert/job.py +279 -179
- sticker_convert/job_option.py +15 -2
- sticker_convert/locales/en_US/LC_MESSAGES/base.mo +0 -0
- sticker_convert/locales/ja_JP/LC_MESSAGES/base.mo +0 -0
- sticker_convert/locales/zh_CN/LC_MESSAGES/base.mo +0 -0
- sticker_convert/locales/zh_TW/LC_MESSAGES/base.mo +0 -0
- sticker_convert/py.typed +0 -0
- sticker_convert/resources/NotoColorEmoji.ttf +0 -0
- sticker_convert/resources/compression.json +220 -16
- sticker_convert/resources/emoji.json +527 -77
- sticker_convert/resources/help.ja_JP.json +88 -0
- sticker_convert/resources/help.json +24 -10
- sticker_convert/resources/help.zh_CN.json +88 -0
- sticker_convert/resources/help.zh_TW.json +88 -0
- sticker_convert/resources/input.ja_JP.json +74 -0
- sticker_convert/resources/input.json +121 -71
- sticker_convert/resources/input.zh_CN.json +74 -0
- sticker_convert/resources/input.zh_TW.json +74 -0
- sticker_convert/resources/memdump_linux.sh +25 -0
- sticker_convert/resources/memdump_windows.ps1 +8 -0
- sticker_convert/resources/output.ja_JP.json +38 -0
- sticker_convert/resources/output.json +24 -0
- sticker_convert/resources/output.zh_CN.json +38 -0
- sticker_convert/resources/output.zh_TW.json +38 -0
- sticker_convert/uploaders/compress_wastickers.py +186 -156
- sticker_convert/uploaders/upload_base.py +44 -35
- sticker_convert/uploaders/upload_signal.py +218 -173
- sticker_convert/uploaders/upload_telegram.py +353 -388
- sticker_convert/uploaders/upload_viber.py +178 -0
- sticker_convert/uploaders/xcode_imessage.py +295 -285
- sticker_convert/utils/callback.py +238 -6
- sticker_convert/utils/chrome_remotedebug.py +219 -0
- sticker_convert/utils/chromiums/linux.py +52 -0
- sticker_convert/utils/chromiums/osx.py +68 -0
- sticker_convert/utils/chromiums/windows.py +45 -0
- sticker_convert/utils/emoji.py +28 -0
- sticker_convert/utils/files/json_resources_loader.py +24 -19
- sticker_convert/utils/files/metadata_handler.py +8 -7
- sticker_convert/utils/files/run_bin.py +1 -1
- sticker_convert/utils/media/codec_info.py +99 -67
- sticker_convert/utils/media/format_verify.py +33 -20
- sticker_convert/utils/process.py +231 -0
- sticker_convert/utils/translate.py +108 -0
- sticker_convert/utils/url_detect.py +40 -33
- sticker_convert/version.py +1 -1
- {sticker_convert-2.8.12.dist-info → sticker_convert-2.17.0.0.dist-info}/METADATA +189 -96
- sticker_convert-2.17.0.0.dist-info/RECORD +138 -0
- {sticker_convert-2.8.12.dist-info → sticker_convert-2.17.0.0.dist-info}/WHEEL +1 -1
- sticker_convert/utils/auth/get_signal_auth.py +0 -129
- sticker_convert-2.8.12.dist-info/RECORD +0 -101
- {sticker_convert-2.8.12.dist-info → sticker_convert-2.17.0.0.dist-info}/entry_points.txt +0 -0
- {sticker_convert-2.8.12.dist-info → sticker_convert-2.17.0.0.dist-info/licenses}/LICENSE +0 -0
- {sticker_convert-2.8.12.dist-info → sticker_convert-2.17.0.0.dist-info}/top_level.txt +0 -0
|
@@ -1,715 +1,757 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
from __future__ import annotations
|
|
3
|
-
|
|
4
|
-
import re
|
|
5
|
-
from
|
|
6
|
-
from
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
from
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
from sticker_convert.gui_components.
|
|
13
|
-
from sticker_convert.gui_components.
|
|
14
|
-
from sticker_convert.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
class AdvancedCompressionWindow(BaseWindow):
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
)
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
self.
|
|
39
|
-
self.
|
|
40
|
-
self.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
)
|
|
44
|
-
self.
|
|
45
|
-
self.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
)
|
|
49
|
-
self.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
self.
|
|
61
|
-
self.
|
|
62
|
-
self.
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
)
|
|
66
|
-
self.
|
|
67
|
-
self.
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
)
|
|
71
|
-
self.
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
self.
|
|
83
|
-
self.
|
|
84
|
-
self.
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
)
|
|
88
|
-
self.
|
|
89
|
-
self.
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
)
|
|
93
|
-
self.
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
self.
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
)
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
self.
|
|
129
|
-
self.
|
|
130
|
-
self.frame_advcomp,
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
)
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
self.
|
|
151
|
-
self.
|
|
152
|
-
self.frame_advcomp,
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
)
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
self.
|
|
173
|
-
self.
|
|
174
|
-
self.frame_advcomp,
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
)
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
self.
|
|
195
|
-
self.
|
|
196
|
-
self.frame_advcomp,
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
self.
|
|
206
|
-
self.
|
|
207
|
-
self.
|
|
208
|
-
self.
|
|
209
|
-
self.frame_advcomp, textvariable=self.gui.
|
|
210
|
-
)
|
|
211
|
-
self.
|
|
212
|
-
self.
|
|
213
|
-
self.
|
|
214
|
-
self.frame_advcomp, textvariable=self.gui.
|
|
215
|
-
)
|
|
216
|
-
self.
|
|
217
|
-
|
|
218
|
-
self.
|
|
219
|
-
self.
|
|
220
|
-
self.
|
|
221
|
-
self.
|
|
222
|
-
self.frame_advcomp, textvariable=self.gui.
|
|
223
|
-
)
|
|
224
|
-
self.
|
|
225
|
-
self.
|
|
226
|
-
self.
|
|
227
|
-
self.frame_advcomp, textvariable=self.gui.
|
|
228
|
-
)
|
|
229
|
-
self.
|
|
230
|
-
|
|
231
|
-
self.
|
|
232
|
-
|
|
233
|
-
)
|
|
234
|
-
self.
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
)
|
|
239
|
-
self.
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
self.
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
)
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
self.
|
|
255
|
-
self.
|
|
256
|
-
self.frame_advcomp,
|
|
257
|
-
)
|
|
258
|
-
self.
|
|
259
|
-
self.frame_advcomp,
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
)
|
|
268
|
-
self.
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
self.
|
|
273
|
-
"
|
|
274
|
-
|
|
275
|
-
"
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
)
|
|
281
|
-
|
|
282
|
-
self.
|
|
283
|
-
self.
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
"
|
|
291
|
-
"
|
|
292
|
-
"
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
self.
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
self.
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
self.
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
self.
|
|
321
|
-
|
|
322
|
-
self.
|
|
323
|
-
self.
|
|
324
|
-
self.
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
self.
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
self.
|
|
333
|
-
self.
|
|
334
|
-
self.
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
self.
|
|
339
|
-
self.
|
|
340
|
-
self.
|
|
341
|
-
self.
|
|
342
|
-
self.
|
|
343
|
-
r
|
|
344
|
-
self.
|
|
345
|
-
|
|
346
|
-
self.
|
|
347
|
-
self.
|
|
348
|
-
self.
|
|
349
|
-
self.
|
|
350
|
-
self.
|
|
351
|
-
r
|
|
352
|
-
self.
|
|
353
|
-
|
|
354
|
-
self.
|
|
355
|
-
self.
|
|
356
|
-
self.
|
|
357
|
-
self.
|
|
358
|
-
self.
|
|
359
|
-
r
|
|
360
|
-
self.
|
|
361
|
-
|
|
362
|
-
self.
|
|
363
|
-
self.
|
|
364
|
-
self.
|
|
365
|
-
|
|
366
|
-
self.
|
|
367
|
-
r
|
|
368
|
-
self.
|
|
369
|
-
self.
|
|
370
|
-
self.
|
|
371
|
-
self.
|
|
372
|
-
self.
|
|
373
|
-
|
|
374
|
-
r
|
|
375
|
-
self.
|
|
376
|
-
self.
|
|
377
|
-
self.
|
|
378
|
-
self.
|
|
379
|
-
self.
|
|
380
|
-
self.
|
|
381
|
-
r += 1
|
|
382
|
-
self.
|
|
383
|
-
self.
|
|
384
|
-
self.
|
|
385
|
-
self.
|
|
386
|
-
self.
|
|
387
|
-
self.
|
|
388
|
-
r
|
|
389
|
-
|
|
390
|
-
self.
|
|
391
|
-
self.
|
|
392
|
-
self.
|
|
393
|
-
r
|
|
394
|
-
self.
|
|
395
|
-
self.
|
|
396
|
-
self.
|
|
397
|
-
r += 1
|
|
398
|
-
self.
|
|
399
|
-
self.
|
|
400
|
-
self.
|
|
401
|
-
self.
|
|
402
|
-
r
|
|
403
|
-
self.
|
|
404
|
-
|
|
405
|
-
self.
|
|
406
|
-
|
|
407
|
-
)
|
|
408
|
-
r
|
|
409
|
-
self.
|
|
410
|
-
self.
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
)
|
|
414
|
-
r
|
|
415
|
-
self.
|
|
416
|
-
self.
|
|
417
|
-
self.
|
|
418
|
-
|
|
419
|
-
)
|
|
420
|
-
r
|
|
421
|
-
self.
|
|
422
|
-
self.
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
self.
|
|
429
|
-
|
|
430
|
-
self.
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
self.
|
|
434
|
-
self.
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
self.
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
)
|
|
453
|
-
self.
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
self.
|
|
458
|
-
self.
|
|
459
|
-
self.
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
self.
|
|
464
|
-
self.
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
self.
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
self.
|
|
480
|
-
self.
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
self.
|
|
490
|
-
|
|
491
|
-
self.
|
|
492
|
-
self.
|
|
493
|
-
self.
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
self.
|
|
504
|
-
self.
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
self.
|
|
513
|
-
self.
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
self.
|
|
522
|
-
self.
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
def
|
|
534
|
-
if self.gui.
|
|
535
|
-
state = "disabled"
|
|
536
|
-
else:
|
|
537
|
-
state = "normal"
|
|
538
|
-
|
|
539
|
-
self.
|
|
540
|
-
self.
|
|
541
|
-
|
|
542
|
-
def
|
|
543
|
-
if (
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
self.
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
)
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
)
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
self.
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
(
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
def
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
self.
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
)
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import re
|
|
5
|
+
from tkinter import colorchooser
|
|
6
|
+
from typing import Any, List, Tuple
|
|
7
|
+
|
|
8
|
+
from PIL import Image, ImageDraw, ImageTk
|
|
9
|
+
from ttkbootstrap import Button, Canvas, Checkbutton, Entry, Frame, Label, LabelFrame, OptionMenu, Scrollbar, StringVar # type: ignore
|
|
10
|
+
|
|
11
|
+
from sticker_convert.gui_components.frames.right_clicker import RightClicker
|
|
12
|
+
from sticker_convert.gui_components.gui_utils import GUIUtils
|
|
13
|
+
from sticker_convert.gui_components.windows.base_window import BaseWindow
|
|
14
|
+
from sticker_convert.utils.translate import I
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class AdvancedCompressionWindow(BaseWindow):
|
|
18
|
+
emoji_visible_rows = 5
|
|
19
|
+
emoji_btns: List[Tuple[Button, ImageTk.PhotoImage]] = []
|
|
20
|
+
|
|
21
|
+
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
|
22
|
+
super().__init__(*args, **kwargs)
|
|
23
|
+
self.categories = list({entry["category"] for entry in self.gui.emoji_list})
|
|
24
|
+
|
|
25
|
+
self.title(I("Advanced compression options"))
|
|
26
|
+
|
|
27
|
+
self.frame_advcomp = LabelFrame(
|
|
28
|
+
self.scrollable_frame, text=I("Advanced compression option")
|
|
29
|
+
)
|
|
30
|
+
self.frame_emoji_search = LabelFrame(
|
|
31
|
+
self.scrollable_frame, text=I("Setting default emoji")
|
|
32
|
+
)
|
|
33
|
+
self.frame_emoji_canvas = Frame(self.scrollable_frame)
|
|
34
|
+
|
|
35
|
+
self.frame_advcomp.grid_columnconfigure(6, weight=1)
|
|
36
|
+
|
|
37
|
+
self.fps_help_btn = self.add_help_btn(self.gui.help["comp"]["fps"])
|
|
38
|
+
self.fps_lbl = Label(self.frame_advcomp, text=I("Output FPS"))
|
|
39
|
+
self.fps_min_lbl = Label(self.frame_advcomp, text=I("Min:"))
|
|
40
|
+
self.fps_min_entry = Entry(
|
|
41
|
+
self.frame_advcomp, textvariable=self.gui.fps_min_var, width=8
|
|
42
|
+
)
|
|
43
|
+
self.fps_min_entry.bind("<Button-3><ButtonRelease-3>", RightClicker)
|
|
44
|
+
self.fps_max_lbl = Label(self.frame_advcomp, text=I("Max:"))
|
|
45
|
+
self.fps_max_entry = Entry(
|
|
46
|
+
self.frame_advcomp, textvariable=self.gui.fps_max_var, width=8
|
|
47
|
+
)
|
|
48
|
+
self.fps_max_entry.bind("<Button-3><ButtonRelease-3>", RightClicker)
|
|
49
|
+
self.fps_disable_cbox = Checkbutton(
|
|
50
|
+
self.frame_advcomp,
|
|
51
|
+
text="X",
|
|
52
|
+
variable=self.gui.fps_disable_var,
|
|
53
|
+
command=self.cb_disable_fps,
|
|
54
|
+
onvalue=True,
|
|
55
|
+
offvalue=False,
|
|
56
|
+
bootstyle="danger-round-toggle", # type: ignore
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
self.res_w_help_btn = self.add_help_btn(self.gui.help["comp"]["res"])
|
|
60
|
+
self.res_w_lbl = Label(self.frame_advcomp, text=I("Output resolution (Width)"))
|
|
61
|
+
self.res_w_min_lbl = Label(self.frame_advcomp, text=I("Min:"))
|
|
62
|
+
self.res_w_min_entry = Entry(
|
|
63
|
+
self.frame_advcomp, textvariable=self.gui.res_w_min_var, width=8
|
|
64
|
+
)
|
|
65
|
+
self.res_w_min_entry.bind("<Button-3><ButtonRelease-3>", RightClicker)
|
|
66
|
+
self.res_w_max_lbl = Label(self.frame_advcomp, text=I("Max:"))
|
|
67
|
+
self.res_w_max_entry = Entry(
|
|
68
|
+
self.frame_advcomp, textvariable=self.gui.res_w_max_var, width=8
|
|
69
|
+
)
|
|
70
|
+
self.res_w_max_entry.bind("<Button-3><ButtonRelease-3>", RightClicker)
|
|
71
|
+
self.res_w_disable_cbox = Checkbutton(
|
|
72
|
+
self.frame_advcomp,
|
|
73
|
+
text="X",
|
|
74
|
+
variable=self.gui.res_w_disable_var,
|
|
75
|
+
command=self.cb_disable_res_w,
|
|
76
|
+
onvalue=True,
|
|
77
|
+
offvalue=False,
|
|
78
|
+
bootstyle="danger-round-toggle", # type: ignore
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
self.res_h_help_btn = self.add_help_btn(self.gui.help["comp"]["res"])
|
|
82
|
+
self.res_h_lbl = Label(self.frame_advcomp, text=I("Output resolution (Height)"))
|
|
83
|
+
self.res_h_min_lbl = Label(self.frame_advcomp, text=I("Min:"))
|
|
84
|
+
self.res_h_min_entry = Entry(
|
|
85
|
+
self.frame_advcomp, textvariable=self.gui.res_h_min_var, width=8
|
|
86
|
+
)
|
|
87
|
+
self.res_h_min_entry.bind("<Button-3><ButtonRelease-3>", RightClicker)
|
|
88
|
+
self.res_h_max_lbl = Label(self.frame_advcomp, text=I("Max:"))
|
|
89
|
+
self.res_h_max_entry = Entry(
|
|
90
|
+
self.frame_advcomp, textvariable=self.gui.res_h_max_var, width=8
|
|
91
|
+
)
|
|
92
|
+
self.res_h_max_entry.bind("<Button-3><ButtonRelease-3>", RightClicker)
|
|
93
|
+
self.res_h_disable_cbox = Checkbutton(
|
|
94
|
+
self.frame_advcomp,
|
|
95
|
+
text="X",
|
|
96
|
+
variable=self.gui.res_h_disable_var,
|
|
97
|
+
command=self.cb_disable_res_h,
|
|
98
|
+
onvalue=True,
|
|
99
|
+
offvalue=False,
|
|
100
|
+
bootstyle="danger-round-toggle", # type: ignore
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
self.res_snap_pow2_help_btn = self.add_help_btn(
|
|
104
|
+
self.gui.help["comp"]["res_snap_pow2"]
|
|
105
|
+
)
|
|
106
|
+
self.res_snap_pow2_lbl = Label(
|
|
107
|
+
self.frame_advcomp, text=I("Snap resolution to power of 2")
|
|
108
|
+
)
|
|
109
|
+
self.res_snap_pow2_cbox = Checkbutton(
|
|
110
|
+
self.frame_advcomp,
|
|
111
|
+
variable=self.gui.res_snap_pow2_var,
|
|
112
|
+
onvalue=True,
|
|
113
|
+
offvalue=False,
|
|
114
|
+
bootstyle="success-round-toggle", # type: ignore
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
self.quality_help_btn = self.add_help_btn(self.gui.help["comp"]["quality"])
|
|
118
|
+
self.quality_lbl = Label(self.frame_advcomp, text=I("Output quality (0-100)"))
|
|
119
|
+
self.quality_min_lbl = Label(self.frame_advcomp, text=I("Min:"))
|
|
120
|
+
self.quality_min_entry = Entry(
|
|
121
|
+
self.frame_advcomp, textvariable=self.gui.quality_min_var, width=8
|
|
122
|
+
)
|
|
123
|
+
self.quality_min_entry.bind("<Button-3><ButtonRelease-3>", RightClicker)
|
|
124
|
+
self.quality_max_lbl = Label(self.frame_advcomp, text=I("Max:"))
|
|
125
|
+
self.quality_max_entry = Entry(
|
|
126
|
+
self.frame_advcomp, textvariable=self.gui.quality_max_var, width=8
|
|
127
|
+
)
|
|
128
|
+
self.quality_max_entry.bind("<Button-3><ButtonRelease-3>", RightClicker)
|
|
129
|
+
self.quality_disable_cbox = Checkbutton(
|
|
130
|
+
self.frame_advcomp,
|
|
131
|
+
text="X",
|
|
132
|
+
variable=self.gui.quality_disable_var,
|
|
133
|
+
command=self.cb_disable_quality,
|
|
134
|
+
onvalue=True,
|
|
135
|
+
offvalue=False,
|
|
136
|
+
bootstyle="danger-round-toggle", # type: ignore
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
self.color_help_btn = self.add_help_btn(self.gui.help["comp"]["color"])
|
|
140
|
+
self.color_lbl = Label(self.frame_advcomp, text=I("Colors (0-256)"))
|
|
141
|
+
self.color_min_lbl = Label(self.frame_advcomp, text=I("Min:"))
|
|
142
|
+
self.color_min_entry = Entry(
|
|
143
|
+
self.frame_advcomp, textvariable=self.gui.color_min_var, width=8
|
|
144
|
+
)
|
|
145
|
+
self.color_min_entry.bind("<Button-3><ButtonRelease-3>", RightClicker)
|
|
146
|
+
self.color_max_lbl = Label(self.frame_advcomp, text=I("Max:"))
|
|
147
|
+
self.color_max_entry = Entry(
|
|
148
|
+
self.frame_advcomp, textvariable=self.gui.color_max_var, width=8
|
|
149
|
+
)
|
|
150
|
+
self.color_max_entry.bind("<Button-3><ButtonRelease-3>", RightClicker)
|
|
151
|
+
self.color_disable_cbox = Checkbutton(
|
|
152
|
+
self.frame_advcomp,
|
|
153
|
+
text="X",
|
|
154
|
+
variable=self.gui.color_disable_var,
|
|
155
|
+
command=self.cb_disable_color,
|
|
156
|
+
onvalue=True,
|
|
157
|
+
offvalue=False,
|
|
158
|
+
bootstyle="danger-round-toggle", # type: ignore
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
self.duration_help_btn = self.add_help_btn(self.gui.help["comp"]["duration"])
|
|
162
|
+
self.duration_lbl = Label(self.frame_advcomp, text=I("Duration (Miliseconds)"))
|
|
163
|
+
self.duration_min_lbl = Label(self.frame_advcomp, text=I("Min:"))
|
|
164
|
+
self.duration_min_entry = Entry(
|
|
165
|
+
self.frame_advcomp, textvariable=self.gui.duration_min_var, width=8
|
|
166
|
+
)
|
|
167
|
+
self.duration_min_entry.bind("<Button-3><ButtonRelease-3>", RightClicker)
|
|
168
|
+
self.duration_max_lbl = Label(self.frame_advcomp, text=I("Max:"))
|
|
169
|
+
self.duration_max_entry = Entry(
|
|
170
|
+
self.frame_advcomp, textvariable=self.gui.duration_max_var, width=8
|
|
171
|
+
)
|
|
172
|
+
self.duration_max_entry.bind("<Button-3><ButtonRelease-3>", RightClicker)
|
|
173
|
+
self.duration_disable_cbox = Checkbutton(
|
|
174
|
+
self.frame_advcomp,
|
|
175
|
+
text="X",
|
|
176
|
+
variable=self.gui.duration_disable_var,
|
|
177
|
+
command=self.cb_disable_duration,
|
|
178
|
+
onvalue=True,
|
|
179
|
+
offvalue=False,
|
|
180
|
+
bootstyle="danger-round-toggle", # type: ignore
|
|
181
|
+
)
|
|
182
|
+
|
|
183
|
+
self.size_help_btn = self.add_help_btn(self.gui.help["comp"]["size"])
|
|
184
|
+
self.size_lbl = Label(self.frame_advcomp, text=I("Maximum file size (bytes)"))
|
|
185
|
+
self.img_size_max_lbl = Label(self.frame_advcomp, text=I("Img:"))
|
|
186
|
+
self.img_size_max_entry = Entry(
|
|
187
|
+
self.frame_advcomp, textvariable=self.gui.img_size_max_var, width=8
|
|
188
|
+
)
|
|
189
|
+
self.img_size_max_entry.bind("<Button-3><ButtonRelease-3>", RightClicker)
|
|
190
|
+
self.vid_size_max_lbl = Label(self.frame_advcomp, text=I("Vid:"))
|
|
191
|
+
self.vid_size_max_entry = Entry(
|
|
192
|
+
self.frame_advcomp, textvariable=self.gui.vid_size_max_var, width=8
|
|
193
|
+
)
|
|
194
|
+
self.vid_size_max_entry.bind("<Button-3><ButtonRelease-3>", RightClicker)
|
|
195
|
+
self.size_disable_cbox = Checkbutton(
|
|
196
|
+
self.frame_advcomp,
|
|
197
|
+
text="X",
|
|
198
|
+
variable=self.gui.size_disable_var,
|
|
199
|
+
command=self.cb_disable_size,
|
|
200
|
+
onvalue=True,
|
|
201
|
+
offvalue=False,
|
|
202
|
+
bootstyle="danger-round-toggle", # type: ignore
|
|
203
|
+
)
|
|
204
|
+
|
|
205
|
+
self.format_help_btn = self.add_help_btn(self.gui.help["comp"]["format"])
|
|
206
|
+
self.format_lbl = Label(self.frame_advcomp, text=I("File format"))
|
|
207
|
+
self.img_format_lbl = Label(self.frame_advcomp, text="Img:")
|
|
208
|
+
self.img_format_entry = Entry(
|
|
209
|
+
self.frame_advcomp, textvariable=self.gui.img_format_var, width=8
|
|
210
|
+
)
|
|
211
|
+
self.img_format_entry.bind("<Button-3><ButtonRelease-3>", RightClicker)
|
|
212
|
+
self.vid_format_lbl = Label(self.frame_advcomp, text=I("Vid:"))
|
|
213
|
+
self.vid_format_entry = Entry(
|
|
214
|
+
self.frame_advcomp, textvariable=self.gui.vid_format_var, width=8
|
|
215
|
+
)
|
|
216
|
+
self.vid_format_entry.bind("<Button-3><ButtonRelease-3>", RightClicker)
|
|
217
|
+
|
|
218
|
+
self.power_help_btn1 = self.add_help_btn(self.gui.help["comp"]["fps_power"])
|
|
219
|
+
self.power_lbl1 = Label(self.frame_advcomp, text=I("Power (Importance)"))
|
|
220
|
+
self.fps_power_lbl = Label(self.frame_advcomp, text=I("FPS:"))
|
|
221
|
+
self.fps_power_entry = Entry(
|
|
222
|
+
self.frame_advcomp, textvariable=self.gui.fps_power_var, width=8
|
|
223
|
+
)
|
|
224
|
+
self.fps_power_entry.bind("<Button-3><ButtonRelease-3>", RightClicker)
|
|
225
|
+
self.res_power_lbl = Label(self.frame_advcomp, text=I("Res:"))
|
|
226
|
+
self.res_power_entry = Entry(
|
|
227
|
+
self.frame_advcomp, textvariable=self.gui.res_power_var, width=8
|
|
228
|
+
)
|
|
229
|
+
self.res_power_entry.bind("<Button-3><ButtonRelease-3>", RightClicker)
|
|
230
|
+
|
|
231
|
+
self.power_help_btn2 = self.add_help_btn(self.gui.help["comp"]["fps_power"])
|
|
232
|
+
self.power_lbl2 = Label(self.frame_advcomp, text="Power (Importance)")
|
|
233
|
+
self.quality_power_lbl = Label(self.frame_advcomp, text="Quality:")
|
|
234
|
+
self.quality_power_entry = Entry(
|
|
235
|
+
self.frame_advcomp, textvariable=self.gui.quality_power_var, width=8
|
|
236
|
+
)
|
|
237
|
+
self.quality_power_entry.bind("<Button-3><ButtonRelease-3>", RightClicker)
|
|
238
|
+
self.color_power_lbl = Label(self.frame_advcomp, text=I("Color:"))
|
|
239
|
+
self.color_power_entry = Entry(
|
|
240
|
+
self.frame_advcomp, textvariable=self.gui.color_power_var, width=8
|
|
241
|
+
)
|
|
242
|
+
self.color_power_entry.bind("<Button-3><ButtonRelease-3>", RightClicker)
|
|
243
|
+
|
|
244
|
+
self.padding_percent_help_btn = self.add_help_btn(
|
|
245
|
+
self.gui.help["comp"]["padding_percent"]
|
|
246
|
+
)
|
|
247
|
+
self.padding_percent_lbl1 = Label(self.frame_advcomp, text=I("Padding"))
|
|
248
|
+
self.padding_percent_lbl2 = Label(self.frame_advcomp, text=I("0-100%"))
|
|
249
|
+
self.padding_percent_entry = Entry(
|
|
250
|
+
self.frame_advcomp, textvariable=self.gui.padding_percent_var, width=8
|
|
251
|
+
)
|
|
252
|
+
self.padding_percent_entry.bind("<Button-3><ButtonRelease-3>", RightClicker)
|
|
253
|
+
|
|
254
|
+
self.fake_vid_help_btn = self.add_help_btn(self.gui.help["comp"]["fake_vid"])
|
|
255
|
+
self.fake_vid_lbl = Label(
|
|
256
|
+
self.frame_advcomp, text=I("Convert (faking) image to video")
|
|
257
|
+
)
|
|
258
|
+
self.fake_vid_cbox = Checkbutton(
|
|
259
|
+
self.frame_advcomp,
|
|
260
|
+
variable=self.gui.fake_vid_var,
|
|
261
|
+
onvalue=True,
|
|
262
|
+
offvalue=False,
|
|
263
|
+
bootstyle="success-round-toggle", # type: ignore
|
|
264
|
+
)
|
|
265
|
+
|
|
266
|
+
self.bg_color_help_btn = self.add_help_btn(self.gui.help["comp"]["bg_color"])
|
|
267
|
+
self.bg_color_lbl = Label(self.frame_advcomp, text=I("Background color"))
|
|
268
|
+
self.bg_color_entry = Entry(
|
|
269
|
+
self.frame_advcomp, textvariable=self.gui.bg_color_var, width=8
|
|
270
|
+
)
|
|
271
|
+
self.bg_color_btn = Button(
|
|
272
|
+
self.frame_advcomp,
|
|
273
|
+
text=I("Set"),
|
|
274
|
+
command=self.cb_bg_color,
|
|
275
|
+
bootstyle="secondary", # type: ignore
|
|
276
|
+
)
|
|
277
|
+
|
|
278
|
+
self.scale_filter_help_btn = self.add_help_btn(
|
|
279
|
+
self.gui.help["comp"]["scale_filter"]
|
|
280
|
+
)
|
|
281
|
+
self.scale_filter_lbl = Label(self.frame_advcomp, text=I("Scale filter"))
|
|
282
|
+
self.scale_filter_opt = OptionMenu(
|
|
283
|
+
self.frame_advcomp,
|
|
284
|
+
self.gui.scale_filter_var,
|
|
285
|
+
self.gui.scale_filter_var.get(),
|
|
286
|
+
"nearest",
|
|
287
|
+
"box",
|
|
288
|
+
"bilinear",
|
|
289
|
+
"hamming",
|
|
290
|
+
"bicubic",
|
|
291
|
+
"lanczos",
|
|
292
|
+
bootstyle="secondary", # type: ignore
|
|
293
|
+
)
|
|
294
|
+
|
|
295
|
+
self.quantize_method_help_btn = self.add_help_btn(
|
|
296
|
+
self.gui.help["comp"]["quantize_method"]
|
|
297
|
+
)
|
|
298
|
+
self.quantize_method_lbl = Label(self.frame_advcomp, text=I("Quantize method"))
|
|
299
|
+
self.quantize_method_opt = OptionMenu(
|
|
300
|
+
self.frame_advcomp,
|
|
301
|
+
self.gui.quantize_method_var,
|
|
302
|
+
self.gui.quantize_method_var.get(),
|
|
303
|
+
"imagequant",
|
|
304
|
+
"fastoctree",
|
|
305
|
+
"maxcoverage",
|
|
306
|
+
"mediancut",
|
|
307
|
+
"none",
|
|
308
|
+
bootstyle="secondary", # type: ignore
|
|
309
|
+
)
|
|
310
|
+
|
|
311
|
+
self.chromium_path_help_btn = self.add_help_btn(
|
|
312
|
+
self.gui.help["comp"]["chromium_path"]
|
|
313
|
+
)
|
|
314
|
+
self.chromium_path_lbl = Label(
|
|
315
|
+
self.frame_advcomp, text=I("Chromium/Chrome directory")
|
|
316
|
+
)
|
|
317
|
+
self.chromium_path_entry = Entry(
|
|
318
|
+
self.frame_advcomp, textvariable=self.gui.chromium_path_var, width=30
|
|
319
|
+
)
|
|
320
|
+
self.chromium_path_entry.bind("<Button-3><ButtonRelease-3>", RightClicker)
|
|
321
|
+
|
|
322
|
+
self.cache_dir_help_btn = self.add_help_btn(self.gui.help["comp"]["cache_dir"])
|
|
323
|
+
self.cache_dir_lbl = Label(self.frame_advcomp, text=I("Custom cache directory"))
|
|
324
|
+
self.cache_dir_entry = Entry(
|
|
325
|
+
self.frame_advcomp, textvariable=self.gui.cache_dir_var, width=30
|
|
326
|
+
)
|
|
327
|
+
self.cache_dir_entry.bind("<Button-3><ButtonRelease-3>", RightClicker)
|
|
328
|
+
|
|
329
|
+
self.default_emoji_help_btn = self.add_help_btn(
|
|
330
|
+
self.gui.help["comp"]["default_emoji"]
|
|
331
|
+
)
|
|
332
|
+
self.default_emoji_lbl = Label(self.frame_advcomp, text=I("Default emoji"))
|
|
333
|
+
self.im: Image.Image = Image.new("RGBA", (32, 32), (255, 255, 255, 0))
|
|
334
|
+
self.ph_im = ImageTk.PhotoImage(self.im)
|
|
335
|
+
self.default_emoji_dsp = Label(self.frame_advcomp, image=self.ph_im)
|
|
336
|
+
|
|
337
|
+
r = 0
|
|
338
|
+
self.fps_help_btn.grid(column=0, row=r, sticky="w", padx=3, pady=3)
|
|
339
|
+
self.fps_lbl.grid(column=1, row=r, sticky="w", padx=3, pady=3)
|
|
340
|
+
self.fps_min_lbl.grid(column=2, row=r, sticky="w", padx=3, pady=3)
|
|
341
|
+
self.fps_min_entry.grid(column=3, row=r, sticky="nes", padx=3, pady=3)
|
|
342
|
+
self.fps_max_lbl.grid(column=4, row=r, sticky="w", padx=3, pady=3)
|
|
343
|
+
self.fps_max_entry.grid(column=5, row=r, sticky="nes", padx=3, pady=3)
|
|
344
|
+
self.fps_disable_cbox.grid(column=6, row=r, sticky="w", padx=3, pady=3)
|
|
345
|
+
r += 1
|
|
346
|
+
self.res_w_help_btn.grid(column=0, row=r, sticky="w", padx=3, pady=3)
|
|
347
|
+
self.res_w_lbl.grid(column=1, row=r, sticky="w", padx=3, pady=3)
|
|
348
|
+
self.res_w_min_lbl.grid(column=2, row=r, sticky="w", padx=3, pady=3)
|
|
349
|
+
self.res_w_min_entry.grid(column=3, row=r, sticky="nes", padx=3, pady=3)
|
|
350
|
+
self.res_w_max_lbl.grid(column=4, row=r, sticky="w", padx=3, pady=3)
|
|
351
|
+
self.res_w_max_entry.grid(column=5, row=r, sticky="nes", padx=3, pady=3)
|
|
352
|
+
self.res_w_disable_cbox.grid(column=6, row=r, sticky="w", padx=3, pady=3)
|
|
353
|
+
r += 1
|
|
354
|
+
self.res_h_help_btn.grid(column=0, row=r, sticky="w", padx=3, pady=3)
|
|
355
|
+
self.res_h_lbl.grid(column=1, row=r, sticky="w", padx=3, pady=3)
|
|
356
|
+
self.res_h_min_lbl.grid(column=2, row=r, sticky="w", padx=3, pady=3)
|
|
357
|
+
self.res_h_min_entry.grid(column=3, row=r, sticky="nes", padx=3, pady=3)
|
|
358
|
+
self.res_h_max_lbl.grid(column=4, row=r, sticky="w", padx=3, pady=3)
|
|
359
|
+
self.res_h_max_entry.grid(column=5, row=r, sticky="nes", padx=3, pady=3)
|
|
360
|
+
self.res_h_disable_cbox.grid(column=6, row=r, sticky="w", padx=3, pady=3)
|
|
361
|
+
r += 1
|
|
362
|
+
self.res_snap_pow2_help_btn.grid(column=0, row=r, sticky="w", padx=3, pady=3)
|
|
363
|
+
self.res_snap_pow2_lbl.grid(column=1, row=r, sticky="w", padx=3, pady=3)
|
|
364
|
+
self.res_snap_pow2_cbox.grid(column=6, row=r, sticky="w", padx=3, pady=3)
|
|
365
|
+
r += 1
|
|
366
|
+
self.quality_help_btn.grid(column=0, row=r, sticky="w", padx=3, pady=3)
|
|
367
|
+
self.quality_lbl.grid(column=1, row=r, sticky="w", padx=3, pady=3)
|
|
368
|
+
self.quality_min_lbl.grid(column=2, row=r, sticky="w", padx=3, pady=3)
|
|
369
|
+
self.quality_min_entry.grid(column=3, row=r, sticky="nes", padx=3, pady=3)
|
|
370
|
+
self.quality_max_lbl.grid(column=4, row=r, sticky="w", padx=3, pady=3)
|
|
371
|
+
self.quality_max_entry.grid(column=5, row=r, sticky="nes", padx=3, pady=3)
|
|
372
|
+
self.quality_disable_cbox.grid(column=6, row=r, sticky="w", padx=3, pady=3)
|
|
373
|
+
r += 1
|
|
374
|
+
self.color_help_btn.grid(column=0, row=r, sticky="w", padx=3, pady=3)
|
|
375
|
+
self.color_lbl.grid(column=1, row=r, sticky="w", padx=3, pady=3)
|
|
376
|
+
self.color_min_lbl.grid(column=2, row=r, sticky="w", padx=3, pady=3)
|
|
377
|
+
self.color_min_entry.grid(column=3, row=r, sticky="nes", padx=3, pady=3)
|
|
378
|
+
self.color_max_lbl.grid(column=4, row=r, sticky="w", padx=3, pady=3)
|
|
379
|
+
self.color_max_entry.grid(column=5, row=r, sticky="nes", padx=3, pady=3)
|
|
380
|
+
self.color_disable_cbox.grid(column=6, row=r, sticky="w", padx=3, pady=3)
|
|
381
|
+
r += 1
|
|
382
|
+
self.duration_help_btn.grid(column=0, row=r, sticky="w", padx=3, pady=3)
|
|
383
|
+
self.duration_lbl.grid(column=1, row=r, sticky="w", padx=3, pady=3)
|
|
384
|
+
self.duration_min_lbl.grid(column=2, row=r, sticky="w", padx=3, pady=3)
|
|
385
|
+
self.duration_min_entry.grid(column=3, row=r, sticky="nes", padx=3, pady=3)
|
|
386
|
+
self.duration_max_lbl.grid(column=4, row=r, sticky="w", padx=3, pady=3)
|
|
387
|
+
self.duration_max_entry.grid(column=5, row=r, sticky="nes", padx=3, pady=3)
|
|
388
|
+
self.duration_disable_cbox.grid(column=6, row=r, sticky="w", padx=3, pady=3)
|
|
389
|
+
r += 1
|
|
390
|
+
self.size_help_btn.grid(column=0, row=r, sticky="w", padx=3, pady=3)
|
|
391
|
+
self.size_lbl.grid(column=1, row=r, sticky="w", padx=3, pady=3)
|
|
392
|
+
self.img_size_max_lbl.grid(column=2, row=r, sticky="w", padx=3, pady=3)
|
|
393
|
+
self.img_size_max_entry.grid(column=3, row=r, sticky="nes", padx=3, pady=3)
|
|
394
|
+
self.vid_size_max_lbl.grid(column=4, row=r, sticky="w", padx=3, pady=3)
|
|
395
|
+
self.vid_size_max_entry.grid(column=5, row=r, sticky="nes", padx=3, pady=3)
|
|
396
|
+
self.size_disable_cbox.grid(column=6, row=r, sticky="w", padx=3, pady=3)
|
|
397
|
+
r += 1
|
|
398
|
+
self.format_help_btn.grid(column=0, row=r, sticky="w", padx=3, pady=3)
|
|
399
|
+
self.format_lbl.grid(column=1, row=r, sticky="w", padx=3, pady=3)
|
|
400
|
+
self.img_format_lbl.grid(column=2, row=r, sticky="w", padx=3, pady=3)
|
|
401
|
+
self.img_format_entry.grid(column=3, row=r, sticky="nes", padx=3, pady=3)
|
|
402
|
+
self.vid_format_lbl.grid(column=4, row=r, sticky="w", padx=3, pady=3)
|
|
403
|
+
self.vid_format_entry.grid(column=5, row=r, sticky="w", padx=3, pady=3)
|
|
404
|
+
r += 1
|
|
405
|
+
self.power_help_btn1.grid(column=0, row=r, sticky="w", padx=3, pady=3)
|
|
406
|
+
self.power_lbl1.grid(column=1, row=r, sticky="w", padx=3, pady=3)
|
|
407
|
+
self.fps_power_lbl.grid(column=2, row=r, sticky="w", padx=3, pady=3)
|
|
408
|
+
self.fps_power_entry.grid(column=3, row=r, sticky="w", padx=3, pady=3)
|
|
409
|
+
self.res_power_lbl.grid(column=4, row=r, sticky="w", padx=3, pady=3)
|
|
410
|
+
self.res_power_entry.grid(column=5, row=r, sticky="w", padx=3, pady=3)
|
|
411
|
+
r += 1
|
|
412
|
+
self.power_help_btn2.grid(column=0, row=r, sticky="w", padx=3, pady=3)
|
|
413
|
+
self.power_lbl2.grid(column=1, row=r, sticky="w", padx=3, pady=3)
|
|
414
|
+
self.quality_power_lbl.grid(column=2, row=r, sticky="w", padx=3, pady=3)
|
|
415
|
+
self.quality_power_entry.grid(column=3, row=r, sticky="w", padx=3, pady=3)
|
|
416
|
+
self.color_power_lbl.grid(column=4, row=r, sticky="w", padx=3, pady=3)
|
|
417
|
+
self.color_power_entry.grid(column=5, row=r, sticky="w", padx=3, pady=3)
|
|
418
|
+
r += 1
|
|
419
|
+
self.padding_percent_help_btn.grid(column=0, row=r, sticky="w", padx=3, pady=3)
|
|
420
|
+
self.padding_percent_lbl1.grid(column=1, row=r, sticky="w", padx=3, pady=3)
|
|
421
|
+
self.padding_percent_lbl2.grid(column=2, row=r, sticky="w", padx=3, pady=3)
|
|
422
|
+
self.padding_percent_entry.grid(column=3, row=r, sticky="w", padx=3, pady=3)
|
|
423
|
+
r += 1
|
|
424
|
+
self.fake_vid_help_btn.grid(column=0, row=r, sticky="w", padx=3, pady=3)
|
|
425
|
+
self.fake_vid_lbl.grid(column=1, row=r, sticky="w", padx=3, pady=3)
|
|
426
|
+
self.fake_vid_cbox.grid(column=6, row=r, sticky="w", padx=3, pady=3)
|
|
427
|
+
r += 1
|
|
428
|
+
self.bg_color_help_btn.grid(column=0, row=r, sticky="w", padx=3, pady=3)
|
|
429
|
+
self.bg_color_lbl.grid(column=1, row=r, sticky="w", padx=3, pady=3)
|
|
430
|
+
self.bg_color_entry.grid(column=5, row=r, sticky="w", padx=3, pady=3)
|
|
431
|
+
self.bg_color_btn.grid(column=6, row=r, sticky="w", padx=3, pady=3)
|
|
432
|
+
r += 1
|
|
433
|
+
self.scale_filter_help_btn.grid(column=0, row=r, sticky="w", padx=3, pady=3)
|
|
434
|
+
self.scale_filter_lbl.grid(column=1, row=r, sticky="w", padx=3, pady=3)
|
|
435
|
+
self.scale_filter_opt.grid(
|
|
436
|
+
column=2, row=r, columnspan=4, sticky="nes", padx=3, pady=3
|
|
437
|
+
)
|
|
438
|
+
r += 1
|
|
439
|
+
self.quantize_method_help_btn.grid(column=0, row=r, sticky="w", padx=3, pady=3)
|
|
440
|
+
self.quantize_method_lbl.grid(column=1, row=r, sticky="w", padx=3, pady=3)
|
|
441
|
+
self.quantize_method_opt.grid(
|
|
442
|
+
column=2, row=r, columnspan=4, sticky="nes", padx=3, pady=3
|
|
443
|
+
)
|
|
444
|
+
r += 1
|
|
445
|
+
self.chromium_path_help_btn.grid(column=0, row=r, sticky="w", padx=3, pady=3)
|
|
446
|
+
self.chromium_path_lbl.grid(column=1, row=r, sticky="w", padx=3, pady=3)
|
|
447
|
+
self.chromium_path_entry.grid(
|
|
448
|
+
column=2, row=r, columnspan=4, sticky="nes", padx=3, pady=3
|
|
449
|
+
)
|
|
450
|
+
r += 1
|
|
451
|
+
self.cache_dir_help_btn.grid(column=0, row=r, sticky="w", padx=3, pady=3)
|
|
452
|
+
self.cache_dir_lbl.grid(column=1, row=r, sticky="w", padx=3, pady=3)
|
|
453
|
+
self.cache_dir_entry.grid(
|
|
454
|
+
column=2, row=r, columnspan=4, sticky="nes", padx=3, pady=3
|
|
455
|
+
)
|
|
456
|
+
r += 1
|
|
457
|
+
self.default_emoji_help_btn.grid(column=0, row=r, sticky="w", padx=3, pady=3)
|
|
458
|
+
self.default_emoji_lbl.grid(column=1, row=r, sticky="w", padx=3, pady=3)
|
|
459
|
+
self.default_emoji_dsp.grid(column=6, row=r, sticky="nes", padx=3, pady=3)
|
|
460
|
+
|
|
461
|
+
# https://stackoverflow.com/questions/43731784/tkinter-canvas-scrollbar-with-grid
|
|
462
|
+
# Create a frame for the canvas with non-zero row&column weights
|
|
463
|
+
self.frame_emoji_canvas.grid_rowconfigure(0, weight=1)
|
|
464
|
+
self.frame_emoji_canvas.grid_columnconfigure(0, weight=1)
|
|
465
|
+
# Set grid_propagate to False to allow buttons resizing later
|
|
466
|
+
self.frame_emoji_canvas.grid_propagate(False)
|
|
467
|
+
|
|
468
|
+
self.frame_advcomp.grid(column=0, row=0, sticky="news", padx=3, pady=3)
|
|
469
|
+
self.frame_emoji_search.grid(column=0, row=1, sticky="news", padx=3, pady=3)
|
|
470
|
+
self.frame_emoji_canvas.grid(column=0, row=2, sticky="news", padx=3, pady=3)
|
|
471
|
+
|
|
472
|
+
self.categories_lbl = Label(
|
|
473
|
+
self.frame_emoji_search,
|
|
474
|
+
text=I("Category"),
|
|
475
|
+
width=15,
|
|
476
|
+
justify="left",
|
|
477
|
+
anchor="w",
|
|
478
|
+
)
|
|
479
|
+
self.categories_var = StringVar(self.scrollable_frame)
|
|
480
|
+
self.categories_var.set("Smileys & Emotion")
|
|
481
|
+
self.categories_opt = OptionMenu(
|
|
482
|
+
self.frame_emoji_search,
|
|
483
|
+
self.categories_var,
|
|
484
|
+
"Smileys & Emotion",
|
|
485
|
+
*self.categories,
|
|
486
|
+
command=self.render_emoji_list,
|
|
487
|
+
bootstyle="secondary", # type: ignore
|
|
488
|
+
)
|
|
489
|
+
self.categories_opt.config(width=30)
|
|
490
|
+
|
|
491
|
+
self.search_lbl = Label(self.frame_emoji_search, text=I("Search"))
|
|
492
|
+
self.search_var = StringVar(self.frame_emoji_search)
|
|
493
|
+
self.search_var.trace_add("write", self.render_emoji_list)
|
|
494
|
+
self.search_entry = Entry(self.frame_emoji_search, textvariable=self.search_var)
|
|
495
|
+
self.search_entry.bind("<Button-3><ButtonRelease-3>", RightClicker)
|
|
496
|
+
|
|
497
|
+
self.categories_lbl.grid(column=0, row=0, sticky="nsw", padx=3, pady=3)
|
|
498
|
+
self.categories_opt.grid(column=1, row=0, sticky="news", padx=3, pady=3)
|
|
499
|
+
self.search_lbl.grid(column=0, row=1, sticky="nsw", padx=3, pady=3)
|
|
500
|
+
self.search_entry.grid(column=1, row=1, sticky="news", padx=3, pady=3)
|
|
501
|
+
|
|
502
|
+
# Add a canvas in frame_emoji_canvas
|
|
503
|
+
self.emoji_canvas = Canvas(self.frame_emoji_canvas)
|
|
504
|
+
self.emoji_canvas.grid(row=0, column=0, sticky="news")
|
|
505
|
+
|
|
506
|
+
# Link a scrollbar to the canvas
|
|
507
|
+
self.vsb = Scrollbar(
|
|
508
|
+
self.frame_emoji_canvas,
|
|
509
|
+
orient="vertical",
|
|
510
|
+
command=self.emoji_canvas.yview, # type: ignore
|
|
511
|
+
)
|
|
512
|
+
self.vsb.grid(row=0, column=1, sticky="ns")
|
|
513
|
+
self.emoji_canvas.configure(yscrollcommand=self.vsb.set)
|
|
514
|
+
|
|
515
|
+
self.frame_buttons = Frame(self.emoji_canvas)
|
|
516
|
+
self.emoji_canvas.create_window((0, 0), window=self.frame_buttons, anchor="nw")
|
|
517
|
+
|
|
518
|
+
self.render_emoji_list()
|
|
519
|
+
|
|
520
|
+
self.set_emoji_btn()
|
|
521
|
+
self.cb_disable_fps()
|
|
522
|
+
self.cb_disable_res_w()
|
|
523
|
+
self.cb_disable_res_h()
|
|
524
|
+
self.cb_disable_quality()
|
|
525
|
+
self.cb_disable_color()
|
|
526
|
+
self.cb_disable_duration()
|
|
527
|
+
self.cb_disable_size()
|
|
528
|
+
self.cb_disable_format()
|
|
529
|
+
self.cb_disable_fake_vid()
|
|
530
|
+
|
|
531
|
+
GUIUtils.finalize_window(self)
|
|
532
|
+
|
|
533
|
+
def cb_disable_fps(self, *_: Any) -> None:
|
|
534
|
+
if self.gui.fps_disable_var.get() is True:
|
|
535
|
+
state = "disabled"
|
|
536
|
+
else:
|
|
537
|
+
state = "normal"
|
|
538
|
+
|
|
539
|
+
self.fps_min_entry.config(state=state)
|
|
540
|
+
self.fps_max_entry.config(state=state)
|
|
541
|
+
|
|
542
|
+
def cb_disable_res_w(self, *_: Any) -> None:
|
|
543
|
+
if self.gui.res_w_disable_var.get() is True:
|
|
544
|
+
state = "disabled"
|
|
545
|
+
else:
|
|
546
|
+
state = "normal"
|
|
547
|
+
|
|
548
|
+
self.res_w_min_entry.config(state=state)
|
|
549
|
+
self.res_w_max_entry.config(state=state)
|
|
550
|
+
|
|
551
|
+
def cb_disable_res_h(self, *_: Any) -> None:
|
|
552
|
+
if self.gui.res_h_disable_var.get() is True:
|
|
553
|
+
state = "disabled"
|
|
554
|
+
else:
|
|
555
|
+
state = "normal"
|
|
556
|
+
|
|
557
|
+
self.res_h_min_entry.config(state=state)
|
|
558
|
+
self.res_h_max_entry.config(state=state)
|
|
559
|
+
|
|
560
|
+
def cb_disable_quality(self, *_: Any) -> None:
|
|
561
|
+
if self.gui.quality_disable_var.get() is True:
|
|
562
|
+
state = "disabled"
|
|
563
|
+
else:
|
|
564
|
+
state = "normal"
|
|
565
|
+
|
|
566
|
+
self.quality_min_entry.config(state=state)
|
|
567
|
+
self.quality_max_entry.config(state=state)
|
|
568
|
+
|
|
569
|
+
def cb_disable_color(self, *_: Any) -> None:
|
|
570
|
+
if self.gui.color_disable_var.get() is True:
|
|
571
|
+
state = "disabled"
|
|
572
|
+
else:
|
|
573
|
+
state = "normal"
|
|
574
|
+
|
|
575
|
+
self.color_min_entry.config(state=state)
|
|
576
|
+
self.color_max_entry.config(state=state)
|
|
577
|
+
|
|
578
|
+
def cb_disable_duration(self, *_: Any) -> None:
|
|
579
|
+
if (
|
|
580
|
+
self.gui.duration_disable_var.get() is True
|
|
581
|
+
or self.gui.comp_preset_var.get() == "auto"
|
|
582
|
+
):
|
|
583
|
+
state = "disabled"
|
|
584
|
+
else:
|
|
585
|
+
state = "normal"
|
|
586
|
+
|
|
587
|
+
self.duration_min_entry.config(state=state)
|
|
588
|
+
self.duration_max_entry.config(state=state)
|
|
589
|
+
|
|
590
|
+
def cb_disable_size(self, *_: Any) -> None:
|
|
591
|
+
if (
|
|
592
|
+
self.gui.size_disable_var.get() is True
|
|
593
|
+
or self.gui.comp_preset_var.get() == "auto"
|
|
594
|
+
):
|
|
595
|
+
state = "disabled"
|
|
596
|
+
else:
|
|
597
|
+
state = "normal"
|
|
598
|
+
|
|
599
|
+
self.img_size_max_entry.config(state=state)
|
|
600
|
+
self.vid_size_max_entry.config(state=state)
|
|
601
|
+
|
|
602
|
+
def cb_disable_format(self, *_: Any) -> None:
|
|
603
|
+
if self.gui.comp_preset_var.get() == "auto":
|
|
604
|
+
state = "disabled"
|
|
605
|
+
else:
|
|
606
|
+
state = "normal"
|
|
607
|
+
|
|
608
|
+
self.img_format_entry.config(state=state)
|
|
609
|
+
self.vid_format_entry.config(state=state)
|
|
610
|
+
|
|
611
|
+
def cb_disable_fake_vid(self, *_: Any) -> None:
|
|
612
|
+
if self.gui.comp_preset_var.get() == "auto":
|
|
613
|
+
state = "disabled"
|
|
614
|
+
else:
|
|
615
|
+
state = "normal"
|
|
616
|
+
|
|
617
|
+
self.fake_vid_cbox.config(state=state)
|
|
618
|
+
|
|
619
|
+
def cb_bg_color(self, *_: Any) -> None:
|
|
620
|
+
color_init = "#" + self.gui.bg_color_var.get()[:6]
|
|
621
|
+
color_init = (
|
|
622
|
+
color_init if re.search(r"^#(?:[0-9a-fA-F]{3}){1,2}$", color_init) else None
|
|
623
|
+
)
|
|
624
|
+
color = colorchooser.askcolor(
|
|
625
|
+
title="Choose color",
|
|
626
|
+
color=color_init,
|
|
627
|
+
parent=self,
|
|
628
|
+
)[1]
|
|
629
|
+
if color:
|
|
630
|
+
self.gui.bg_color_var.set(color.replace("#", "") + "00")
|
|
631
|
+
self.lift() # type: ignore
|
|
632
|
+
self.attributes("-topmost", True) # type: ignore
|
|
633
|
+
self.attributes("-topmost", False) # type: ignore
|
|
634
|
+
|
|
635
|
+
def cb_bound_to_mousewheel(self, event: Any) -> None:
|
|
636
|
+
for i in self.mousewheel:
|
|
637
|
+
self.emoji_canvas.bind_all(i, self.cb_on_mousewheel)
|
|
638
|
+
|
|
639
|
+
def cb_unbound_to_mousewheel(self, event: Any) -> None:
|
|
640
|
+
for i in self.mousewheel:
|
|
641
|
+
self.emoji_canvas.unbind_all(i)
|
|
642
|
+
|
|
643
|
+
def cb_on_mousewheel(self, event: Any) -> None:
|
|
644
|
+
self.emoji_canvas.yview_scroll(
|
|
645
|
+
int(-1 * (event.delta / self.delta_divide)), "units"
|
|
646
|
+
) # type: ignore
|
|
647
|
+
|
|
648
|
+
def cb_set_emoji(self, emoji: str) -> None:
|
|
649
|
+
self.gui.default_emoji_var.set(emoji)
|
|
650
|
+
self.set_emoji_btn()
|
|
651
|
+
|
|
652
|
+
def add_help_btn(self, msg: str) -> Button:
|
|
653
|
+
return Button(
|
|
654
|
+
self.frame_advcomp,
|
|
655
|
+
text="?",
|
|
656
|
+
width=1,
|
|
657
|
+
command=lambda: self.gui.cb.put(
|
|
658
|
+
("msg_block", None, {"message": msg, "parent": self})
|
|
659
|
+
),
|
|
660
|
+
bootstyle="secondary", # type: ignore
|
|
661
|
+
)
|
|
662
|
+
|
|
663
|
+
def set_emoji_btn(self) -> None:
|
|
664
|
+
self.im = Image.new("RGBA", (128, 128), (255, 255, 255, 0))
|
|
665
|
+
ImageDraw.Draw(self.im).text( # type: ignore
|
|
666
|
+
(0, 0),
|
|
667
|
+
self.gui.default_emoji_var.get(),
|
|
668
|
+
embedded_color=True,
|
|
669
|
+
font=self.gui.emoji_font,
|
|
670
|
+
) # type: ignore
|
|
671
|
+
self.im = self.im.resize((32, 32))
|
|
672
|
+
self.ph_im = ImageTk.PhotoImage(self.im)
|
|
673
|
+
self.default_emoji_dsp.config(image=self.ph_im)
|
|
674
|
+
|
|
675
|
+
def render_emoji_list(self, *_: Any) -> None:
|
|
676
|
+
category = self.categories_var.get()
|
|
677
|
+
|
|
678
|
+
for emoji_btn, ph_im in self.emoji_btns:
|
|
679
|
+
emoji_btn.destroy()
|
|
680
|
+
del ph_im
|
|
681
|
+
|
|
682
|
+
column = 0
|
|
683
|
+
row = 0
|
|
684
|
+
emoji_column_per_row = 0
|
|
685
|
+
|
|
686
|
+
self.emoji_btns = []
|
|
687
|
+
for entry in self.gui.emoji_list:
|
|
688
|
+
# Filtering
|
|
689
|
+
search_term = self.search_var.get().lower()
|
|
690
|
+
emoji = entry["emoji"]
|
|
691
|
+
keywords = entry["aliases"] + entry["tags"] + [emoji]
|
|
692
|
+
if search_term == "":
|
|
693
|
+
if entry["category"] != category:
|
|
694
|
+
continue
|
|
695
|
+
else:
|
|
696
|
+
ok = False
|
|
697
|
+
|
|
698
|
+
if search_term in keywords:
|
|
699
|
+
ok = True
|
|
700
|
+
elif len(search_term) >= 3:
|
|
701
|
+
for i in keywords:
|
|
702
|
+
if search_term in i:
|
|
703
|
+
ok = True
|
|
704
|
+
|
|
705
|
+
if ok is False:
|
|
706
|
+
continue
|
|
707
|
+
|
|
708
|
+
im = Image.new("RGBA", (196, 196), (255, 255, 255, 0))
|
|
709
|
+
ImageDraw.Draw(im).text( # type: ignore
|
|
710
|
+
(16, 16), emoji, embedded_color=True, font=self.gui.emoji_font
|
|
711
|
+
) # type: ignore
|
|
712
|
+
im = im.resize((32, 32))
|
|
713
|
+
ph_im = ImageTk.PhotoImage(im)
|
|
714
|
+
|
|
715
|
+
button = Button(
|
|
716
|
+
self.frame_buttons,
|
|
717
|
+
command=lambda i=emoji: self.cb_set_emoji(i), # type: ignore
|
|
718
|
+
bootstyle="dark", # type: ignore
|
|
719
|
+
)
|
|
720
|
+
button.config(image=ph_im)
|
|
721
|
+
button.grid(column=column, row=row)
|
|
722
|
+
|
|
723
|
+
column += 1
|
|
724
|
+
|
|
725
|
+
if emoji_column_per_row == 0:
|
|
726
|
+
self.emoji_canvas.update_idletasks()
|
|
727
|
+
emoji_column_per_row = int(
|
|
728
|
+
self.emoji_canvas.winfo_width() / button.winfo_width()
|
|
729
|
+
)
|
|
730
|
+
if column == emoji_column_per_row:
|
|
731
|
+
column = 0
|
|
732
|
+
row += 1
|
|
733
|
+
|
|
734
|
+
self.emoji_btns.append((button, ph_im))
|
|
735
|
+
|
|
736
|
+
# Update buttons frames idle tasks to let tkinter calculate buttons sizes
|
|
737
|
+
self.frame_buttons.update_idletasks()
|
|
738
|
+
|
|
739
|
+
# Resize the canvas frame to show specified number of buttons and the scrollbar
|
|
740
|
+
if len(self.emoji_btns) > 0:
|
|
741
|
+
in_view_columns_width = (
|
|
742
|
+
self.emoji_btns[0][0].winfo_width() * emoji_column_per_row
|
|
743
|
+
)
|
|
744
|
+
in_view_rows_height = (
|
|
745
|
+
self.emoji_btns[0][0].winfo_height() * self.emoji_visible_rows
|
|
746
|
+
)
|
|
747
|
+
self.frame_emoji_canvas.config(
|
|
748
|
+
width=in_view_columns_width + self.vsb.winfo_width(),
|
|
749
|
+
height=in_view_rows_height,
|
|
750
|
+
)
|
|
751
|
+
|
|
752
|
+
# Set the canvas scrolling region
|
|
753
|
+
self.emoji_canvas.config(scrollregion=self.emoji_canvas.bbox("all"))
|
|
754
|
+
|
|
755
|
+
# https://stackoverflow.com/questions/17355902/tkinter-binding-mousewheel-to-scrollbar
|
|
756
|
+
self.emoji_canvas.bind("<Enter>", self.cb_bound_to_mousewheel)
|
|
757
|
+
self.emoji_canvas.bind("<Leave>", self.cb_unbound_to_mousewheel)
|