From 272dec92f38316e2c526d2b17c327f3dca8728f7 Mon Sep 17 00:00:00 2001 From: nef <83908932+not-nef@users.noreply.github.com> Date: Sat, 25 Dec 2021 13:42:29 +0100 Subject: [PATCH 01/14] Delete configurator.py --- configurator.py | 49 ------------------------------------------------- 1 file changed, 49 deletions(-) delete mode 100644 configurator.py diff --git a/configurator.py b/configurator.py deleted file mode 100644 index dd2ea3ad..00000000 --- a/configurator.py +++ /dev/null @@ -1,49 +0,0 @@ -import tkinter -from tkinter import ttk - -def createManagerWindow(saveTimer, current_mins, current_secs, current_hrs): - manager_app_window = tkinter.Tk() - manager_app_window.geometry('250x170') - manager_app_window.title('TimerX Timer Manager') - - manager_app_window.resizable(False, False) - - # APP THEME - manager_app_window.tk.call("source", "sun-valley.tcl") - manager_app_window.tk.call("set_theme", "light") - - # WINDOW FRAME - manager_window = ttk.Frame(manager_app_window) - manager_window.pack(fill="both", expand=True) - - timer_hr_label = ttk.Label(manager_window, text = 'Hours: ') - timer_hr_label.place(x=17, y=17) - timer_hr_input = ttk.Entry(manager_window) - timer_hr_input.place(x=65, y=10) - timer_hr_input.insert(1, current_hrs) - - timer_min_label = ttk.Label(manager_window, text = 'Minutes: ') - timer_min_label.place(x=13, y=57) - timer_min_input = ttk.Entry(manager_window) - timer_min_input.place(x=65, y=50) - timer_min_input.insert(1, current_mins) - - timer_sec_label = ttk.Label(manager_window, text = 'Seconds: ') - timer_sec_label.place(x=12, y=97) - timer_sec_input = ttk.Entry(manager_window) - timer_sec_input.place(x=65, y=90) - timer_sec_input.insert(1, current_secs) - - ok_button = ttk.Button(manager_window, text = 'Ok!', command = lambda:saveTimer(timer_sec_input, timer_min_input, timer_hr_input, manager_app_window)) - ok_button.place(x=95, y=126) - -def createAboutWindow(): - about_window = tkinter.Tk() - about_window.geometry('300x200') - about_window.title('TimerX Timer Manager') - - logo = tkinter.PhotoImage(file = 'assets/images/logo.jpeg') - - about_window = tkinter.ttk(about_window, image = logo, bd = 0) - about_window.grid(pady = 20) - From 5037db9c4900c950be6dd51800b063266d457362 Mon Sep 17 00:00:00 2001 From: nef <83908932+not-nef@users.noreply.github.com> Date: Sat, 25 Dec 2021 13:43:01 +0100 Subject: [PATCH 02/14] Switch themes in settings --- main.py | 652 ++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 425 insertions(+), 227 deletions(-) diff --git a/main.py b/main.py index ae68d60e..2381b923 100644 --- a/main.py +++ b/main.py @@ -1,227 +1,425 @@ -# TimerX v0.2 by sumeshir26 -# IMPORTS -import platform -from time import sleep -from tkinter import TclError, ttk, Tk, PhotoImage, Frame -from tkinter.constants import LEFT, RIGHT, SE, SW -from playsound import playsound -from threading import Thread -from platform import system -""" -# Disabled by default due to module unavailability on Linux -from BlurWindow.blurWindow import GlobalBlur, blur -""" -import ctypes -import configurator -import darkdetect - -# TKINTER WINDOW -app = Tk() -app.title('TimerX') -app.geometry('300x210') -app.resizable(False, False) -app.update() -""" -# Disabled by default -HWND = ctypes.windll.user32.GetForegroundWindow() -GlobalBlur(HWND) -blur(HWND, hexColor='#12121240') -""" -# SYSTEM CODE -print(f'Running on {system}') -try: - if system() == "darwin": - app.iconbitmap(r'assets/logo.icns') - app.wm_attributes("-transparent", True) - app.config(bg="systemTransparent") - elif system() == "Windows": - app.iconbitmap(r'assets/logo.ico') - from win10toast_click import ToastNotifier - elif system() == "win": - app.iconphoto(r'assets/logo.ico') - else: - logo_img = PhotoImage(file = 'assets/images/logo.png') - app.iconphoto(False, logo_img) -except TclError: - pass - try: - app.iconphoto(r'assets/logo.ico') - except TclError: - pass - -# VARIABLES -app_on = True - -timer_on = False -timer_paused = False - -timer_seconds = 5 -timer_minutes = 0 -timer_hours = 0 - -ontop = False - -# FUNCTIONS -def playBuzzer(): - playsound('./assets/sounds/sound1.wav') - -def startstopButtonPressed(): - global timer_on, timer_paused - if timer_on: - timer_on = False - timer_paused = True - play_button.configure(text = "Play") - elif timer_paused == False and timer_on == False: - play_button.configure(text = "Pause") - timer_thread = Thread(target=runTimer, daemon=True) - timer_thread.start() - else: - timer_paused = False - -def saveTimer(timer_sec_input, timer_min_input, timer_hr_input, manager_app_window): - global timer_seconds, timer_minutes, timer_hours - - try: - timer_seconds = int(timer_sec_input.get()) - timer_minutes = int(timer_min_input.get()) - timer_hours = int(timer_hr_input.get()) - time_selected_display.configure(text = f'Time Selected : {timer_hours}:{timer_minutes}:{timer_seconds}') - time_display.configure(text = f'{timer_hours} : {timer_minutes} : {timer_seconds}') - manager_app_window.destroy() - except ValueError: - time_selected_display.configure(text = "Please enter a number!") - -def runTimer(): - global timer_seconds, timer_minutes, timer_hours, timer_on, app - - seconds_left = timer_seconds - minutes_left = timer_minutes - hours_left = timer_hours - timer_on = True - - while True: - if timer_on and timer_paused == False: - time_display.configure(text = f'{hours_left} : {minutes_left} : {seconds_left}') - if seconds_left == 0 and minutes_left != 0: - minutes_left -= 1 - seconds_left = 59 - elif seconds_left == 0 and minutes_left == 0 and hours_left != 0: - hours_left -= 1 - minutes_left = 59 - seconds_left = 59 - elif seconds_left == 0 and timer_minutes == 0 and hours_left == 0: - break - else: - seconds_left -= 1 - sleep(1) - - else: - time_display.configure(text = f'{hours_left} : {minutes_left} : {seconds_left}') - - timer_on = False - time_display.configure(text = f'{hours_left} : {minutes_left} : {seconds_left}') - play_button.config(text = "Play") - - if system() == "Windows": - notification = ToastNotifier() - notification.show_toast( - "TimerX", - "Timer done!", - icon_path='./assets/logo.ico', - duration='None', - threaded=True, - callback_on_click= app.focus_force() - ) - - playBuzzer() - -def toggleAlwaysOnTop(app): - global ontop, pin_button, theme - if ontop == False: - app.attributes('-topmost', True) - ontop = True - if theme == 'dark': - global unpin_image_dark - pin_button.configure(image=unpin_image_dark) - else: - global unpin_image_light - pin_button.configure(image=unpin_image_light) - return - else: - app.attributes('-topmost', False) - if theme == 'dark': - global pin_image_dark - pin_button.configure(image=pin_image_dark) - else: - global pin_image_light - pin_button.configure(image=pin_image_light) - ontop = False - -# APP THEME - -app.tk.call("source", "sun-valley.tcl") -theme = 'light' - -if darkdetect.theme() == "Dark": - app.tk.call("set_theme", "dark") - theme = 'dark' -else: - app.tk.call("set_theme", "light") - -def switchTheme(): - global theme, app, pin_button, switch_theme_button - if theme == 'light': - theme = 'dark' - app.tk.call("set_theme", "dark") - switch_theme_button.configure(image=switch_theme_image_dark) - pin_button.configure(image=pin_image_dark) - else: - theme = 'light' - app.tk.call("set_theme", "light") - pin_button.configure(image=pin_image_light) - switch_theme_button.configure(image=switch_theme_image_light) - -#KEYBIMDS -app.bind('key-space', startstopButtonPressed) - -# IMAGES - -switch_theme_image_light = PhotoImage(file=f"./assets/images/light/dark_theme.png") -switch_theme_image_dark = PhotoImage(file=f"./assets/images/dark/dark_theme.png") - -pin_image_light = PhotoImage(file=f"./assets/images/light/pin.png") -pin_image_dark = PhotoImage(file=f"./assets/images/dark/pin.png") - -unpin_image_light = PhotoImage(file=f"./assets/images/light/unpin.png") -unpin_image_dark = PhotoImage(file=f"./assets/images/dark/unpin.png") - -# WINDOW FRAME -window = Frame(app) -window.pack(fill="both", expand=True) - -# WINDOW ELEMENTS -time_selected_display = ttk.Label(master = window, text = f'Time Selected : {timer_seconds} Seconds') -time_selected_display.pack() - -time_display = ttk.Label(master = window, text = f'{timer_hours} : {timer_minutes} : {timer_seconds}', font = ("any", 30)) -time_display.pack(pady = 5) - -play_button = ttk.Button(master = window, text = "Play", width = 25, command = startstopButtonPressed, style="Accent.TButton") -play_button.pack() - -manager_button = ttk.Button(master =window, text = 'Edit Timer', command = lambda: configurator.createManagerWindow(saveTimer, timer_minutes, timer_seconds, timer_hours), width = 25) -manager_button.pack(pady = 5) - -switch_theme_button = ttk.Button(master=window, image=switch_theme_image_light, command=switchTheme, style="Toolbutton") -switch_theme_button.pack(side=LEFT, padx=5, pady=(5, 5)) - -pin_button = ttk.Button(master=window, image=pin_image_light, command = lambda:toggleAlwaysOnTop(app), style="Toolbutton") -pin_button.pack(side=RIGHT, padx=(0, 5), pady=(5, 5)) - -# THEMED IMAGES -if darkdetect.theme() == "Dark": - switch_theme_button.configure(image=switch_theme_image_dark) - pin_button.configure(image=pin_image_dark) - -# TKINTER MAINLOOP -app.mainloop() +# TimerX v0.2 by sumeshir26 +# IMPORTS +import platform +from time import sleep +from tkinter import TclError, ttk, Tk, PhotoImage, Frame, StringVar +import tkinter +from tkinter.constants import LEFT, RIGHT, SE, SW +from playsound import playsound +from threading import Thread +from platform import system +import os +""" +# Disabled by default due to module unavailability on Linux +from BlurWindow.blurWindow import GlobalBlur, blur +""" +import ctypes +#from configurator import createManagerWindow, createSettingsWindow +import darkdetect + +global theme + +if darkdetect.theme() == "Dark": + theme = "dark" +else: + theme = "light" + +# TKINTER WINDOW +app = Tk() +app.title('TimerX') +app.geometry('300x210') +app.resizable(False, False) +app.update() +""" +# Disabled by default +HWND = ctypes.windll.user32.GetForegroundWindow() +GlobalBlur(HWND) +blur(HWND, hexColor='#12121240') +""" +# SYSTEM CODE +print(f'Running on {system}') +try: + if system() == "darwin": + app.iconbitmap(r'assets/logo_new.icns') + app.wm_attributes("-transparent", True) + app.config(bg="systemTransparent") + elif system() == "Windows": + app.iconbitmap(r'assets/logo_new.ico') + from win10toast_click import ToastNotifier + elif system() == "win": + app.iconphoto(r'assets/logo_new.ico') + else: + logo_img = PhotoImage(file = 'assets/images/logo_new.png') + app.iconphoto(False, logo_img) +except TclError: + pass + try: + app.iconphoto(r'assets/logo.ico') + except TclError: + pass + +# VARIABLES +app_on = True + +timer_on = False +timer_paused = False + +timer_seconds = 5 +timer_minutes = 0 +timer_hours = 0 + +ontop = False + +# FUNCTIONS +def playBuzzer(): + playsound('./assets/sounds/sound1.wav') + +def startstopButtonPressed(): + global timer_on, timer_paused + if timer_on: + timer_on = False + timer_paused = True + play_button.configure(text = "Play") + elif timer_paused == False and timer_on == False: + play_button.configure(text = "Pause") + timer_thread = Thread(target=runTimer, daemon=True) + timer_thread.start() + else: + timer_paused = False + +def saveTimer(timer_sec_input, timer_min_input, timer_hr_input, manager_app_window): + global timer_seconds, timer_minutes, timer_hours + + try: + timer_seconds = int(timer_sec_input.get()) + timer_minutes = int(timer_min_input.get()) + timer_hours = int(timer_hr_input.get()) + time_selected_display.configure(text = f'Time Selected : {timer_hours}:{timer_minutes}:{timer_seconds}') + time_display.configure(text = f'{timer_hours} : {timer_minutes} : {timer_seconds}') + manager_app_window.destroy() + except ValueError: + time_selected_display.configure(text = "Please enter a number!") + +def runTimer(): + global timer_seconds, timer_minutes, timer_hours, timer_on, app + + seconds_left = timer_seconds + minutes_left = timer_minutes + hours_left = timer_hours + timer_on = True + + while True: + if timer_on and timer_paused == False: + time_display.configure(text = f'{hours_left} : {minutes_left} : {seconds_left}') + if seconds_left == 0 and minutes_left != 0: + minutes_left -= 1 + seconds_left = 59 + elif seconds_left == 0 and minutes_left == 0 and hours_left != 0: + hours_left -= 1 + minutes_left = 59 + seconds_left = 59 + elif seconds_left == 0 and timer_minutes == 0 and hours_left == 0: + break + else: + seconds_left -= 1 + sleep(1) + + else: + time_display.configure(text = f'{hours_left} : {minutes_left} : {seconds_left}') + + timer_on = False + time_display.configure(text = f'{hours_left} : {minutes_left} : {seconds_left}') + play_button.config(text = "Play") + + if system() == "Windows": + notification = ToastNotifier() + notification.show_toast( + "TimerX", + "Timer done!", + icon_path='./assets/logo.ico', + duration='None', + threaded=True, + callback_on_click= app.focus_force() + ) + + playBuzzer() + +def toggleAlwaysOnTop(app): + global ontop, pin_button, theme + if ontop == False: + app.attributes('-topmost', True) + ontop = True + if theme == 'dark': + global unpin_image_dark + pin_button.configure(image=unpin_image_dark) + else: + global unpin_image_light + pin_button.configure(image=unpin_image_light) + return + else: + app.attributes('-topmost', False) + if theme == 'dark': + global pin_image_dark + pin_button.configure(image=pin_image_dark) + else: + global pin_image_light + pin_button.configure(image=pin_image_light) + ontop = False + + +################################################################################################ + +################################################################################################ + + +#WINDOWS + +def createManagerWindow(saveTimer, current_mins, current_secs, current_hrs): + global manager_app_window + manager_app_window = tkinter.Tk() + manager_app_window.geometry('250x170') + manager_app_window.title('Edit Timer') + + manager_app_window.resizable(False, False) + + # APP THEME + + manager_app_window.tk.call("source", "sun-valley.tcl") + + if os.path.isfile("./config/theme.txt"): + read_theme_cfg = open("./config/theme.txt", "r") + + theme_cfg = read_theme_cfg.read() + + if theme_cfg == "Dark": + manager_app_window.tk.call("set_theme", "dark") + elif theme_cfg == "Light": + manager_app_window.tk.call("set_theme", "light") + elif theme_cfg == "System": + manager_app_window.tk.call("set_theme", f"{theme}") + else: + manager_app_window.tk.call("set_theme", f"{theme}") + + read_theme_cfg.close() + + try: + if system() == "darwin": + manager_app_window.iconbitmap(r'assets/logo_new.icns') + manager_app_window.wm_attributes("-transparent", True) + manager_app_window.config(bg="systemTransparent") + elif system() == "Windows": + manager_app_window.iconbitmap(r'assets/logo_new.ico') + from win10toast_click import ToastNotifier + elif system() == "win": + manager_app_window.iconphoto(r'assets/logo_new.ico') + else: + logo_img = PhotoImage(file = 'assets/images/logo.png') + manager_app_window.iconphoto(False, logo_img) + except TclError: + pass + + # WINDOW FRAME + manager_window = ttk.Frame(manager_app_window) + manager_window.pack(fill="both", expand=True) + + timer_hr_label = ttk.Label(manager_window, text = 'Hours: ') + timer_hr_label.place(x=17, y=17) + timer_hr_input = ttk.Entry(manager_window) + timer_hr_input.place(x=65, y=10) + timer_hr_input.insert(1, current_hrs) + + timer_min_label = ttk.Label(manager_window, text = 'Minutes: ') + timer_min_label.place(x=13, y=57) + timer_min_input = ttk.Entry(manager_window) + timer_min_input.place(x=65, y=50) + timer_min_input.insert(1, current_mins) + + timer_sec_label = ttk.Label(manager_window, text = 'Seconds: ') + timer_sec_label.place(x=12, y=97) + timer_sec_input = ttk.Entry(manager_window) + timer_sec_input.place(x=65, y=90) + timer_sec_input.insert(1, current_secs) + + ok_button = ttk.Button(manager_window, text = 'Ok!', command = lambda:saveTimer(timer_sec_input, timer_min_input, timer_hr_input, manager_app_window)) + ok_button.place(x=95, y=126) + +def createSettingsWindow(): + settings_window = tkinter.Tk() + settings_window.geometry('300x200') + settings_window.title('Settings') + + settings_window.tk.call("source", "sun-valley.tcl") + + if os.path.isfile("./config/theme.txt"): + read_theme_cfg = open("./config/theme.txt", "r") + + theme_cfg = read_theme_cfg.read() + + if theme_cfg == "Dark": + settings_window.tk.call("set_theme", "dark") + elif theme_cfg == "Light": + settings_window.tk.call("set_theme", "light") + elif theme_cfg == "System": + settings_window.tk.call("set_theme", f"{theme}") + else: + settings_window.tk.call("set_theme", f"{theme}") + + read_theme_cfg.close() + + try: + if system() == "darwin": + settings_window.iconbitmap(r'assets/logo_new.icns') + settings_window.wm_attributes("-transparent", True) + settings_window.config(bg="systemTransparent") + elif system() == "Windows": + settings_window.iconbitmap(r'assets/logo_new.ico') + from win10toast_click import ToastNotifier + elif system() == "win": + settings_window.iconphoto(r'assets/logo_new.ico') + else: + logo_img = PhotoImage(file = 'assets/images/logo_new.png') + settings_window.iconphoto(False, logo_img) + except TclError: + pass + + box_current_value= StringVar(settings_window) + box_current_value.set("System") + + if os.path.isfile("./config/theme.txt"): + read_theme_cfg = open("./config/theme.txt", "r") + theme_cfg = read_theme_cfg.read() + + if theme_cfg == "Dark": + box_current_value.set("Dark") + elif theme_cfg == "Light": + box_current_value.set("Light") + elif theme_cfg == "System": + box_current_value.set("System") + + read_theme_cfg.close() + + combobox = ttk.Spinbox(settings_window, state="readonly", values=("Dark", "Light", "System"), wrap=True, textvariable=box_current_value) + combobox.pack() + + def ApplyChanges(): + new_theme = combobox.get() + + if os.path.isfile("./config/theme.txt"): + os.remove("./config/theme.txt") + + if not os.path.isdir("./config"): + os.makedirs("./config") + + savethemecfg = open("./config/theme.txt", "w+") + savethemecfg.write(new_theme) + savethemecfg.close + + if new_theme == "Dark": + #settings_window.tk.call("set_theme", "dark") + app.tk.call("set_theme", "dark") + elif new_theme == "Light": + #settings_window.tk.call("set_theme", "light") + app.tk.call("set_theme", "light") + elif new_theme == "System": + #settings_window.tk.call("set_theme", f"{theme}") + app.tk.call("set_theme", f"{theme}") + + settings_window.destroy() + + + + okbtn = ttk.Button(settings_window, text="Apply Changes", command=lambda:ApplyChanges()) + okbtn.pack() + + settings_window.mainloop() + + +###################################################################################################### + +################################################################################################## + + + +# APP THEME + +app.tk.call("source", "sun-valley.tcl") + +if os.path.isfile("./config/theme.txt"): + read_theme_cfg = open("./config/theme.txt", "r") + + theme_cfg = read_theme_cfg.read() + + if theme_cfg == "Dark": + app.tk.call("set_theme", "dark") + elif theme_cfg == "Light": + app.tk.call("set_theme", "light") + elif theme_cfg == "System": + app.tk.call("set_theme", f"{theme}") +else: + app.tk.call("set_theme", f"{theme}") + +read_theme_cfg.close() + +def switchTheme(): + global theme, app, pin_button, switch_theme_button + if theme == 'light': + theme = 'dark' + app.tk.call("set_theme", "dark") + switch_theme_button.configure(image=switch_theme_image_dark) + pin_button.configure(image=pin_image_dark) + else: + theme = 'light' + app.tk.call("set_theme", "light") + pin_button.configure(image=pin_image_light) + switch_theme_button.configure(image=switch_theme_image_light) + +#KEYBIMDS +app.bind('key-space', startstopButtonPressed) + +# IMAGES + +switch_theme_image_light = PhotoImage(file=f"./assets/images/light/dark_theme.png") +switch_theme_image_dark = PhotoImage(file=f"./assets/images/dark/dark_theme.png") + +pin_image_light = PhotoImage(file=f"./assets/images/light/pin.png") +pin_image_dark = PhotoImage(file=f"./assets/images/dark/pin.png") + +unpin_image_light = PhotoImage(file=f"./assets/images/light/unpin.png") +unpin_image_dark = PhotoImage(file=f"./assets/images/dark/unpin.png") + +settings_image_light = PhotoImage(file=f"./assets/images/light/settings.png") +settings_image_dark = PhotoImage(file=f"./assets/images/dark/settings.png") + +# WINDOW FRAME +window = Frame(app) +window.pack(fill="both", expand=True) + +# WINDOW ELEMENTS +time_selected_display = ttk.Label(master = window, text = f'Time Selected : {timer_seconds} Seconds') +time_selected_display.pack() + +time_display = ttk.Label(master = window, text = f'{timer_hours} : {timer_minutes} : {timer_seconds}', font = ("any", 30)) +time_display.pack(pady = 5) + +play_button = ttk.Button(master = window, text = "Play", width = 25, command = startstopButtonPressed, style="Accent.TButton") +play_button.pack() + +manager_button = ttk.Button(master =window, text = 'Edit Timer', command = lambda: createManagerWindow(saveTimer, timer_minutes, timer_seconds, timer_hours), width = 25) +manager_button.pack(pady = 5) + +switch_theme_button = ttk.Button(master=window, image=switch_theme_image_light, command=switchTheme, style="Toolbutton") +switch_theme_button.pack(side=LEFT, padx=5, pady=(5, 5)) + +pin_button = ttk.Button(master=window, image=pin_image_light, command = lambda:toggleAlwaysOnTop(app), style="Toolbutton") +pin_button.pack(side=RIGHT, padx=(0, 5), pady=(5, 5)) + +settings_btn = ttk.Button(master=window, image=settings_image_dark, command=lambda:createSettingsWindow(), style="Toolbutton") +settings_btn.place(x=0, y=0) + +# THEMED IMAGES +if darkdetect.theme() == "Dark": + switch_theme_button.configure(image=switch_theme_image_dark) + pin_button.configure(image=pin_image_dark) + +# TKINTER MAINLOOP +app.mainloop() From eaf462b5c8744f1f5431c91ed04f0aca29321ddf Mon Sep 17 00:00:00 2001 From: nef <83908932+not-nef@users.noreply.github.com> Date: Sat, 25 Dec 2021 17:33:12 +0100 Subject: [PATCH 03/14] Sync Button Texture --- main.py | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/main.py b/main.py index 2381b923..4878ac5e 100644 --- a/main.py +++ b/main.py @@ -245,8 +245,9 @@ def createManagerWindow(saveTimer, current_mins, current_secs, current_hrs): def createSettingsWindow(): settings_window = tkinter.Tk() - settings_window.geometry('300x200') + settings_window.geometry('300x210') settings_window.title('Settings') + settings_window.resizable(False, False) settings_window.tk.call("source", "sun-valley.tcl") @@ -317,19 +318,25 @@ def ApplyChanges(): if new_theme == "Dark": #settings_window.tk.call("set_theme", "dark") app.tk.call("set_theme", "dark") + pin_button.configure(image=pin_image_dark) elif new_theme == "Light": #settings_window.tk.call("set_theme", "light") app.tk.call("set_theme", "light") + pin_button.configure(image=pin_image_light) elif new_theme == "System": #settings_window.tk.call("set_theme", f"{theme}") app.tk.call("set_theme", f"{theme}") settings_window.destroy() - + def CancelSettings(): + settings_window.destroy() okbtn = ttk.Button(settings_window, text="Apply Changes", command=lambda:ApplyChanges()) - okbtn.pack() + okbtn.place(x=150, y=150) + + cancelbtn = ttk.Button(settings_window, text="Cancel", command=lambda:CancelSettings()) + cancelbtn.place(x=25, y=150) settings_window.mainloop() @@ -365,13 +372,11 @@ def switchTheme(): if theme == 'light': theme = 'dark' app.tk.call("set_theme", "dark") - switch_theme_button.configure(image=switch_theme_image_dark) pin_button.configure(image=pin_image_dark) else: theme = 'light' app.tk.call("set_theme", "light") pin_button.configure(image=pin_image_light) - switch_theme_button.configure(image=switch_theme_image_light) #KEYBIMDS app.bind('key-space', startstopButtonPressed) @@ -407,19 +412,30 @@ def switchTheme(): manager_button = ttk.Button(master =window, text = 'Edit Timer', command = lambda: createManagerWindow(saveTimer, timer_minutes, timer_seconds, timer_hours), width = 25) manager_button.pack(pady = 5) -switch_theme_button = ttk.Button(master=window, image=switch_theme_image_light, command=switchTheme, style="Toolbutton") -switch_theme_button.pack(side=LEFT, padx=5, pady=(5, 5)) - pin_button = ttk.Button(master=window, image=pin_image_light, command = lambda:toggleAlwaysOnTop(app), style="Toolbutton") pin_button.pack(side=RIGHT, padx=(0, 5), pady=(5, 5)) settings_btn = ttk.Button(master=window, image=settings_image_dark, command=lambda:createSettingsWindow(), style="Toolbutton") -settings_btn.place(x=0, y=0) +settings_btn.place(x=5, y=163) # THEMED IMAGES -if darkdetect.theme() == "Dark": - switch_theme_button.configure(image=switch_theme_image_dark) - pin_button.configure(image=pin_image_dark) + +if os.path.isfile("./config/theme.txt"): + read_theme_cfg = open("./config/theme.txt", "r") + + theme_cfg = read_theme_cfg.read() + + if theme_cfg == "Dark": + pin_button.configure(image=pin_image_dark) + elif theme_cfg == "Light": + pin_button.configure(image=pin_image_light) +else: + if darkdetect.theme() == "Dark": + pin_button.configure(image=pin_image_dark) + else: + pin_button.configure(image=pin_image_light) + +read_theme_cfg.close() # TKINTER MAINLOOP app.mainloop() From 64f51788fb077871fb81669984f8081d20cf5cdc Mon Sep 17 00:00:00 2001 From: nef <83908932+not-nef@users.noreply.github.com> Date: Sun, 26 Dec 2021 11:46:31 +0100 Subject: [PATCH 04/14] Made switching themes more efficient MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Icons also sync correctly now. I also replaced the „switch themes“ Button with the settings button --- main.py | 154 ++++++++++++++++++++++++-------------------------------- 1 file changed, 65 insertions(+), 89 deletions(-) diff --git a/main.py b/main.py index 4878ac5e..d34fb29e 100644 --- a/main.py +++ b/main.py @@ -17,12 +17,37 @@ #from configurator import createManagerWindow, createSettingsWindow import darkdetect -global theme + + +#Detect System theme & theme config + +global systheme if darkdetect.theme() == "Dark": - theme = "dark" + systheme = "dark" else: - theme = "light" + systheme = "light" + +theme = f"{systheme}" + + +if os.path.isfile("./config/theme.txt"): + read_theme_cfg = open("./config/theme.txt", "r") + theme = read_theme_cfg.read() + read_theme_cfg.close() + + if theme == "System": + if systheme == "dark": + theme = "Dark" + elif systheme == "light": + theme = "Light" + +if theme == "Dark": + lc_theme = "dark" +elif theme == "Light": + lc_theme = "light" +elif theme == f"{systheme}": + lc_theme = f"{systheme}" # TKINTER WINDOW app = Tk() @@ -185,22 +210,7 @@ def createManagerWindow(saveTimer, current_mins, current_secs, current_hrs): # APP THEME manager_app_window.tk.call("source", "sun-valley.tcl") - - if os.path.isfile("./config/theme.txt"): - read_theme_cfg = open("./config/theme.txt", "r") - - theme_cfg = read_theme_cfg.read() - - if theme_cfg == "Dark": - manager_app_window.tk.call("set_theme", "dark") - elif theme_cfg == "Light": - manager_app_window.tk.call("set_theme", "light") - elif theme_cfg == "System": - manager_app_window.tk.call("set_theme", f"{theme}") - else: - manager_app_window.tk.call("set_theme", f"{theme}") - - read_theme_cfg.close() + manager_app_window.tk.call("set_theme", f"{lc_theme}") try: if system() == "darwin": @@ -244,6 +254,8 @@ def createManagerWindow(saveTimer, current_mins, current_secs, current_hrs): ok_button.place(x=95, y=126) def createSettingsWindow(): + global lc_theme, theme + settings_window = tkinter.Tk() settings_window.geometry('300x210') settings_window.title('Settings') @@ -251,21 +263,10 @@ def createSettingsWindow(): settings_window.tk.call("source", "sun-valley.tcl") - if os.path.isfile("./config/theme.txt"): - read_theme_cfg = open("./config/theme.txt", "r") - - theme_cfg = read_theme_cfg.read() - - if theme_cfg == "Dark": - settings_window.tk.call("set_theme", "dark") - elif theme_cfg == "Light": - settings_window.tk.call("set_theme", "light") - elif theme_cfg == "System": - settings_window.tk.call("set_theme", f"{theme}") - else: - settings_window.tk.call("set_theme", f"{theme}") - - read_theme_cfg.close() + try: + settings_window.tk.call("set_theme", f"{lc_new_theme}") + except: + settings_window.tk.call("set_theme", f"{lc_theme}") try: if system() == "darwin": @@ -284,18 +285,11 @@ def createSettingsWindow(): pass box_current_value= StringVar(settings_window) - box_current_value.set("System") - - if os.path.isfile("./config/theme.txt"): - read_theme_cfg = open("./config/theme.txt", "r") - theme_cfg = read_theme_cfg.read() - if theme_cfg == "Dark": - box_current_value.set("Dark") - elif theme_cfg == "Light": - box_current_value.set("Light") - elif theme_cfg == "System": - box_current_value.set("System") + try: + box_current_value.set(f"{new_theme}") + except: + box_current_value.set(f"{theme}") read_theme_cfg.close() @@ -303,6 +297,8 @@ def createSettingsWindow(): combobox.pack() def ApplyChanges(): + global theme, lc_theme, new_theme, lc_new_theme + new_theme = combobox.get() if os.path.isfile("./config/theme.txt"): @@ -316,17 +312,29 @@ def ApplyChanges(): savethemecfg.close if new_theme == "Dark": - #settings_window.tk.call("set_theme", "dark") + lc_new_theme = "dark" + elif new_theme == "Light": + lc_new_theme = "light" + elif new_theme == "System": + lc_new_theme = f"{systheme}" + + if new_theme == "Dark": app.tk.call("set_theme", "dark") pin_button.configure(image=pin_image_dark) + settings_btn.configure(image=settings_image_dark) elif new_theme == "Light": - #settings_window.tk.call("set_theme", "light") app.tk.call("set_theme", "light") pin_button.configure(image=pin_image_light) + settings_btn.configure(image=settings_image_light) elif new_theme == "System": - #settings_window.tk.call("set_theme", f"{theme}") - app.tk.call("set_theme", f"{theme}") - + app.tk.call("set_theme", f"{systheme}") + if systheme == "dark": + pin_button.configure(image=pin_image_dark) + settings_btn.configure(image=settings_image_dark) + elif systheme == "light": + pin_button.configure(image=pin_image_light) + settings_btn.configure(image=settings_image_light) + settings_window.destroy() def CancelSettings(): @@ -350,34 +358,10 @@ def CancelSettings(): # APP THEME app.tk.call("source", "sun-valley.tcl") - -if os.path.isfile("./config/theme.txt"): - read_theme_cfg = open("./config/theme.txt", "r") - - theme_cfg = read_theme_cfg.read() - - if theme_cfg == "Dark": - app.tk.call("set_theme", "dark") - elif theme_cfg == "Light": - app.tk.call("set_theme", "light") - elif theme_cfg == "System": - app.tk.call("set_theme", f"{theme}") -else: - app.tk.call("set_theme", f"{theme}") +app.tk.call("set_theme", f"{lc_theme}") read_theme_cfg.close() -def switchTheme(): - global theme, app, pin_button, switch_theme_button - if theme == 'light': - theme = 'dark' - app.tk.call("set_theme", "dark") - pin_button.configure(image=pin_image_dark) - else: - theme = 'light' - app.tk.call("set_theme", "light") - pin_button.configure(image=pin_image_light) - #KEYBIMDS app.bind('key-space', startstopButtonPressed) @@ -420,20 +404,12 @@ def switchTheme(): # THEMED IMAGES -if os.path.isfile("./config/theme.txt"): - read_theme_cfg = open("./config/theme.txt", "r") - - theme_cfg = read_theme_cfg.read() - - if theme_cfg == "Dark": - pin_button.configure(image=pin_image_dark) - elif theme_cfg == "Light": - pin_button.configure(image=pin_image_light) -else: - if darkdetect.theme() == "Dark": - pin_button.configure(image=pin_image_dark) - else: - pin_button.configure(image=pin_image_light) +if lc_theme == "dark": + pin_button.configure(image=pin_image_dark) + settings_btn.configure(image=settings_image_dark) +elif lc_theme == "light": + pin_button.configure(image=pin_image_light) + settings_btn.configure(image=settings_image_light) read_theme_cfg.close() From 37f71588f29deb16dfadade1cba469b68c72694e Mon Sep 17 00:00:00 2001 From: nef <83908932+not-nef@users.noreply.github.com> Date: Sun, 26 Dec 2021 13:20:55 +0100 Subject: [PATCH 05/14] Multiple Settings saving is now set up! --- main.py | 58 ++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 37 insertions(+), 21 deletions(-) diff --git a/main.py b/main.py index d34fb29e..74725f24 100644 --- a/main.py +++ b/main.py @@ -21,7 +21,15 @@ #Detect System theme & theme config -global systheme +############################################################### +# Config: +# +# config[0] = theme +# +# +############################################################### + +global systheme, cfg if darkdetect.theme() == "Dark": systheme = "dark" @@ -30,17 +38,35 @@ theme = f"{systheme}" - -if os.path.isfile("./config/theme.txt"): - read_theme_cfg = open("./config/theme.txt", "r") - theme = read_theme_cfg.read() - read_theme_cfg.close() +if os.path.isfile("./config/config.txt"): + read_cfg = open("./config/config.txt", "r") + cfg = read_cfg.readlines() + theme = cfg[0] + theme = theme.rstrip("\n") + print(theme) + read_cfg.close() if theme == "System": if systheme == "dark": theme = "Dark" elif systheme == "light": theme = "Light" + elif theme == "noconfig": + theme = f"{systheme}" +else: + if not os.path.isdir("./config"): + os.makedirs("./config") + + make_cfg = open ("./config/config.txt", "w+") + make_cfg.write("noconfig\n") # add another "noconfig\n" for every new setting + make_cfg.close() + + read_cfg = open("./config/config.txt", "r") + cfg = read_cfg.readlines() + read_cfg.close() + + + if theme == "Dark": lc_theme = "dark" @@ -254,7 +280,7 @@ def createManagerWindow(saveTimer, current_mins, current_secs, current_hrs): ok_button.place(x=95, y=126) def createSettingsWindow(): - global lc_theme, theme + global lc_theme, theme, cfg settings_window = tkinter.Tk() settings_window.geometry('300x210') @@ -291,8 +317,6 @@ def createSettingsWindow(): except: box_current_value.set(f"{theme}") - read_theme_cfg.close() - combobox = ttk.Spinbox(settings_window, state="readonly", values=("Dark", "Light", "System"), wrap=True, textvariable=box_current_value) combobox.pack() @@ -301,14 +325,10 @@ def ApplyChanges(): new_theme = combobox.get() - if os.path.isfile("./config/theme.txt"): - os.remove("./config/theme.txt") - - if not os.path.isdir("./config"): - os.makedirs("./config") + cfg[0] = f"{new_theme}" - savethemecfg = open("./config/theme.txt", "w+") - savethemecfg.write(new_theme) + savethemecfg = open("./config/config.txt", "w+") + savethemecfg.writelines(cfg[0]) savethemecfg.close if new_theme == "Dark": @@ -360,8 +380,6 @@ def CancelSettings(): app.tk.call("source", "sun-valley.tcl") app.tk.call("set_theme", f"{lc_theme}") -read_theme_cfg.close() - #KEYBIMDS app.bind('key-space', startstopButtonPressed) @@ -411,7 +429,5 @@ def CancelSettings(): pin_button.configure(image=pin_image_light) settings_btn.configure(image=settings_image_light) -read_theme_cfg.close() - # TKINTER MAINLOOP -app.mainloop() +app.mainloop() \ No newline at end of file From 6419f92fceccf38bcd99864ba4b7b093dcaa90cf Mon Sep 17 00:00:00 2001 From: nef <83908932+not-nef@users.noreply.github.com> Date: Sun, 26 Dec 2021 16:47:32 +0100 Subject: [PATCH 06/14] Fix theme selection box sometimes containing a lowercase value --- main.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/main.py b/main.py index 74725f24..24bba3f3 100644 --- a/main.py +++ b/main.py @@ -313,17 +313,21 @@ def createSettingsWindow(): box_current_value= StringVar(settings_window) try: - box_current_value.set(f"{new_theme}") + if new_theme == "Dark" or "Light" or "System": + box_current_value.set(f"{new_theme}") except: - box_current_value.set(f"{theme}") + if theme == "dark": + box_current_value.set("Dark") + elif theme == "light": + box_current_value.set("Light") - combobox = ttk.Spinbox(settings_window, state="readonly", values=("Dark", "Light", "System"), wrap=True, textvariable=box_current_value) - combobox.pack() + theme_combobox = ttk.Spinbox(settings_window, state="readonly", values=("Dark", "Light", "System"), wrap=True, textvariable=box_current_value) + theme_combobox.pack() def ApplyChanges(): global theme, lc_theme, new_theme, lc_new_theme - new_theme = combobox.get() + new_theme = theme_combobox.get() cfg[0] = f"{new_theme}" From 44ad7c950a82ed16c2f2da7aa65ebe01c206fbc2 Mon Sep 17 00:00:00 2001 From: nef <83908932+not-nef@users.noreply.github.com> Date: Mon, 27 Dec 2021 10:04:27 +0100 Subject: [PATCH 07/14] Fix configurator theme not syncing Also fix theme settings box sometimes containing the wrong value (hopefully for the last time) --- main.py | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/main.py b/main.py index 24bba3f3..b7229242 100644 --- a/main.py +++ b/main.py @@ -2,7 +2,7 @@ # IMPORTS import platform from time import sleep -from tkinter import TclError, ttk, Tk, PhotoImage, Frame, StringVar +from tkinter import Scale, TclError, ttk, Tk, PhotoImage, Frame, StringVar import tkinter from tkinter.constants import LEFT, RIGHT, SE, SW from playsound import playsound @@ -24,7 +24,7 @@ ############################################################### # Config: # -# config[0] = theme +# cfg[0] = theme # # ############################################################### @@ -38,12 +38,15 @@ theme = f"{systheme}" +use_sys_theme = 0 + if os.path.isfile("./config/config.txt"): read_cfg = open("./config/config.txt", "r") cfg = read_cfg.readlines() + theme = cfg[0] theme = theme.rstrip("\n") - print(theme) + read_cfg.close() if theme == "System": @@ -51,6 +54,7 @@ theme = "Dark" elif systheme == "light": theme = "Light" + use_sys_theme = 1 elif theme == "noconfig": theme = f"{systheme}" else: @@ -236,7 +240,11 @@ def createManagerWindow(saveTimer, current_mins, current_secs, current_hrs): # APP THEME manager_app_window.tk.call("source", "sun-valley.tcl") - manager_app_window.tk.call("set_theme", f"{lc_theme}") + + try: + manager_app_window.tk.call("set_theme", f"{lc_new_theme}") + except: + manager_app_window.tk.call("set_theme", f"{lc_theme}") try: if system() == "darwin": @@ -280,7 +288,7 @@ def createManagerWindow(saveTimer, current_mins, current_secs, current_hrs): ok_button.place(x=95, y=126) def createSettingsWindow(): - global lc_theme, theme, cfg + global lc_theme, theme, cfg, value_label settings_window = tkinter.Tk() settings_window.geometry('300x210') @@ -312,18 +320,28 @@ def createSettingsWindow(): box_current_value= StringVar(settings_window) + print(use_sys_theme) + try: if new_theme == "Dark" or "Light" or "System": box_current_value.set(f"{new_theme}") except: - if theme == "dark": + if use_sys_theme == 1: + box_current_value.set("System") + elif theme == "Dark": box_current_value.set("Dark") - elif theme == "light": + elif theme == "Light": box_current_value.set("Light") theme_combobox = ttk.Spinbox(settings_window, state="readonly", values=("Dark", "Light", "System"), wrap=True, textvariable=box_current_value) theme_combobox.pack() + ### + + + + ### + def ApplyChanges(): global theme, lc_theme, new_theme, lc_new_theme From 61c6edbef16b56b96665fe0368db541d2e8ec100 Mon Sep 17 00:00:00 2001 From: nef <83908932+not-nef@users.noreply.github.com> Date: Mon, 27 Dec 2021 11:36:49 +0100 Subject: [PATCH 08/14] Transparency Slider --- main.py | 90 +++++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 75 insertions(+), 15 deletions(-) diff --git a/main.py b/main.py index b7229242..73c32787 100644 --- a/main.py +++ b/main.py @@ -25,6 +25,7 @@ # Config: # # cfg[0] = theme +# cfg[1] = transparency_value # # ############################################################### @@ -47,30 +48,46 @@ theme = cfg[0] theme = theme.rstrip("\n") + transparency_value = cfg[1] + transparency_value = transparency_value.rstrip("\n") + + print(transparency_value) + read_cfg.close() - if theme == "System": - if systheme == "dark": - theme = "Dark" - elif systheme == "light": - theme = "Light" - use_sys_theme = 1 - elif theme == "noconfig": - theme = f"{systheme}" else: if not os.path.isdir("./config"): os.makedirs("./config") make_cfg = open ("./config/config.txt", "w+") - make_cfg.write("noconfig\n") # add another "noconfig\n" for every new setting + make_cfg.write("noconfig\nnoconfig\n") # add another "noconfig\n" for every new setting make_cfg.close() read_cfg = open("./config/config.txt", "r") cfg = read_cfg.readlines() + + theme = cfg[0] + theme = theme.rstrip("\n") + + transparency_value = cfg[1] + transparency_value = transparency_value.rstrip("\n") + read_cfg.close() - - +if theme == "System": + if systheme == "dark": + theme = "Dark" + elif systheme == "light": + theme = "Light" + use_sys_theme = 1 +elif theme == "noconfig": + theme = f"{systheme}" + use_sys_theme = 1 + +if theme == "dark": + theme = "Dark" +if theme == "light": + theme = "Light" if theme == "Dark": lc_theme = "dark" @@ -79,6 +96,10 @@ elif theme == f"{systheme}": lc_theme = f"{systheme}" + +if transparency_value == "noconfig": + transparency_value = ".99" + # TKINTER WINDOW app = Tk() app.title('TimerX') @@ -234,6 +255,10 @@ def createManagerWindow(saveTimer, current_mins, current_secs, current_hrs): manager_app_window = tkinter.Tk() manager_app_window.geometry('250x170') manager_app_window.title('Edit Timer') + try: + manager_app_window.attributes("-alpha", new_transparency_value) + except: + manager_app_window.attributes("-alpha", transparency_value) manager_app_window.resizable(False, False) @@ -294,6 +319,10 @@ def createSettingsWindow(): settings_window.geometry('300x210') settings_window.title('Settings') settings_window.resizable(False, False) + try: + settings_window.attributes("-alpha", new_transparency_value) + except: + settings_window.attributes("-alpha", transparency_value) settings_window.tk.call("source", "sun-valley.tcl") @@ -320,8 +349,6 @@ def createSettingsWindow(): box_current_value= StringVar(settings_window) - print(use_sys_theme) - try: if new_theme == "Dark" or "Light" or "System": box_current_value.set(f"{new_theme}") @@ -338,19 +365,47 @@ def createSettingsWindow(): ### + current_value = tkinter.DoubleVar() + + didsliderload = 0 + + def get_current_value(): + return ".{:.0f}".format(slider.get()) + + def slider_changed(event): + if didsliderload == 1: + settings_window.attributes("-alpha", get_current_value()) + app.attributes("-alpha", get_current_value()) + + slider = ttk.Scale(settings_window, from_=25, to=99, orient="horizontal", command=slider_changed, variable=current_value) + + transparency_value_nodot = transparency_value.lstrip(".") + transparency_value_nodot = int(transparency_value_nodot) + try: + new_transparency_value_nodot = new_transparency_value.lstrip(".") + slider.set(new_transparency_value_nodot) + except: + slider.set(transparency_value_nodot) + + slider.pack() + + didsliderload = 1 ### def ApplyChanges(): - global theme, lc_theme, new_theme, lc_new_theme + global theme, lc_theme, new_theme, lc_new_theme, new_transparency_value new_theme = theme_combobox.get() + new_transparency_value = get_current_value() - cfg[0] = f"{new_theme}" + cfg[0] = f"{new_theme}\n" + cfg[1] = f"{new_transparency_value}\n" savethemecfg = open("./config/config.txt", "w+") savethemecfg.writelines(cfg[0]) + savethemecfg.writelines(cfg[1]) savethemecfg.close if new_theme == "Dark": @@ -399,6 +454,11 @@ def CancelSettings(): # APP THEME +try: + app.attributes("-alpha", new_transparency_value) +except: + app.attributes("-alpha", transparency_value) + app.tk.call("source", "sun-valley.tcl") app.tk.call("set_theme", f"{lc_theme}") From 4a4fd66f2df3b772ad37f6d0191c45501e93ee37 Mon Sep 17 00:00:00 2001 From: nef <83908932+not-nef@users.noreply.github.com> Date: Wed, 29 Dec 2021 11:41:01 +0100 Subject: [PATCH 09/14] Option to play sound when timer ends dunno why this took 2 days lmao --- main.py | 53 ++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 44 insertions(+), 9 deletions(-) diff --git a/main.py b/main.py index 73c32787..10207ea8 100644 --- a/main.py +++ b/main.py @@ -1,8 +1,8 @@ # TimerX v0.2 by sumeshir26 # IMPORTS import platform -from time import sleep -from tkinter import Scale, TclError, ttk, Tk, PhotoImage, Frame, StringVar +from time import sleep, time +from tkinter import Scale, TclError, TkVersion, ttk, Tk, PhotoImage, Frame, StringVar import tkinter from tkinter.constants import LEFT, RIGHT, SE, SW from playsound import playsound @@ -17,7 +17,7 @@ #from configurator import createManagerWindow, createSettingsWindow import darkdetect - +from tkinter.messagebox import showinfo #Detect System theme & theme config @@ -51,7 +51,8 @@ transparency_value = cfg[1] transparency_value = transparency_value.rstrip("\n") - print(transparency_value) + Play_Buzzer_Setting = cfg[2] + Play_Buzzer_Setting = Play_Buzzer_Setting.rstrip("\n") read_cfg.close() @@ -60,7 +61,7 @@ os.makedirs("./config") make_cfg = open ("./config/config.txt", "w+") - make_cfg.write("noconfig\nnoconfig\n") # add another "noconfig\n" for every new setting + make_cfg.write("noconfig\nnoconfig\nnoconfig\n") # add another "noconfig\n" for every new setting make_cfg.close() read_cfg = open("./config/config.txt", "r") @@ -72,6 +73,9 @@ transparency_value = cfg[1] transparency_value = transparency_value.rstrip("\n") + Play_Buzzer_Setting = cfg[2] + Play_Buzzer_Setting = Play_Buzzer_Setting.rstrip("\n") + read_cfg.close() if theme == "System": @@ -100,6 +104,13 @@ if transparency_value == "noconfig": transparency_value = ".99" +if Play_Buzzer_Setting == "noconfig": + Play_Buzzer_Setting = True +elif Play_Buzzer_Setting == "True": + Play_Buzzer_Setting = True +elif Play_Buzzer_Setting == "False": + Play_Buzzer_Setting = False + # TKINTER WINDOW app = Tk() app.title('TimerX') @@ -148,7 +159,7 @@ # FUNCTIONS def playBuzzer(): - playsound('./assets/sounds/sound1.wav') + playsound("./assets/sounds/sound1.wav") def startstopButtonPressed(): global timer_on, timer_paused @@ -218,7 +229,12 @@ def runTimer(): callback_on_click= app.focus_force() ) - playBuzzer() + try: + if new_play_buzzer_setting == True: + playBuzzer() + except: + if Play_Buzzer_Setting == True: + playBuzzer() def toggleAlwaysOnTop(app): global ontop, pin_button, theme @@ -313,7 +329,7 @@ def createManagerWindow(saveTimer, current_mins, current_secs, current_hrs): ok_button.place(x=95, y=126) def createSettingsWindow(): - global lc_theme, theme, cfg, value_label + global lc_theme, theme, cfg, value_label, New_Play_Buzzer_Setting settings_window = tkinter.Tk() settings_window.geometry('300x210') @@ -394,20 +410,39 @@ def slider_changed(event): ### + btn1 = ttk.Checkbutton(settings_window) + try: + if new_play_buzzer_setting == True: + btn1.state(['!alternate', 'selected']) + elif new_play_buzzer_setting == False: + btn1.state(['!alternate']) + except: + if Play_Buzzer_Setting == True: + btn1.state(['!alternate', 'selected']) + elif Play_Buzzer_Setting == False: + btn1.state(['!alternate']) + btn1.pack() + + ### + def ApplyChanges(): - global theme, lc_theme, new_theme, lc_new_theme, new_transparency_value + global theme, lc_theme, new_theme, lc_new_theme, new_transparency_value, new_play_buzzer_setting new_theme = theme_combobox.get() new_transparency_value = get_current_value() + new_play_buzzer_setting = btn1.instate(['selected']) cfg[0] = f"{new_theme}\n" cfg[1] = f"{new_transparency_value}\n" + cfg[2] = f"{new_play_buzzer_setting}\n" savethemecfg = open("./config/config.txt", "w+") savethemecfg.writelines(cfg[0]) savethemecfg.writelines(cfg[1]) + savethemecfg.writelines(cfg[2]) savethemecfg.close + if new_theme == "Dark": lc_new_theme = "dark" elif new_theme == "Light": From d71e8fa9b9ac7f21c2e64922e42f2ea18a79d0d6 Mon Sep 17 00:00:00 2001 From: nef <83908932+not-nef@users.noreply.github.com> Date: Fri, 31 Dec 2021 14:40:26 +0100 Subject: [PATCH 10/14] Added necessary images for dark theme --- assets/images/dark/bell.png | Bin 0 -> 5810 bytes assets/images/dark/speaker.png | Bin 0 -> 7032 bytes assets/images/dark/transparency.png | Bin 0 -> 5631 bytes 3 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 assets/images/dark/bell.png create mode 100644 assets/images/dark/speaker.png create mode 100644 assets/images/dark/transparency.png diff --git a/assets/images/dark/bell.png b/assets/images/dark/bell.png new file mode 100644 index 0000000000000000000000000000000000000000..35352c0629c3042cab334d5a4697023020b4bbfb GIT binary patch literal 5810 zcmeHLc{r478y`!y5LuF=V;YAFvl`3{lQIY)B%;M^?~JM0%nXL8h-}$gRCI(Q5mDKf zERiKeQKu9wr&6CRX;GcNchGiy-#=Z~_x;z*^}h4I&vW0u`@Vno{cIEO?zT=vNmmI1 zfv7k++IfP%I+9C44!jSC5Z^%{a^7KHn?;_K5GY^3W3bo&R20ewpn#agfI!55{mW;| z;YTZ#KQXl`WK-3mo{U>FgHc_7n%s3VJXBTNcc#BzU&CjqJbn3d=Ot}Dd;Zxzh77;m z{x~Cp8kAfdGZXIa;R9A~oJFR2z%3nx$jGP)NBI_HUcLp~piQ%s-tlhHuP;n*VLUqd2L#O+nvxle+mLEoH zVPT}QMH;TEF9VsYmB}9#C7Wm~gfOCIdJix!Z$h74*R7Vy44mBGO)06J%CgZOGZ2I) zyzSbWnBqLd6qjxoq5q>% zX1%^3_(SpwuN!{eR?FXoCuzNeb(v&RI_@mjb^Dgpa*$oCR0p5Zj1cDJ{XUC7Ykjbz1DV#7W)wRYujV@=?pql%iWx^7uI zOel>z%I4MOQ8ElqM(944hem6d%*`XDFzbOX}#n9yPl3iTp|D zrF(Gq8dlf%_`hS=2Tf#p^k?4C$e-Bh+stvz^+O4|j!g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`-c-_Ir-s4Lt zX!Up~@oru&vp27LTe2PxoW0?sW6Y`PCP@xYh5DuLalRpm!##d7y`aDBSnc-w3$ySu kr{Yr{`W~xXT-M39iX(bgspu1i0J=d0{4Uc%W7qKi0a}SkQ2+n{ literal 0 HcmV?d00001 diff --git a/assets/images/dark/transparency.png b/assets/images/dark/transparency.png new file mode 100644 index 0000000000000000000000000000000000000000..635d1cbdf81205fd6f699b8b28f5da841aa5dc72 GIT binary patch literal 5631 zcmeHLX;c&05)L~CP()S-C1hBI>;aNM03j?8D>Z_{n)~)WF493C$ z1Nclh38nAVv%X1FW_kR!wr5r-EIB4kQ2hyWEl4h*LF zPiOeD*lt(-_dRn?X(l6dCFJe9%}&wHgt4;0 z`-T@D8QRTQdoMp&s{<{GJZ327rn$Fqukao`9k#F>+ER4dTDqoB=-gAYe%YqNfR_pR zyq8-J)ovL5n-=_J;Oe%xR`&(>O174FZ+K-Re-(f2!qGT;@)>$v{)Qv3Hs-&1v6RoQ zslIl!q**h%op7Uft zXAE4Lg)vKaR{GsYj)ARgWNKo7J5TFzV+ujNcz~2)S$^v3_GQ&4a;jz~7&>Sq<*#2L zj(t0;C)A%G(Qo)B{ikNu4g+mGufzNlf@Vldnt*vIx&&fn7G{a#mkO@Ri6T@V?1Cq|HFg}zKx?pQaJ3Fju4xf2# z-{FX?TdicyMMr)cdPn4ZhwM2{wkD{Pc_B`zi^b)N+T`L}rZa0g_Lc5O)wHh(7#r>= zJy1@qT@g1681!zi;PqbEn@!;%^Eie0>o@Yb`7zcvOplykmzFvmsd#4MBGLI{T2J4> zYg)&TZo&JUDM?!rhH<`dDZ`xO?MzeeTBD07P63_}&YKs`l8)<@Not1ZWBW4zaQh$E$&Gc=y za;>=?FxqMMLE*oxs_afh`7Kjyy8aP(UwhN0 zdcGYpz&uzfnGmYA<|ah-Rm zJm=Q$&pQt1N{`<=tWF^2TP>>h-zqo|gTJ!;arV9=D+l{Kdp&K(e6mL8ohVxUGC}5b zt!vkQYhnN4nF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|c05s8mpF2#Sp-W62;uK#}k+0E&op!JG+g z*&@00tBA=HfT1!##V5{{h$RzAZf;ntn=8&`lKo;(B86&Eg^I(X37;gYiJ?I0K-2=N zN`(N%VWDg&z7i0Si6l&sD4L2?1%*&qju$w>r1lfHOu~q{@E(opgiIVy}&ijYy0TkMVE>=GC3dt=W?M;p=_WM8qWsdFhQo{xBBwcpo%Fh9*4r= zQ3MDiDWUVHT^kT56u7Y;W4f-sR=-KpT?l(0`)4)mu5A=mx{uF@iQ?G z|Dp#7`iGP6;`aw#Kj``{2EI%AM|J(6>$@2EF6AH9^?#!a{&l+p3ZXY3IkcJCj6b*! z+6ZY!%@3f#KB~UOXAa~-BU8kI5mFdTZ-(kngB292{;<@M(S!VS9_w4_X~W+eI3b|j z?ld}WE;F#@#WtK!9cSogm72+lKg^hMuw5k4JuxM-iT=&zY^ zp1xkG$r;g&P6AStCWB$~;EzSo27Cfz7%%xhZMu`&@gr#$812icrhTpVo87 ztZsJ0>6DbPri7l4!~Et5o#Ywf*p=56_hS8a@NIS+xsKpUGcP=-cObxWiEzK81Kvlo zr&nd1KAEgp8*X>DwsCuM%08ZRu30_TVOJ%sKm55*%)!mfn+EUe9i3Kn(KfBfa*~9t qIp-KTC0}XK)50g+UG|`@5!02mkY#-7;Z%q%7~O9nt=wl-@_zw?SE_OV literal 0 HcmV?d00001 From 41f8f518aafc01ed831ef039b0d57079fd3c61f1 Mon Sep 17 00:00:00 2001 From: nef <83908932+not-nef@users.noreply.github.com> Date: Fri, 31 Dec 2021 14:41:10 +0100 Subject: [PATCH 11/14] Added necessary images for light theme --- assets/images/light/bell.png | Bin 0 -> 5844 bytes assets/images/light/speaker.png | Bin 0 -> 6066 bytes assets/images/light/transparency.png | Bin 0 -> 5663 bytes 3 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 assets/images/light/bell.png create mode 100644 assets/images/light/speaker.png create mode 100644 assets/images/light/transparency.png diff --git a/assets/images/light/bell.png b/assets/images/light/bell.png new file mode 100644 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kC4jfKNntpg_PSAdy0$ z&{&8y=J1$Ew7I!C5`{rxFbGfr!H;4KD3J&@UsntP{I z0v6*3S^x4)+%p%>&yIlV-*NvX{Vn!6VNlB1nLy&u!o}`6l8A7zeFB|BW6=q7w>T6) zp)vp(!W>1RB5)`yfWYHX<_H{MMnjvK0W=(z{u7iVn=hcSX@D3C1UF`ZI5>bx!7=C* z1kKEpg22&GR0M^=Kq2sEc(56VK?5d?pCDX$EU+pmAwPR1hN6Q|3>v6}#bXf|Iu?b% z;TaeN6^}+COibuB6H{~W!Z4eIqSFZW99}2|OeZUp!UT|9Hgm2+OgO>D&5;Pl7^8l) zxP?#z3{U|a11vV3Bjo?+@??bq9s-J(PqZlx1=`1=&?aas+6?zYXcNHWgS99|MWc+d z^T^`F5WsLiYANDM1p($Xz-S1zJb)tL@H{!35F%Xc6ilo+SKu&<`LvK(d{81vT=QS6 z-UA4mf0`czA*{JB7;LU^2^8AA5k4gXn9m8QH{V4Iq_CL)IKsb{)VFrle@Pe0jD`VB z%`pfp77vIyrXuh-kaCnM&BP34W`+mw^Wl9*=W`eWA%zFnFu_Q{XuuMhiw3s(E13p! zVSkqw1_ENHP#81vztJW4 zW4i;e!4;4Y+{`4dn+gOsLekU?4kXAI@h|(v#Wb)*mP_{GLm={t#U~V!c}o0=c!9vt z*>1t;!W9ZKYSt3BsNinb&5>l|Np2qh`__g{VXDnj$Ipebt4Q`tC8;o$%Cgq{Kosfz zLxZI@d0*fRXfvXmYYAnyqJjXyb||<+S~M(FVJhVN*y^i7}<}@&afZLR@OZJ4(3t-Id0<6 zY+F-*h?-eXQ46^7v~Sz7sVOx43{Aand|9Yg4g%`m9ay?5#dmyitX%rzrYQ(;x z>0m3?xZacc=d2*;;^G6$r(u0Q0{ND{BL!#H)b2XYV(hG2*fBN!S=5(M3~BE2q&BP; R&46@69PM04#p?oM{{!(7qH+KL literal 0 HcmV?d00001 diff --git a/assets/images/light/transparency.png b/assets/images/light/transparency.png new file mode 100644 index 0000000000000000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1biu=i> ziyO=Pn}te(P`*GsY6Xe?6H>HHW7Wd4o!C-m3cN5K$^#iBWiIFYLG z+#DH5m46yn#Nl&kqn7}V%OzonBorH@Qcy&YOho}8g@nQpaclxWW^-_O>JL74;vg1)M8u*v9K1D&fF)B1oUv%Q9GbI8A^@P_6rh~gFXuQ zVG)4r#@e981zM{x-xjNJy;KtZi=Xjv_!m7u)W4nllD@y?`YqQlDez0+-_`Y7u3u8% zm%zWP>;EQ~&iCyOD1_dCqM^-9w*Q_MXd|S__Hc28eNlb)TsXK5YS9+EE|Hn# z8Z0MI^=~Fz=Eib@Ki4zUooJ!+F>)ca+ck1?wD)tp*0r4>RL2=4+iEQp;tJhYsW1JM z%-oXesGw-iM0zNM>GOvhi0h-%W!n6}fWseRIlg`Swx6H9rr_Fbg2pn(JLxEFg(Vh# zwJJZ?Mr}sO+~UPZY{i-oZF=M4V=Wg6W!w8dV$=z1)Elb=Nil}KOWi-E8lB$Oqh9~G zSAUbmtl{hSmutXWsoMpv;y*`VH*Td6-X|Y(!S=L<7#@GBv>nM=eJ`OEu8a)6uPp3J ztKZ>@4nAmK|H4?2S%oF6+qMswpU8qI?wD?$TX$I3wRiT-XI{%5`jl-aW`KQ!vdN${ zyKYu`(4k2tTT9Lsno+=soAO@W4PWh4>Mo!pTbWNe))p6|9~$5Fc)3y|9=<&4cHo&J QNHCb2lc!^;LrCI(0c#)6&j0`b literal 0 HcmV?d00001 From 703e4bf1147dbd34c38d7713bceeba45cbb15ef9 Mon Sep 17 00:00:00 2001 From: nef <83908932+not-nef@users.noreply.github.com> Date: Fri, 31 Dec 2021 14:51:24 +0100 Subject: [PATCH 12/14] Finished Up Added option to show notification, keep app on top, and added icons and descriptions for every setting --- main.py | 215 ++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 156 insertions(+), 59 deletions(-) diff --git a/main.py b/main.py index 10207ea8..1822da75 100644 --- a/main.py +++ b/main.py @@ -1,10 +1,10 @@ # TimerX v0.2 by sumeshir26 # IMPORTS import platform -from time import sleep, time -from tkinter import Scale, TclError, TkVersion, ttk, Tk, PhotoImage, Frame, StringVar +from time import sleep +from tkinter import Label, TclError, ttk, Tk, PhotoImage, Frame, StringVar import tkinter -from tkinter.constants import LEFT, RIGHT, SE, SW +from tkinter.constants import LEFT, RIGHT, Y from playsound import playsound from threading import Thread from platform import system @@ -54,6 +54,12 @@ Play_Buzzer_Setting = cfg[2] Play_Buzzer_Setting = Play_Buzzer_Setting.rstrip("\n") + Show_Notification_Setting = cfg[3] + Show_Notification_Setting = Show_Notification_Setting.rstrip("\n") + + ontop = cfg[4] + ontop = ontop.rstrip("\n") + read_cfg.close() else: @@ -61,7 +67,7 @@ os.makedirs("./config") make_cfg = open ("./config/config.txt", "w+") - make_cfg.write("noconfig\nnoconfig\nnoconfig\n") # add another "noconfig\n" for every new setting + make_cfg.write("noconfig\nnoconfig\nnoconfig\nnoconfig\nnoconfig\n") # add another "noconfig\n" for every new setting make_cfg.close() read_cfg = open("./config/config.txt", "r") @@ -76,6 +82,12 @@ Play_Buzzer_Setting = cfg[2] Play_Buzzer_Setting = Play_Buzzer_Setting.rstrip("\n") + Show_Notification_Setting = cfg[3] + Show_Notification_Setting = Show_Notification_Setting.rstrip("\n") + + ontop = cfg[4] + ontop = ontop.rstrip("\n") + read_cfg.close() if theme == "System": @@ -111,6 +123,22 @@ elif Play_Buzzer_Setting == "False": Play_Buzzer_Setting = False +if Show_Notification_Setting == "noconfig": + Show_Notification_Setting = True +elif Show_Notification_Setting == "True": + Show_Notification_Setting = True +elif Show_Notification_Setting == "False": + Show_Notification_Setting = False + +print(ontop) + +if ontop == "noconfig": + ontop = False +elif ontop == "True": + ontop = True +elif ontop == "False": + ontop = False + # TKINTER WINDOW app = Tk() app.title('TimerX') @@ -155,11 +183,9 @@ timer_minutes = 0 timer_hours = 0 -ontop = False - # FUNCTIONS def playBuzzer(): - playsound("./assets/sounds/sound1.wav") + playsound(r".\assets\sounds\sound1.wav") def startstopButtonPressed(): global timer_on, timer_paused @@ -218,16 +244,24 @@ def runTimer(): time_display.configure(text = f'{hours_left} : {minutes_left} : {seconds_left}') play_button.config(text = "Play") - if system() == "Windows": - notification = ToastNotifier() - notification.show_toast( - "TimerX", - "Timer done!", - icon_path='./assets/logo.ico', - duration='None', - threaded=True, - callback_on_click= app.focus_force() - ) + def shownotif(): + if system() == "Windows": + notification = ToastNotifier() + notification.show_toast( + "TimerX", + "Timer done!", + icon_path='./assets/logo.ico', + duration='None', + threaded=True, + callback_on_click= app.focus_force() + ) + + try: + if new_show_notification_setting == True: + shownotif() + except: + if Show_Notification_Setting == True: + shownotif() try: if new_play_buzzer_setting == True: @@ -238,26 +272,13 @@ def runTimer(): def toggleAlwaysOnTop(app): global ontop, pin_button, theme - if ontop == False: + if ontop == True: app.attributes('-topmost', True) - ontop = True - if theme == 'dark': - global unpin_image_dark - pin_button.configure(image=unpin_image_dark) - else: - global unpin_image_light - pin_button.configure(image=unpin_image_light) return else: app.attributes('-topmost', False) - if theme == 'dark': - global pin_image_dark - pin_button.configure(image=pin_image_dark) - else: - global pin_image_light - pin_button.configure(image=pin_image_light) - ontop = False +toggleAlwaysOnTop(app) ################################################################################################ @@ -331,8 +352,8 @@ def createManagerWindow(saveTimer, current_mins, current_secs, current_hrs): def createSettingsWindow(): global lc_theme, theme, cfg, value_label, New_Play_Buzzer_Setting - settings_window = tkinter.Tk() - settings_window.geometry('300x210') + settings_window = tkinter.Toplevel() + settings_window.geometry('500x320') settings_window.title('Settings') settings_window.resizable(False, False) try: @@ -340,7 +361,7 @@ def createSettingsWindow(): except: settings_window.attributes("-alpha", transparency_value) - settings_window.tk.call("source", "sun-valley.tcl") + #settings_window.tk.call("source", "sun-valley.tcl") try: settings_window.tk.call("set_theme", f"{lc_new_theme}") @@ -363,6 +384,71 @@ def createSettingsWindow(): except TclError: pass + ### + + theme_dark = PhotoImage(file="./assets/images/dark/dark_theme.png") + theme_light = PhotoImage(file="./assets/images/light/dark_theme.png") + + transparency_dark = PhotoImage(file="./assets/images/dark/transparency.png") + transparency_light = PhotoImage(file="./assets/images/light/transparency.png") + + speaker_dark = PhotoImage(file="./assets/images/dark/speaker.png") + speaker_light = PhotoImage(file="./assets/images/light/speaker.png") + + bell_dark = PhotoImage(file="./assets/images/dark/bell.png") + bell_light = PhotoImage(file="./assets/images/light/bell.png") + + pin_dark = PhotoImage(file="./assets/images/dark/pin.png") + pin_light = PhotoImage(file="./assets/images/light/pin.png") + + + theme_label = ttk.Label(settings_window, text=" Change theme of the app", image=theme_dark, compound=LEFT) + theme_label.place(x=23, y=23) + + transparency_label = ttk.Label(settings_window, text=" Adjust Transparency of the app", image=transparency_dark, compound=LEFT) + transparency_label.place(x=23, y=73) + + speaker_label = ttk.Label(settings_window, text=" Play sound when timer ends", image=speaker_dark, compound=LEFT) + speaker_label.place(x=23, y=123) + + bell_label = ttk.Label(settings_window, text=" Show notification when timer ends", image=bell_dark, compound=LEFT) + bell_label.place(x=23, y=173) + + pin_label = ttk.Label(settings_window, text=" Keep app always on top", image=pin_dark, compound=LEFT) + pin_label.place(x=23, y=223) + + + ### + + try: + if lc_new_theme == "dark": + theme_label.configure(image=theme_dark) + transparency_label.configure(image=transparency_dark) + speaker_label.configure(image=speaker_dark) + bell_label.configure(image=bell_dark) + pin_label.configure(image=pin_dark) + elif lc_new_theme == "light": + theme_label.configure(image=theme_light) + transparency_label.configure(image=transparency_light) + speaker_label.configure(image=speaker_light) + bell_label.configure(image=bell_light) + pin_label.configure(image=pin_light) + except: + if lc_theme == "dark": + theme_label.configure(image=theme_dark) + transparency_label.configure(image=transparency_dark) + speaker_label.configure(image=speaker_dark) + bell_label.configure(image=bell_dark) + pin_label.configure(image=pin_dark) + elif lc_theme == "light": + theme_label.configure(image=theme_light) + transparency_label.configure(image=transparency_light) + speaker_label.configure(image=speaker_light) + bell_label.configure(image=bell_light) + pin_label.configure(image=pin_light) + + ### + box_current_value= StringVar(settings_window) try: @@ -377,7 +463,7 @@ def createSettingsWindow(): box_current_value.set("Light") theme_combobox = ttk.Spinbox(settings_window, state="readonly", values=("Dark", "Light", "System"), wrap=True, textvariable=box_current_value) - theme_combobox.pack() + theme_combobox.place(x=275, y=20) ### @@ -404,7 +490,7 @@ def slider_changed(event): except: slider.set(transparency_value_nodot) - slider.pack() + slider.place(x=325, y=75) didsliderload = 1 @@ -421,25 +507,54 @@ def slider_changed(event): btn1.state(['!alternate', 'selected']) elif Play_Buzzer_Setting == False: btn1.state(['!alternate']) - btn1.pack() + btn1.place(x=360, y=125) + + ### + + btn2 = ttk.Checkbutton(settings_window) + try: + if new_show_notification_setting == True: + btn2.state(['!alternate', 'selected']) + elif new_show_notification_setting == False: + btn2.state(['!alternate']) + except: + if Show_Notification_Setting == True: + btn2.state(['!alternate', 'selected']) + elif Show_Notification_Setting == False: + btn2.state(['!alternate']) + btn2.place(x=360, y=175) ### + btn3 = ttk.Checkbutton(settings_window) + if ontop == True: + btn3.state(['!alternate', 'selected']) + elif ontop == False: + btn3.state(['!alternate']) + btn3.place(x=360, y=215) + def ApplyChanges(): - global theme, lc_theme, new_theme, lc_new_theme, new_transparency_value, new_play_buzzer_setting + global theme, lc_theme, new_theme, lc_new_theme, new_transparency_value, new_play_buzzer_setting, new_show_notification_setting, ontop new_theme = theme_combobox.get() new_transparency_value = get_current_value() new_play_buzzer_setting = btn1.instate(['selected']) + new_show_notification_setting = btn2.instate(["selected"]) + ontop = btn3.instate(["selected"]) + toggleAlwaysOnTop(app) cfg[0] = f"{new_theme}\n" cfg[1] = f"{new_transparency_value}\n" cfg[2] = f"{new_play_buzzer_setting}\n" + cfg[3] = f"{new_show_notification_setting}\n" + cfg[4] = f"{ontop}\n" savethemecfg = open("./config/config.txt", "w+") savethemecfg.writelines(cfg[0]) savethemecfg.writelines(cfg[1]) savethemecfg.writelines(cfg[2]) + savethemecfg.writelines(cfg[3]) + savethemecfg.writelines(cfg[4]) savethemecfg.close @@ -452,19 +567,15 @@ def ApplyChanges(): if new_theme == "Dark": app.tk.call("set_theme", "dark") - pin_button.configure(image=pin_image_dark) settings_btn.configure(image=settings_image_dark) elif new_theme == "Light": app.tk.call("set_theme", "light") - pin_button.configure(image=pin_image_light) settings_btn.configure(image=settings_image_light) elif new_theme == "System": app.tk.call("set_theme", f"{systheme}") if systheme == "dark": - pin_button.configure(image=pin_image_dark) settings_btn.configure(image=settings_image_dark) elif systheme == "light": - pin_button.configure(image=pin_image_light) settings_btn.configure(image=settings_image_light) settings_window.destroy() @@ -473,10 +584,10 @@ def CancelSettings(): settings_window.destroy() okbtn = ttk.Button(settings_window, text="Apply Changes", command=lambda:ApplyChanges()) - okbtn.place(x=150, y=150) + okbtn.place(x=250, y=270) cancelbtn = ttk.Button(settings_window, text="Cancel", command=lambda:CancelSettings()) - cancelbtn.place(x=25, y=150) + cancelbtn.place(x=125, y=270) settings_window.mainloop() @@ -502,15 +613,6 @@ def CancelSettings(): # IMAGES -switch_theme_image_light = PhotoImage(file=f"./assets/images/light/dark_theme.png") -switch_theme_image_dark = PhotoImage(file=f"./assets/images/dark/dark_theme.png") - -pin_image_light = PhotoImage(file=f"./assets/images/light/pin.png") -pin_image_dark = PhotoImage(file=f"./assets/images/dark/pin.png") - -unpin_image_light = PhotoImage(file=f"./assets/images/light/unpin.png") -unpin_image_dark = PhotoImage(file=f"./assets/images/dark/unpin.png") - settings_image_light = PhotoImage(file=f"./assets/images/light/settings.png") settings_image_dark = PhotoImage(file=f"./assets/images/dark/settings.png") @@ -531,19 +633,14 @@ def CancelSettings(): manager_button = ttk.Button(master =window, text = 'Edit Timer', command = lambda: createManagerWindow(saveTimer, timer_minutes, timer_seconds, timer_hours), width = 25) manager_button.pack(pady = 5) -pin_button = ttk.Button(master=window, image=pin_image_light, command = lambda:toggleAlwaysOnTop(app), style="Toolbutton") -pin_button.pack(side=RIGHT, padx=(0, 5), pady=(5, 5)) - settings_btn = ttk.Button(master=window, image=settings_image_dark, command=lambda:createSettingsWindow(), style="Toolbutton") settings_btn.place(x=5, y=163) # THEMED IMAGES if lc_theme == "dark": - pin_button.configure(image=pin_image_dark) settings_btn.configure(image=settings_image_dark) elif lc_theme == "light": - pin_button.configure(image=pin_image_light) settings_btn.configure(image=settings_image_light) # TKINTER MAINLOOP From 78da9cbd1d58bc5cfdd3ad2f2840b2ae7d412307 Mon Sep 17 00:00:00 2001 From: LG <76845820+im-coder-lg@users.noreply.github.com> Date: Fri, 31 Dec 2021 19:49:33 +0530 Subject: [PATCH 13/14] Remove configurator.py from included files. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 3e23943b..c1ecf93d 100644 --- a/setup.py +++ b/setup.py @@ -34,7 +34,7 @@ # build_exe_options = {"includes": ["tkinter, platform, threading"], "include_msvcr": True} build_exe_options = { "include_msvcr": True, - "include_files":(r"./sun-valley.tcl", r"./theme", r"./assets", r"./configurator.py"), + "include_files":(r"./sun-valley.tcl", r"./theme", r"./assets"), } bdist_rpm_options = { From 44c88ddbca57f6185451fdae4b655e30cc1e9c33 Mon Sep 17 00:00:00 2001 From: sumeshir26 <68823982+sumeshir26@users.noreply.github.com> Date: Sat, 1 Jan 2022 16:25:23 +0530 Subject: [PATCH 14/14] feat: Use switch style for CheckButton --- main.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index 1822da75..b72b3eba 100644 --- a/main.py +++ b/main.py @@ -496,7 +496,7 @@ def slider_changed(event): ### - btn1 = ttk.Checkbutton(settings_window) + btn1 = ttk.Checkbutton(settings_window, style="Switch.TCheckbutton") try: if new_play_buzzer_setting == True: btn1.state(['!alternate', 'selected']) @@ -511,7 +511,7 @@ def slider_changed(event): ### - btn2 = ttk.Checkbutton(settings_window) + btn2 = ttk.Checkbutton(settings_window, style="Switch.TCheckbutton") try: if new_show_notification_setting == True: btn2.state(['!alternate', 'selected']) @@ -526,7 +526,7 @@ def slider_changed(event): ### - btn3 = ttk.Checkbutton(settings_window) + btn3 = ttk.Checkbutton(settings_window, style="Switch.TCheckbutton") if ontop == True: btn3.state(['!alternate', 'selected']) elif ontop == False: @@ -644,4 +644,4 @@ def CancelSettings(): settings_btn.configure(image=settings_image_light) # TKINTER MAINLOOP -app.mainloop() \ No newline at end of file +app.mainloop()