def apply_this_command(ignored, cmdstring): logging.debug('%s command string: "%s"' % (self.mode, str(cmdstring))) # translate cmdstring into :class:`Command` cmd = commandfactory(cmdstring, self.mode) # store cmdline for use with 'repeat' command if cmd.repeatable: self.last_commandline = cmdline return self.apply_command(cmd)
def keypress(self, size, key): """overwrites `urwid.WidgetWrap.keypress`""" mode = self.ui.mode if self.select_cancel_only: mode = 'global' cmdline = settings.get_keybinding(mode, key) if cmdline: try: cmd = commandfactory(cmdline, mode) if self.allowed_command(cmd): self.ui.apply_command(cmd) return None except CommandParseError, e: self.ui.notify(e.message, priority='error')
def apply_this_command(ignored, cmdstring): logging.debug('%s command string: "%s"' % (self.mode, str(cmdstring))) #logging.debug('CMDSEQ: apply %s' % str(cmdstring)) # translate cmdstring into :class:`Command` #try: cmd = commandfactory(cmdstring, self.mode) #except CommandParseError, e: # self.notify(e.message, priority='error') # return # store cmdline for use with 'repeat' command if cmd.repeatable: self.last_commandline = cmdline return self.apply_command(cmd)
def apply_commandline(self, cmdline): """ Interprets a command line string and applies the resulting (sequence of) :class:`Commands <alot.commands.Command>`. :param cmdline: command line to interpret :type cmdline: str """ # split commandline if necessary cmd = None cmdlist = split_commandline(cmdline) if len(cmdlist) == 1: try: # translate cmdstring into :class:`Command` cmd = commandfactory(cmdlist[0], self.mode) except CommandParseError, e: self.notify(e.message, priority='error') return