def handle_input(self, source, condition): sys.stderr.flush() # before handling an input, check whether there's any enqueued message from libsoup # BEGIN while libsoup.quark_queue_idx() >= 0: #tlog("libsoup has a queued message!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!11") class quark_message(ctypes.Structure): pass quark_message._fields_=[("msg_id",ctypes.c_char),("param",ctypes.c_char * 512)] m = quark_message() libsoup.quark_dequeue_msg(ctypes.pointer(m)) if ord(m.msg_id) == 5 : q_m = msg.create_key_press(m.param[0]) self.process_message(q_m) else: pass #tlog(str(quark_message_struct)) # END m = self.read_message() self.process_message(m) gobject.io_add_watch(self.soc.fileno(), gobject.IO_IN, self.handle_input) return False
def process_input_char(self, c): #if c == 'g': #t = self.curr_tab() # t.write_message(msg.create_go("http://cseweb.ucsd.edu/~lerner/test1.html")) #t.write_message(msg.create_go("http://abc.go.com")) #t.write_message(msg.create_go("http://mail.eng.ucsd.edu")) #t.write_message(msg.create_go("http://www.google.com/ig")) #return ascii = ord(c) tab_idx = self.get_tab_idx(ascii) if tab_idx != None: self.switch_tab(tab_idx) elif ascii == 15: # F9 self.exit() elif ascii == 16: # F10 self.add_tab() elif ascii == 17: # F11 self.add_tab() elif ascii == 18: # F12 self.mouse_click() else: t = self.curr_tab() t.write_message(msg.create_key_press(c))