def _bind_key(self, key, func): if not callable(func): print 'Trying to bind non method to keystroke:%s,%s' % (key, func) raise ReadlineError('Trying to bind non method to keystroke:%s,%s,%s,%s' % (key, func, type(func), type(self._bind_key))) keyinfo = make_KeyPress_from_keydescr(key.lower()).tuple() log('>>>%s -> %s<<<' % (keyinfo, func.__name__)) self.key_dispatch[keyinfo] = func
def _bind_key(self, key, func): u"""setup the mapping from key to call the function.""" if not callable(func): print u"Trying to bind non method to keystroke:%s,%s"%(key,func) raise ReadlineError(u"Trying to bind non method to keystroke:%s,%s,%s,%s"%(key,func,type(func),type(self._bind_key))) keyinfo = make_KeyPress_from_keydescr(key.lower()).tuple() log(u">>>%s -> %s<<<"%(keyinfo,func.__name__)) self.key_dispatch[keyinfo] = func
def _bind_key(self, key, func): '''setup the mapping from key to call the function.''' if type(func) != type(self._bind_key): print "Trying to bind non method to keystroke:%s,%s"%(key,func) raise PyreadlineError("Trying to bind non method to keystroke:%s,%s,%s,%s"%(key,func,type(func),type(self._bind_key))) keyinfo = make_KeyPress_from_keydescr(key.lower()).tuple() log(">>>%s -> %s<<<"%(keyinfo,func.__name__)) self.key_dispatch[keyinfo] = func
def _bind_key(self, key, func): """Setup the mapping from key to call the function. Parameters ---------- func : function Must be callable. Raises ------ ReadlineError """ if not callable(func): print("Trying to bind non method to keystroke:%s,%s" % (key, func)) raise ReadlineError( "Trying to bind non method to keystroke:%s,%s,%s,%s" % (key, func, type(func), type(self._bind_key)) ) keyinfo = make_KeyPress_from_keydescr(key.lower()).tuple() log(">>>%s -> %s<<<" % (keyinfo, func.__name__), logging.DEBUG) self.key_dispatch[keyinfo] = func
def un_bind_exit_key(key): keyinfo = make_KeyPress_from_keydescr(key).tuple() if keyinfo in modes[mode].exit_dispatch: del modes[mode].exit_dispatch[keyinfo]
def _bind_exit_key(self, key): u"""setup the mapping from key to call the function.""" keyinfo = make_KeyPress_from_keydescr(key.lower()).tuple() self.exit_dispatch[keyinfo] = None
def _bind_exit_key(self, key): '''setup the mapping from key to call the function.''' keyinfo = make_KeyPress_from_keydescr(key.lower()).tuple() self.exit_dispatch[keyinfo] = None
def un_bind_exit_key(self, key): keyinfo = make_KeyPress_from_keydescr(key).tuple() if keyinfo in self.mode.exit_dispatch: del self.mode.exit_dispatch[keyinfo]
def _bind_exit_key(self, key): keyinfo = make_KeyPress_from_keydescr(key.lower()).tuple() self.exit_dispatch[keyinfo] = None return