@@ -1438,8 +1438,6 @@ def fun():
1438
1438
def run_settings (* args ):
1439
1439
changed = 0
1440
1440
1441
- assert not shared .cmd_opts .freeze_settings , "changing settings is disabled"
1442
-
1443
1441
for key , value , comp in zip (opts .data_labels .keys (), args , components ):
1444
1442
if comp != dummy_component and not opts .same_type (value , opts .data_labels [key ].default ):
1445
1443
return f"Bad value for setting { key } : { value } ; expecting { type (opts .data_labels [key ].default ).__name__ } " , opts .dumpjson ()
@@ -1448,15 +1446,9 @@ def run_settings(*args):
1448
1446
if comp == dummy_component :
1449
1447
continue
1450
1448
1451
- comp_args = opts .data_labels [key ].component_args
1452
- if comp_args and isinstance (comp_args , dict ) and comp_args .get ('visible' ) is False :
1453
- continue
1454
-
1455
- if cmd_opts .hide_ui_dir_config and key in restricted_opts :
1456
- continue
1457
-
1458
1449
oldval = opts .data .get (key , None )
1459
- opts .data [key ] = value
1450
+
1451
+ setattr (opts , key , value )
1460
1452
1461
1453
if oldval != value :
1462
1454
if opts .data_labels [key ].onchange is not None :
@@ -1469,17 +1461,15 @@ def run_settings(*args):
1469
1461
return f'{ changed } settings changed.' , opts .dumpjson ()
1470
1462
1471
1463
def run_settings_single (value , key ):
1472
- assert not shared .cmd_opts .freeze_settings , "changing settings is disabled"
1473
-
1474
1464
if not opts .same_type (value , opts .data_labels [key ].default ):
1475
1465
return gr .update (visible = True ), opts .dumpjson ()
1476
1466
1477
1467
oldval = opts .data .get (key , None )
1478
- if cmd_opts .hide_ui_dir_config and key in restricted_opts :
1468
+ try :
1469
+ setattr (opts , key , value )
1470
+ except Exception :
1479
1471
return gr .update (value = oldval ), opts .dumpjson ()
1480
1472
1481
- opts .data [key ] = value
1482
-
1483
1473
if oldval != value :
1484
1474
if opts .data_labels [key ].onchange is not None :
1485
1475
opts .data_labels [key ].onchange ()
0 commit comments