def on_new_item(arg): global last_set_item if arg != last_set_item: print('new line', arg) last_set_item = arg + '\n' glipper.set_history_item(0, last_set_item) glipper.add_history_item(last_set_item)
def on_new_item(arg): global last_set_item if arg != last_set_item: print 'new line', arg last_set_item = arg + '\n' glipper.set_history_item(0, last_set_item) glipper.add_history_item(last_set_item)
def on_new_item(arg): global recursive if recursive: recursive = False else: recursive = True i = arg + '\n' glipper.set_history_item(0, i) glipper.add_history_item(i)
def layout_decode(menu, from_layout, to_layout): string = glipper.get_history_item(0) result = [] for ch in string: try: idx = layouts[from_layout].index(ch) result.append(layouts[to_layout][idx]) except: result.append(ch) plaintext = ''.join(result) glipper.set_history_item(0, plaintext) glipper.add_history_item(plaintext)
def run(self): print "comparing passwords:" try: if self.establisher: self.request_password_compare() else: self.response_password_compare() except socket.error: self.quit() return except PasswordException: print "wrong password for connection %s" % self.socket.getpeername( )[0] self.quit() return print "password ok! start listening" def recv(): string = self.socket.recv(4096) if not string: raise socket.error return string while True: #loop quits when socket gets closed try: item = "" string = recv() while string != "\0": item += string string = recv() item = self.decrypt(item) except socket.error: self.quit() return global inserting inserting = True glipper.add_history_item(item) inserting = False
def run(self): print "comparing passwords:" try: if self.establisher: self.request_password_compare() else: self.response_password_compare() except socket.error: self.quit() return except PasswordException: print "wrong password for connection %s" % self.socket.getpeername()[0] self.quit() return print "password ok! start listening" def recv(): string = self.socket.recv(4096) if not string: raise socket.error return string while True: #loop quits when socket gets closed try: item = "" string = recv() while string != "\0": item += string string = recv() item = self.decrypt(item) except socket.error: self.quit() return global inserting inserting = True glipper.add_history_item(item) inserting = False
def on_activate(menuitem, snippet): glipper.add_history_item(snippet)