@@ -429,12 +429,10 @@ def get_view_spec(self):
429
429
def _default_keys (self ):
430
430
return [name for name in self .traits (sync = True )]
431
431
432
- _property_lock = Dict () # only used when JUPYTER_WIDGETS_ECHO=0
432
+ _property_lock = Dict ()
433
433
_holding_sync = False
434
- _holding_sync_from_frontend_update = False
435
434
_states_to_send = Set ()
436
435
_msg_callbacks = Instance (CallbackDispatcher , ())
437
- _updated_attrs_from_frontend = None
438
436
439
437
#-------------------------------------------------------------------------
440
438
# (Con/de)structor
@@ -536,23 +534,9 @@ def send_state(self, key=None):
536
534
for name , value in state .items ():
537
535
if name in self ._property_lock :
538
536
self ._property_lock [name ] = value
539
-
540
-
541
- echo_state = {}
542
- if self ._updated_attrs_from_frontend :
543
- for attr in self ._updated_attrs_from_frontend :
544
- echo_state [attr ] = state [attr ]
545
- del state [attr ]
546
- self ._updated_attrs_from_frontend = None
547
537
state , buffer_paths , buffers = _remove_buffers (state )
548
- echo_state , echo_buffer_paths , echo_buffers = _remove_buffers (echo_state )
549
538
msg = {'method' : 'update' , 'state' : state , 'buffer_paths' : buffer_paths }
550
- if echo_state or echo_buffer_paths :
551
- msg ['echo_state' ] = echo_state
552
- msg ['echo_buffer_paths' ] = echo_buffer_paths
553
- buffers += echo_buffers
554
539
self ._send (msg , buffers = buffers )
555
- return
556
540
557
541
def get_state (self , key = None , drop_defaults = False ):
558
542
"""Gets the widget state, or a piece of it.
@@ -663,18 +647,6 @@ def notify_change(self, change):
663
647
# Send the state to the frontend before the user-registered callbacks
664
648
# are called.
665
649
name = change ['name' ]
666
- if JUPYTER_WIDGETS_ECHO :
667
- if self .comm is not None and self .comm .kernel is not None and name in self .keys :
668
- if self ._holding_sync :
669
- # if we're holding a sync, we will only record which trait was changed
670
- # but we skip those traits marked no_echo, during an update from the frontend
671
- if not (self ._holding_sync_from_frontend_update and self .trait_metadata (name , 'no_echo' )):
672
- self ._states_to_send .add (name )
673
- else :
674
- # otherwise we send it directly
675
- self .send_state (key = name )
676
- super ().notify_change (change )
677
- return
678
650
if self .comm is not None and self .comm .kernel is not None :
679
651
# Make sure this isn't information that the front-end just sent us.
680
652
if name in self .keys and self ._should_send_property (name , getattr (self , name )):
@@ -738,21 +710,6 @@ def _should_send_property(self, key, value):
738
710
else :
739
711
return True
740
712
741
- @contextmanager
742
- def _hold_sync_frontend (self ):
743
- """Same as hold_sync, but will not sync back traits tagged as no_echo"""
744
- if self ._holding_sync_from_frontend_update is True :
745
- with self .hold_sync ():
746
- yield
747
- else :
748
- try :
749
- self ._holding_sync_from_frontend_update = True
750
- with self .hold_sync ():
751
- yield
752
- finally :
753
- self ._holding_sync_from_frontend_update = False
754
-
755
-
756
713
# Event handlers
757
714
@_show_traceback
758
715
def _handle_msg (self , msg ):
@@ -774,11 +731,7 @@ def _handle_msg(self, msg):
774
731
# Handle a custom msg from the front-end.
775
732
elif method == 'custom' :
776
733
if 'content' in data :
777
- if JUPYTER_WIDGETS_ECHO :
778
- with self ._hold_sync_frontend ():
779
- self ._handle_custom_msg (data ['content' ], msg ['buffers' ])
780
- else :
781
- self ._handle_custom_msg (data ['content' ], msg ['buffers' ])
734
+ self ._handle_custom_msg (data ['content' ], msg ['buffers' ])
782
735
783
736
# Catch remainder.
784
737
else :
0 commit comments