Reset settings option

This commit is contained in:
LOUDO 2024-04-11 14:21:07 +02:00
parent 8b85fd2f8c
commit a78a99e88d
3 changed files with 8 additions and 3 deletions

View File

@ -1,7 +1,7 @@
from sys import platform
from os import path, getenv, mkdir
from json import dumps, load
from utils.version import Version
from tkinter import messagebox
class UserSettings:
@ -91,6 +91,10 @@ class UserSettings:
with open(self.user_setting, "w") as settingFile:
settingFile.write(updatedValues)
def reset_settings(self):
if messagebox.askyesno("Confirm", "Are you sure you want to reset your settings?"):
self.init_settings()
def get_path(self):
return self.path_setting

View File

@ -81,6 +81,7 @@ class MenuBar(Menu):
self.options_menu.add_cascade(label="Others", menu=self.others_sub)
self.Check_update = BooleanVar(value=userSettings["Others"]["Check_update"])
self.others_sub.add_checkbutton(label="Check update", variable=self.Check_update, command=lambda: settings.change_settings("Others", "Check_update"))
self.others_sub.add_command(label="Reset settings", command=settings.reset_settings)
self.others_sub.add_command(label="Fixed timestamp", command=lambda: Timestamp(self, parent))
# Help section

View File

@ -13,8 +13,8 @@ class NewVerAvailable(Popup):
Label(self, text=f"New Version {version} available!").pack(side=TOP)
Label(self, text="Do you want to download it now?").pack(side=TOP)
buttonArea = Frame(self)
Button(buttonArea, text="Ignore", command=lambda: self.ignore_new_ver()).pack(side=LEFT, padx=5)
Button(buttonArea, text="Remind me later", command=lambda: self.remind_later()).pack(side=LEFT, padx=5)
Button(buttonArea, text="Ignore", command=self.ignore_new_ver).pack(side=LEFT, padx=5)
Button(buttonArea, text="Remind me later", command=self.remind_later).pack(side=LEFT, padx=5)
Button(buttonArea, text="Download update",
command=lambda: OpenUrl(f"https://github.com/LOUDO56/PyMacroRecord/releases/tag/v{version}")).pack(
side=LEFT, padx=5)