Skip to content

Commit b87ea1b

Browse files
committed
Added Notes Functionality + Dark and Light Themes
- Created basic notes UI - Added the ability to create and view notes - Added dark and light themes - Added pink color
1 parent 26e4731 commit b87ea1b

3 files changed

Lines changed: 273 additions & 110 deletions

File tree

Package/data_management.py

Lines changed: 77 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,20 @@ def initialize_variables(self) -> None:
2424
def initialize_new_file_variables(self) -> None:
2525
self.goal_amount = 0
2626
self.data_amount = 0
27+
self.notes_amount = 0
2728
self.monday_duration = self.tuesday_duration = self.wednesday_duration = self.thursday_duration = self.friday_duration = self.saturday_duration = self.sunday_duration = 0
2829
self.color_name = "Orange"
30+
self.theme_name = "Dark"
2931

3032
self.customize_excel()
3133
self.save_color()
34+
self.save_theme()
3235

3336

3437
def collect_data(self) -> None:
3538
self.data_amount = int(self.worksheet["Z2"].value)
3639
self.goal_amount = int(self.worksheet["R2"].value)
40+
self.notes_amount = int(self.worksheet["N9"].value)
3741

3842
self.collect_day_data()
3943

@@ -81,6 +85,8 @@ def write_to_excel(self) -> None:
8185
self.worksheet["D" + str((self.data_amount + 1))].value = self.timer_manager.break_time/60
8286
self.worksheet["E" + str((self.data_amount + 1))].value = self.app.subject_selection.get()
8387

88+
self.worksheet["N9"].value = self.notes_amount
89+
8490
self.worksheet["R2"].value = self.goal_amount
8591

8692
self.worksheet["Z2"].value = self.data_amount
@@ -94,6 +100,13 @@ def customize_excel(self) -> None:
94100
self.worksheet["D1"].value = "Break:"
95101
self.worksheet["E1"].value = "Subject:"
96102

103+
self.worksheet["N8"].value = "Notes amount:"
104+
self.worksheet["N9"].value = self.notes_amount
105+
self.worksheet["N11"].value = "Notes:"
106+
self.worksheet["N12"].value = "Date:"
107+
self.worksheet["O12"].value = "Title:"
108+
self.worksheet["P12"].value = "Text:"
109+
97110
self.worksheet["Q1"].value = "Eye care:"
98111
self.worksheet["Q4"].value = "Only when timer running:"
99112

@@ -105,6 +118,9 @@ def customize_excel(self) -> None:
105118
self.worksheet["T1"].value = "Color:"
106119
self.worksheet["T2"].value = self.color_name
107120

121+
self.worksheet["U1"].value = "Theme:"
122+
self.worksheet["U2"].value = self.theme_name
123+
108124
self.worksheet["W1"].value = "Weekday duration:"
109125

110126
self.worksheet["Z1"].value = "Data amount: "
@@ -224,7 +240,8 @@ def load_color(self) -> None:
224240
self.app.color_dropdown.configure(variable=ctk.StringVar(value=self.color_name))
225241
colors = {"Orange": [orange_button_color, orange_highlight_color, orange_pie_colors],
226242
"Green": [green_button_color, green_highlight_color, green_pie_colors],
227-
"Blue": [blue_button_color, blue_highlight_color, blue_pie_colors]}
243+
"Blue": [blue_button_color, blue_highlight_color, blue_pie_colors],
244+
"Pink": [pink_button_color, pink_highlight_color, pink_pie_colors]}
228245

229246
self.color = colors[self.color_name][0]
230247
self.highlight_color = colors[self.color_name][1]
@@ -244,10 +261,32 @@ def change_color(self) -> None:
244261
print("Color changed.")
245262

246263

264+
def set_theme(self, theme_dropdown) -> None:
265+
self.theme_name = theme_dropdown.get()
266+
print("Theme set.")
267+
self.save_theme()
268+
269+
def save_theme(self) -> None:
270+
self.worksheet["U2"].value = self.theme_name
271+
self.load_theme()
272+
273+
247274
def save_subject(self, subject: str) -> None:
248275
self.worksheet["S2"].value = subject
249276
print("Subject saved.")
250277

278+
279+
def load_theme(self) -> None:
280+
self.theme_name = self.worksheet["U2"].value
281+
self.app.theme_dropdown.configure(variable=ctk.StringVar(value=self.theme_name))
282+
283+
if self.theme_name == "Dark":
284+
ctk.set_appearance_mode("dark")
285+
else:
286+
ctk.set_appearance_mode("light")
287+
288+
print("Theme loaded.")
289+
251290

252291
def load_subject(self) -> None:
253292
if self.worksheet["S2"].value != None:
@@ -260,9 +299,46 @@ def load_subject(self) -> None:
260299
return subject
261300

262301

302+
def create_new_note(self, title, text):
303+
self.notes_amount += 1
304+
305+
self.worksheet["N9"].value = self.notes_amount
306+
307+
self.worksheet["N" + str(self.notes_amount + 12)].value = datetime.datetime.now().strftime("%d/%m/%Y %H:%M")
308+
self.worksheet["O" + str(self.notes_amount + 12)].value = title
309+
self.worksheet["P" + str(self.notes_amount + 12)].value = text
310+
311+
self.workbook.save(self.app.data_file)
312+
313+
print("New note created.")
314+
315+
self.load_notes()
316+
317+
318+
def load_notes(self) -> None:
319+
if self.notes_amount == 0:
320+
return None
321+
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+
336+
263337
def save_eye_care(self, eye_care: str, checkbox: str) -> None:
264338
self.worksheet["Q2"].value = eye_care
265339
self.worksheet["Q5"].value = checkbox
340+
341+
self.workbook.save(self.app.data_file)
266342
print("Eye care saved.")
267343

268344

Package/styles.py

Lines changed: 43 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,104 @@
11
default_color = "SystemButtonFace"
22

3-
window_color = "#2b2b2b"
43
BORDER_WIDTH = 3
54
WIDTH = 975
65
HEIGHT = 600
76

87
font_family = "Segoe UI Semibold"
9-
font_color = "white"
108
font_size = 16
119

10+
font_color = "#e6e6e6"
11+
light_font_color = "#262626"
12+
13+
window_color = "#2b2b2b"
14+
light_window_color = "#d4d4d4"
15+
16+
1217
frame_padding = 10
18+
frame_width = 300
19+
1320
frame_color = "#383838"
21+
light_frame_color = "#c7c7c7"
22+
1423
frame_border_color = "#5b5b5b"
15-
frame_width = 300
24+
light_frame_border_color = "#b3b3b3"
1625

1726
widget_padding_x = 10
1827
widget_padding_y = 10
28+
1929
widget_color = frame_color
30+
light_widget_color = light_frame_color
2031

2132
button_height = 40
33+
2234
button_color = "#f38064"
2335
button_highlight_color = "#f5937a"
2436
button_font_color = "black"
2537

26-
tab_frame_color = "#222222"
2738
tab_frame_width = 200
28-
tab_highlight_color = "#333333"
29-
tab_selected_color = "#343434"
30-
tab_color = tab_frame_color
3139
tab_font_weight = "normal"
3240
tab_font_family = "Calibri"
3341
tab_padding_y = 0
3442

43+
tab_frame_color = "#222222"
44+
light_tab_frame_color = "#dedede"
45+
46+
tab_highlight_color = "#333333"
47+
light_tab_highlight_color = "#cccccc"
48+
49+
tab_selected_color = "#343434"
50+
light_tab_selected_color = "#cdcdcd"
51+
52+
tab_color = tab_frame_color
53+
light_tab_color = light_tab_frame_color
54+
3555
tab_width = tab_frame_width - (tab_frame_width * 0.2)
3656
tab_height = HEIGHT * 0.07
3757

3858
border_frame_color = "#5b5b5b"
59+
light_border_frame_color = "#b3b3b3"
3960

40-
main_frame_color = "#2b2b2b"
4161
main_frame_pad_x = 0
4262
main_frame_pad_y = 0
4363

64+
main_frame_color = "#2b2b2b"
65+
light_main_frame_color = "#d4d4d4"
66+
4467
graph_height = HEIGHT/2
4568
graph_width = (WIDTH/2)-25
69+
4670
graph_bg_color = "#323232"
71+
light_graph_bg_color = "#cccccc"
72+
4773
graph_fg_color = "#323232"
74+
light_graph_fg_color = "#cccccc"
75+
4876
graph_color = "#f38064"
4977
spine_color = "#5b5b5b"
5078

5179
pie_font_family = font_family
5280
pie_font_size = 10
5381

54-
#ORANGE
82+
5583
orange_button_color = "#f38064"
5684
orange_highlight_color = "#f5937a"
5785
orange_pie_colors = ["#f38064", "#eb856b", "#e28a73", "#da8f7c", "#d29484", "#c9998d", "#c19e95"]
5886

5987

60-
#GREEN
6188
green_button_color = "#93f263"
6289
green_highlight_color = "#a3f47b"
6390
green_pie_colors = ["#96ea6c", "#99e274", "#9cd97d", "#9ed185", "#a1c88d", "#a4c096", "#a7b79e"]
6491

6592

66-
#BLUE
6793
blue_button_color = "#63c2f2"
6894
blue_highlight_color = "#7bccf4"
6995
blue_pie_colors = ["#63c2f2", "#6cc0ea", "#74bde2", "#7dbad9", "#85b6d1", "#8db4c8", "#96b2c0"]
7096

97+
98+
pink_button_color = "#f263d5"
99+
pink_highlight_color = "#f47bdc"
100+
pink_pie_colors = ["#f263d5", "#ea6cd1", "#e274cc", "#d97dc7", "#d185c2", "#c88dbd", "#c096b8"]
101+
102+
71103
image_width = 30
72104
image_height = 30

0 commit comments

Comments
 (0)