##// END OF EJS Templates
make parent_header available from the Shell object
MinRK -
Show More
@@ -1,14 +1,5 b''
1 #!/usr/bin/env python
1 #!/usr/bin/env python
2 """A simple interactive kernel that talks to a frontend over 0MQ.
2 """An interactive kernel that talks to frontends over 0MQ."""
3
4 Things to do:
5
6 * Implement `set_parent` logic. Right before doing exec, the Kernel should
7 call set_parent on all the PUB objects with the message about to be executed.
8 * Implement random port and security key logic.
9 * Implement control messages.
10 * Implement event loop and poll version.
11 """
12
3
13 #-----------------------------------------------------------------------------
4 #-----------------------------------------------------------------------------
14 # Imports
5 # Imports
@@ -478,6 +478,7 b' class ZMQInteractiveShell(InteractiveShell):'
478 display_pub_class = Type(ZMQDisplayPublisher)
478 display_pub_class = Type(ZMQDisplayPublisher)
479 data_pub_class = Type(ZMQDataPublisher)
479 data_pub_class = Type(ZMQDataPublisher)
480 kernel = Any()
480 kernel = Any()
481 parent_header = Any()
481
482
482 # Override the traitlet in the parent class, because there's no point using
483 # Override the traitlet in the parent class, because there's no point using
483 # readline for the kernel. Can be removed when the readline code is moved
484 # readline for the kernel. Can be removed when the readline code is moved
@@ -589,6 +590,7 b' class ZMQInteractiveShell(InteractiveShell):'
589
590
590 def set_parent(self, parent):
591 def set_parent(self, parent):
591 """Set the parent header for associating output with its triggering input"""
592 """Set the parent header for associating output with its triggering input"""
593 self.parent_header = parent
592 self.displayhook.set_parent(parent)
594 self.displayhook.set_parent(parent)
593 self.display_pub.set_parent(parent)
595 self.display_pub.set_parent(parent)
594 self.data_pub.set_parent(parent)
596 self.data_pub.set_parent(parent)
@@ -601,6 +603,9 b' class ZMQInteractiveShell(InteractiveShell):'
601 except AttributeError:
603 except AttributeError:
602 pass
604 pass
603
605
606 def get_parent(self):
607 return self.parent_header
608
604 #-------------------------------------------------------------------------
609 #-------------------------------------------------------------------------
605 # Things related to magics
610 # Things related to magics
606 #-------------------------------------------------------------------------
611 #-------------------------------------------------------------------------
General Comments 0
You need to be logged in to leave comments. Login now