Пример #1
0
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()
Пример #2
0
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()
Пример #3
0
 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()
Пример #4
0
 def back_to_home(self):
     self.root.destroy()
     main.main_window()
Пример #5
0
 def run(self):
     ui = main_window(self.iface)
     ui.show()
     ui.exec_()
Пример #6
0
def run(world):
  if isinstance(world, main.Window):
    main.main_window(world)
Пример #7
0
 def run(self):
     ui = main_window(self.iface)
     ui.show()
     ui.exec_()