Merge pull request #122 from fishyboteso/fixup/popup_icon

fix popup default configuration
This commit is contained in:
Adam Saudagar 2022-06-13 14:01:08 +05:30 committed by GitHub
commit 17a03c7142
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 7 deletions

View File

@ -99,7 +99,7 @@ class Recorder(IMode):
def _open_save_popup(self):
top = PopUp(empty_function, self.engine.get_gui()._root, background=self.engine.get_gui()._root["background"])
controls_frame = ttk.Frame(top)
recorder_frame = ttk.Frame(top)
top.title("Save Recording?")
button = [-1]
@ -109,14 +109,15 @@ class Recorder(IMode):
top.quit_top()
selected_text = f"\n\nSelected: {os.path.basename(config.get('full_auto_rec_file'))}" if config.get('edit_recorder_mode') else ""
ttk.Label(controls_frame, text=f"Do you want to save the recording?{selected_text}").grid(row=0, column=0, columnspan=3, pady=(0, 5))
ttk.Label(recorder_frame, text=f"Do you want to save the recording?{selected_text}").grid(row=0, column=0, columnspan=3, pady=(0, 5))
_overwrite = tk.NORMAL if config.get("edit_recorder_mode") else tk.DISABLED
ttk.Button(controls_frame, text="Overwrite", command=lambda: button_pressed(0), state=_overwrite).grid(row=1, column=0, pady=(5, 0))
ttk.Button(controls_frame, text="Save As", command=lambda: button_pressed(1)).grid(row=1, column=1)
ttk.Button(controls_frame, text="Cancel", command=lambda: button_pressed(2)).grid(row=1, column=2)
ttk.Button(recorder_frame, text="Overwrite", command=lambda: button_pressed(0), state=_overwrite).grid(row=1, column=0, pady=(5, 0))
ttk.Button(recorder_frame, text="Save As", command=lambda: button_pressed(1)).grid(row=1, column=1)
ttk.Button(recorder_frame, text="Cancel", command=lambda: button_pressed(2)).grid(row=1, column=2)
controls_frame.pack(padx=(5, 5), pady=(5, 5))
recorder_frame.pack(padx=(5, 5), pady=(5, 5))
recorder_frame.update()
top.start()
return button[0]

View File

@ -90,6 +90,8 @@ def start_fullfisher_config(gui: 'GUI'):
ttk.Label(controls_frame, text="Use semi-fisher config for rest").grid(row=row, column=0, columnspan=2, pady=(20, 0))
controls_frame.pack(padx=(5, 5), pady=(5, 10))
controls_frame.update()
top.start()
@ -149,6 +151,8 @@ def start_semifisher_config(gui: 'GUI'):
jitter.grid(row=5, column=1)
controls_frame.pack(padx=(5, 5), pady=(5, 5))
controls_frame.update()
top.start()

View File

@ -18,7 +18,6 @@ def _show(gui, currentversion, newversion, returns):
top = PopUp(helper.empty_function, gui._root)
top.title("A wild fishy update appeared!")
top.iconbitmap(helper.manifest_file('icon.ico'))
dialogLabel = tk.Label(top, text="There is a new fishy update available (" +
currentversion + "->" + newversion + "). Do you want to update now?")
@ -38,6 +37,7 @@ def _show(gui, currentversion, newversion, returns):
width=buttonWidth, compound="c")
dialogBtnYes.grid(row=2, column=1, padx=5, pady=5)
dialogBtnYes.focus_set()
dialogBtnYes.update()
top.protocol('WM_DELETE_WINDOW', _clickNo)
top.start()

View File

@ -1,5 +1,6 @@
import time
from tkinter import Toplevel
from fishy import helper
def center(win):
@ -20,6 +21,7 @@ class PopUp(Toplevel):
self.running = True
self.quit_callback = quit_callback
self.protocol("WM_DELETE_WINDOW", self.quit_top)
self.iconbitmap(helper.manifest_file('icon.ico'))
def quit_top(self):
self.quit_callback()
@ -27,6 +29,7 @@ class PopUp(Toplevel):
self.running = False
def start(self):
self.minsize(self.winfo_width(), self.winfo_height())
self.grab_set()
center(self)
while self.running: