##// END OF EJS Templates
raw_input captured and working fine
Omar Andres Zapata Mesa -
Show More
@@ -27,6 +27,7 b' import cPickle as pickle'
27 import code
27 import code
28 import zmq
28 import zmq
29 import rlcompleter
29 import rlcompleter
30 import readline
30 import time
31 import time
31
32
32
33
@@ -70,9 +71,9 b' class Frontend(object):'
70 self.msg_header = self.km.session.msg_header()
71 self.msg_header = self.km.session.msg_header()
71
72
72 self.completer = completer.ClientCompleter(self,self.session,self.request_socket)
73 self.completer = completer.ClientCompleter(self,self.session,self.request_socket)
73 rlcompleter.readline.set_completer(self.completer.complete)
74 readline.set_completer(self.completer.complete)
74 rlcompleter.readline.parse_and_bind("tab: complete")
75 readline.parse_and_bind("tab: complete")
75 rlcompleter.readline.parse_and_bind('set show-all-if-ambiguous on')
76 readline.parse_and_bind('set show-all-if-ambiguous on')
76
77
77 history_path = os.path.expanduser('~/.ipython/history')
78 history_path = os.path.expanduser('~/.ipython/history')
78 if os.path.isfile(history_path):
79 if os.path.isfile(history_path):
@@ -134,12 +135,14 b' class Frontend(object):'
134 """
135 """
135 self.km.xreq_channel.execute(source, hidden)
136 self.km.xreq_channel.execute(source, hidden)
136 self.handle_xreq_channel()
137 self.handle_xreq_channel()
138 self.handle_rep_channel()
137
139
138 def handle_xreq_channel(self):
140 def handle_xreq_channel(self):
139 # Give the kernel up to 0.5s to respond
141 # Give the kernel up to 0.5s to respond
140 for i in range(5):
142 for i in range(5):
141 if self.km.xreq_channel.was_called():
143 if self.km.xreq_channel.was_called():
142 self.msg_xreq = self.km.xreq_channel.get_msg()
144 self.msg_xreq = self.km.xreq_channel.get_msg()
145 #print self.msg_xreq
143 if self.msg_header["session"] == self.msg_xreq["parent_header"]["session"] :
146 if self.msg_header["session"] == self.msg_xreq["parent_header"]["session"] :
144 if self.msg_xreq["content"]["status"] == 'ok' :
147 if self.msg_xreq["content"]["status"] == 'ok' :
145 if self.msg_xreq["msg_type"] == "complete_reply" :
148 if self.msg_xreq["msg_type"] == "complete_reply" :
@@ -186,9 +189,20 b' class Frontend(object):'
186
189
187 if sub_msg['msg_type'] == 'pyout' :
190 if sub_msg['msg_type'] == 'pyout' :
188 print >> sys.stdout,"Out[%i]:"%sub_msg["content"]["execution_count"], sub_msg["content"]["data"]
191 print >> sys.stdout,"Out[%i]:"%sub_msg["content"]["execution_count"], sub_msg["content"]["data"]
189 #print >> sys.stdout,"Out[%i]:"%self.msg_xreq["content"]["execution_count"], sub_msg["content"]["data"]
190 sys.stdout.flush()
192 sys.stdout.flush()
191
193
194 def handle_rep_channel(self):
195 """ Method to capture raw_input
196 """
197 if self.km.rep_channel.was_called() :
198 self.msg_rep = self.km.rep_channel.get_msg()
199 #print self.msg_rep
200 if self.msg_header["session"] == self.msg_rep["parent_header"]["session"] :
201 raw_data = raw_input(self.msg_rep["content"]["prompt"])
202 self.km.rep_channel.input(raw_data)
203
204
205
192
206
193 def start_frontend():
207 def start_frontend():
194 """ Entry point for application.
208 """ Entry point for application.
General Comments 0
You need to be logged in to leave comments. Login now