@@ -94,7 +94,7 @@ def __init__(self, viewer: "napari.viewer.Viewer"):
9494 self .lbl_weights_path .setReadOnly (True )
9595
9696 self .weights_path_container = ui .combine_blocks (
97- self .btn_weights_path , self .lbl_weights_path
97+ self .btn_weights_path , self .lbl_weights_path , b = 0
9898 )
9999 self .weights_path_container .setVisible (False )
100100
@@ -107,7 +107,7 @@ def __init__(self, viewer: "napari.viewer.Viewer"):
107107 (
108108 self .container_report ,
109109 self .container_report_layout ,
110- ) = ui .make_container_widget (10 , 5 , 5 , 5 )
110+ ) = ui .make_container (10 , 5 , 5 , 5 )
111111 self .container_report .setSizePolicy (
112112 QSizePolicy .Fixed , QSizePolicy .Minimum
113113 )
@@ -130,7 +130,17 @@ def __init__(self, viewer: "napari.viewer.Viewer"):
130130 self .btn_save_log .setVisible (False )
131131 #####################################################
132132
133+ def toggle_visibility (self , checkbox , widget ):
134+ """Toggles the visibility of a widget based on the status of a checkbox.
135+
136+ Args:
137+ checkbox: The QCheckbox that determines whether to show or not
138+ widget: The widget to hide or show
139+ """
140+ widget .setVisible (checkbox .isChecked ())
141+
133142 def send_log (self , text ):
143+ """Emit a signal to print in a Log"""
134144 self .log .print_and_log (text )
135145
136146 def save_log (self ):
@@ -223,10 +233,9 @@ def display_status_report(self):
223233 self .progress .setValue (0 )
224234
225235 def toggle_weights_path (self ):
226- if self .custom_weights_choice .isChecked ():
227- self .weights_path_container .setVisible (True )
228- else :
229- self .weights_path_container .setVisible (False )
236+ self .toggle_visibility (
237+ self .custom_weights_choice , self .weights_path_container
238+ )
230239
231240 def create_train_dataset_dict (self ):
232241 """Creates data dictionary for MONAI transforms and training.
0 commit comments