Ejemplo n.º 1
0
    def add_string(self, row, string):
        """
        Adds a string to the desired `:param:row`.

        :param row: int, the row number to write the string

        """
        col = 0
        try:
            parsed = colors.parse_color_string(string, self.encoding)
        except colors.BadColorString, e:
            log.error("Cannot add bad color string %s: %s", string, e)
            return
Ejemplo n.º 2
0
    def add_string(self, row, string):
        """
        Adds a string to the desired `:param:row`.

        :param row: int, the row number to write the string

        """
        col = 0
        try:
            parsed = colors.parse_color_string(string, self.encoding)
        except colors.BadColorString, e:
            log.error("Cannot add bad color string %s: %s", string, e)
            return
Ejemplo n.º 3
0
    def add_string(self, row, string, scr=None, col=0, pad=True, trim=True):
        """
        Adds a string to the desired `:param:row`.

        :param row: int, the row number to write the string
        :param string: string, the string of text to add
        :param scr: curses.window, optional window to add string to instead of self.stdscr
        :param col: int, optional starting column offset
        :param pad: bool, optional bool if the string should be padded out to the width of the screen
        :param trim: bool, optional bool if the string should be trimmed if it is too wide for the screen

        The text can be formatted with color using the following format:

        "{!fg, bg, attributes, ...!}"

        See: http://docs.python.org/library/curses.html#constants for attributes.

        Alternatively, it can use some built-in scheme for coloring.
        See colors.py for built-in schemes.

        "{!scheme!}"

        Examples:

        "{!blue, black, bold!}My Text is {!white, black!}cool"
        "{!info!}I am some info text!"
        "{!error!}Uh oh!"


        """
        if scr:
            screen = scr
        else:
            screen = self.stdscr
        try:
            parsed = colors.parse_color_string(string, self.encoding)
        except colors.BadColorString, e:
            log.error("Cannot add bad color string %s: %s", string, e)
            return
Ejemplo n.º 4
0
    def add_string(self, row, string, scr=None, col=0, pad=True, trim=True):
        """
        Adds a string to the desired `:param:row`.

        :param row: int, the row number to write the string
        :param string: string, the string of text to add
        :param scr: curses.window, optional window to add string to instead of self.stdscr
        :param col: int, optional starting column offset
        :param pad: bool, optional bool if the string should be padded out to the width of the screen
        :param trim: bool, optional bool if the string should be trimmed if it is too wide for the screen

        The text can be formatted with color using the following format:

        "{!fg, bg, attributes, ...!}"

        See: http://docs.python.org/library/curses.html#constants for attributes.

        Alternatively, it can use some built-in scheme for coloring.
        See colors.py for built-in schemes.

        "{!scheme!}"

        Examples:

        "{!blue, black, bold!}My Text is {!white, black!}cool"
        "{!info!}I am some info text!"
        "{!error!}Uh oh!"


        """
        if scr:
            screen = scr
        else:
            screen = self.stdscr
        try:
            parsed = colors.parse_color_string(string, self.encoding)
        except colors.BadColorString, e:
            log.error("Cannot add bad color string %s: %s", string, e)
            return