@@ -1484,16 +1484,9 @@ def run_settings(*args):
1484
1484
if comp == dummy_component :
1485
1485
continue
1486
1486
1487
- oldval = opts .data .get (key , None )
1488
- try :
1489
- setattr (opts , key , value )
1490
- except RuntimeError :
1491
- continue
1492
- if oldval != value :
1493
- if opts .data_labels [key ].onchange is not None :
1494
- opts .data_labels [key ].onchange ()
1495
-
1487
+ if opts .set (key , value ):
1496
1488
changed .append (key )
1489
+
1497
1490
try :
1498
1491
opts .save (shared .config_filename )
1499
1492
except RuntimeError :
@@ -1504,15 +1497,8 @@ def run_settings_single(value, key):
1504
1497
if not opts .same_type (value , opts .data_labels [key ].default ):
1505
1498
return gr .update (visible = True ), opts .dumpjson ()
1506
1499
1507
- oldval = opts .data .get (key , None )
1508
- try :
1509
- setattr (opts , key , value )
1510
- except Exception :
1511
- return gr .update (value = oldval ), opts .dumpjson ()
1512
-
1513
- if oldval != value :
1514
- if opts .data_labels [key ].onchange is not None :
1515
- opts .data_labels [key ].onchange ()
1500
+ if not opts .set (key , value ):
1501
+ return gr .update (value = getattr (opts , key )), opts .dumpjson ()
1516
1502
1517
1503
opts .save (shared .config_filename )
1518
1504
0 commit comments