sticker-convert 2.13.3.0__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 -27
- sticker_convert/auth/__init__.py +0 -0
- sticker_convert/auth/auth_base.py +19 -0
- sticker_convert/{utils/auth/get_discord_auth.py → auth/auth_discord.py} +149 -118
- sticker_convert/{utils/auth/get_kakao_auth.py → auth/auth_kakao_android_login.py} +331 -330
- sticker_convert/auth/auth_kakao_desktop_login.py +327 -0
- sticker_convert/{utils/auth/get_kakao_desktop_auth.py → auth/auth_kakao_desktop_memdump.py} +281 -263
- sticker_convert/{utils/auth/get_line_auth.py → auth/auth_line.py} +98 -80
- sticker_convert/{utils/auth/get_signal_auth.py → auth/auth_signal.py} +139 -135
- sticker_convert/auth/auth_telethon.py +161 -0
- sticker_convert/{utils/auth/get_viber_auth.py → auth/auth_viber.py} +250 -235
- sticker_convert/{utils/auth → auth}/telegram_api.py +736 -675
- sticker_convert/cli.py +623 -608
- sticker_convert/converter.py +1093 -1084
- sticker_convert/definitions.py +4 -0
- sticker_convert/downloaders/download_band.py +111 -110
- sticker_convert/downloaders/download_base.py +171 -166
- sticker_convert/downloaders/download_discord.py +92 -91
- sticker_convert/downloaders/download_kakao.py +417 -404
- sticker_convert/downloaders/download_line.py +484 -475
- sticker_convert/downloaders/download_ogq.py +80 -79
- sticker_convert/downloaders/download_signal.py +108 -105
- sticker_convert/downloaders/download_telegram.py +56 -55
- sticker_convert/downloaders/download_viber.py +121 -120
- sticker_convert/gui.py +788 -873
- sticker_convert/gui_components/frames/comp_frame.py +180 -166
- 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 -233
- 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 -757
- sticker_convert/gui_components/windows/base_window.py +7 -2
- sticker_convert/gui_components/windows/discord_get_auth_window.py +79 -82
- sticker_convert/gui_components/windows/kakao_get_auth_window.py +511 -321
- sticker_convert/gui_components/windows/line_get_auth_window.py +94 -102
- sticker_convert/gui_components/windows/signal_get_auth_window.py +84 -89
- sticker_convert/gui_components/windows/viber_get_auth_window.py +168 -168
- sticker_convert/ios-message-stickers-template/.github/FUNDING.yml +3 -3
- 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 2.sticker/Contents.json +9 -9
- 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/iMessage App Icon.stickersiconset/Contents.json +91 -91
- 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/xcuserdata/niklaspeterson.xcuserdatad/xcschemes/xcschememanagement.plist +14 -14
- sticker_convert/job.py +166 -130
- sticker_convert/job_option.py +1 -0
- 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/help.ja_JP.json +88 -0
- sticker_convert/resources/help.json +10 -7
- 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 -121
- sticker_convert/resources/input.zh_CN.json +74 -0
- sticker_convert/resources/input.zh_TW.json +74 -0
- sticker_convert/resources/output.ja_JP.json +38 -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 -177
- sticker_convert/uploaders/upload_base.py +44 -35
- sticker_convert/uploaders/upload_signal.py +218 -203
- sticker_convert/uploaders/upload_telegram.py +353 -338
- sticker_convert/uploaders/upload_viber.py +178 -169
- sticker_convert/uploaders/xcode_imessage.py +295 -286
- sticker_convert/utils/callback.py +238 -6
- sticker_convert/utils/emoji.py +16 -4
- sticker_convert/utils/files/json_resources_loader.py +24 -19
- sticker_convert/utils/files/metadata_handler.py +3 -3
- sticker_convert/utils/translate.py +108 -0
- sticker_convert/utils/url_detect.py +40 -37
- sticker_convert/version.py +1 -1
- {sticker_convert-2.13.3.0.dist-info → sticker_convert-2.17.0.0.dist-info}/METADATA +89 -74
- {sticker_convert-2.13.3.0.dist-info → sticker_convert-2.17.0.0.dist-info}/RECORD +91 -74
- sticker_convert/utils/auth/telethon_setup.py +0 -97
- sticker_convert/utils/singletons.py +0 -18
- {sticker_convert-2.13.3.0.dist-info → sticker_convert-2.17.0.0.dist-info}/WHEEL +0 -0
- {sticker_convert-2.13.3.0.dist-info → sticker_convert-2.17.0.0.dist-info}/entry_points.txt +0 -0
- {sticker_convert-2.13.3.0.dist-info → sticker_convert-2.17.0.0.dist-info}/licenses/LICENSE +0 -0
- {sticker_convert-2.13.3.0.dist-info → sticker_convert-2.17.0.0.dist-info}/top_level.txt +0 -0
|
@@ -1,137 +1,139 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
from pathlib import Path
|
|
3
|
-
from tkinter import filedialog
|
|
4
|
-
from typing import TYPE_CHECKING, Any
|
|
5
|
-
|
|
6
|
-
from ttkbootstrap import Button, Entry, Label, LabelFrame, OptionMenu # type: ignore
|
|
7
|
-
|
|
8
|
-
from sticker_convert.definitions import DEFAULT_DIR
|
|
9
|
-
from sticker_convert.gui_components.frames.right_clicker import RightClicker
|
|
10
|
-
from sticker_convert.utils.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
self
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
self.
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
self.
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
self.
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
self.
|
|
87
|
-
self.
|
|
88
|
-
self.
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
self.
|
|
137
|
-
self.
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
from tkinter import filedialog
|
|
4
|
+
from typing import TYPE_CHECKING, Any
|
|
5
|
+
|
|
6
|
+
from ttkbootstrap import Button, Entry, Label, LabelFrame, OptionMenu # type: ignore
|
|
7
|
+
|
|
8
|
+
from sticker_convert.definitions import DEFAULT_DIR
|
|
9
|
+
from sticker_convert.gui_components.frames.right_clicker import RightClicker
|
|
10
|
+
from sticker_convert.utils.translate import I
|
|
11
|
+
from sticker_convert.utils.url_detect import UrlDetect
|
|
12
|
+
|
|
13
|
+
if TYPE_CHECKING:
|
|
14
|
+
from sticker_convert.gui import GUI # type: ignore
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class InputFrame(LabelFrame):
|
|
18
|
+
def __init__(self, gui: "GUI", *args: Any, **kwargs: Any) -> None:
|
|
19
|
+
self.gui = gui
|
|
20
|
+
super().__init__(*args, **kwargs)
|
|
21
|
+
|
|
22
|
+
self.input_option_lbl = Label(
|
|
23
|
+
self, text=I("Input source"), width=15, justify="left", anchor="w"
|
|
24
|
+
)
|
|
25
|
+
input_full_names = [i["full_name"] for i in self.gui.input_presets.values()]
|
|
26
|
+
default_input_full_name = self.gui.input_presets[self.gui.default_input_mode][
|
|
27
|
+
"full_name"
|
|
28
|
+
]
|
|
29
|
+
self.input_option_opt = OptionMenu(
|
|
30
|
+
self,
|
|
31
|
+
self.gui.input_option_display_var,
|
|
32
|
+
default_input_full_name,
|
|
33
|
+
*input_full_names,
|
|
34
|
+
command=self.cb_input_option,
|
|
35
|
+
bootstyle="secondary", # type: ignore
|
|
36
|
+
)
|
|
37
|
+
self.input_option_opt.config(width=32)
|
|
38
|
+
|
|
39
|
+
self.input_setdir_lbl = Label(
|
|
40
|
+
self, text=I("Input directory"), width=35, justify="left", anchor="w"
|
|
41
|
+
)
|
|
42
|
+
self.input_setdir_entry = Entry(
|
|
43
|
+
self,
|
|
44
|
+
textvariable=self.gui.input_setdir_var,
|
|
45
|
+
width=60,
|
|
46
|
+
validatecommand=self.gui.highlight_fields,
|
|
47
|
+
)
|
|
48
|
+
self.input_setdir_entry.bind("<Button-3><ButtonRelease-3>", RightClicker)
|
|
49
|
+
self.setdir_btn = Button(
|
|
50
|
+
self,
|
|
51
|
+
text=I("Choose directory"),
|
|
52
|
+
command=self.cb_set_indir,
|
|
53
|
+
width=16,
|
|
54
|
+
bootstyle="secondary", # type: ignore
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
self.address_lbl = Label(
|
|
58
|
+
self,
|
|
59
|
+
text=self.gui.input_presets[self.gui.default_input_mode]["address_lbls"],
|
|
60
|
+
width=18,
|
|
61
|
+
justify="left",
|
|
62
|
+
anchor="w",
|
|
63
|
+
)
|
|
64
|
+
self.address_entry = Entry(
|
|
65
|
+
self,
|
|
66
|
+
textvariable=self.gui.input_address_var,
|
|
67
|
+
width=80,
|
|
68
|
+
validate="focusout",
|
|
69
|
+
validatecommand=self.cb_input_option,
|
|
70
|
+
)
|
|
71
|
+
self.address_entry.bind("<Button-3><ButtonRelease-3>", RightClicker)
|
|
72
|
+
self.address_tip = Label(
|
|
73
|
+
self,
|
|
74
|
+
text=self.gui.input_presets[self.gui.default_input_mode]["example"],
|
|
75
|
+
justify="left",
|
|
76
|
+
anchor="w",
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
self.input_option_lbl.grid(column=0, row=0, sticky="w", padx=3, pady=3)
|
|
80
|
+
self.input_option_opt.grid(
|
|
81
|
+
column=1, row=0, columnspan=2, sticky="w", padx=3, pady=3
|
|
82
|
+
)
|
|
83
|
+
self.input_setdir_lbl.grid(
|
|
84
|
+
column=0, row=1, columnspan=2, sticky="w", padx=3, pady=3
|
|
85
|
+
)
|
|
86
|
+
self.input_setdir_entry.grid(column=1, row=1, sticky="w", padx=3, pady=3)
|
|
87
|
+
self.setdir_btn.grid(column=2, row=1, sticky="e", padx=3, pady=3)
|
|
88
|
+
self.address_lbl.grid(column=0, row=2, sticky="w", padx=3, pady=3)
|
|
89
|
+
self.address_entry.grid(
|
|
90
|
+
column=1, row=2, columnspan=2, sticky="w", padx=3, pady=3
|
|
91
|
+
)
|
|
92
|
+
self.address_tip.grid(column=0, row=3, columnspan=3, sticky="w", padx=3, pady=3)
|
|
93
|
+
|
|
94
|
+
preset = [
|
|
95
|
+
k
|
|
96
|
+
for k, v in self.gui.input_presets.items()
|
|
97
|
+
if v["full_name"] == self.gui.input_option_display_var.get()
|
|
98
|
+
][0]
|
|
99
|
+
if preset == "local":
|
|
100
|
+
self.address_entry.config(state="disabled")
|
|
101
|
+
else:
|
|
102
|
+
self.address_entry.config(state="normal")
|
|
103
|
+
|
|
104
|
+
def cb_set_indir(self, *_args: Any) -> None:
|
|
105
|
+
orig_input_dir = self.gui.input_setdir_var.get()
|
|
106
|
+
if not Path(orig_input_dir).is_dir():
|
|
107
|
+
orig_input_dir = DEFAULT_DIR
|
|
108
|
+
input_dir = filedialog.askdirectory(initialdir=orig_input_dir)
|
|
109
|
+
if input_dir:
|
|
110
|
+
self.gui.input_setdir_var.set(input_dir)
|
|
111
|
+
|
|
112
|
+
def cb_input_option(self, *_: Any) -> bool:
|
|
113
|
+
input_option_display = self.gui.get_input_display_name()
|
|
114
|
+
|
|
115
|
+
if input_option_display == "auto":
|
|
116
|
+
url = self.gui.input_address_var.get()
|
|
117
|
+
download_option = UrlDetect.detect(url)
|
|
118
|
+
|
|
119
|
+
if download_option is None:
|
|
120
|
+
self.gui.input_option_true_var.set(
|
|
121
|
+
self.gui.input_presets["auto"]["full_name"]
|
|
122
|
+
)
|
|
123
|
+
else:
|
|
124
|
+
self.gui.input_option_true_var.set(
|
|
125
|
+
self.gui.input_presets[download_option]["full_name"]
|
|
126
|
+
)
|
|
127
|
+
else:
|
|
128
|
+
self.gui.input_option_true_var.set(self.gui.input_option_display_var.get())
|
|
129
|
+
|
|
130
|
+
self.gui.highlight_fields()
|
|
131
|
+
self.gui.comp_frame.cb_no_compress_toggle()
|
|
132
|
+
|
|
133
|
+
return True
|
|
134
|
+
|
|
135
|
+
def set_states(self, state: str) -> None:
|
|
136
|
+
self.input_option_opt.config(state=state)
|
|
137
|
+
self.address_entry.config(state=state)
|
|
138
|
+
self.input_setdir_entry.config(state=state)
|
|
139
|
+
self.setdir_btn.config(state=state)
|
|
@@ -1,110 +1,112 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
from pathlib import Path
|
|
3
|
-
from tkinter import filedialog
|
|
4
|
-
from typing import TYPE_CHECKING, Any
|
|
5
|
-
|
|
6
|
-
from ttkbootstrap import Button, Entry, Label, LabelFrame, OptionMenu # type: ignore
|
|
7
|
-
|
|
8
|
-
from sticker_convert.definitions import DEFAULT_DIR
|
|
9
|
-
from sticker_convert.gui_components.frames.right_clicker import RightClicker
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
self
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
self.
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
self.
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
self.
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
self.
|
|
85
|
-
self.
|
|
86
|
-
self.
|
|
87
|
-
self.
|
|
88
|
-
self.
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
self.gui.
|
|
103
|
-
self.gui.
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
self.
|
|
109
|
-
self.
|
|
110
|
-
self.
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
from tkinter import filedialog
|
|
4
|
+
from typing import TYPE_CHECKING, Any
|
|
5
|
+
|
|
6
|
+
from ttkbootstrap import Button, Entry, Label, LabelFrame, OptionMenu # type: ignore
|
|
7
|
+
|
|
8
|
+
from sticker_convert.definitions import DEFAULT_DIR
|
|
9
|
+
from sticker_convert.gui_components.frames.right_clicker import RightClicker
|
|
10
|
+
from sticker_convert.utils.translate import I
|
|
11
|
+
|
|
12
|
+
if TYPE_CHECKING:
|
|
13
|
+
from sticker_convert.gui import GUI # type: ignore
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class OutputFrame(LabelFrame):
|
|
17
|
+
def __init__(self, gui: "GUI", *args: Any, **kwargs: Any) -> None:
|
|
18
|
+
self.gui = gui
|
|
19
|
+
super().__init__(*args, **kwargs)
|
|
20
|
+
|
|
21
|
+
self.output_option_lbl = Label(
|
|
22
|
+
self, text=I("Output options"), width=18, justify="left", anchor="w"
|
|
23
|
+
)
|
|
24
|
+
output_full_names = [i["full_name"] for i in self.gui.output_presets.values()]
|
|
25
|
+
defult_output_full_name = self.gui.output_presets[self.gui.default_output_mode][
|
|
26
|
+
"full_name"
|
|
27
|
+
]
|
|
28
|
+
self.output_option_opt = OptionMenu(
|
|
29
|
+
self,
|
|
30
|
+
self.gui.output_option_display_var,
|
|
31
|
+
defult_output_full_name,
|
|
32
|
+
*output_full_names,
|
|
33
|
+
command=self.cb_output_option,
|
|
34
|
+
bootstyle="secondary", # type: ignore
|
|
35
|
+
)
|
|
36
|
+
self.output_option_opt.config(width=32)
|
|
37
|
+
|
|
38
|
+
self.output_setdir_lbl = Label(
|
|
39
|
+
self, text=I("Output directory"), justify="left", anchor="w"
|
|
40
|
+
)
|
|
41
|
+
self.output_setdir_entry = Entry(
|
|
42
|
+
self,
|
|
43
|
+
textvariable=self.gui.output_setdir_var,
|
|
44
|
+
width=60,
|
|
45
|
+
validatecommand=self.gui.highlight_fields,
|
|
46
|
+
)
|
|
47
|
+
self.output_setdir_entry.bind("<Button-3><ButtonRelease-3>", RightClicker)
|
|
48
|
+
|
|
49
|
+
self.output_setdir_btn = Button(
|
|
50
|
+
self,
|
|
51
|
+
text=I("Choose directory"),
|
|
52
|
+
command=self.cb_set_outdir,
|
|
53
|
+
width=16,
|
|
54
|
+
bootstyle="secondary", # type: ignore
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
self.title_lbl = Label(self, text=I("Title"))
|
|
58
|
+
self.title_entry = Entry(
|
|
59
|
+
self,
|
|
60
|
+
textvariable=self.gui.title_var,
|
|
61
|
+
width=80,
|
|
62
|
+
validate="focusout",
|
|
63
|
+
validatecommand=self.gui.highlight_fields,
|
|
64
|
+
)
|
|
65
|
+
self.title_entry.bind("<Button-3><ButtonRelease-3>", RightClicker)
|
|
66
|
+
|
|
67
|
+
self.author_lbl = Label(self, text=I("Author"))
|
|
68
|
+
self.author_entry = Entry(
|
|
69
|
+
self,
|
|
70
|
+
textvariable=self.gui.author_var,
|
|
71
|
+
width=80,
|
|
72
|
+
validate="focusout",
|
|
73
|
+
validatecommand=self.gui.highlight_fields,
|
|
74
|
+
)
|
|
75
|
+
self.author_entry.bind("<Button-3><ButtonRelease-3>", RightClicker)
|
|
76
|
+
|
|
77
|
+
self.output_option_lbl.grid(column=0, row=0, sticky="w", padx=3, pady=3)
|
|
78
|
+
self.output_option_opt.grid(
|
|
79
|
+
column=1, row=0, columnspan=2, sticky="w", padx=3, pady=3
|
|
80
|
+
)
|
|
81
|
+
self.output_setdir_lbl.grid(
|
|
82
|
+
column=0, row=1, columnspan=2, sticky="w", padx=3, pady=3
|
|
83
|
+
)
|
|
84
|
+
self.output_setdir_entry.grid(column=1, row=1, sticky="w", padx=3, pady=3)
|
|
85
|
+
self.output_setdir_btn.grid(column=2, row=1, sticky="e", padx=3, pady=3)
|
|
86
|
+
self.title_lbl.grid(column=0, row=2, sticky="w", padx=3, pady=3)
|
|
87
|
+
self.title_entry.grid(column=1, columnspan=2, row=2, sticky="w", padx=3, pady=3)
|
|
88
|
+
self.author_lbl.grid(column=0, row=3, sticky="w", padx=3, pady=3)
|
|
89
|
+
self.author_entry.grid(
|
|
90
|
+
column=1, columnspan=2, row=3, sticky="w", padx=3, pady=3
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
def cb_set_outdir(self, *_args: Any) -> None:
|
|
94
|
+
orig_output_dir = self.gui.output_setdir_var.get()
|
|
95
|
+
if not Path(orig_output_dir).is_dir():
|
|
96
|
+
orig_output_dir = DEFAULT_DIR
|
|
97
|
+
output_dir = filedialog.askdirectory(initialdir=orig_output_dir)
|
|
98
|
+
if output_dir:
|
|
99
|
+
self.gui.output_setdir_var.set(output_dir)
|
|
100
|
+
|
|
101
|
+
def cb_output_option(self, *_: Any) -> None:
|
|
102
|
+
self.gui.output_option_true_var.set(self.gui.output_option_display_var.get())
|
|
103
|
+
self.gui.comp_frame.cb_comp_apply_preset()
|
|
104
|
+
self.gui.highlight_fields()
|
|
105
|
+
self.gui.comp_frame.cb_no_compress_toggle()
|
|
106
|
+
|
|
107
|
+
def set_states(self, state: str) -> None:
|
|
108
|
+
self.title_entry.config(state=state)
|
|
109
|
+
self.author_entry.config(state=state)
|
|
110
|
+
self.output_option_opt.config(state=state)
|
|
111
|
+
self.output_setdir_entry.config(state=state)
|
|
112
|
+
self.output_setdir_btn.config(state=state)
|
|
@@ -1,23 +1,25 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
from typing import Any
|
|
3
|
-
|
|
4
|
-
from ttkbootstrap import Menu # type: ignore
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
from ttkbootstrap import Menu # type: ignore
|
|
5
|
+
|
|
6
|
+
from sticker_convert.utils.translate import I
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
# Reference: https://stackoverflow.com/a/57704013
|
|
10
|
+
class RightClicker:
|
|
11
|
+
def __init__(self, event: Any) -> None:
|
|
12
|
+
right_click_menu = Menu(None, tearoff=0, takefocus=0)
|
|
13
|
+
|
|
14
|
+
for txt in [I("Cut"), I("Copy"), I("Paste")]:
|
|
15
|
+
right_click_menu.add_command(
|
|
16
|
+
label=txt,
|
|
17
|
+
command=lambda event=event, text=txt: self.right_click_command(
|
|
18
|
+
event, text
|
|
19
|
+
),
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
right_click_menu.tk_popup(event.x_root, event.y_root, entry="0")
|
|
23
|
+
|
|
24
|
+
def right_click_command(self, event: Any, cmd: str) -> None:
|
|
25
|
+
event.widget.event_generate(f"<<{cmd}>>")
|