sticker-convert 2.7.2__py3-none-any.whl → 2.7.4__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/__init__.py +1 -0
- sticker_convert/__main__.py +3 -1
- sticker_convert/cli.py +20 -24
- sticker_convert/converter.py +108 -119
- sticker_convert/definitions.py +8 -12
- sticker_convert/downloaders/download_base.py +14 -31
- sticker_convert/downloaders/download_kakao.py +25 -39
- sticker_convert/downloaders/download_line.py +24 -33
- sticker_convert/downloaders/download_signal.py +7 -16
- sticker_convert/downloaders/download_telegram.py +6 -15
- sticker_convert/gui.py +53 -61
- sticker_convert/gui_components/frames/comp_frame.py +11 -20
- sticker_convert/gui_components/frames/config_frame.py +9 -9
- sticker_convert/gui_components/frames/control_frame.py +3 -3
- sticker_convert/gui_components/frames/cred_frame.py +12 -18
- sticker_convert/gui_components/frames/input_frame.py +9 -15
- sticker_convert/gui_components/frames/output_frame.py +9 -15
- sticker_convert/gui_components/frames/progress_frame.py +8 -8
- sticker_convert/gui_components/frames/right_clicker.py +2 -2
- sticker_convert/gui_components/gui_utils.py +6 -8
- sticker_convert/gui_components/windows/advanced_compression_window.py +23 -32
- sticker_convert/gui_components/windows/base_window.py +6 -6
- sticker_convert/gui_components/windows/kakao_get_auth_window.py +5 -11
- sticker_convert/gui_components/windows/line_get_auth_window.py +5 -5
- sticker_convert/gui_components/windows/signal_get_auth_window.py +6 -6
- sticker_convert/job.py +84 -90
- sticker_convert/job_option.py +36 -32
- sticker_convert/resources/emoji.json +334 -70
- sticker_convert/resources/help.json +1 -1
- sticker_convert/uploaders/compress_wastickers.py +19 -30
- sticker_convert/uploaders/upload_base.py +19 -13
- sticker_convert/uploaders/upload_signal.py +20 -33
- sticker_convert/uploaders/upload_telegram.py +21 -28
- sticker_convert/uploaders/xcode_imessage.py +30 -95
- sticker_convert/utils/auth/get_kakao_auth.py +7 -8
- sticker_convert/utils/auth/get_line_auth.py +5 -6
- sticker_convert/utils/auth/get_signal_auth.py +7 -7
- sticker_convert/utils/callback.py +31 -23
- sticker_convert/utils/files/cache_store.py +6 -8
- sticker_convert/utils/files/json_manager.py +6 -7
- sticker_convert/utils/files/json_resources_loader.py +12 -0
- sticker_convert/utils/files/metadata_handler.py +93 -84
- sticker_convert/utils/files/run_bin.py +11 -10
- sticker_convert/utils/files/sanitize_filename.py +30 -28
- sticker_convert/utils/media/apple_png_normalize.py +3 -2
- sticker_convert/utils/media/codec_info.py +41 -44
- sticker_convert/utils/media/decrypt_kakao.py +7 -7
- sticker_convert/utils/media/format_verify.py +14 -14
- sticker_convert/utils/url_detect.py +4 -5
- sticker_convert/version.py +2 -1
- {sticker_convert-2.7.2.dist-info → sticker_convert-2.7.4.dist-info}/METADATA +19 -17
- {sticker_convert-2.7.2.dist-info → sticker_convert-2.7.4.dist-info}/RECORD +56 -55
- {sticker_convert-2.7.2.dist-info → sticker_convert-2.7.4.dist-info}/WHEEL +1 -1
- {sticker_convert-2.7.2.dist-info → sticker_convert-2.7.4.dist-info}/LICENSE +0 -0
- {sticker_convert-2.7.2.dist-info → sticker_convert-2.7.4.dist-info}/entry_points.txt +0 -0
- {sticker_convert-2.7.2.dist-info → sticker_convert-2.7.4.dist-info}/top_level.txt +0 -0
sticker_convert/gui.py
CHANGED
@@ -9,18 +9,11 @@ from math import ceil
|
|
9
9
|
from multiprocessing import Event, cpu_count
|
10
10
|
from pathlib import Path
|
11
11
|
from threading import Lock, Thread
|
12
|
-
from typing import Any, Callable, Optional, Union
|
12
|
+
from typing import Any, Callable, Dict, Optional, Union
|
13
13
|
from urllib.parse import urlparse
|
14
14
|
|
15
15
|
from PIL import ImageFont
|
16
|
-
from ttkbootstrap import
|
17
|
-
BooleanVar,
|
18
|
-
DoubleVar,
|
19
|
-
IntVar,
|
20
|
-
StringVar,
|
21
|
-
Toplevel,
|
22
|
-
Window,
|
23
|
-
)
|
16
|
+
from ttkbootstrap import BooleanVar, DoubleVar, IntVar, StringVar, Toplevel, Window # type: ignore
|
24
17
|
from ttkbootstrap.dialogs import Messagebox, Querybox # type: ignore
|
25
18
|
|
26
19
|
from sticker_convert.definitions import CONFIG_DIR, DEFAULT_DIR, ROOT_DIR
|
@@ -41,8 +34,8 @@ from sticker_convert.version import __version__
|
|
41
34
|
|
42
35
|
|
43
36
|
class GUI(Window):
|
44
|
-
def __init__(self):
|
45
|
-
super(
|
37
|
+
def __init__(self) -> None:
|
38
|
+
super().__init__(themename="darkly", alpha=0) # type: ignore
|
46
39
|
self.init_done = False
|
47
40
|
self.load_jsons()
|
48
41
|
|
@@ -73,15 +66,15 @@ class GUI(Window):
|
|
73
66
|
|
74
67
|
self.bind("<<exec_in_main>>", self.exec_in_main) # type: ignore
|
75
68
|
|
76
|
-
def __enter__(self):
|
69
|
+
def __enter__(self) -> "GUI":
|
77
70
|
return self
|
78
71
|
|
79
|
-
def gui(self):
|
72
|
+
def gui(self) -> None:
|
80
73
|
self.init_done = True
|
81
74
|
self.highlight_fields()
|
82
75
|
self.mainloop()
|
83
76
|
|
84
|
-
def quit(self):
|
77
|
+
def quit(self) -> None:
|
85
78
|
if self.job:
|
86
79
|
response = self.cb_ask_bool("Job is running, really quit?")
|
87
80
|
if response is False:
|
@@ -99,7 +92,7 @@ class GUI(Window):
|
|
99
92
|
self.cancel_job()
|
100
93
|
self.destroy()
|
101
94
|
|
102
|
-
def declare_variables(self):
|
95
|
+
def declare_variables(self) -> None:
|
103
96
|
# Input
|
104
97
|
self.input_option_display_var = StringVar(self)
|
105
98
|
self.input_option_true_var = StringVar(self)
|
@@ -173,9 +166,9 @@ class GUI(Window):
|
|
173
166
|
self.response_event = Event()
|
174
167
|
self.response = None
|
175
168
|
self.action: Optional[Callable[..., Any]] = None
|
176
|
-
self.job = None
|
169
|
+
self.job: Optional[Job] = None
|
177
170
|
|
178
|
-
def init_frames(self):
|
171
|
+
def init_frames(self) -> None:
|
179
172
|
self.input_frame = InputFrame(
|
180
173
|
self, self.scrollable_frame, borderwidth=1, text="Input"
|
181
174
|
)
|
@@ -196,7 +189,7 @@ class GUI(Window):
|
|
196
189
|
)
|
197
190
|
self.control_frame = ControlFrame(self, self.scrollable_frame, borderwidth=1)
|
198
191
|
|
199
|
-
def pack_frames(self):
|
192
|
+
def pack_frames(self) -> None:
|
200
193
|
self.input_frame.grid(column=0, row=0, sticky="w", padx=5, pady=5)
|
201
194
|
self.comp_frame.grid(column=1, row=0, sticky="news", padx=5, pady=5)
|
202
195
|
self.output_frame.grid(column=0, row=1, sticky="w", padx=5, pady=5)
|
@@ -209,7 +202,7 @@ class GUI(Window):
|
|
209
202
|
column=0, row=4, columnspan=2, sticky="news", padx=5, pady=5
|
210
203
|
)
|
211
204
|
|
212
|
-
def warn_tkinter_bug(self):
|
205
|
+
def warn_tkinter_bug(self) -> None:
|
213
206
|
if (
|
214
207
|
platform.system() == "Darwin"
|
215
208
|
and platform.mac_ver()[0].split(".")[0] == "14"
|
@@ -227,14 +220,18 @@ class GUI(Window):
|
|
227
220
|
msg = "(https://github.com/python/cpython/issues/110218)"
|
228
221
|
self.cb_msg(msg)
|
229
222
|
|
230
|
-
def load_jsons(self):
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
self.
|
223
|
+
def load_jsons(self) -> None:
|
224
|
+
try:
|
225
|
+
from sticker_convert.utils.files.json_resources_loader import COMPRESSION_JSON, EMOJI_JSON, HELP_JSON, INPUT_JSON, OUTPUT_JSON
|
226
|
+
except RuntimeError as e:
|
227
|
+
self.cb_msg(str(e))
|
228
|
+
return
|
229
|
+
|
230
|
+
self.help = HELP_JSON
|
231
|
+
self.input_presets = INPUT_JSON
|
232
|
+
self.compression_presets = COMPRESSION_JSON
|
233
|
+
self.output_presets = OUTPUT_JSON
|
234
|
+
self.emoji_list = EMOJI_JSON
|
238
235
|
|
239
236
|
if not (
|
240
237
|
self.compression_presets and self.input_presets and self.output_presets
|
@@ -248,7 +245,7 @@ class GUI(Window):
|
|
248
245
|
self.settings_path = CONFIG_DIR / "config.json"
|
249
246
|
if self.settings_path.is_file():
|
250
247
|
try:
|
251
|
-
self.settings:
|
248
|
+
self.settings: Dict[Any, Any] = JsonManager.load_json(
|
252
249
|
self.settings_path
|
253
250
|
)
|
254
251
|
except JSONDecodeError:
|
@@ -267,7 +264,7 @@ class GUI(Window):
|
|
267
264
|
else:
|
268
265
|
self.creds = {}
|
269
266
|
|
270
|
-
def save_config(self):
|
267
|
+
def save_config(self) -> None:
|
271
268
|
# Only update comp_custom if custom preset is selected
|
272
269
|
if self.comp_preset_var.get() == "custom":
|
273
270
|
comp_custom = self.get_opt_comp().to_dict()
|
@@ -295,20 +292,20 @@ class GUI(Window):
|
|
295
292
|
|
296
293
|
JsonManager.save_json(self.settings_path, self.settings)
|
297
294
|
|
298
|
-
def save_creds(self):
|
295
|
+
def save_creds(self) -> None:
|
299
296
|
self.creds = self.get_opt_cred().to_dict()
|
300
297
|
|
301
298
|
JsonManager.save_json(self.creds_path, self.creds)
|
302
299
|
|
303
|
-
def delete_creds(self):
|
300
|
+
def delete_creds(self) -> None:
|
304
301
|
if self.creds_path.is_file():
|
305
302
|
os.remove(self.creds_path)
|
306
303
|
|
307
|
-
def delete_config(self):
|
304
|
+
def delete_config(self) -> None:
|
308
305
|
if self.settings_path.is_file():
|
309
306
|
os.remove(self.settings_path)
|
310
307
|
|
311
|
-
def apply_config(self):
|
308
|
+
def apply_config(self) -> None:
|
312
309
|
# Input
|
313
310
|
self.default_input_mode: str = self.settings.get("input", {}).get(
|
314
311
|
"option", "auto"
|
@@ -365,7 +362,7 @@ class GUI(Window):
|
|
365
362
|
self.output_presets[self.default_output_mode]["full_name"]
|
366
363
|
)
|
367
364
|
|
368
|
-
def apply_creds(self):
|
365
|
+
def apply_creds(self) -> None:
|
369
366
|
self.signal_uuid_var.set(self.creds.get("signal", {}).get("uuid", ""))
|
370
367
|
self.signal_password_var.set(self.creds.get("signal", {}).get("password", ""))
|
371
368
|
self.telegram_token_var.set(self.creds.get("telegram", {}).get("token", ""))
|
@@ -402,12 +399,12 @@ class GUI(Window):
|
|
402
399
|
if v["full_name"] == self.output_option_true_var.get()
|
403
400
|
][0]
|
404
401
|
|
405
|
-
def get_output_display_name(self) -> str:
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
402
|
+
# def get_output_display_name(self) -> str:
|
403
|
+
# return [
|
404
|
+
# k
|
405
|
+
# for k, v in self.output_presets.items()
|
406
|
+
# if v["full_name"] == self.output_option_display_var.get()
|
407
|
+
# ][0]
|
411
408
|
|
412
409
|
def get_preset(self) -> str:
|
413
410
|
selection = self.comp_preset_var.get()
|
@@ -415,15 +412,13 @@ class GUI(Window):
|
|
415
412
|
output_option = self.get_output_name()
|
416
413
|
if output_option == "imessage":
|
417
414
|
return "imessage_small"
|
418
|
-
|
415
|
+
if output_option == "local":
|
419
416
|
return selection
|
420
|
-
|
421
|
-
return output_option
|
417
|
+
return output_option
|
422
418
|
|
423
|
-
|
424
|
-
return selection
|
419
|
+
return selection
|
425
420
|
|
426
|
-
def start_job(self):
|
421
|
+
def start_job(self) -> None:
|
427
422
|
self.save_config()
|
428
423
|
if self.settings_save_cred_var.get() is True:
|
429
424
|
self.save_creds()
|
@@ -542,24 +537,24 @@ class GUI(Window):
|
|
542
537
|
line_cookies=self.line_cookies_var.get(),
|
543
538
|
)
|
544
539
|
|
545
|
-
def start_process(self):
|
540
|
+
def start_process(self) -> None:
|
546
541
|
if self.job:
|
547
542
|
self.job.start()
|
548
543
|
self.job = None
|
549
544
|
|
550
545
|
self.stop_job()
|
551
546
|
|
552
|
-
def stop_job(self):
|
547
|
+
def stop_job(self) -> None:
|
553
548
|
self.set_inputs("normal")
|
554
549
|
self.control_frame.start_btn.config(text="Start", bootstyle="default") # type: ignore
|
555
550
|
|
556
|
-
def cancel_job(self):
|
551
|
+
def cancel_job(self) -> None:
|
557
552
|
if self.job:
|
558
553
|
self.cb_msg(msg="Cancelling job...")
|
559
554
|
self.job.cancel()
|
560
555
|
self.cb_bar(set_progress_mode="clear")
|
561
556
|
|
562
|
-
def set_inputs(self, state: str):
|
557
|
+
def set_inputs(self, state: str) -> None:
|
563
558
|
# state: 'normal', 'disabled'
|
564
559
|
|
565
560
|
self.input_frame.set_states(state=state)
|
@@ -572,7 +567,7 @@ class GUI(Window):
|
|
572
567
|
self.input_frame.cb_input_option()
|
573
568
|
self.comp_frame.cb_no_compress()
|
574
569
|
|
575
|
-
def exec_in_main(self,
|
570
|
+
def exec_in_main(self, _evt: Any) -> Any:
|
576
571
|
if self.action:
|
577
572
|
self.response = self.action()
|
578
573
|
self.response_event.set()
|
@@ -614,16 +609,16 @@ class GUI(Window):
|
|
614
609
|
return True
|
615
610
|
return False
|
616
611
|
|
617
|
-
def cb_msg(self, *args: Any, **kwargs: Any):
|
612
|
+
def cb_msg(self, *args: Any, **kwargs: Any) -> None:
|
618
613
|
with self.msg_lock:
|
619
614
|
self.progress_frame.update_message_box(*args, **kwargs)
|
620
615
|
|
621
616
|
def cb_msg_block(
|
622
617
|
self,
|
618
|
+
*args: Any,
|
623
619
|
message: Optional[str] = None,
|
624
620
|
parent: Optional[object] = None,
|
625
|
-
|
626
|
-
**kwargs: Any,
|
621
|
+
**_kwargs: Any,
|
627
622
|
) -> Any:
|
628
623
|
if message is None and len(args) > 0:
|
629
624
|
message = " ".join(str(i) for i in args)
|
@@ -641,12 +636,12 @@ class GUI(Window):
|
|
641
636
|
|
642
637
|
def cb_bar(
|
643
638
|
self,
|
639
|
+
*args: Any,
|
644
640
|
set_progress_mode: Optional[str] = None,
|
645
641
|
steps: int = 0,
|
646
642
|
update_bar: bool = False,
|
647
|
-
*args: Any,
|
648
643
|
**kwargs: Any,
|
649
|
-
):
|
644
|
+
) -> None:
|
650
645
|
with self.bar_lock:
|
651
646
|
self.progress_frame.update_progress_bar(
|
652
647
|
set_progress_mode, steps, update_bar, *args, **kwargs
|
@@ -662,13 +657,10 @@ class GUI(Window):
|
|
662
657
|
# output_option_display = self.get_output_display_name()
|
663
658
|
url = self.input_address_var.get()
|
664
659
|
|
665
|
-
|
660
|
+
in_out_dir_same = (
|
666
661
|
Path(self.input_setdir_var.get()).absolute()
|
667
662
|
== Path(self.output_setdir_var.get()).absolute()
|
668
|
-
)
|
669
|
-
in_out_dir_same = True
|
670
|
-
else:
|
671
|
-
in_out_dir_same = False
|
663
|
+
)
|
672
664
|
|
673
665
|
# Input
|
674
666
|
if in_out_dir_same is True:
|
@@ -1,28 +1,19 @@
|
|
1
1
|
#!/usr/bin/env python3
|
2
2
|
from typing import TYPE_CHECKING, Any
|
3
3
|
|
4
|
-
from ttkbootstrap import
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
Label,
|
9
|
-
LabelFrame,
|
10
|
-
OptionMenu,
|
11
|
-
)
|
4
|
+
from ttkbootstrap import Button, Checkbutton, Entry, Label, LabelFrame, OptionMenu # type: ignore
|
5
|
+
|
6
|
+
from sticker_convert.gui_components.frames.right_clicker import RightClicker
|
7
|
+
from sticker_convert.gui_components.windows.advanced_compression_window import AdvancedCompressionWindow
|
12
8
|
|
13
9
|
if TYPE_CHECKING:
|
14
10
|
from sticker_convert.gui import GUI # type: ignore
|
15
11
|
|
16
|
-
from sticker_convert.gui_components.frames.right_clicker import RightClicker
|
17
|
-
from sticker_convert.gui_components.windows.advanced_compression_window import (
|
18
|
-
AdvancedCompressionWindow,
|
19
|
-
)
|
20
|
-
|
21
12
|
|
22
13
|
class CompFrame(LabelFrame):
|
23
|
-
def __init__(self, gui: "GUI", *args: Any, **kwargs: Any):
|
14
|
+
def __init__(self, gui: "GUI", *args: Any, **kwargs: Any) -> None:
|
24
15
|
self.gui = gui
|
25
|
-
super(
|
16
|
+
super().__init__(*args, **kwargs)
|
26
17
|
|
27
18
|
self.grid_columnconfigure(2, weight=1)
|
28
19
|
|
@@ -111,7 +102,7 @@ class CompFrame(LabelFrame):
|
|
111
102
|
self.cb_comp_apply_preset()
|
112
103
|
self.cb_no_compress()
|
113
104
|
|
114
|
-
def cb_comp_apply_preset(self, *
|
105
|
+
def cb_comp_apply_preset(self, *_: Any) -> None:
|
115
106
|
selection = self.gui.get_preset()
|
116
107
|
if selection == "auto":
|
117
108
|
if self.gui.get_input_name() == "local":
|
@@ -190,10 +181,10 @@ class CompFrame(LabelFrame):
|
|
190
181
|
self.cb_no_compress()
|
191
182
|
self.gui.highlight_fields()
|
192
183
|
|
193
|
-
def cb_compress_advanced(self, *
|
184
|
+
def cb_compress_advanced(self, *_: Any) -> None:
|
194
185
|
AdvancedCompressionWindow(self.gui)
|
195
186
|
|
196
|
-
def cb_no_compress(self, *
|
187
|
+
def cb_no_compress(self, *_: Any) -> None:
|
197
188
|
if self.gui.no_compress_var.get() is True:
|
198
189
|
state = "disabled"
|
199
190
|
else:
|
@@ -203,12 +194,12 @@ class CompFrame(LabelFrame):
|
|
203
194
|
self.steps_entry.config(state=state)
|
204
195
|
self.processes_entry.config(state=state)
|
205
196
|
|
206
|
-
def set_inputs_comp(self, state: str):
|
197
|
+
def set_inputs_comp(self, state: str) -> None:
|
207
198
|
self.comp_preset_opt.config(state=state)
|
208
199
|
self.comp_advanced_btn.config(state=state)
|
209
200
|
self.steps_entry.config(state=state)
|
210
201
|
self.processes_entry.config(state=state)
|
211
202
|
|
212
|
-
def set_states(self, state: str):
|
203
|
+
def set_states(self, state: str) -> None:
|
213
204
|
self.no_compress_cbox.config(state=state)
|
214
205
|
self.set_inputs_comp(state=state)
|
@@ -5,17 +5,17 @@ from typing import TYPE_CHECKING, Any
|
|
5
5
|
|
6
6
|
from ttkbootstrap import Button, Checkbutton, Label, LabelFrame # type: ignore
|
7
7
|
|
8
|
-
if TYPE_CHECKING:
|
9
|
-
from sticker_convert.gui import GUI # type: ignore
|
10
|
-
|
11
8
|
from sticker_convert.definitions import CONFIG_DIR
|
12
9
|
from sticker_convert.utils.files.run_bin import RunBin
|
13
10
|
|
11
|
+
if TYPE_CHECKING:
|
12
|
+
from sticker_convert.gui import GUI # type: ignore
|
13
|
+
|
14
14
|
|
15
15
|
class ConfigFrame(LabelFrame):
|
16
|
-
def __init__(self, gui: "GUI", *args: Any, **kwargs: Any):
|
16
|
+
def __init__(self, gui: "GUI", *args: Any, **kwargs: Any) -> None:
|
17
17
|
self.gui = gui
|
18
|
-
super(
|
18
|
+
super().__init__(*args, **kwargs)
|
19
19
|
|
20
20
|
self.grid_columnconfigure(1, weight=1)
|
21
21
|
self.grid_columnconfigure(3, weight=1)
|
@@ -77,7 +77,7 @@ class ConfigFrame(LabelFrame):
|
|
77
77
|
column=3, row=1, sticky="w", padx=3, pady=3
|
78
78
|
)
|
79
79
|
|
80
|
-
def cb_clear_cred(self, *
|
80
|
+
def cb_clear_cred(self, *_: Any, **kwargs: Any) -> None:
|
81
81
|
response = self.gui.cb_ask_bool("Are you sure you want to clear credentials?")
|
82
82
|
if response is True:
|
83
83
|
self.gui.delete_creds()
|
@@ -86,7 +86,7 @@ class ConfigFrame(LabelFrame):
|
|
86
86
|
self.gui.highlight_fields()
|
87
87
|
self.gui.cb_msg_block("Credentials cleared.")
|
88
88
|
|
89
|
-
def cb_restore_default(self, *
|
89
|
+
def cb_restore_default(self, *_: Any, **kwargs: Any) -> None:
|
90
90
|
response = self.gui.cb_ask_bool(
|
91
91
|
"Are you sure you want to restore default config? (This will not clear credentials.)"
|
92
92
|
)
|
@@ -97,7 +97,7 @@ class ConfigFrame(LabelFrame):
|
|
97
97
|
self.gui.highlight_fields()
|
98
98
|
self.gui.cb_msg_block("Restored to default config.")
|
99
99
|
|
100
|
-
def cb_open_config_directory(self, *
|
100
|
+
def cb_open_config_directory(self, *_: Any, **kwargs: Any) -> None:
|
101
101
|
self.gui.cb_msg(msg=f"Config is located at {CONFIG_DIR}")
|
102
102
|
if platform.system() == "Windows":
|
103
103
|
os.startfile(CONFIG_DIR) # type: ignore
|
@@ -106,7 +106,7 @@ class ConfigFrame(LabelFrame):
|
|
106
106
|
else:
|
107
107
|
RunBin.run_cmd(["xdg-open", str(CONFIG_DIR)], silence=True)
|
108
108
|
|
109
|
-
def set_states(self, state: str):
|
109
|
+
def set_states(self, state: str) -> None:
|
110
110
|
self.settings_save_cred_cbox.config(state=state)
|
111
111
|
self.settings_clear_cred_btn.config(state=state)
|
112
112
|
self.settings_restore_default_btn.config(state=state)
|
@@ -8,9 +8,9 @@ if TYPE_CHECKING:
|
|
8
8
|
|
9
9
|
|
10
10
|
class ControlFrame(Frame):
|
11
|
-
def __init__(self, gui: "GUI", *args: Any, **kwargs: Any):
|
11
|
+
def __init__(self, gui: "GUI", *args: Any, **kwargs: Any) -> None:
|
12
12
|
self.gui = gui
|
13
|
-
super(
|
13
|
+
super().__init__(*args, **kwargs)
|
14
14
|
|
15
15
|
self.start_btn = Button(
|
16
16
|
self,
|
@@ -21,7 +21,7 @@ class ControlFrame(Frame):
|
|
21
21
|
|
22
22
|
self.start_btn.pack(expand=True, fill="x")
|
23
23
|
|
24
|
-
def cb_start_btn(self, *args: Any, **kwargs: Any):
|
24
|
+
def cb_start_btn(self, *args: Any, **kwargs: Any) -> None:
|
25
25
|
if self.gui.job:
|
26
26
|
response = self.gui.cb_ask_bool("Cancel job?")
|
27
27
|
if response is True:
|
@@ -4,25 +4,19 @@ from typing import TYPE_CHECKING, Any
|
|
4
4
|
|
5
5
|
from ttkbootstrap import Button, Entry, Label, LabelFrame # type: ignore
|
6
6
|
|
7
|
+
from sticker_convert.gui_components.frames.right_clicker import RightClicker
|
8
|
+
from sticker_convert.gui_components.windows.kakao_get_auth_window import KakaoGetAuthWindow
|
9
|
+
from sticker_convert.gui_components.windows.line_get_auth_window import LineGetAuthWindow
|
10
|
+
from sticker_convert.gui_components.windows.signal_get_auth_window import SignalGetAuthWindow
|
11
|
+
|
7
12
|
if TYPE_CHECKING:
|
8
13
|
from sticker_convert.gui import GUI # type: ignore
|
9
14
|
|
10
|
-
from sticker_convert.gui_components.frames.right_clicker import RightClicker
|
11
|
-
from sticker_convert.gui_components.windows.kakao_get_auth_window import (
|
12
|
-
KakaoGetAuthWindow,
|
13
|
-
)
|
14
|
-
from sticker_convert.gui_components.windows.line_get_auth_window import (
|
15
|
-
LineGetAuthWindow,
|
16
|
-
)
|
17
|
-
from sticker_convert.gui_components.windows.signal_get_auth_window import (
|
18
|
-
SignalGetAuthWindow,
|
19
|
-
)
|
20
|
-
|
21
15
|
|
22
16
|
class CredFrame(LabelFrame):
|
23
|
-
def __init__(self, gui: "GUI", *args: Any, **kwargs: Any):
|
17
|
+
def __init__(self, gui: "GUI", *args: Any, **kwargs: Any) -> None:
|
24
18
|
self.gui = gui
|
25
|
-
super(
|
19
|
+
super().__init__(*args, **kwargs)
|
26
20
|
|
27
21
|
self.grid_columnconfigure(1, weight=1)
|
28
22
|
|
@@ -141,22 +135,22 @@ class CredFrame(LabelFrame):
|
|
141
135
|
self.line_get_auth_btn.grid(column=2, row=6, sticky="e", padx=3, pady=3)
|
142
136
|
self.help_btn.grid(column=2, row=8, sticky="e", padx=3, pady=3)
|
143
137
|
|
144
|
-
def cb_cred_help(self, *
|
138
|
+
def cb_cred_help(self, *_: Any) -> None:
|
145
139
|
faq_site = "https://github.com/laggykiller/sticker-convert#faq"
|
146
140
|
success = webbrowser.open(faq_site)
|
147
141
|
if not success:
|
148
142
|
self.gui.cb_ask_str("You can get help from:", initialvalue=faq_site)
|
149
143
|
|
150
|
-
def cb_kakao_get_auth(self, *
|
144
|
+
def cb_kakao_get_auth(self, *_: Any) -> None:
|
151
145
|
KakaoGetAuthWindow(self.gui)
|
152
146
|
|
153
|
-
def cb_signal_get_auth(self, *
|
147
|
+
def cb_signal_get_auth(self, *_: Any) -> None:
|
154
148
|
SignalGetAuthWindow(self.gui)
|
155
149
|
|
156
|
-
def cb_line_get_auth(self, *
|
150
|
+
def cb_line_get_auth(self, *_: Any) -> None:
|
157
151
|
LineGetAuthWindow(self.gui)
|
158
152
|
|
159
|
-
def set_states(self, state: str):
|
153
|
+
def set_states(self, state: str) -> None:
|
160
154
|
self.signal_uuid_entry.config(state=state)
|
161
155
|
self.signal_password_entry.config(state=state)
|
162
156
|
self.signal_get_auth_btn.config(state=state)
|
@@ -3,26 +3,20 @@ from pathlib import Path
|
|
3
3
|
from tkinter import filedialog
|
4
4
|
from typing import TYPE_CHECKING, Any
|
5
5
|
|
6
|
-
from ttkbootstrap import
|
7
|
-
Button,
|
8
|
-
Entry,
|
9
|
-
Label,
|
10
|
-
LabelFrame,
|
11
|
-
OptionMenu,
|
12
|
-
)
|
13
|
-
|
14
|
-
if TYPE_CHECKING:
|
15
|
-
from sticker_convert.gui import GUI # type: ignore
|
6
|
+
from ttkbootstrap import Button, Entry, Label, LabelFrame, OptionMenu # type: ignore
|
16
7
|
|
17
8
|
from sticker_convert.definitions import DEFAULT_DIR
|
18
9
|
from sticker_convert.gui_components.frames.right_clicker import RightClicker
|
19
10
|
from sticker_convert.utils.url_detect import UrlDetect
|
20
11
|
|
12
|
+
if TYPE_CHECKING:
|
13
|
+
from sticker_convert.gui import GUI # type: ignore
|
14
|
+
|
21
15
|
|
22
16
|
class InputFrame(LabelFrame):
|
23
|
-
def __init__(self, gui: "GUI", *args: Any, **kwargs: Any):
|
17
|
+
def __init__(self, gui: "GUI", *args: Any, **kwargs: Any) -> None:
|
24
18
|
self.gui = gui
|
25
|
-
super(
|
19
|
+
super().__init__(*args, **kwargs)
|
26
20
|
|
27
21
|
self.input_option_lbl = Label(
|
28
22
|
self, text="Input source", width=15, justify="left", anchor="w"
|
@@ -106,7 +100,7 @@ class InputFrame(LabelFrame):
|
|
106
100
|
else:
|
107
101
|
self.address_entry.config(state="normal")
|
108
102
|
|
109
|
-
def cb_set_indir(self, *
|
103
|
+
def cb_set_indir(self, *_args: Any) -> None:
|
110
104
|
orig_input_dir = self.gui.input_setdir_var.get()
|
111
105
|
if not Path(orig_input_dir).is_dir():
|
112
106
|
orig_input_dir = DEFAULT_DIR
|
@@ -114,7 +108,7 @@ class InputFrame(LabelFrame):
|
|
114
108
|
if input_dir:
|
115
109
|
self.gui.input_setdir_var.set(input_dir)
|
116
110
|
|
117
|
-
def cb_input_option(self, *
|
111
|
+
def cb_input_option(self, *_: Any) -> bool:
|
118
112
|
input_option_display = self.gui.get_input_display_name()
|
119
113
|
|
120
114
|
if input_option_display == "auto":
|
@@ -136,7 +130,7 @@ class InputFrame(LabelFrame):
|
|
136
130
|
|
137
131
|
return True
|
138
132
|
|
139
|
-
def set_states(self, state: str):
|
133
|
+
def set_states(self, state: str) -> None:
|
140
134
|
self.input_option_opt.config(state=state)
|
141
135
|
self.address_entry.config(state=state)
|
142
136
|
self.input_setdir_entry.config(state=state)
|
@@ -3,25 +3,19 @@ from pathlib import Path
|
|
3
3
|
from tkinter import filedialog
|
4
4
|
from typing import TYPE_CHECKING, Any
|
5
5
|
|
6
|
-
from ttkbootstrap import
|
7
|
-
Button,
|
8
|
-
Entry,
|
9
|
-
Label,
|
10
|
-
LabelFrame,
|
11
|
-
OptionMenu,
|
12
|
-
)
|
13
|
-
|
14
|
-
if TYPE_CHECKING:
|
15
|
-
from sticker_convert.gui import GUI # type: ignore
|
6
|
+
from ttkbootstrap import Button, Entry, Label, LabelFrame, OptionMenu # type: ignore
|
16
7
|
|
17
8
|
from sticker_convert.definitions import DEFAULT_DIR
|
18
9
|
from sticker_convert.gui_components.frames.right_clicker import RightClicker
|
19
10
|
|
11
|
+
if TYPE_CHECKING:
|
12
|
+
from sticker_convert.gui import GUI # type: ignore
|
13
|
+
|
20
14
|
|
21
15
|
class OutputFrame(LabelFrame):
|
22
|
-
def __init__(self, gui: "GUI", *args: Any, **kwargs: Any):
|
16
|
+
def __init__(self, gui: "GUI", *args: Any, **kwargs: Any) -> None:
|
23
17
|
self.gui = gui
|
24
|
-
super(
|
18
|
+
super().__init__(*args, **kwargs)
|
25
19
|
|
26
20
|
self.output_option_lbl = Label(
|
27
21
|
self, text="Output options", width=18, justify="left", anchor="w"
|
@@ -95,7 +89,7 @@ class OutputFrame(LabelFrame):
|
|
95
89
|
column=1, columnspan=2, row=3, sticky="w", padx=3, pady=3
|
96
90
|
)
|
97
91
|
|
98
|
-
def cb_set_outdir(self, *
|
92
|
+
def cb_set_outdir(self, *_args: Any) -> None:
|
99
93
|
orig_output_dir = self.gui.output_setdir_var.get()
|
100
94
|
if not Path(orig_output_dir).is_dir():
|
101
95
|
orig_output_dir = DEFAULT_DIR
|
@@ -103,12 +97,12 @@ class OutputFrame(LabelFrame):
|
|
103
97
|
if output_dir:
|
104
98
|
self.gui.output_setdir_var.set(output_dir)
|
105
99
|
|
106
|
-
def cb_output_option(self, *
|
100
|
+
def cb_output_option(self, *_: Any) -> None:
|
107
101
|
self.gui.output_option_true_var.set(self.gui.output_option_display_var.get())
|
108
102
|
self.gui.comp_frame.cb_comp_apply_preset()
|
109
103
|
self.gui.highlight_fields()
|
110
104
|
|
111
|
-
def set_states(self, state: str):
|
105
|
+
def set_states(self, state: str) -> None:
|
112
106
|
self.title_entry.config(state=state)
|
113
107
|
self.author_entry.config(state=state)
|
114
108
|
self.output_option_opt.config(state=state)
|
@@ -5,20 +5,20 @@ from tqdm import tqdm
|
|
5
5
|
from ttkbootstrap import LabelFrame, Progressbar # type: ignore
|
6
6
|
from ttkbootstrap.scrolled import ScrolledText # type: ignore
|
7
7
|
|
8
|
+
from sticker_convert.gui_components.frames.right_clicker import RightClicker
|
9
|
+
|
8
10
|
if TYPE_CHECKING:
|
9
11
|
from sticker_convert.gui import GUI # type: ignore
|
10
12
|
|
11
|
-
from sticker_convert.gui_components.frames.right_clicker import RightClicker
|
12
|
-
|
13
13
|
|
14
14
|
class ProgressFrame(LabelFrame):
|
15
15
|
progress_bar_cli = None
|
16
16
|
progress_bar_steps = 0
|
17
17
|
auto_scroll = True
|
18
18
|
|
19
|
-
def __init__(self, gui: "GUI", *args: Any, **kwargs: Any):
|
19
|
+
def __init__(self, gui: "GUI", *args: Any, **kwargs: Any) -> None:
|
20
20
|
self.gui = gui
|
21
|
-
super(
|
21
|
+
super().__init__(*args, **kwargs) # type: ignore
|
22
22
|
|
23
23
|
self.message_box = ScrolledText(self, height=15, wrap="word")
|
24
24
|
self.message_box._text.bind("<Button-3><ButtonRelease-3>", RightClicker) # type: ignore
|
@@ -36,7 +36,7 @@ class ProgressFrame(LabelFrame):
|
|
36
36
|
set_progress_mode: Optional[str] = None,
|
37
37
|
steps: int = 0,
|
38
38
|
update_bar: bool = False,
|
39
|
-
):
|
39
|
+
) -> None:
|
40
40
|
if update_bar and self.progress_bar_cli:
|
41
41
|
self.progress_bar_cli.update()
|
42
42
|
self.progress_bar["value"] += 100 / self.progress_bar_steps
|
@@ -60,7 +60,7 @@ class ProgressFrame(LabelFrame):
|
|
60
60
|
self.progress_bar.stop()
|
61
61
|
self.progress_bar["value"] = 0
|
62
62
|
|
63
|
-
def update_message_box(self, *args: Any, **kwargs: Any):
|
63
|
+
def update_message_box(self, *args: Any, **kwargs: Any) -> None:
|
64
64
|
msg = kwargs.get("msg")
|
65
65
|
cls = kwargs.get("cls")
|
66
66
|
file = kwargs.get("file")
|
@@ -90,8 +90,8 @@ class ProgressFrame(LabelFrame):
|
|
90
90
|
|
91
91
|
self.message_box._text.config(state="disabled") # type: ignore
|
92
92
|
|
93
|
-
def cb_disable_autoscroll(self, *
|
93
|
+
def cb_disable_autoscroll(self, *_: Any) -> None:
|
94
94
|
self.auto_scroll = False
|
95
95
|
|
96
|
-
def cb_enable_autoscroll(self, *
|
96
|
+
def cb_enable_autoscroll(self, *_: Any) -> None:
|
97
97
|
self.auto_scroll = True
|