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,165 +1,180 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
from typing import TYPE_CHECKING, Any
|
|
3
|
-
|
|
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
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
self.
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
)
|
|
83
|
-
|
|
84
|
-
self.
|
|
85
|
-
|
|
86
|
-
self.
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
self.
|
|
94
|
-
self.
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
self.
|
|
98
|
-
self.
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
self.
|
|
103
|
-
self.
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
self.gui.
|
|
115
|
-
|
|
116
|
-
self.gui.
|
|
117
|
-
self.gui.
|
|
118
|
-
self.gui.
|
|
119
|
-
self.gui.
|
|
120
|
-
self.gui.
|
|
121
|
-
self.gui.
|
|
122
|
-
self.gui.
|
|
123
|
-
self.gui.
|
|
124
|
-
self.gui.
|
|
125
|
-
self.gui.
|
|
126
|
-
self.gui.
|
|
127
|
-
self.gui.
|
|
128
|
-
self.gui.
|
|
129
|
-
self.gui.
|
|
130
|
-
self.gui.
|
|
131
|
-
self.gui.
|
|
132
|
-
self.gui.
|
|
133
|
-
self.gui.
|
|
134
|
-
self.gui.
|
|
135
|
-
self.gui.
|
|
136
|
-
self.gui.
|
|
137
|
-
self.gui.
|
|
138
|
-
self.gui.
|
|
139
|
-
self.gui.
|
|
140
|
-
|
|
141
|
-
self.
|
|
142
|
-
self.gui.
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
from typing import TYPE_CHECKING, Any
|
|
3
|
+
|
|
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
|
|
8
|
+
from sticker_convert.utils.translate import I
|
|
9
|
+
|
|
10
|
+
if TYPE_CHECKING:
|
|
11
|
+
from sticker_convert.gui import GUI # type: ignore
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class CompFrame(LabelFrame):
|
|
15
|
+
def __init__(self, gui: "GUI", *args: Any, **kwargs: Any) -> None:
|
|
16
|
+
self.gui = gui
|
|
17
|
+
super().__init__(*args, **kwargs)
|
|
18
|
+
|
|
19
|
+
self.grid_columnconfigure(2, weight=1)
|
|
20
|
+
|
|
21
|
+
self.no_compress_help_btn = Button(
|
|
22
|
+
self,
|
|
23
|
+
text="?",
|
|
24
|
+
width=1,
|
|
25
|
+
command=lambda: self.gui.cb.put(
|
|
26
|
+
("msg_block", (self.gui.help["comp"]["no_compress"],), None)
|
|
27
|
+
),
|
|
28
|
+
bootstyle="secondary", # type: ignore
|
|
29
|
+
)
|
|
30
|
+
self.no_compress_lbl = Label(self, text=I("No compression"))
|
|
31
|
+
self.no_compress_cbox = Checkbutton(
|
|
32
|
+
self,
|
|
33
|
+
variable=self.gui.no_compress_var,
|
|
34
|
+
command=self.cb_no_compress,
|
|
35
|
+
onvalue=True,
|
|
36
|
+
offvalue=False,
|
|
37
|
+
bootstyle="danger-round-toggle", # type: ignore
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
self.comp_preset_help_btn = Button(
|
|
41
|
+
self,
|
|
42
|
+
text="?",
|
|
43
|
+
width=1,
|
|
44
|
+
command=lambda: self.gui.cb.put(
|
|
45
|
+
("msg_block", (self.gui.help["comp"]["preset"],), None)
|
|
46
|
+
),
|
|
47
|
+
bootstyle="secondary", # type: ignore
|
|
48
|
+
)
|
|
49
|
+
self.comp_preset_lbl = Label(self, text=I("Preset"))
|
|
50
|
+
self.comp_preset_opt = OptionMenu(
|
|
51
|
+
self,
|
|
52
|
+
self.gui.comp_preset_var,
|
|
53
|
+
self.gui.comp_preset_var.get(),
|
|
54
|
+
*self.gui.compression_presets.keys(),
|
|
55
|
+
command=self.cb_comp_apply_preset,
|
|
56
|
+
bootstyle="secondary", # type: ignore
|
|
57
|
+
)
|
|
58
|
+
self.comp_preset_opt.config(width=15)
|
|
59
|
+
|
|
60
|
+
self.steps_help_btn = Button(
|
|
61
|
+
self,
|
|
62
|
+
text="?",
|
|
63
|
+
width=1,
|
|
64
|
+
command=lambda: self.gui.cb.put(
|
|
65
|
+
("msg_block", (self.gui.help["comp"]["steps"],), None)
|
|
66
|
+
),
|
|
67
|
+
bootstyle="secondary", # type: ignore
|
|
68
|
+
)
|
|
69
|
+
self.steps_lbl = Label(self, text=I("Number of steps"))
|
|
70
|
+
self.steps_entry = Entry(self, textvariable=self.gui.steps_var, width=8)
|
|
71
|
+
self.steps_entry.bind("<Button-3><ButtonRelease-3>", RightClicker)
|
|
72
|
+
|
|
73
|
+
self.processes_help_btn = Button(
|
|
74
|
+
self,
|
|
75
|
+
text="?",
|
|
76
|
+
width=1,
|
|
77
|
+
command=lambda: self.gui.cb.put(
|
|
78
|
+
("msg_block", (self.gui.help["comp"]["processes"],), None)
|
|
79
|
+
),
|
|
80
|
+
bootstyle="secondary", # type: ignore
|
|
81
|
+
)
|
|
82
|
+
self.processes_lbl = Label(self, text=I("Number of processes"))
|
|
83
|
+
self.processes_entry = Entry(self, textvariable=self.gui.processes_var, width=8)
|
|
84
|
+
self.processes_entry.bind("<Button-3><ButtonRelease-3>", RightClicker)
|
|
85
|
+
|
|
86
|
+
self.comp_advanced_btn = Button(
|
|
87
|
+
self,
|
|
88
|
+
text=I("Advanced..."),
|
|
89
|
+
command=self.cb_compress_advanced,
|
|
90
|
+
bootstyle="secondary", # type: ignore
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
self.no_compress_help_btn.grid(column=0, row=0, sticky="w", padx=3, pady=3)
|
|
94
|
+
self.no_compress_lbl.grid(column=1, row=0, sticky="w", padx=3, pady=3)
|
|
95
|
+
self.no_compress_cbox.grid(column=2, row=0, sticky="nes", padx=3, pady=3)
|
|
96
|
+
|
|
97
|
+
self.comp_preset_help_btn.grid(column=0, row=1, sticky="w", padx=3, pady=3)
|
|
98
|
+
self.comp_preset_lbl.grid(column=1, row=1, sticky="w", padx=3, pady=3)
|
|
99
|
+
self.comp_preset_opt.grid(column=2, row=1, sticky="nes", padx=3, pady=3)
|
|
100
|
+
|
|
101
|
+
self.steps_help_btn.grid(column=0, row=2, sticky="w", padx=3, pady=3)
|
|
102
|
+
self.steps_lbl.grid(column=1, row=2, sticky="w", padx=3, pady=3)
|
|
103
|
+
self.steps_entry.grid(column=2, row=2, sticky="nes", padx=3, pady=3)
|
|
104
|
+
|
|
105
|
+
self.processes_help_btn.grid(column=0, row=3, sticky="w", padx=3, pady=3)
|
|
106
|
+
self.processes_lbl.grid(column=1, row=3, sticky="w", padx=3, pady=3)
|
|
107
|
+
self.processes_entry.grid(column=2, row=3, sticky="nes", padx=3, pady=3)
|
|
108
|
+
|
|
109
|
+
self.comp_advanced_btn.grid(column=2, row=4, sticky="nes", padx=3, pady=3)
|
|
110
|
+
|
|
111
|
+
self.cb_comp_apply_preset()
|
|
112
|
+
|
|
113
|
+
def cb_comp_apply_preset(self, *_: Any) -> None:
|
|
114
|
+
selection = self.gui.get_preset()
|
|
115
|
+
|
|
116
|
+
preset = self.gui.compression_presets[selection]
|
|
117
|
+
self.gui.fps_min_var.set(preset.get("fps", {}).get("min"))
|
|
118
|
+
self.gui.fps_max_var.set(preset.get("fps", {}).get("max"))
|
|
119
|
+
self.gui.fps_power_var.set(preset.get("fps", {}).get("power"))
|
|
120
|
+
self.gui.res_w_min_var.set(preset.get("res", {}).get("w", {}).get("min"))
|
|
121
|
+
self.gui.res_w_max_var.set(preset.get("res", {}).get("w", {}).get("max"))
|
|
122
|
+
self.gui.res_h_min_var.set(preset.get("res", {}).get("h", {}).get("min"))
|
|
123
|
+
self.gui.res_h_max_var.set(preset.get("res", {}).get("h", {}).get("max"))
|
|
124
|
+
self.gui.res_power_var.set(preset.get("res", {}).get("power"))
|
|
125
|
+
self.gui.res_snap_pow2_var.set(preset.get("res", {}).get("snap_pow2"))
|
|
126
|
+
self.gui.quality_min_var.set(preset.get("quality", {}).get("min"))
|
|
127
|
+
self.gui.quality_max_var.set(preset.get("quality", {}).get("max"))
|
|
128
|
+
self.gui.quality_power_var.set(preset.get("quality", {}).get("power"))
|
|
129
|
+
self.gui.color_min_var.set(preset.get("color", {}).get("min"))
|
|
130
|
+
self.gui.color_max_var.set(preset.get("color", {}).get("max"))
|
|
131
|
+
self.gui.color_power_var.set(preset.get("color", {}).get("power"))
|
|
132
|
+
self.gui.duration_min_var.set(preset.get("duration", {}).get("min"))
|
|
133
|
+
self.gui.duration_max_var.set(preset.get("duration", {}).get("max"))
|
|
134
|
+
self.gui.img_size_max_var.set(preset.get("size_max", {}).get("img"))
|
|
135
|
+
self.gui.vid_size_max_var.set(preset.get("size_max", {}).get("vid"))
|
|
136
|
+
self.gui.img_format_var.set(preset.get("format", {}).get("img"))
|
|
137
|
+
self.gui.vid_format_var.set(preset.get("format", {}).get("vid"))
|
|
138
|
+
self.gui.bg_color_var.set(preset.get("bg_color"))
|
|
139
|
+
self.gui.fake_vid_var.set(preset.get("fake_vid"))
|
|
140
|
+
self.gui.scale_filter_var.set(preset.get("scale_filter"))
|
|
141
|
+
self.gui.quantize_method_var.set(preset.get("quantize_method"))
|
|
142
|
+
self.gui.default_emoji_var.set(preset.get("default_emoji"))
|
|
143
|
+
self.gui.steps_var.set(preset.get("steps"))
|
|
144
|
+
|
|
145
|
+
self.gui.highlight_fields()
|
|
146
|
+
self.cb_no_compress_toggle()
|
|
147
|
+
self.cb_no_compress()
|
|
148
|
+
|
|
149
|
+
def cb_compress_advanced(self, *_: Any) -> None:
|
|
150
|
+
AdvancedCompressionWindow(self.gui)
|
|
151
|
+
|
|
152
|
+
def cb_no_compress_toggle(self, *_: Any) -> None:
|
|
153
|
+
if (
|
|
154
|
+
self.gui.comp_preset_var.get() == "auto"
|
|
155
|
+
and self.gui.get_output_name() == "local"
|
|
156
|
+
):
|
|
157
|
+
self.gui.no_compress_var.set(True)
|
|
158
|
+
else:
|
|
159
|
+
self.gui.no_compress_var.set(False)
|
|
160
|
+
|
|
161
|
+
def cb_no_compress(self, *_: Any) -> None:
|
|
162
|
+
if self.gui.no_compress_var.get() is True:
|
|
163
|
+
state = "disabled"
|
|
164
|
+
else:
|
|
165
|
+
state = "normal"
|
|
166
|
+
|
|
167
|
+
self.comp_advanced_btn.config(state=state)
|
|
168
|
+
self.steps_entry.config(state=state)
|
|
169
|
+
self.processes_entry.config(state=state)
|
|
170
|
+
|
|
171
|
+
def set_inputs_comp(self, state: str) -> None:
|
|
172
|
+
self.comp_preset_opt.config(state=state)
|
|
173
|
+
self.comp_advanced_btn.config(state=state)
|
|
174
|
+
self.steps_entry.config(state=state)
|
|
175
|
+
self.processes_entry.config(state=state)
|
|
176
|
+
|
|
177
|
+
def set_states(self, state: str) -> None:
|
|
178
|
+
self.no_compress_cbox.config(state=state)
|
|
179
|
+
self.set_inputs_comp(state=state)
|
|
180
|
+
self.cb_no_compress()
|
|
@@ -1,113 +1,156 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
import os
|
|
3
|
-
import platform
|
|
4
|
-
from typing import TYPE_CHECKING, Any
|
|
5
|
-
|
|
6
|
-
from ttkbootstrap import Button, Checkbutton, Label, LabelFrame # type: ignore
|
|
7
|
-
|
|
8
|
-
from sticker_convert.definitions import CONFIG_DIR
|
|
9
|
-
from sticker_convert.utils.files.run_bin import RunBin
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
self.grid_columnconfigure(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
self,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
self,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
import os
|
|
3
|
+
import platform
|
|
4
|
+
from typing import TYPE_CHECKING, Any
|
|
5
|
+
|
|
6
|
+
from ttkbootstrap import Button, Checkbutton, Label, LabelFrame, OptionMenu # type: ignore
|
|
7
|
+
|
|
8
|
+
from sticker_convert.definitions import CONFIG_DIR, RUNTIME_STATE
|
|
9
|
+
from sticker_convert.utils.files.run_bin import RunBin
|
|
10
|
+
from sticker_convert.utils.translate import SUPPORTED_LANG, I, get_lang
|
|
11
|
+
|
|
12
|
+
if TYPE_CHECKING:
|
|
13
|
+
from sticker_convert.gui import GUI # type: ignore
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class ConfigFrame(LabelFrame):
|
|
17
|
+
def __init__(self, gui: "GUI", *args: Any, **kwargs: Any) -> None:
|
|
18
|
+
self.gui = gui
|
|
19
|
+
super().__init__(*args, **kwargs)
|
|
20
|
+
|
|
21
|
+
self.grid_columnconfigure(1, weight=1)
|
|
22
|
+
self.grid_columnconfigure(3, weight=1)
|
|
23
|
+
|
|
24
|
+
self.settings_save_cred_lbl = Label(
|
|
25
|
+
self, text=I("Save credentials"), width=18, justify="left", anchor="w"
|
|
26
|
+
)
|
|
27
|
+
self.settings_save_cred_cbox = Checkbutton(
|
|
28
|
+
self,
|
|
29
|
+
variable=self.gui.settings_save_cred_var,
|
|
30
|
+
onvalue=True,
|
|
31
|
+
offvalue=False,
|
|
32
|
+
bootstyle="success-round-toggle", # type: ignore
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
self.settings_clear_cred_lbl = Label(
|
|
36
|
+
self,
|
|
37
|
+
text=I("Clear credentials"),
|
|
38
|
+
width=18,
|
|
39
|
+
justify="left",
|
|
40
|
+
anchor="w",
|
|
41
|
+
)
|
|
42
|
+
self.settings_clear_cred_btn = Button(
|
|
43
|
+
self,
|
|
44
|
+
text=I("Clear..."),
|
|
45
|
+
command=self.cb_clear_cred,
|
|
46
|
+
bootstyle="secondary", # type: ignore
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
self.settings_restore_default_lbl = Label(
|
|
50
|
+
self, text=I("Default config"), width=18, justify="left", anchor="w"
|
|
51
|
+
)
|
|
52
|
+
self.settings_restore_default_btn = Button(
|
|
53
|
+
self,
|
|
54
|
+
text=I("Restore..."),
|
|
55
|
+
command=self.cb_restore_default,
|
|
56
|
+
bootstyle="secondary", # type: ignore
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
self.settings_open_dir_lbl = Label(
|
|
60
|
+
self, text=I("Config directory"), width=18, justify="left", anchor="w"
|
|
61
|
+
)
|
|
62
|
+
self.settings_open_dir_btn = Button(
|
|
63
|
+
self,
|
|
64
|
+
text=I("Open..."),
|
|
65
|
+
command=self.cb_open_config_directory,
|
|
66
|
+
bootstyle="secondary", # type: ignore
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
self.settings_lang_lbl = Label(
|
|
70
|
+
self, text=I("Language"), width=18, justify="left", anchor="w"
|
|
71
|
+
)
|
|
72
|
+
self.settings_lang_opt = OptionMenu(
|
|
73
|
+
self,
|
|
74
|
+
self.gui.lang_display_var,
|
|
75
|
+
self.gui.lang_display_var.get(),
|
|
76
|
+
*list(SUPPORTED_LANG.keys()),
|
|
77
|
+
command=self.cb_lang,
|
|
78
|
+
bootstyle="secondary", # type: ignore
|
|
79
|
+
)
|
|
80
|
+
self.settings_lang_opt.config(width=8)
|
|
81
|
+
|
|
82
|
+
self.settings_save_cred_lbl.grid(column=0, row=0, sticky="w", padx=3, pady=3)
|
|
83
|
+
self.settings_save_cred_cbox.grid(column=1, row=0, sticky="w", padx=3, pady=3)
|
|
84
|
+
|
|
85
|
+
self.settings_clear_cred_lbl.grid(column=2, row=0, sticky="w", padx=3, pady=3)
|
|
86
|
+
self.settings_clear_cred_btn.grid(column=3, row=0, sticky="w", padx=3, pady=3)
|
|
87
|
+
|
|
88
|
+
self.settings_open_dir_lbl.grid(column=0, row=1, sticky="w", padx=3, pady=3)
|
|
89
|
+
self.settings_open_dir_btn.grid(column=1, row=1, sticky="w", padx=3, pady=3)
|
|
90
|
+
|
|
91
|
+
self.settings_restore_default_lbl.grid(
|
|
92
|
+
column=2, row=1, sticky="w", padx=3, pady=3
|
|
93
|
+
)
|
|
94
|
+
self.settings_restore_default_btn.grid(
|
|
95
|
+
column=3, row=1, sticky="w", padx=3, pady=3
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
self.settings_lang_lbl.grid(column=0, row=2, sticky="w", padx=3, pady=3)
|
|
99
|
+
self.settings_lang_opt.grid(column=1, row=2, sticky="w", padx=3, pady=3)
|
|
100
|
+
|
|
101
|
+
def cb_clear_cred(self, *_: Any, **kwargs: Any) -> None:
|
|
102
|
+
response = self.gui.cb.put(
|
|
103
|
+
(
|
|
104
|
+
"ask_bool",
|
|
105
|
+
(I("Are you sure you want to clear credentials?"),),
|
|
106
|
+
None,
|
|
107
|
+
)
|
|
108
|
+
)
|
|
109
|
+
if response is True:
|
|
110
|
+
self.gui.delete_creds()
|
|
111
|
+
self.gui.load_jsons()
|
|
112
|
+
self.gui.apply_creds()
|
|
113
|
+
self.gui.highlight_fields()
|
|
114
|
+
self.gui.cb.put(("msg_block", ("Credentials cleared.",), None))
|
|
115
|
+
|
|
116
|
+
def cb_restore_default(self, *_: Any, **kwargs: Any) -> None:
|
|
117
|
+
response = self.gui.cb.put(
|
|
118
|
+
(
|
|
119
|
+
"ask_bool",
|
|
120
|
+
(
|
|
121
|
+
I(
|
|
122
|
+
"Are you sure you want to restore default config? (This will not clear credentials.)"
|
|
123
|
+
),
|
|
124
|
+
),
|
|
125
|
+
None,
|
|
126
|
+
)
|
|
127
|
+
)
|
|
128
|
+
if response is True:
|
|
129
|
+
self.gui.delete_config()
|
|
130
|
+
self.gui.load_jsons()
|
|
131
|
+
self.gui.apply_config()
|
|
132
|
+
self.gui.highlight_fields()
|
|
133
|
+
self.gui.cb.put(("msg_block", (I("Restored to default config."),), None))
|
|
134
|
+
|
|
135
|
+
def cb_open_config_directory(self, *_: Any, **kwargs: Any) -> None:
|
|
136
|
+
self.gui.cb.put(I("Config is located at {}").format(CONFIG_DIR))
|
|
137
|
+
if platform.system() == "Windows":
|
|
138
|
+
os.startfile(CONFIG_DIR) # type: ignore
|
|
139
|
+
elif platform.system() == "Darwin":
|
|
140
|
+
RunBin.run_cmd(["open", str(CONFIG_DIR)], silence=True)
|
|
141
|
+
else:
|
|
142
|
+
RunBin.run_cmd(["xdg-open", str(CONFIG_DIR)], silence=True)
|
|
143
|
+
|
|
144
|
+
def cb_lang(self, *_: Any, **kwargs: Any) -> None:
|
|
145
|
+
self.gui.lang_true_var.set(SUPPORTED_LANG[self.gui.lang_display_var.get()])
|
|
146
|
+
self.gui.save_config()
|
|
147
|
+
RUNTIME_STATE["LANG"] = get_lang()
|
|
148
|
+
RUNTIME_STATE["TRANS"] = None
|
|
149
|
+
self.gui.reset()
|
|
150
|
+
|
|
151
|
+
def set_states(self, state: str) -> None:
|
|
152
|
+
self.settings_save_cred_cbox.config(state=state)
|
|
153
|
+
self.settings_clear_cred_btn.config(state=state)
|
|
154
|
+
self.settings_restore_default_btn.config(state=state)
|
|
155
|
+
self.settings_open_dir_btn.config(state=state)
|
|
156
|
+
self.settings_lang_opt.config(state=state)
|