Implemented most of the api placeholders

This commit is contained in:
Ivan
2021-04-26 22:42:56 +03:00
parent 7ba9f228b7
commit b2b447e392
4 changed files with 286 additions and 73 deletions

View File

@@ -123,10 +123,10 @@ class WorkSpaceFrame(tk.Frame):
# data
self.lists = user.fetchUserLists()
text = tk.Text(self, width=15, height=1)
text.pack(anchor="sw")
self.add_list_text = tk.Text(self, width=15, height=1)
self.add_list_text.pack(anchor="sw")
add = tk.Button(self, text="Добавить лист", command=placeholder)
add = tk.Button(self, text="Добавить лист", command=self.add_list)
add.pack(anchor="sw")
# select list box
@@ -152,9 +152,26 @@ class WorkSpaceFrame(tk.Frame):
# todo lists
self.toToList = ToDoListWidget(self)
self.toToList.pack(side="left", fill="both", expand=1)
def add_list(self, *args):
text = self.add_list_text.get(1.0, "end").strip()
if len(text) == 0:
print("empty name! Not adding!")
return
self.user.appendUserList(title=text)
self.lists = self.user.fetchUserLists()
# fill list box
self.listBox.delete(0,'end')
for item in self.lists:
s = f"{str(item)}: {item.created_at.strftime('%Y-%m-%d %H:%M:%S')}"
self.listBox.insert(tk.END, s)
self.listBox.pack()
len(self.lists) > 0 and self.listBox.selection_set(first=0)
def listBox_selected(self, *args):
self.toToList.clear()
selection = self.listBox.curselection()