@@ -369,13 +369,14 @@ def _history_gui_setup(self) -> None:
369369
370370 def _settings_gui_setup (self ) -> None :
371371 self .color_frame = ctk .CTkFrame (self .settings_frame , fg_color = "transparent" )
372- self .color_frame .grid (column = 0 )
372+ self .color_frame .grid (column = 0 , row = 0 )
373373
374374 self .eye_care_export_frame = ctk .CTkFrame (self .settings_frame , fg_color = "transparent" )
375- self .eye_care_export_frame .grid (column = 1 )
375+ self .eye_care_export_frame .grid (column = 1 , row = 0 )
376376
377377 self ._color_gui_setup ()
378378 self ._eye_care_gui_setup ()
379+ self ._export_gui_setup ()
379380
380381 reset_frame = ctk .CTkFrame (self .settings_frame , fg_color = (light_tab_color , tab_color ))
381382 reset_frame .place (anchor = "s" , relx = 0.5 , rely = 0.985 )
@@ -409,7 +410,7 @@ def _color_gui_setup(self) -> None:
409410
410411 def _eye_care_gui_setup (self ):
411412 eye_care_frame = ctk .CTkFrame (self .eye_care_export_frame , fg_color = (light_frame_color , frame_color ), height = 250 , width = int (frame_width / 1.25 ), corner_radius = 10 )
412- eye_care_frame .grid (column = 1 , row = 0 , padx = frame_padding , pady = frame_padding )
413+ eye_care_frame .grid (column = 0 , row = 0 , padx = frame_padding , pady = frame_padding )
413414 eye_care_label = ctk .CTkLabel (eye_care_frame , text = "Eye care" , font = (font_family , font_size ), text_color = (light_font_color , font_color ))
414415 eye_care_label .place (anchor = "nw" , relx = 0.05 , rely = 0.05 )
415416 self .eye_care_selection = ctk .CTkComboBox (eye_care_frame , values = ["On" , "Off" ], state = "readonly" , width = 100 , height = 30 , dropdown_font = (font_family , int (font_size * 0.75 )),
@@ -423,6 +424,20 @@ def _eye_care_gui_setup(self):
423424 eye_care_button .place (anchor = "s" , relx = 0.5 , rely = 0.9 )
424425
425426
427+ def _export_gui_setup (self ):
428+ export_frame = ctk .CTkFrame (self .eye_care_export_frame , fg_color = (light_frame_color , frame_color ), height = 250 , width = int (frame_width / 1.25 ), corner_radius = 10 )
429+ export_frame .grid (row = 1 , column = 0 , padx = frame_padding , pady = frame_padding )
430+ export_label = ctk .CTkLabel (export_frame , text = "Export data" , font = (font_family , font_size ), text_color = (light_font_color , font_color ))
431+ export_label .place (anchor = "nw" , relx = 0.05 , rely = 0.05 )
432+ export_button = ctk .CTkButton (export_frame , text = "Export" , font = (font_family , font_size ), text_color = button_font_color , fg_color = button_color ,
433+ hover_color = button_highlight_color , height = button_height , command = self .export_data )
434+ export_button .place (anchor = "s" , relx = 0.5 , rely = 0.9 )
435+
436+
437+ def export_data (self ):
438+ self .data_manager .export_data ()
439+
440+
426441 def _subject_gui_setup (self ) -> None :
427442 subject_frame = ctk .CTkFrame (self .subject_autobreak_frame , fg_color = (light_frame_color , frame_color ), height = 175 , width = frame_width , corner_radius = 10 )
428443 subject_frame .pack (padx = frame_padding , pady = frame_padding )
@@ -433,9 +448,9 @@ def _subject_gui_setup(self) -> None:
433448 state = "readonly" , width = 200 , height = 30 , dropdown_font = (font_family , int (font_size * 0.75 )), border_color = (light_border_frame_color , border_frame_color ),
434449 font = (font_family , int (font_size )), fg_color = (light_border_frame_color , border_frame_color ), button_color = (light_border_frame_color , border_frame_color ))
435450 self .subject_selection .place (anchor = "center" , relx = 0.5 , rely = 0.45 )
436- subject_button = ctk .CTkButton (subject_frame , text = "Save" , font = (font_family , font_size ), text_color = button_font_color , fg_color = button_color , hover_color = button_highlight_color ,
451+ self . subject_button = ctk .CTkButton (subject_frame , text = "Save" , font = (font_family , font_size ), text_color = button_font_color , fg_color = button_color , hover_color = button_highlight_color ,
437452 height = button_height , command = self .select_subject )
438- subject_button .place (anchor = "s" , relx = 0.5 , rely = 0.9 )
453+ self . subject_button .place (anchor = "s" , relx = 0.5 , rely = 0.9 )
439454
440455
441456 def _autobreak_gui_setup (self ) -> None :
@@ -486,7 +501,7 @@ def _notes_gui_setup(self) -> None:
486501 new_note_frame .pack (pady = (frame_padding , 0 ))
487502 new_note_frame .grid_propagate (False )
488503
489- self .notes_data_frame = ctk .CTkScrollableFrame (self .notes_frame_frame , fg_color = "transparent" , width = WIDTH , height = 520 + frame_padding * 2 , label_anchor = "w" )
504+ self .notes_data_frame = ctk .CTkScrollableFrame (self .notes_frame_frame , fg_color = "transparent" , width = WIDTH + frame_padding * 4 , height = 520 + frame_padding * 2 , label_anchor = "w" )
490505 self .notes_data_frame .pack ()
491506
492507 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 ,
@@ -781,6 +796,8 @@ def save_data(self) -> None:
781796 self .duration_input .delete ("end" )
782797 self .autobreak_button .configure (state = "normal" , fg_color = button_color )
783798 self .break_button .configure (state = "normal" , fg_color = button_color , command = lambda : self .timer_manager .break_mechanism (self .break_button , self .timer_button , self .break_display_label ), hover = True )
799+ self .subject_button .configure (state = "normal" , fg_color = button_color )
800+ self .goal_button .configure (state = "normal" , fg_color = button_color )
784801
785802 if time_in_minutes >= self .goal :
786803 self .data_manager .increase_goal_streak ()
@@ -847,7 +864,7 @@ def eye_protection(self):
847864 if self .eye_care_selection .get () == "On" :
848865 if checkbox == "On" and self .timer_manager .timer_running :
849866 self .send_notification ("Eye Protection" , "It's time for a 20/20/20 break! Look away for 20 seconds at something 20 feet away." )
850- elif checkbox == "Off" :
867+ else :
851868 self .send_notification ("Eye Protection" , "It's time for a 20/20/20 break! Look away for 20 seconds at something 20 feet away." )
852869
853870 # Schedule the next iteration
@@ -966,6 +983,19 @@ def _get_widgets(frame):
966983 self .widget_list .append (widget )
967984
968985
986+ def lock_widgets (self ):
987+ self .frequency_input .configure (state = "disabled" )
988+ self .frequency_input .insert ("end" , self .data_manager .autobreak_frequency )
989+ self .duration_input .configure (state = "disabled" )
990+ self .duration_input .insert ("end" , self .data_manager .autobreak_duration )
991+
992+ self .autobreak_button .configure (state = "disabled" , fg_color = "grey" )
993+ self .subject_button .configure (state = "disabled" , fg_color = "grey" )
994+ self .goal_button .configure (state = "disabled" , fg_color = "grey" )
995+ if self .autobreak_switch .get () == "On" :
996+ self .break_button .configure (state = "disabled" , fg_color = "grey" , command = None , hover = False )
997+
998+
969999 def save_on_quit (self ) -> None :
9701000 self .save_data ()
9711001 print ("Data saved on exit." )
0 commit comments