@@ -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
0 commit comments