Skip to content

Commit

Permalink
Revert "Add tooltips and remove help buttons"
Browse files Browse the repository at this point in the history
This reverts commit 4b3fd9f.
Done due to poor compatibility in linux
  • Loading branch information
laggykiller committed Jan 4, 2024
1 parent fab3d6d commit cc18fc1
Show file tree
Hide file tree
Showing 4 changed files with 130 additions and 153 deletions.
40 changes: 0 additions & 40 deletions src/sticker_convert/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from PIL import ImageFont
from ttkbootstrap import Window, StringVar, BooleanVar, IntVar # type: ignore
from ttkbootstrap.dialogs import Messagebox, Querybox # type: ignore
from ttkbootstrap.tooltip import ToolTip

from .job import Job # type: ignore
from .job_option import InputOption, CompOption, OutputOption, CredOption # type: ignore
Expand Down Expand Up @@ -545,26 +544,20 @@ def highlight_fields(self) -> bool:
url = self.input_address_var.get()

# Input
ToolTip(self.input_frame.input_option_opt, text=self.input_presets[input_option]['help'], bootstyle='default')

if os.path.isdir(self.input_setdir_var.get()):
self.input_frame.input_setdir_entry.config(bootstyle='default')
ToolTip(self.input_frame.input_setdir_entry, text=self.help['input']['input_dir'], bootstyle='default')
else:
self.input_frame.input_setdir_entry.config(bootstyle='warning')
ToolTip(self.input_frame.input_setdir_entry, text='The directory could not be found. Will be created automatically.', bootstyle=('warning', 'inverse'))

self.input_frame.address_lbl.config(text=self.input_presets[input_option_display]['address_lbls'])
self.input_frame.address_entry.config(bootstyle='default')

if input_option == 'local':
self.input_frame.address_entry.config(state='disabled')
ToolTip(self.input_frame.address_entry, text='URL not required.', bootstyle='default')
self.input_frame.address_tip.config(text=self.input_presets[input_option_display]['example'])

else:
self.input_frame.address_entry.config(state='normal')
ToolTip(self.input_frame.address_entry, text='URL to download from.', bootstyle='default')
self.input_frame.address_tip.config(text=self.input_presets[input_option_display]['example'])
download_option = UrlDetect.detect(url)

Expand All @@ -583,30 +576,24 @@ def highlight_fields(self) -> bool:
# Output
if os.path.isdir(self.output_setdir_var.get()):
self.output_frame.output_setdir_entry.config(bootstyle='default')
ToolTip(self.output_frame.output_setdir_entry, text=self.help['output']['output_dir'], bootstyle='default')
else:
self.output_frame.output_setdir_entry.config(bootstyle='warning')
ToolTip(self.output_frame.output_setdir_entry, text='The directory could not be found. Will be created automatically.', bootstyle=('warning', 'inverse'))

if (MetadataHandler.check_metadata_required(output_option, 'title') and
not MetadataHandler.check_metadata_provided(self.input_setdir_var.get(), input_option, 'title') and
not self.title_var.get()):

self.output_frame.title_entry.config(bootstyle='warning')
ToolTip(self.output_frame.title_entry, text='Title is required.', bootstyle=('warning', 'inverse'))
else:
self.output_frame.title_entry.config(bootstyle='default')
ToolTip(self.output_frame.title_entry, text=self.help['output']['title'], bootstyle='default')

if (MetadataHandler.check_metadata_required(output_option, 'author') and
not MetadataHandler.check_metadata_provided(self.input_setdir_var.get(), input_option, 'author') and
not self.author_var.get()):

self.output_frame.author_entry.config(bootstyle='warning')
ToolTip(self.output_frame.author_entry, text='Author is required.', bootstyle=('warning', 'inverse'))
else:
self.output_frame.author_entry.config(bootstyle='default')
ToolTip(self.output_frame.author_entry, text=self.help['output']['author'], bootstyle='default')

if self.comp_preset_var.get() == 'auto':
if output_option == 'local':
Expand All @@ -618,50 +605,29 @@ def highlight_fields(self) -> bool:
# Credentials
if output_option == 'signal' and not self.signal_uuid_var.get():
self.cred_frame.signal_uuid_entry.config(bootstyle='warning')
ToolTip(self.cred_frame.signal_uuid_entry, text='Signal uuid is required. Press "Get help" for more info.', bootstyle=('warning', 'inverse'))
else:
self.cred_frame.signal_uuid_entry.config(bootstyle='default')
ToolTip(self.cred_frame.signal_uuid_entry, text=self.help['cred']['signal_uuid'], bootstyle='default')

if output_option == 'signal' and not self.signal_password_var.get():
self.cred_frame.signal_password_entry.config(bootstyle='warning')
ToolTip(self.cred_frame.signal_password_entry, text='Signal password is required. Press "Get help" for more info.', bootstyle=('warning', 'inverse'))
else:
self.cred_frame.signal_password_entry.config(bootstyle='default')
ToolTip(self.cred_frame.signal_password_entry, text=self.help['cred']['signal_password'], bootstyle='default')

if (input_option == 'telegram' or output_option == 'telegram') and not self.telegram_token_var.get():
self.cred_frame.telegram_token_entry.config(bootstyle='warning')
ToolTip(self.cred_frame.telegram_token_entry, text='Telegram token is required. Press "Get help" for more info.', bootstyle=('warning', 'inverse'))
else:
self.cred_frame.telegram_token_entry.config(bootstyle='default')
ToolTip(self.cred_frame.telegram_token_entry, text=self.help['cred']['telegram_token'], bootstyle='default')

if output_option == 'telegram' and not self.telegram_userid_var.get():
self.cred_frame.telegram_userid_entry.config(bootstyle='warning')
ToolTip(self.cred_frame.telegram_userid_entry, text='Telegram userid is required. Press "Get help" for more info.', bootstyle=('warning', 'inverse'))
else:
self.cred_frame.telegram_userid_entry.config(bootstyle='default')
ToolTip(self.cred_frame.telegram_userid_entry, text=self.help['cred']['telegram_userid'], bootstyle='default')

if urlparse(url).netloc == 'e.kakao.com' and not self.kakao_auth_token_var.get():
self.cred_frame.kakao_auth_token_entry.config(bootstyle='warning')
ToolTip(self.cred_frame.kakao_auth_token_entry, text='Kakao auth token is required. Press "Get help" for more info.', bootstyle=('warning', 'inverse'))
else:
self.cred_frame.kakao_auth_token_entry.config(bootstyle='default')
ToolTip(self.cred_frame.kakao_auth_token_entry, text=self.help['cred']['kakao_auth_token'], bootstyle='default')

ToolTip(self.cred_frame.line_cookies_entry, text=self.help['cred']['line_cookies'], bootstyle='default')

ToolTip(self.cred_frame.signal_get_auth_btn, text=self.help['cred']['signal_get_auth'], bootstyle='default')
ToolTip(self.cred_frame.kakao_get_auth_btn, text=self.help['cred']['kakao_get_auth'], bootstyle='default')
ToolTip(self.cred_frame.line_get_auth_btn, text=self.help['cred']['line_get_auth'], bootstyle='default')

# Compression
ToolTip(self.comp_frame.no_compress_cbox, text=self.help['comp']['no_compress'], bootstyle='default')
ToolTip(self.comp_frame.steps_entry, text=self.help['comp']['steps'], bootstyle='default')
ToolTip(self.comp_frame.processes_entry, text=self.help['comp']['processes'], bootstyle='default')

# Check for Input and Compression mismatch
if (not self.no_compress_var.get() and
self.get_output_name() != 'local' and
Expand All @@ -670,14 +636,8 @@ def highlight_fields(self) -> bool:

self.comp_frame.comp_preset_opt.config(bootstyle='warning')
self.output_frame.output_option_opt.config(bootstyle='warning')

ToolTip(self.comp_frame.comp_preset_opt, text='Compression preset and output option do not match, which may cause upload to fail.', bootstyle=('warning', 'inverse'))
ToolTip(self.output_frame.output_option_opt, text='Compression preset and output option do not match, which may cause upload to fail.', bootstyle=('warning', 'inverse'))
else:
self.comp_frame.comp_preset_opt.config(bootstyle='secondary')
self.output_frame.output_option_opt.config(bootstyle='secondary')

ToolTip(self.comp_frame.comp_preset_opt, text=self.help['comp']['preset'], bootstyle='default')
ToolTip(self.output_frame.output_option_opt, text=self.output_presets[output_option]['help'], bootstyle='default')

return True
28 changes: 18 additions & 10 deletions src/sticker_convert/gui_components/frames/comp_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,38 +12,46 @@ def __init__(self, gui: "GUI", *args, **kwargs):
self.gui = gui
super(CompFrame, self).__init__(*args, **kwargs)

self.grid_columnconfigure(1, weight=1)
self.grid_columnconfigure(2, weight = 1)

self.no_compress_help_btn = Button(self, text='?', width=1, command=lambda: self.gui.cb_msg_block(self.gui.help['comp']['no_compress']), bootstyle='secondary')
self.no_compress_lbl = Label(self, text='No compression')
self.no_compress_cbox = Checkbutton(self, variable=self.gui.no_compress_var, command=self.cb_no_compress, onvalue=True, offvalue=False, bootstyle='danger-round-toggle')

self.comp_preset_help_btn = Button(self, text='?', width=1, command=lambda: self.gui.cb_msg_block(self.gui.help['comp']['preset']), bootstyle='secondary')
self.comp_preset_lbl = Label(self, text='Preset')
self.comp_preset_opt = OptionMenu(self, self.gui.comp_preset_var, self.gui.comp_preset_var.get(), *self.gui.compression_presets.keys(), command=self.cb_comp_apply_preset, bootstyle='secondary')
self.comp_preset_opt.config(width=15)

self.steps_help_btn = Button(self, text='?', width=1, command=lambda: self.gui.cb_msg_block(self.gui.help['comp']['steps']), bootstyle='secondary')
self.steps_lbl = Label(self, text='Number of steps')
self.steps_entry = Entry(self, textvariable=self.gui.steps_var, width=8)
self.steps_entry.bind('<Button-3><ButtonRelease-3>', RightClicker)

self.processes_help_btn = Button(self, text='?', width=1, command=lambda: self.gui.cb_msg_block(self.gui.help['comp']['processes']), bootstyle='secondary')
self.processes_lbl = Label(self, text='Number of processes')
self.processes_entry = Entry(self, textvariable=self.gui.processes_var, width=8)
self.processes_entry.bind('<Button-3><ButtonRelease-3>', RightClicker)

self.comp_advanced_btn = Button(self, text='Advanced...', command=self.cb_compress_advanced, bootstyle='secondary')

self.no_compress_lbl.grid(column=0, row=0, sticky='w', padx=3, pady=3)
self.no_compress_cbox.grid(column=1, row=0, sticky='nes', padx=3, pady=3)
self.no_compress_help_btn.grid(column=0, row=0, sticky='w', padx=3, pady=3)
self.no_compress_lbl.grid(column=1, row=0, sticky='w', padx=3, pady=3)
self.no_compress_cbox.grid(column=2, row=0, sticky='nes', padx=3, pady=3)

self.comp_preset_lbl.grid(column=0, row=1, sticky='w', padx=3, pady=3)
self.comp_preset_opt.grid(column=1, row=1, sticky='nes', padx=3, pady=3)
self.comp_preset_help_btn.grid(column=0, row=1, sticky='w', padx=3, pady=3)
self.comp_preset_lbl.grid(column=1, row=1, sticky='w', padx=3, pady=3)
self.comp_preset_opt.grid(column=2, row=1, sticky='nes', padx=3, pady=3)

self.steps_lbl.grid(column=0, row=2, sticky='w', padx=3, pady=3)
self.steps_entry.grid(column=1, row=2, sticky='nes', padx=3, pady=3)
self.steps_help_btn.grid(column=0, row=2, sticky='w', padx=3, pady=3)
self.steps_lbl.grid(column=1, row=2, sticky='w', padx=3, pady=3)
self.steps_entry.grid(column=2, row=2, sticky='nes', padx=3, pady=3)

self.processes_lbl.grid(column=0, row=3, sticky='w', padx=3, pady=3)
self.processes_entry.grid(column=1, row=3, sticky='nes', padx=3, pady=3)
self.processes_help_btn.grid(column=0, row=3, sticky='w', padx=3, pady=3)
self.processes_lbl.grid(column=1, row=3, sticky='w', padx=3, pady=3)
self.processes_entry.grid(column=2, row=3, sticky='nes', padx=3, pady=3)

self.comp_advanced_btn.grid(column=1, row=4, sticky='nes', padx=3, pady=3)
self.comp_advanced_btn.grid(column=2, row=4, sticky='nes', padx=3, pady=3)

self.cb_comp_apply_preset()
self.cb_no_compress()
Expand Down
Loading

0 comments on commit cc18fc1

Please sign in to comment.