@@ -444,26 +444,41 @@ def _add_simple_theme_view(self):
444444
445445 def _on_simple_theme_selected (self , view , theme ):
446446 """Handle theme selection from simplified theme view."""
447- logger .info (f"Simple theme selected : { theme } " )
447+ logger .info (f"========== SIMPLE THEME SELECTED : { theme } ========== " )
448448
449- # Mark theme step as completed
450- self .completed_steps .add ("theme" )
451-
452- # Save to config
453- self .config .simple_theme = theme
454-
455- # Apply simple theme (light or dark)
456- self .system_service .apply_simple_theme (theme )
457-
458- # Get JamesDSP and contrast settings from the theme view
459- theme_view = self .stack .get_child_by_name ("simple_theme" )
460- if theme_view :
461- self .config .enable_jamesdsp = theme_view .is_jamesdsp_enabled ()
462- self .config .enable_enhanced_contrast = theme_view .is_contrast_enabled ()
463-
464- # Finalize and close
465- self .system_service .finalize_setup (self .config )
466- self .close ()
449+ try :
450+ # Mark theme step as completed
451+ self .completed_steps .add ("theme" )
452+ logger .debug (f"Marked theme step as completed. Completed steps: { self .completed_steps } " )
453+
454+ # Save to config
455+ self .config .simple_theme = theme
456+ logger .debug (f"Saved theme to config: { theme } " )
457+
458+ # Apply simple theme (light or dark)
459+ logger .info (f"Applying simple theme: { theme } " )
460+ self .system_service .apply_simple_theme (theme )
461+ logger .info (f"Simple theme applied successfully" )
462+
463+ # Get JamesDSP and contrast settings from the theme view
464+ theme_view = self .stack .get_child_by_name ("simple_theme" )
465+ if theme_view :
466+ jamesdsp = theme_view .is_jamesdsp_enabled ()
467+ contrast = theme_view .is_contrast_enabled ()
468+ self .config .enable_jamesdsp = jamesdsp
469+ self .config .enable_enhanced_contrast = contrast
470+ logger .info (f"JamesDSP: { jamesdsp } , Enhanced Contrast: { contrast } " )
471+ else :
472+ logger .warning ("Could not get theme_view from stack" )
473+
474+ # Finalize and close
475+ logger .info ("Finalizing setup..." )
476+ self .system_service .finalize_setup (self .config )
477+ logger .info ("Setup finalized. Closing application..." )
478+ self .close ()
479+ logger .info ("Application closed successfully" )
480+ except Exception as e :
481+ logger .error (f"ERROR in _on_simple_theme_selected: { e } " , exc_info = True )
467482
468483 def _on_key_press_event (self , controller , keyval , keycode , state ):
469484 current_view = self .stack .get_visible_child ()
0 commit comments