sticker-convert 2.7.3__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/cli.py +12 -16
- sticker_convert/converter.py +46 -50
- sticker_convert/definitions.py +8 -12
- sticker_convert/downloaders/download_base.py +13 -30
- sticker_convert/downloaders/download_kakao.py +19 -25
- sticker_convert/downloaders/download_line.py +7 -8
- sticker_convert/downloaders/download_signal.py +4 -5
- sticker_convert/downloaders/download_telegram.py +4 -5
- sticker_convert/gui.py +28 -29
- sticker_convert/gui_components/frames/comp_frame.py +7 -7
- sticker_convert/gui_components/frames/config_frame.py +7 -7
- sticker_convert/gui_components/frames/control_frame.py +1 -1
- sticker_convert/gui_components/frames/cred_frame.py +8 -8
- sticker_convert/gui_components/frames/input_frame.py +6 -6
- sticker_convert/gui_components/frames/output_frame.py +6 -6
- sticker_convert/gui_components/frames/progress_frame.py +6 -6
- sticker_convert/gui_components/gui_utils.py +2 -4
- sticker_convert/gui_components/windows/advanced_compression_window.py +13 -11
- sticker_convert/gui_components/windows/base_window.py +3 -3
- sticker_convert/gui_components/windows/kakao_get_auth_window.py +2 -2
- sticker_convert/gui_components/windows/line_get_auth_window.py +2 -2
- sticker_convert/gui_components/windows/signal_get_auth_window.py +1 -1
- sticker_convert/job.py +66 -75
- sticker_convert/job_option.py +1 -1
- sticker_convert/resources/help.json +1 -1
- sticker_convert/uploaders/compress_wastickers.py +3 -3
- sticker_convert/uploaders/upload_base.py +2 -3
- sticker_convert/uploaders/upload_signal.py +5 -5
- sticker_convert/uploaders/upload_telegram.py +5 -4
- sticker_convert/uploaders/xcode_imessage.py +14 -69
- sticker_convert/utils/auth/get_kakao_auth.py +4 -5
- sticker_convert/utils/auth/get_line_auth.py +1 -2
- sticker_convert/utils/auth/get_signal_auth.py +4 -4
- sticker_convert/utils/callback.py +25 -17
- sticker_convert/utils/files/cache_store.py +4 -6
- sticker_convert/utils/files/json_manager.py +3 -4
- sticker_convert/utils/files/json_resources_loader.py +12 -0
- sticker_convert/utils/files/metadata_handler.py +83 -74
- sticker_convert/utils/files/run_bin.py +8 -7
- sticker_convert/utils/files/sanitize_filename.py +30 -28
- sticker_convert/utils/media/apple_png_normalize.py +2 -2
- sticker_convert/utils/media/codec_info.py +22 -29
- sticker_convert/utils/media/decrypt_kakao.py +3 -5
- sticker_convert/utils/media/format_verify.py +6 -8
- sticker_convert/utils/url_detect.py +4 -5
- sticker_convert/version.py +1 -1
- {sticker_convert-2.7.3.dist-info → sticker_convert-2.7.4.dist-info}/METADATA +16 -14
- {sticker_convert-2.7.3.dist-info → sticker_convert-2.7.4.dist-info}/RECORD +52 -51
- {sticker_convert-2.7.3.dist-info → sticker_convert-2.7.4.dist-info}/WHEEL +1 -1
- {sticker_convert-2.7.3.dist-info → sticker_convert-2.7.4.dist-info}/LICENSE +0 -0
- {sticker_convert-2.7.3.dist-info → sticker_convert-2.7.4.dist-info}/entry_points.txt +0 -0
- {sticker_convert-2.7.3.dist-info → sticker_convert-2.7.4.dist-info}/top_level.txt +0 -0
sticker_convert/gui.py
CHANGED
@@ -35,7 +35,7 @@ from sticker_convert.version import __version__
|
|
35
35
|
|
36
36
|
class GUI(Window):
|
37
37
|
def __init__(self) -> None:
|
38
|
-
super(
|
38
|
+
super().__init__(themename="darkly", alpha=0) # type: ignore
|
39
39
|
self.init_done = False
|
40
40
|
self.load_jsons()
|
41
41
|
|
@@ -221,13 +221,17 @@ class GUI(Window):
|
|
221
221
|
self.cb_msg(msg)
|
222
222
|
|
223
223
|
def load_jsons(self) -> None:
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
self.
|
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
|
231
235
|
|
232
236
|
if not (
|
233
237
|
self.compression_presets and self.input_presets and self.output_presets
|
@@ -395,12 +399,12 @@ class GUI(Window):
|
|
395
399
|
if v["full_name"] == self.output_option_true_var.get()
|
396
400
|
][0]
|
397
401
|
|
398
|
-
def get_output_display_name(self) -> str:
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
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]
|
404
408
|
|
405
409
|
def get_preset(self) -> str:
|
406
410
|
selection = self.comp_preset_var.get()
|
@@ -408,13 +412,11 @@ class GUI(Window):
|
|
408
412
|
output_option = self.get_output_name()
|
409
413
|
if output_option == "imessage":
|
410
414
|
return "imessage_small"
|
411
|
-
|
415
|
+
if output_option == "local":
|
412
416
|
return selection
|
413
|
-
|
414
|
-
return output_option
|
417
|
+
return output_option
|
415
418
|
|
416
|
-
|
417
|
-
return selection
|
419
|
+
return selection
|
418
420
|
|
419
421
|
def start_job(self) -> None:
|
420
422
|
self.save_config()
|
@@ -565,7 +567,7 @@ class GUI(Window):
|
|
565
567
|
self.input_frame.cb_input_option()
|
566
568
|
self.comp_frame.cb_no_compress()
|
567
569
|
|
568
|
-
def exec_in_main(self,
|
570
|
+
def exec_in_main(self, _evt: Any) -> Any:
|
569
571
|
if self.action:
|
570
572
|
self.response = self.action()
|
571
573
|
self.response_event.set()
|
@@ -613,10 +615,10 @@ class GUI(Window):
|
|
613
615
|
|
614
616
|
def cb_msg_block(
|
615
617
|
self,
|
618
|
+
*args: Any,
|
616
619
|
message: Optional[str] = None,
|
617
620
|
parent: Optional[object] = None,
|
618
|
-
|
619
|
-
**kwargs: Any,
|
621
|
+
**_kwargs: Any,
|
620
622
|
) -> Any:
|
621
623
|
if message is None and len(args) > 0:
|
622
624
|
message = " ".join(str(i) for i in args)
|
@@ -634,12 +636,12 @@ class GUI(Window):
|
|
634
636
|
|
635
637
|
def cb_bar(
|
636
638
|
self,
|
639
|
+
*args: Any,
|
637
640
|
set_progress_mode: Optional[str] = None,
|
638
641
|
steps: int = 0,
|
639
642
|
update_bar: bool = False,
|
640
|
-
*args: Any,
|
641
643
|
**kwargs: Any,
|
642
|
-
):
|
644
|
+
) -> None:
|
643
645
|
with self.bar_lock:
|
644
646
|
self.progress_frame.update_progress_bar(
|
645
647
|
set_progress_mode, steps, update_bar, *args, **kwargs
|
@@ -655,13 +657,10 @@ class GUI(Window):
|
|
655
657
|
# output_option_display = self.get_output_display_name()
|
656
658
|
url = self.input_address_var.get()
|
657
659
|
|
658
|
-
|
660
|
+
in_out_dir_same = (
|
659
661
|
Path(self.input_setdir_var.get()).absolute()
|
660
662
|
== Path(self.output_setdir_var.get()).absolute()
|
661
|
-
)
|
662
|
-
in_out_dir_same = True
|
663
|
-
else:
|
664
|
-
in_out_dir_same = False
|
663
|
+
)
|
665
664
|
|
666
665
|
# Input
|
667
666
|
if in_out_dir_same is True:
|
@@ -3,17 +3,17 @@ from typing import TYPE_CHECKING, Any
|
|
3
3
|
|
4
4
|
from ttkbootstrap import Button, Checkbutton, Entry, Label, LabelFrame, OptionMenu # type: ignore
|
5
5
|
|
6
|
-
if TYPE_CHECKING:
|
7
|
-
from sticker_convert.gui import GUI # type: ignore
|
8
|
-
|
9
6
|
from sticker_convert.gui_components.frames.right_clicker import RightClicker
|
10
7
|
from sticker_convert.gui_components.windows.advanced_compression_window import AdvancedCompressionWindow
|
11
8
|
|
9
|
+
if TYPE_CHECKING:
|
10
|
+
from sticker_convert.gui import GUI # type: ignore
|
11
|
+
|
12
12
|
|
13
13
|
class CompFrame(LabelFrame):
|
14
14
|
def __init__(self, gui: "GUI", *args: Any, **kwargs: Any) -> None:
|
15
15
|
self.gui = gui
|
16
|
-
super(
|
16
|
+
super().__init__(*args, **kwargs)
|
17
17
|
|
18
18
|
self.grid_columnconfigure(2, weight=1)
|
19
19
|
|
@@ -102,7 +102,7 @@ class CompFrame(LabelFrame):
|
|
102
102
|
self.cb_comp_apply_preset()
|
103
103
|
self.cb_no_compress()
|
104
104
|
|
105
|
-
def cb_comp_apply_preset(self, *
|
105
|
+
def cb_comp_apply_preset(self, *_: Any) -> None:
|
106
106
|
selection = self.gui.get_preset()
|
107
107
|
if selection == "auto":
|
108
108
|
if self.gui.get_input_name() == "local":
|
@@ -181,10 +181,10 @@ class CompFrame(LabelFrame):
|
|
181
181
|
self.cb_no_compress()
|
182
182
|
self.gui.highlight_fields()
|
183
183
|
|
184
|
-
def cb_compress_advanced(self, *
|
184
|
+
def cb_compress_advanced(self, *_: Any) -> None:
|
185
185
|
AdvancedCompressionWindow(self.gui)
|
186
186
|
|
187
|
-
def cb_no_compress(self, *
|
187
|
+
def cb_no_compress(self, *_: Any) -> None:
|
188
188
|
if self.gui.no_compress_var.get() is True:
|
189
189
|
state = "disabled"
|
190
190
|
else:
|
@@ -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
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
|
@@ -10,7 +10,7 @@ if TYPE_CHECKING:
|
|
10
10
|
class ControlFrame(Frame):
|
11
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,
|
@@ -4,19 +4,19 @@ from typing import TYPE_CHECKING, Any
|
|
4
4
|
|
5
5
|
from ttkbootstrap import Button, Entry, Label, LabelFrame # type: ignore
|
6
6
|
|
7
|
-
if TYPE_CHECKING:
|
8
|
-
from sticker_convert.gui import GUI # type: ignore
|
9
|
-
|
10
7
|
from sticker_convert.gui_components.frames.right_clicker import RightClicker
|
11
8
|
from sticker_convert.gui_components.windows.kakao_get_auth_window import KakaoGetAuthWindow
|
12
9
|
from sticker_convert.gui_components.windows.line_get_auth_window import LineGetAuthWindow
|
13
10
|
from sticker_convert.gui_components.windows.signal_get_auth_window import SignalGetAuthWindow
|
14
11
|
|
12
|
+
if TYPE_CHECKING:
|
13
|
+
from sticker_convert.gui import GUI # type: ignore
|
14
|
+
|
15
15
|
|
16
16
|
class CredFrame(LabelFrame):
|
17
17
|
def __init__(self, gui: "GUI", *args: Any, **kwargs: Any) -> None:
|
18
18
|
self.gui = gui
|
19
|
-
super(
|
19
|
+
super().__init__(*args, **kwargs)
|
20
20
|
|
21
21
|
self.grid_columnconfigure(1, weight=1)
|
22
22
|
|
@@ -135,19 +135,19 @@ class CredFrame(LabelFrame):
|
|
135
135
|
self.line_get_auth_btn.grid(column=2, row=6, sticky="e", padx=3, pady=3)
|
136
136
|
self.help_btn.grid(column=2, row=8, sticky="e", padx=3, pady=3)
|
137
137
|
|
138
|
-
def cb_cred_help(self, *
|
138
|
+
def cb_cred_help(self, *_: Any) -> None:
|
139
139
|
faq_site = "https://github.com/laggykiller/sticker-convert#faq"
|
140
140
|
success = webbrowser.open(faq_site)
|
141
141
|
if not success:
|
142
142
|
self.gui.cb_ask_str("You can get help from:", initialvalue=faq_site)
|
143
143
|
|
144
|
-
def cb_kakao_get_auth(self, *
|
144
|
+
def cb_kakao_get_auth(self, *_: Any) -> None:
|
145
145
|
KakaoGetAuthWindow(self.gui)
|
146
146
|
|
147
|
-
def cb_signal_get_auth(self, *
|
147
|
+
def cb_signal_get_auth(self, *_: Any) -> None:
|
148
148
|
SignalGetAuthWindow(self.gui)
|
149
149
|
|
150
|
-
def cb_line_get_auth(self, *
|
150
|
+
def cb_line_get_auth(self, *_: Any) -> None:
|
151
151
|
LineGetAuthWindow(self.gui)
|
152
152
|
|
153
153
|
def set_states(self, state: str) -> None:
|
@@ -5,18 +5,18 @@ from typing import TYPE_CHECKING, Any
|
|
5
5
|
|
6
6
|
from ttkbootstrap import Button, Entry, Label, LabelFrame, OptionMenu # 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 DEFAULT_DIR
|
12
9
|
from sticker_convert.gui_components.frames.right_clicker import RightClicker
|
13
10
|
from sticker_convert.utils.url_detect import UrlDetect
|
14
11
|
|
12
|
+
if TYPE_CHECKING:
|
13
|
+
from sticker_convert.gui import GUI # type: ignore
|
14
|
+
|
15
15
|
|
16
16
|
class InputFrame(LabelFrame):
|
17
17
|
def __init__(self, gui: "GUI", *args: Any, **kwargs: Any) -> None:
|
18
18
|
self.gui = gui
|
19
|
-
super(
|
19
|
+
super().__init__(*args, **kwargs)
|
20
20
|
|
21
21
|
self.input_option_lbl = Label(
|
22
22
|
self, text="Input source", width=15, justify="left", anchor="w"
|
@@ -100,7 +100,7 @@ class InputFrame(LabelFrame):
|
|
100
100
|
else:
|
101
101
|
self.address_entry.config(state="normal")
|
102
102
|
|
103
|
-
def cb_set_indir(self, *
|
103
|
+
def cb_set_indir(self, *_args: Any) -> None:
|
104
104
|
orig_input_dir = self.gui.input_setdir_var.get()
|
105
105
|
if not Path(orig_input_dir).is_dir():
|
106
106
|
orig_input_dir = DEFAULT_DIR
|
@@ -108,7 +108,7 @@ class InputFrame(LabelFrame):
|
|
108
108
|
if input_dir:
|
109
109
|
self.gui.input_setdir_var.set(input_dir)
|
110
110
|
|
111
|
-
def cb_input_option(self, *
|
111
|
+
def cb_input_option(self, *_: Any) -> bool:
|
112
112
|
input_option_display = self.gui.get_input_display_name()
|
113
113
|
|
114
114
|
if input_option_display == "auto":
|
@@ -5,17 +5,17 @@ from typing import TYPE_CHECKING, Any
|
|
5
5
|
|
6
6
|
from ttkbootstrap import Button, Entry, Label, LabelFrame, OptionMenu # 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 DEFAULT_DIR
|
12
9
|
from sticker_convert.gui_components.frames.right_clicker import RightClicker
|
13
10
|
|
11
|
+
if TYPE_CHECKING:
|
12
|
+
from sticker_convert.gui import GUI # type: ignore
|
13
|
+
|
14
14
|
|
15
15
|
class OutputFrame(LabelFrame):
|
16
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.output_option_lbl = Label(
|
21
21
|
self, text="Output options", width=18, justify="left", anchor="w"
|
@@ -89,7 +89,7 @@ class OutputFrame(LabelFrame):
|
|
89
89
|
column=1, columnspan=2, row=3, sticky="w", padx=3, pady=3
|
90
90
|
)
|
91
91
|
|
92
|
-
def cb_set_outdir(self, *
|
92
|
+
def cb_set_outdir(self, *_args: Any) -> None:
|
93
93
|
orig_output_dir = self.gui.output_setdir_var.get()
|
94
94
|
if not Path(orig_output_dir).is_dir():
|
95
95
|
orig_output_dir = DEFAULT_DIR
|
@@ -97,7 +97,7 @@ class OutputFrame(LabelFrame):
|
|
97
97
|
if output_dir:
|
98
98
|
self.gui.output_setdir_var.set(output_dir)
|
99
99
|
|
100
|
-
def cb_output_option(self, *
|
100
|
+
def cb_output_option(self, *_: Any) -> None:
|
101
101
|
self.gui.output_option_true_var.set(self.gui.output_option_display_var.get())
|
102
102
|
self.gui.comp_frame.cb_comp_apply_preset()
|
103
103
|
self.gui.highlight_fields()
|
@@ -5,11 +5,11 @@ 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
|
@@ -18,7 +18,7 @@ class ProgressFrame(LabelFrame):
|
|
18
18
|
|
19
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
|
@@ -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
|
@@ -80,10 +80,8 @@ class GUIUtils:
|
|
80
80
|
window_width = frame_width + window.y_scrollbar.winfo_width()
|
81
81
|
window_height = frame_height + window.x_scrollbar.winfo_height()
|
82
82
|
|
83
|
-
|
84
|
-
|
85
|
-
if window_height > screen_height:
|
86
|
-
window_height = screen_height
|
83
|
+
window_width = min(window_width, screen_width)
|
84
|
+
window_height = min(window_height, screen_height)
|
87
85
|
|
88
86
|
frame_width = window_width - window.y_scrollbar.winfo_width()
|
89
87
|
frame_height = window_height - window.x_scrollbar.winfo_height()
|
@@ -18,7 +18,7 @@ class AdvancedCompressionWindow(BaseWindow):
|
|
18
18
|
emoji_btns: List[Tuple[Button, ImageTk.PhotoImage]] = []
|
19
19
|
|
20
20
|
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
21
|
-
super(
|
21
|
+
super().__init__(*args, **kwargs)
|
22
22
|
self.categories = list({entry["category"] for entry in self.gui.emoji_list})
|
23
23
|
|
24
24
|
self.title("Advanced compression options")
|
@@ -329,7 +329,9 @@ class AdvancedCompressionWindow(BaseWindow):
|
|
329
329
|
self.gui.scale_filter_var,
|
330
330
|
self.gui.scale_filter_var.get(),
|
331
331
|
"nearest",
|
332
|
+
"box",
|
332
333
|
"bilinear",
|
334
|
+
"hamming",
|
333
335
|
"bicubic",
|
334
336
|
"lanczos",
|
335
337
|
bootstyle="secondary", # type: ignore
|
@@ -559,7 +561,7 @@ class AdvancedCompressionWindow(BaseWindow):
|
|
559
561
|
|
560
562
|
GUIUtils.finalize_window(self)
|
561
563
|
|
562
|
-
def cb_disable_fps(self, *
|
564
|
+
def cb_disable_fps(self, *_: Any) -> None:
|
563
565
|
if self.gui.fps_disable_var.get() is True:
|
564
566
|
state = "disabled"
|
565
567
|
else:
|
@@ -568,7 +570,7 @@ class AdvancedCompressionWindow(BaseWindow):
|
|
568
570
|
self.fps_min_entry.config(state=state)
|
569
571
|
self.fps_max_entry.config(state=state)
|
570
572
|
|
571
|
-
def cb_disable_res_w(self, *
|
573
|
+
def cb_disable_res_w(self, *_: Any) -> None:
|
572
574
|
if self.gui.res_w_disable_var.get() is True:
|
573
575
|
state = "disabled"
|
574
576
|
else:
|
@@ -577,7 +579,7 @@ class AdvancedCompressionWindow(BaseWindow):
|
|
577
579
|
self.res_w_min_entry.config(state=state)
|
578
580
|
self.res_w_max_entry.config(state=state)
|
579
581
|
|
580
|
-
def cb_disable_res_h(self, *
|
582
|
+
def cb_disable_res_h(self, *_: Any) -> None:
|
581
583
|
if self.gui.res_h_disable_var.get() is True:
|
582
584
|
state = "disabled"
|
583
585
|
else:
|
@@ -586,7 +588,7 @@ class AdvancedCompressionWindow(BaseWindow):
|
|
586
588
|
self.res_h_min_entry.config(state=state)
|
587
589
|
self.res_h_max_entry.config(state=state)
|
588
590
|
|
589
|
-
def cb_disable_quality(self, *
|
591
|
+
def cb_disable_quality(self, *_: Any) -> None:
|
590
592
|
if self.gui.quality_disable_var.get() is True:
|
591
593
|
state = "disabled"
|
592
594
|
else:
|
@@ -595,7 +597,7 @@ class AdvancedCompressionWindow(BaseWindow):
|
|
595
597
|
self.quality_min_entry.config(state=state)
|
596
598
|
self.quality_max_entry.config(state=state)
|
597
599
|
|
598
|
-
def cb_disable_color(self, *
|
600
|
+
def cb_disable_color(self, *_: Any) -> None:
|
599
601
|
if self.gui.color_disable_var.get() is True:
|
600
602
|
state = "disabled"
|
601
603
|
else:
|
@@ -604,7 +606,7 @@ class AdvancedCompressionWindow(BaseWindow):
|
|
604
606
|
self.color_min_entry.config(state=state)
|
605
607
|
self.color_max_entry.config(state=state)
|
606
608
|
|
607
|
-
def cb_disable_duration(self, *
|
609
|
+
def cb_disable_duration(self, *_: Any) -> None:
|
608
610
|
if (
|
609
611
|
self.gui.duration_disable_var.get() is True
|
610
612
|
or self.gui.comp_preset_var.get() == "auto"
|
@@ -616,7 +618,7 @@ class AdvancedCompressionWindow(BaseWindow):
|
|
616
618
|
self.duration_min_entry.config(state=state)
|
617
619
|
self.duration_max_entry.config(state=state)
|
618
620
|
|
619
|
-
def cb_disable_size(self, *
|
621
|
+
def cb_disable_size(self, *_: Any) -> None:
|
620
622
|
if (
|
621
623
|
self.gui.size_disable_var.get() is True
|
622
624
|
or self.gui.comp_preset_var.get() == "auto"
|
@@ -628,7 +630,7 @@ class AdvancedCompressionWindow(BaseWindow):
|
|
628
630
|
self.img_size_max_entry.config(state=state)
|
629
631
|
self.vid_size_max_entry.config(state=state)
|
630
632
|
|
631
|
-
def cb_disable_format(self, *
|
633
|
+
def cb_disable_format(self, *_: Any) -> None:
|
632
634
|
if self.gui.comp_preset_var.get() == "auto":
|
633
635
|
state = "disabled"
|
634
636
|
else:
|
@@ -637,7 +639,7 @@ class AdvancedCompressionWindow(BaseWindow):
|
|
637
639
|
self.img_format_entry.config(state=state)
|
638
640
|
self.vid_format_entry.config(state=state)
|
639
641
|
|
640
|
-
def cb_disable_fake_vid(self, *
|
642
|
+
def cb_disable_fake_vid(self, *_: Any) -> None:
|
641
643
|
if self.gui.comp_preset_var.get() == "auto":
|
642
644
|
state = "disabled"
|
643
645
|
else:
|
@@ -657,7 +659,7 @@ class AdvancedCompressionWindow(BaseWindow):
|
|
657
659
|
self.ph_im = ImageTk.PhotoImage(self.im)
|
658
660
|
self.default_emoji_dsp.config(image=self.ph_im)
|
659
661
|
|
660
|
-
def render_emoji_list(self, *
|
662
|
+
def render_emoji_list(self, *_: Any) -> None:
|
661
663
|
category = self.categories_var.get()
|
662
664
|
|
663
665
|
for emoji_btn, ph_im in self.emoji_btns:
|
@@ -4,15 +4,15 @@ from typing import TYPE_CHECKING, Tuple
|
|
4
4
|
|
5
5
|
from ttkbootstrap import Toplevel # type: ignore
|
6
6
|
|
7
|
+
from sticker_convert.gui_components.gui_utils import GUIUtils
|
8
|
+
|
7
9
|
if TYPE_CHECKING:
|
8
10
|
from sticker_convert.gui import GUI # type: ignore
|
9
11
|
|
10
|
-
from sticker_convert.gui_components.gui_utils import GUIUtils
|
11
|
-
|
12
12
|
|
13
13
|
class BaseWindow(Toplevel):
|
14
14
|
def __init__(self, gui: "GUI") -> None:
|
15
|
-
super(
|
15
|
+
super().__init__(alpha=0) # type: ignore
|
16
16
|
self.gui = gui
|
17
17
|
|
18
18
|
GUIUtils.set_icon(self)
|
@@ -13,7 +13,7 @@ from sticker_convert.utils.auth.get_kakao_auth import GetKakaoAuth
|
|
13
13
|
|
14
14
|
class KakaoGetAuthWindow(BaseWindow):
|
15
15
|
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
16
|
-
super(
|
16
|
+
super().__init__(*args, **kwargs)
|
17
17
|
|
18
18
|
self.title("Get Kakao auth_token")
|
19
19
|
|
@@ -162,7 +162,7 @@ class KakaoGetAuthWindow(BaseWindow):
|
|
162
162
|
def cb_login(self) -> None:
|
163
163
|
Thread(target=self.cb_login_thread, daemon=True).start()
|
164
164
|
|
165
|
-
def cb_login_thread(self, *
|
165
|
+
def cb_login_thread(self, *_: Any) -> None:
|
166
166
|
self.gui.save_creds()
|
167
167
|
m = GetKakaoAuth(
|
168
168
|
opt_cred=self.gui.get_opt_cred(),
|
@@ -13,7 +13,7 @@ from sticker_convert.utils.auth.get_line_auth import GetLineAuth
|
|
13
13
|
|
14
14
|
class LineGetAuthWindow(BaseWindow):
|
15
15
|
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
16
|
-
super(
|
16
|
+
super().__init__(*args, **kwargs)
|
17
17
|
|
18
18
|
self.title("Get Line cookie")
|
19
19
|
|
@@ -80,7 +80,7 @@ class LineGetAuthWindow(BaseWindow):
|
|
80
80
|
def cb_get_cookies(self) -> None:
|
81
81
|
Thread(target=self.cb_get_cookies_thread, daemon=True).start()
|
82
82
|
|
83
|
-
def cb_get_cookies_thread(self, *
|
83
|
+
def cb_get_cookies_thread(self, *_: Any) -> None:
|
84
84
|
m = GetLineAuth()
|
85
85
|
|
86
86
|
line_cookies = None
|
@@ -14,7 +14,7 @@ from sticker_convert.utils.auth.get_signal_auth import GetSignalAuth
|
|
14
14
|
|
15
15
|
class SignalGetAuthWindow(BaseWindow):
|
16
16
|
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
17
|
-
super(
|
17
|
+
super().__init__(*args, **kwargs)
|
18
18
|
|
19
19
|
self.title("Get Signal uuid and password")
|
20
20
|
|