2222)
2323
2424
25- def show_about_window (root : ttk .Frame , _version : str ) -> None : # pylint: disable=too-many-locals
25+ def show_about_window (root : ttk .Frame , _version : str ) -> None :
2626 # Create a new window for the custom "About" message
2727 about_window = tk .Toplevel (root )
2828 about_window .title (_ ("About" ))
@@ -47,34 +47,20 @@ def show_about_window(root: ttk.Frame, _version: str) -> None: # pylint: disabl
4747 usage_popup_label = ttk .Label (usage_popup_frame , text = _ ("Display usage popup" ))
4848 usage_popup_label .pack (side = tk .TOP , anchor = tk .W )
4949
50- component_editor_var = tk .BooleanVar (value = ProgramSettings .display_usage_popup ("component_editor" ))
51- component_editor_checkbox = ttk .Checkbutton (
52- usage_popup_frame ,
53- text = _ ("Component editor window introduction" ),
54- variable = component_editor_var ,
55- command = lambda : ProgramSettings .set_display_usage_popup ("component_editor" , component_editor_var .get ()),
56- )
57- component_editor_checkbox .pack (side = tk .TOP , anchor = tk .W )
58-
59- component_editor_validation_var = tk .BooleanVar (value = ProgramSettings .display_usage_popup ("component_editor_validation" ))
60- component_editor_validation_checkbox = ttk .Checkbutton (
61- usage_popup_frame ,
62- text = _ ("Component editor window data validation" ),
63- variable = component_editor_validation_var ,
64- command = lambda : ProgramSettings .set_display_usage_popup (
65- "component_editor_validation" , component_editor_validation_var .get ()
66- ),
67- )
68- component_editor_validation_checkbox .pack (side = tk .TOP , anchor = tk .W )
69-
70- parameter_editor_var = tk .BooleanVar (value = ProgramSettings .display_usage_popup ("parameter_editor" ))
71- parameter_editor_checkbox = ttk .Checkbutton (
72- usage_popup_frame ,
73- text = _ ("Parameter file editor and uploader window" ),
74- variable = parameter_editor_var ,
75- command = lambda : ProgramSettings .set_display_usage_popup ("parameter_editor" , parameter_editor_var .get ()),
76- )
77- parameter_editor_checkbox .pack (side = tk .TOP , anchor = tk .W )
50+ def _create_usage_popup_checkbox (popup_type : str , text : str ) -> None :
51+ """Create a usage popup checkbox for the given popup type."""
52+ var = tk .BooleanVar (value = ProgramSettings .display_usage_popup (popup_type ))
53+ checkbox = ttk .Checkbutton (
54+ usage_popup_frame ,
55+ text = text ,
56+ variable = var ,
57+ command = lambda : ProgramSettings .set_display_usage_popup (popup_type , var .get ()),
58+ )
59+ checkbox .pack (side = tk .TOP , anchor = tk .W )
60+
61+ _create_usage_popup_checkbox ("component_editor" , _ ("Component editor window introduction" ))
62+ _create_usage_popup_checkbox ("component_editor_validation" , _ ("Component editor window data validation" ))
63+ _create_usage_popup_checkbox ("parameter_editor" , _ ("Parameter file editor and uploader window" ))
7864
7965 # Create buttons for each action
8066 user_manual_button = ttk .Button (
0 commit comments