@@ -127,6 +127,7 @@ def __init__(self, parent=None, value: str = None, tree:QTreeWidget = None, undo
127127 self ._slider_dragging = False # True while a slider is being dragged
128128 self ._pre_commit_snapshot = None # value snapshot taken at sliderPressed
129129 self ._restoring_from_undo = False # True while undo/redo is restoring state
130+ self ._populating = False # True while populating properties
130131 self ._next_undo_desc = None # optional label for the next undo push
131132
132133 # Init variables
@@ -390,6 +391,7 @@ def get_properties_value(self):
390391 def _restore_state (self , state : dict ):
391392 """Rebuild the properties UI from a full state snapshot."""
392393 self ._undo_enabled = False # don't push a new command while restoring
394+ self ._populating = True
393395 self .properties_clear ()
394396 self .properties_groups_show ()
395397 self .populate_properties (state )
@@ -410,6 +412,7 @@ def _restore_state(self, state: dict):
410412 pass
411413
412414 self .update_value ()
415+ self ._populating = False
413416 self ._undo_enabled = True
414417 self .edited .emit ()
415418
@@ -432,6 +435,8 @@ def _get_current_element_key_and_name(self):
432435 return element_key , element_name
433436
434437 def on_update (self ):
438+ if self ._populating :
439+ return
435440 """Updating dict value and send signal.
436441 For slider drags this is called on every tick — only real-time save, NO undo push.
437442 Undo is pushed once in on_commit() when the slider is released.
@@ -569,6 +574,7 @@ def switch_to_item(self, item):
569574 return
570575 # Ensure any UI-changing logic we perform does not push undo entries
571576 self ._undo_enabled = False
577+ self ._populating = True # ← block on_update mid-populate
572578
573579 if item is None :
574580 self .properties_clear ()
@@ -601,6 +607,7 @@ def switch_to_item(self, item):
601607 pass
602608
603609 # Re-enable undo pushes and notify listeners
610+ self ._populating = False # ← clear BEFORE re-enabling undo
604611 self ._undo_enabled = True
605612 self .edited .emit ()
606613
0 commit comments