Apply the set of commands defined in cmdmap. for example, apply_styles({'FONTSIZE': 12, 'BACKGROUND': white})
        :param cmdmap: dict of commands mapped to the command arguments
        :return: self
500534
def apply_styles(self, cmdmap):
        
        is_list_like = lambda arg: isinstance(arg, (list, tuple))
        is_first_param_list = lambda c: c in ('COLBACKGROUNDS', 'ROWBACKGROUNDS')
        for cmd, args in cmdmap.iteritems():
            if not is_list_like(args):
                args = [args]
            elif is_first_param_list(cmd) and is_list_like(args) and not is_list_like(args[0]):
                args = [args]
            self.apply_style(cmd, *args)
        return self
147311
def set_cmap_cb(self, w, index):
        """"""
        name = cmap.get_names()[index]
        self.t_.set(color_map=name)
590238
def cmd_param(self, args):
        ''''''
        self.pstate.handle_command(self.master, self.mpstate, args)
1210667
def colored_map(text, cmap):
    
    if not __ISON: return text
    for key, v in cmap.items():
        if isinstance(v, dict):
            text = text.replace(key, colored(key, **v))
        else:
            text = text.replace(key, colored(key, color=v))
    return text
945859
def apply( self ):
        
        font = self.value('font')
        
        try:
            font.setPointSize(self.value('fontSize'))
        
        # errors in linux for some reason
        except TypeError:
            pass
        
        palette = self.value('colorSet').palette()
        
        if ( unwrapVariant(QApplication.instance().property('useScheme')) ):
            QApplication.instance().setFont(font)
            QApplication.instance().setPalette(palette)
            
            # hack to support MDI Areas
            for widget in QApplication.topLevelWidgets():
                for area in widget.findChildren(QMdiArea):
                    area.setPalette(palette)
        else:
            logger.debug('The application doesnt have the useScheme property.')
164384
async def runCmdLine(self, line):
        '''
        

        '''
        opts = self.getCmdOpts(line)
        return await self.runCmdOpts(opts)
1327954
def cmd(commands, opts={})
      results = {}
      threads = clouds.collect do |name, c|
        Thread.new{ results[ name ] = c.cmd(commands, opts) }
      end
      threads.each{ |aThread| aThread.join }
      results
    end
1096475
def linkify_command_list_with_commands(self, commands, prop):
        
        for i in self:
            if not hasattr(i, prop):
                continue

            commands_list = strip_and_uniq(getattr(i, prop, ''))
            cmds_list = []
            for command in commands_list:
                if not command:
                    continue

                cmds_list.append(self.create_commandcall(i, commands, command))
            setattr(i, prop, cmds_list)
1018929
def format_cmdline(args, maxwidth=80):
    '''
    '''

    # Leave room for the space and backslash at the end of each line
    maxwidth -= 2

    def lines():
        line = ''
        for a in (shell_quote(a) for a in args):
            # If adding this argument will make the line too long,
            # yield the current line, and start a new one.
            if len(line) + len(a) + 1 > maxwidth:
                yield line
                line = ''

            # Append this argument to the current line, separating
            # it by a space from the existing arguments.
            if line:
                line += ' ' + a
            else:
                line = a

        yield line

    return ' \\\n'.join(lines())
229781
protected function stylingText()
    {
        parent::stylingText();

        $this->text['table'] = "[".$this->command->paintString($this->model->getTable(), 'green')."]";
        $this->text['primary_key'] = "[".$this->command->paintString($this->defaultOptions['primary_key'], 'green')."]";
        $this->text['primary_text'] = $this->command->paintString('primary key', 'brown');
    }
420573
def set_cmdln_info(self, cmdln, subcmd):
        
        self.cmdln = cmdln
        self.subcmd = subcmd
571361
def run_command(command, args):
    
    for category, commands in iteritems(command_categories):
        for existing_command in commands:
            if existing_command.match(command):
                existing_command.run(args)
147800
def do_text(self, subcmd, opts, message):
        
        client = MdClient(self.maildir, filesystem=self.filesystem)
        client.gettext(message, self.stdout)
270669
def cmd_help(*args):
    
    if len(args) == 0:
        print("Possible commands are:")
        print("")
        for cmd_name in sorted(COMMANDS.keys()):
            cmd_func = COMMANDS[cmd_name]
            print("{}:".format(cmd_name))
            print("=" * (len(cmd_name) + 1))
            print("    {}".format(cmd_func.__doc__.strip()))
            print("")
    else:
        cmd_name = args[0]
        cmd_func = COMMANDS[cmd_name]
        print("{}:".format(cmd_name))
        print("=" * (len(cmd_name) + 1))
        print("    {}".format(cmd_func.__doc__.strip()))
1291969
def set_commands(self, commands, timeout=None):
        
        self.desired_commands = commands

        target_commands = list(self.desired_commands)
        for process in list(self.processes):
            found = False
            for i in range(len(target_commands)):
                if process["command"] == target_commands[i]:
                    target_commands.pop(i)
                    found = True
                    break

            if not found:
                self.stop_process(process, timeout)

        # What is left are the commands to add
        # TODO: we should only do this once memory conditions allow
        for command in target_commands:
            self.spawn(command)
230804
def applyCommand(self):
        
        # generate the command information
        cursor      = self.textCursor()
        cursor.movePosition(cursor.EndOfLine)
        
        line        = projex.text.nativestring(cursor.block().text())
        at_end      = cursor.atEnd()
        modifiers   = QApplication.instance().keyboardModifiers()
        mod_mode    = at_end or modifiers == Qt.ShiftModifier
        
        # test the line for information
        if mod_mode and line.endswith(':'):
            cursor.movePosition(cursor.EndOfLine)
            
            line = re.sub('^>>> ', '', line)
            line = re.sub('^\.\.\. ', '', line)
            count = len(line) - len(line.lstrip()) + 4
            
            self.insertPlainText('\n... ' + count * ' ')
            return False
        
        elif mod_mode and line.startswith('...') and \
            (line.strip() != '...' or not at_end):
            cursor.movePosition(cursor.EndOfLine)
            line = re.sub('^\.\.\. ', '', line)
            count = len(line) - len(line.lstrip())
            self.insertPlainText('\n... ' + count * ' ')
            return False
        
        # if we're not at the end of the console, then add it to the end
        elif line.startswith('>>>') or line.startswith('...'):
            # move to the top of the command structure
            line = projex.text.nativestring(cursor.block().text())
            while line.startswith('...'):
                cursor.movePosition(cursor.PreviousBlock)
                line = projex.text.nativestring(cursor.block().text())
            
            # calculate the command
            cursor.movePosition(cursor.EndOfLine)
            line = projex.text.nativestring(cursor.block().text())
            ended = False
            lines = []
            
            while True:
                # add the new block
                lines.append(line)
                
                if cursor.atEnd():
                    ended = True
                    break
                
                # move to the next line
                cursor.movePosition(cursor.NextBlock)
                cursor.movePosition(cursor.EndOfLine)
                
                line = projex.text.nativestring(cursor.block().text())
                
                # check for a new command or the end of the command
                if not line.startswith('...'):
                    break
            
            command = '\n'.join(lines)
            
            # if we did not end up at the end of the command block, then
            # copy it for modification
            if not (ended and command):
                self.waitForInput()
                self.insertPlainText(command.replace('>>> ', ''))
                cursor.movePosition(cursor.End)
                return False
        
        else:
            self.waitForInput()
            return False
        
        self.executeCommand(command)
        return True
315965
def update(self, command=None, **kwargs):
        
        if command is None:
            argparser = self.argparser
        else:
            argparser = self[command]

        for k,v in kwargs.items():
            setattr(argparser, k, v)