def save_new_list(list_name, window, root): list_name = str(list_name) if len(list_name) >= 13: window.destroy() messagebox.showerror("Error", "List name is too long") return None elif len(list_name) <= 0: window.destroy() messagebox.showerror("Error", "List name is invalid") return None with open("lists.json") as rf: data = json.load(rf) if list_name in list(data.keys()): window.destroy() messagebox.showerror("Error", "List name already exists") return None elif len(list(data.keys())) >= 6: window.destroy() messagebox.showerror("Error", "You have too many lists") return None data.update({list_name: []}) with open("lists.json", "w") as wf: json.dump(data, wf, indent=2) window.destroy() root.destroy() main.main_window()
def delete_list_from_db(list_name, window, root): with open("lists.json") as rf: data = json.load(rf) del data[list_name] with open("lists.json", "w") as wf: json.dump(data, wf, indent=2) window.destroy() root.destroy() main.main_window()
def save_details(self): self.file = open('resources/time.txt', 'w') self.given = self.n.get() print(self.given) self.file.write(self.given) self.file.close() messagebox.showinfo('Details saved', 'Time interval saved successfully') self.root.destroy() main.main_window()
def back_to_home(self): self.root.destroy() main.main_window()
def run(self): ui = main_window(self.iface) ui.show() ui.exec_()
def run(world): if isinstance(world, main.Window): main.main_window(world)
def run(self): ui = main_window(self.iface) ui.show() ui.exec_()