##// END OF EJS Templates
set_next_input: squash multiple calls from the same cell execution...
Pablo de Oliveira -
Show More
@@ -29,9 +29,17 b' class PayloadManager(Configurable):'
29
29
30 _payload = List([])
30 _payload = List([])
31
31
32 def write_payload(self, data):
32 def write_payload(self, data, update=False):
33 if not isinstance(data, dict):
33 if not isinstance(data, dict):
34 raise TypeError('Each payload write must be a dict, got: %r' % data)
34 raise TypeError('Each payload write must be a dict, got: %r' % data)
35
36 if update and 'source' in data:
37 source = data['source']
38 for i,pl in enumerate(self._payload):
39 if 'source' in pl and pl['source'] == source:
40 self._payload[i] = data
41 return
42
35 self._payload.append(data)
43 self._payload.append(data)
36
44
37 def read_payload(self):
45 def read_payload(self):
@@ -583,7 +583,7 b' class ZMQInteractiveShell(InteractiveShell):'
583 source='set_next_input',
583 source='set_next_input',
584 text=text
584 text=text
585 )
585 )
586 self.payload_manager.write_payload(payload)
586 self.payload_manager.write_payload(payload, update=True)
587
587
588 #-------------------------------------------------------------------------
588 #-------------------------------------------------------------------------
589 # Things related to magics
589 # Things related to magics
General Comments 0
You need to be logged in to leave comments. Login now