Skip to content

Commit b3b3994

Browse files
committed
Final v1.0.0 update
Added some minor note functionalities
1 parent b87ea1b commit b3b3994

2 files changed

Lines changed: 75 additions & 18 deletions

File tree

Package/data_management.py

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -316,23 +316,33 @@ def create_new_note(self, title, text):
316316

317317

318318
def load_notes(self) -> None:
319+
self.app.clear_notes()
320+
319321
if self.notes_amount == 0:
320322
return None
321323

322-
for i in range(13, self.notes_amount+13):
323-
frame = ctk.CTkFrame(self.app.notes_data_frame)
324-
frame.pack(padx=frame_padding, pady=frame_padding)
325-
#date_label = ctk.CTkLabel(frame, font=(font_family, font_size), text_color=(light_font_color, font_color))
326-
#date_label.grid()
327-
date = ctk.CTkLabel(frame, text=f"Date: {str(self.worksheet["N" + str(i)].value)}", font=(font_family, font_size), text_color=(light_font_color, font_color))
328-
date.pack()
329-
title = ctk.CTkLabel(frame, text=f"Title: {str(self.worksheet["O" + str(i)].value)}", font=(font_family, font_size), text_color=(light_font_color, font_color))
330-
title.pack()
331-
text = ctk.CTkTextbox(frame, font=(font_family, font_size), text_color=(light_font_color, font_color))
332-
text.pack()
333-
text.insert("0.0", str(self.worksheet["P" + str(i)].value))
334-
text.configure(state="disabled")
335-
324+
for i in range(self.notes_amount+13, 13, -1):
325+
frame = ctk.CTkFrame(self.app.notes_data_frame, width=WIDTH + frame_padding, fg_color=(light_frame_color, frame_color), height=button_height + frame_padding * 2)
326+
frame.pack(pady=frame_padding)
327+
frame.grid_propagate(False)
328+
329+
title = ctk.CTkLabel(frame, text=str(self.worksheet["O" + str(i)].value), font=(font_family, font_size*1.25),
330+
text_color=(light_font_color, font_color), anchor="center", height=button_height + frame_padding * 2)
331+
title.grid(row=0, column=0, padx=widget_padding_x)
332+
date = ctk.CTkLabel(frame, text=str(self.worksheet["N" + str(i)].value), font=(font_family, font_size*1.25),
333+
text_color=(light_font_color, font_color), anchor="center", height=button_height + frame_padding * 2)
334+
date.grid(row=0, column=1, padx=widget_padding_x)
335+
336+
button_frame = ctk.CTkFrame(frame, fg_color="transparent")
337+
button_frame.place(anchor="center", rely=0.5, relx=0.8)
338+
339+
open_button = ctk.CTkButton(button_frame, text="Open", height=button_height, fg_color=self.color, hover_color=self.highlight_color, font=(font_family, font_size), text_color=button_font_color,
340+
command=lambda: self.app._open_notes_text(str(self.worksheet["N" + str(i)].value), str(self.worksheet["O" + str(i)].value), str(self.worksheet["P" + str(i)].value), i))
341+
open_button.grid(row=0, column=0, padx=widget_padding_x)
342+
delete_button = ctk.CTkButton(button_frame, text="Delete", height=button_height, fg_color=self.color, hover_color=self.highlight_color, font=(font_family, font_size), text_color=button_font_color,
343+
command=lambda: self.app._delete_note(frame))
344+
delete_button.grid(row=0, column=1)
345+
336346

337347
def save_eye_care(self, eye_care: str, checkbox: str) -> None:
338348
self.worksheet["Q2"].value = eye_care

main.py

Lines changed: 51 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -421,12 +421,12 @@ def _notes_gui_setup(self) -> None:
421421
self.notes_frame_frame.grid(row=0, column=0, padx=frame_padding, pady=(frame_padding, 0))
422422
self.notes_frame_frame.pack_propagate(False)
423423

424-
new_note_frame = ctk.CTkFrame(self.notes_frame_frame, fg_color=(light_frame_color, frame_color), width=WIDTH-(frame_padding*4), height=35)
424+
new_note_frame = ctk.CTkFrame(self.notes_frame_frame, fg_color=(light_frame_color, frame_color), width=WIDTH - frame_padding * 2, height=60)
425425
new_note_frame.pack(pady=(frame_padding, 0))
426426
new_note_frame.grid_propagate(False)
427427

428-
self.notes_data_frame = ctk.CTkScrollableFrame(self.notes_frame_frame, fg_color="transparent", width=WIDTH-(frame_padding*4), height=520+frame_padding*2)
429-
self.notes_data_frame.pack(padx=frame_padding)
428+
self.notes_data_frame = ctk.CTkScrollableFrame(self.notes_frame_frame, fg_color="transparent", width=WIDTH, height=520+frame_padding*2)
429+
self.notes_data_frame.pack()
430430

431431
new_note_button = ctk.CTkButton(new_note_frame, text="New note", font=(font_family, font_size), text_color=button_font_color, fg_color=button_color, hover_color=button_highlight_color,
432432
height=button_height, command=self._create_new_note_gui)
@@ -749,7 +749,54 @@ def create_new_note(self):
749749

750750
print("Error. Note title or text can't be empty.")
751751

752-
752+
753+
def _open_notes_text(self, date, title, text, index):
754+
self.notes_frame_frame.grid_forget()
755+
756+
frame = ctk.CTkFrame(self.notes_frame, fg_color="transparent", corner_radius=10, height=HEIGHT + frame_padding * 2, width=WIDTH - frame_padding * 2)
757+
frame.grid(padx=frame_padding, pady=frame_padding)
758+
frame.grid_propagate(False)
759+
760+
header_frame = ctk.CTkFrame(frame, fg_color=(light_frame_color, frame_color), corner_radius=10, width=WIDTH - frame_padding * 2, height=60)
761+
header_frame.grid(row=0, column=0, pady=(0, frame_padding))
762+
header_frame.grid_propagate(False)
763+
764+
title_label = ctk.CTkLabel(header_frame, text=title, font=(font_family, font_size), text_color=(light_font_color, font_color),
765+
height=40, width=WIDTH - 280 - frame_padding * 6, fg_color=(light_frame_color, frame_color))
766+
title_label.grid(row=0, column=0, padx=widget_padding_x, pady=widget_padding_y)
767+
date_label = ctk.CTkLabel(header_frame, text=date, font=(font_family, font_size), text_color=(light_font_color, font_color),
768+
height=40, width=WIDTH - 280 - frame_padding * 6, fg_color=(light_frame_color, frame_color))
769+
date_label.grid(row=0, column=0, padx=widget_padding_x, pady=widget_padding_y)
770+
771+
button_frame = ctk.CTkFrame(header_frame, fg_color="transparent")
772+
button_frame.place(anchor="center", rely=0.5, relx=0.85)
773+
774+
save_button = ctk.CTkButton(button_frame, height=button_height, text="Save", fg_color=self.data_manager.color,
775+
hover_color=self.data_manager.highlight_color, font=(font_family, font_size), text_color=button_font_color)
776+
save_button.grid(row=0, column=1)
777+
exit_button = ctk.CTkButton(button_frame, height=button_height, text="Exit", fg_color=self.data_manager.color, command=lambda: self._exit_note(frame),
778+
hover_color=self.data_manager.highlight_color, font=(font_family, font_size), text_color=button_font_color)
779+
exit_button.grid(row=0, column=2, padx=widget_padding_x, pady=widget_padding_y)
780+
781+
textbox = ctk.CTkTextbox(frame, font=(font_family, font_size), text_color=(light_font_color, font_color), fg_color="transparent", width=WIDTH - frame_padding * 4, height=300)
782+
textbox.grid(row=1, column=0, pady=(widget_padding_y, 0))
783+
textbox.insert("0.0", text)
784+
textbox.configure(state="disabled")
785+
786+
787+
def _exit_note(self, frame):
788+
frame.destroy()
789+
self.notes_frame_frame.grid(row=0, column=0, padx=frame_padding, pady=(frame_padding, 0))
790+
791+
792+
def _delete_note(self, frame):
793+
frame.configure(fg_color="red")
794+
#DELTE NOTE FROM EXCEL
795+
796+
def clear_notes(self):
797+
for note in self.notes_data_frame.winfo_children():
798+
note.destroy()
799+
753800
def send_notification(self, title, message) -> None:
754801
toast = Notification(app_id=self.APPNAME, title=title, msg=message)
755802
toast.show()

0 commit comments

Comments
 (0)