Python curses 模块,ACS_HLINE 实例源码

我们从Python开源项目中,提取了以下22个代码示例,用于说明如何使用curses.ACS_HLINE

项目:awesome-finder    作者:mingrammer    | 项目源码 | 文件源码
def init_layout(self):
        """Initialize the each windows with their size and shape"""
        self.height, self.width = self.window.getmaxyx()

        # Title section
        self.window.addstr(0, 0, '[awesome-{}] Find awesome things!'.format(self.awesome_title), curses.color_pair(1))
        self.window.hline(1, 0, curses.ACS_HLINE, self.width)

        # Search result section
        self.result_window = curses.newwin(self.height - 4, self.width, 2, 0)
        self.result_window.keypad(True)

        # Search bar section
        self.window.hline(self.height - 2, 0, curses.ACS_HLINE, self.width)
        self.window.addch(self.height - 1, 0, '>')
        self.search_window = curses.newwin(1, self.width - 1, self.height - 1, 2)
        self.search_window.keypad(True)

        self.window.refresh()
项目:isar    作者:ilbers    | 项目源码 | 文件源码
def setTitle( self, title ):
            self.decoration.setText( 1, 1, title.center( self.dimensions[WIDTH]-2 ), curses.A_BOLD )

    #-------------------------------------------------------------------------#
#    class TitleWindow( Window ):
    #-------------------------------------------------------------------------#
#        """Title Window"""
#        def __init__( self, x, y, width, height ):
#            NCursesUI.Window.__init__( self, x, y, width, height )
#            version = bb.__version__
#            title = "BitBake %s" % version
#            credit = "(C) 2003-2007 Team BitBake"
#            #self.win.hline( 2, 1, curses.ACS_HLINE, width-2 )
#            self.win.border()
#            self.setText( 1, 1, title.center( self.dimensions[WIDTH]-2 ), curses.A_BOLD )
#            self.setText( 1, 2, credit.center( self.dimensions[WIDTH]-2 ), curses.A_BOLD )

    #-------------------------------------------------------------------------#
项目:sciibo    作者:fdev    | 项目源码 | 文件源码
def draw_rectangle(self, y, x, h, w, filled=True, dashed=False, color=None):
        """Rectangle with corners."""
        if dashed:
            hch = '-'
            vch = '|'
        else:
            hch = curses.ACS_HLINE
            vch = curses.ACS_VLINE

        # Borders
        self.draw_hline(y,         x + 1,     w - 2, hch, color)  # top
        self.draw_vline(y + 1,     x + w - 1, h - 2, vch, color)  # right
        self.draw_hline(y + h - 1, x + 1,     w - 2, hch, color)  # bottom
        self.draw_vline(y + 1,     x,         h - 2, vch, color)  # left

        # Corners
        self.draw_ch(y,         x,         curses.ACS_ULCORNER, color)
        self.draw_ch(y,         x + w - 1, curses.ACS_URCORNER, color)
        self.draw_ch(y + h - 1, x + w - 1, curses.ACS_LRCORNER, color)
        self.draw_ch(y + h - 1, x,         curses.ACS_LLCORNER, color)

        # Fill
        if filled:
            self.draw_fill(y + 1, x + 1, h - 2, w - 2, color=color)
项目:supremm    作者:ubccr    | 项目源码 | 文件源码
def newpage(self, title=None):
        """ Clear the screen and display a title. If the title is absent, then
            the previous title is reused.  """
        if title != None:
            self.page_title = title
        self.erase()
        self.stdscr.addstr(self.row, 0, self.page_title)
        self.nextrow()
        self.stdscr.move(self.row, 0)
        # pylint: disable=no-member
        self.stdscr.hline(curses.ACS_HLINE, len(self.page_title))
        # pylint: enable=no-member
        self.nextrow()
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def rectangle(win, uly, ulx, lry, lrx):
    """Draw a rectangle with corners at the provided upper-left
    and lower-right coordinates.
    """
    win.vline(uly+1, ulx, curses.ACS_VLINE, lry - uly - 1)
    win.hline(uly, ulx+1, curses.ACS_HLINE, lrx - ulx - 1)
    win.hline(lry, ulx+1, curses.ACS_HLINE, lrx - ulx - 1)
    win.vline(uly+1, lrx, curses.ACS_VLINE, lry - uly - 1)
    win.addch(uly, ulx, curses.ACS_ULCORNER)
    win.addch(uly, lrx, curses.ACS_URCORNER)
    win.addch(lry, lrx, curses.ACS_LRCORNER)
    win.addch(lry, ulx, curses.ACS_LLCORNER)
项目:sandsifter    作者:xoreaxeaxeax    | 项目源码 | 文件源码
def box(self, window, x, y, w, h, color):
        for i in xrange(1, w - 1):
            window.addch(y, x + i, curses.ACS_HLINE, color)
            window.addch(y + h - 1, x + i, curses.ACS_HLINE, color)
        for i in xrange(1, h - 1):
            window.addch(y + i, x, curses.ACS_VLINE, color)
            window.addch(y + i, x + w - 1, curses.ACS_VLINE, color)
        window.addch(y, x, curses.ACS_ULCORNER, color)
        window.addch(y, x + w - 1, curses.ACS_URCORNER, color)
        window.addch(y + h - 1, x, curses.ACS_LLCORNER, color)
        window.addch(y + h - 1, x + w - 1, curses.ACS_LRCORNER, color)
项目:sandsifter    作者:xoreaxeaxeax    | 项目源码 | 文件源码
def box(self, window, x, y, w, h, color):
        for i in xrange(1, w - 1):
            window.addch(y, x + i, curses.ACS_HLINE, color)
            window.addch(y + h - 1, x + i, curses.ACS_HLINE, color)
        for i in xrange(1, h - 1):
            window.addch(y + i, x, curses.ACS_VLINE, color)
            window.addch(y + i, x + w - 1, curses.ACS_VLINE, color)
        window.addch(y, x, curses.ACS_ULCORNER, color)
        window.addch(y, x + w - 1, curses.ACS_URCORNER, color)
        window.addch(y + h - 1, x, curses.ACS_LLCORNER, color)
        window.addch(y + h - 1, x + w - 1, curses.ACS_LRCORNER, color)
项目:huhamhire-hosts    作者:jiangsile    | 项目源码 | 文件源码
def setup_menu(self):
        """
        Draw the main frame of `Setup` tab in the TUI window.
        """
        screen = self._stdscr.subwin(21, 80, 2, 0)
        screen.box()
        screen.bkgd(' ', curses.color_pair(4))
        # Configuration Section
        screen.addch(0, 26, curses.ACS_BSSS)
        screen.vline(1, 26, curses.ACS_VLINE, 17)
        # Status Section
        screen.addch(7, 0, curses.ACS_SSSB)
        screen.addch(7, 26, curses.ACS_SBSS)
        screen.hline(7, 1, curses.ACS_HLINE, 25)
        # Select Functions Section
        screen.addch(0, 52, curses.ACS_BSSS)
        screen.vline(1, 52, curses.ACS_VLINE, 17)
        # Process Bar Section
        screen.addch(18, 0, curses.ACS_SSSB)
        screen.addch(18, 79, curses.ACS_SBSS)
        screen.hline(18, 1, curses.ACS_HLINE, 78)
        screen.addch(18, 26, curses.ACS_SSBS)
        screen.addch(18, 52, curses.ACS_SSBS)
        # Section Titles
        title = curses.color_pair(6)
        subtitles = [["Configure Settings", (1, 2)], ["Status", (8, 2)],
                     ["Hosts File", (13, 2)], ["Select Functions", (1, 28)]]
        for s_title in subtitles:
            cord = s_title[1]
            screen.addstr(cord[0], cord[1], s_title[0], title)
            screen.hline(cord[0] + 1, cord[1], curses.ACS_HLINE, 23)
        screen.refresh()
项目:isar    作者:ilbers    | 项目源码 | 文件源码
def drawHline( self, y ):
            self.win.hline( y, 0, curses.ACS_HLINE, self.dimensions[WIDTH] )
            self.win.noutrefresh()
项目:isar    作者:ilbers    | 项目源码 | 文件源码
def __init__( self, title, x, y, width, height, fg=curses.COLOR_BLACK, bg=curses.COLOR_WHITE ):
            NCursesUI.Window.__init__( self, x+1, y+3, width-2, height-4, fg, bg )
            self.decoration = NCursesUI.Window( x, y, width, height, fg, bg )
            self.decoration.setBoxed()
            self.decoration.win.hline( 2, 1, curses.ACS_HLINE, width-2 )
            self.setTitle( title )
项目:grbl-stream    作者:fragmuffin    | 项目源码 | 文件源码
def render(self, strong=False):
        (y, x) = self.window.getmaxyx()
        label_str = " {} ".format(self._label)
        addstr_params = [
            self.row, self.label_col, " {} ".format(self._label),
            curses.color_pair(self.color_index) if curses.has_colors() else 0
        ]

        # heading attributes
        attrs = curses.color_pair(self.color_index) if curses.has_colors() else 0
        if strong:
            attrs |= curses.A_BOLD

        self.window.hline(0, 0, curses.ACS_HLINE, x)
        self.window.addstr(self.row, self.label_col, " {} ".format(self._label), attrs)
项目:grbl-stream    作者:fragmuffin    | 项目源码 | 文件源码
def to_render_list(self, index, width):
        """
        Return list of tuples, where each tuple contains:
            column, string content, colour
        """
        # import .window for colour indexes
        from .window import CPI_GOOD, CPI_ERROR

        # status colour
        status_color = 0
        if 'ok' in self.status:
            status_color = CPI_GOOD
        elif 'error' in self.status:
            status_color = CPI_ERROR

        # Gcode string (tree structure prepended
        gcode_w = max(0, width - (3 + 20))  # sent, status

        # Render List (to return)
        render_list = []
        if self.tree_chr:
            render_list.append((index + 1, self.tree_chr, 0))
            render_list.append((index + 2, curses.ACS_HLINE, 0))
            gcode_child_w = max(0, gcode_w - 4)
            gcode_str = ("{:<%i.%is}" % (gcode_child_w, gcode_child_w)).format(self.gcode)
            render_list.append((index + 4, gcode_str, 0))
        else:
            gcode_str = ("{:<%i.%is}" % (gcode_w, gcode_w)).format(self.gcode)
            render_list.append((index, gcode_str, 0))
        render_list.append((index + gcode_w + 1, '>' if self.sent else ' ', 0))
        render_list.append((index + gcode_w + 3, "{:<20s}".format(self.status), status_color))

        return render_list
项目:zippy    作者:securesystemslab    | 项目源码 | 文件源码
def rectangle(win, uly, ulx, lry, lrx):
    """Draw a rectangle with corners at the provided upper-left
    and lower-right coordinates.
    """
    win.vline(uly+1, ulx, curses.ACS_VLINE, lry - uly - 1)
    win.hline(uly, ulx+1, curses.ACS_HLINE, lrx - ulx - 1)
    win.hline(lry, ulx+1, curses.ACS_HLINE, lrx - ulx - 1)
    win.vline(uly+1, lrx, curses.ACS_VLINE, lry - uly - 1)
    win.addch(uly, ulx, curses.ACS_ULCORNER)
    win.addch(uly, lrx, curses.ACS_URCORNER)
    win.addch(lry, lrx, curses.ACS_LRCORNER)
    win.addch(lry, ulx, curses.ACS_LLCORNER)
项目:aws-ec2rescue-linux    作者:awslabs    | 项目源码 | 文件源码
def rectangle(win, uly, ulx, lry, lrx):
    """
    Draw a rectangle with corners at the provided upper-left and lower-right
    coordinates.

    Parameters:
        win (WindowObject): the screen/window
        uly (int): upper left y coordinate
        ulx (int): upper left x coordinate
        lry (int): lower right y coordinate
        lrx (int): lower right x coordinate

    Returns:
        None
    """
    # Add exception handling
    try:
        win.vline(uly + 1, ulx, curses.ACS_VLINE, lry - uly - 1)
        win.hline(uly, ulx + 1, curses.ACS_HLINE, lrx - ulx - 1)
        win.hline(lry, ulx + 1, curses.ACS_HLINE, lrx - ulx - 1)
        win.vline(uly + 1, lrx, curses.ACS_VLINE, lry - uly - 1)
        win.addch(uly, ulx, curses.ACS_ULCORNER)
        win.addch(uly, lrx, curses.ACS_URCORNER)
        win.addch(lry, lrx, curses.ACS_LRCORNER)
        win.addch(lry, ulx, curses.ACS_LLCORNER)
    # Catch attempts to print a character out of the bounds of the window
    except curses.error:
        pass
项目:oil    作者:oilshell    | 项目源码 | 文件源码
def rectangle(win, uly, ulx, lry, lrx):
    """Draw a rectangle with corners at the provided upper-left
    and lower-right coordinates.
    """
    win.vline(uly+1, ulx, curses.ACS_VLINE, lry - uly - 1)
    win.hline(uly, ulx+1, curses.ACS_HLINE, lrx - ulx - 1)
    win.hline(lry, ulx+1, curses.ACS_HLINE, lrx - ulx - 1)
    win.vline(uly+1, lrx, curses.ACS_VLINE, lry - uly - 1)
    win.addch(uly, ulx, curses.ACS_ULCORNER)
    win.addch(uly, lrx, curses.ACS_URCORNER)
    win.addch(lry, lrx, curses.ACS_LRCORNER)
    win.addch(lry, ulx, curses.ACS_LLCORNER)
项目:sciibo    作者:fdev    | 项目源码 | 文件源码
def draw_hline(self, y, x, w, ch=None, color=None):
        """Horizontal line."""
        ch = ch or curses.ACS_HLINE
        for dx in range(w):
            self.draw_ch(y, x + dx, ch, color)
项目:sciibo    作者:fdev    | 项目源码 | 文件源码
def update(self):
        self.erase()

        self.frame = self.frame % 4
        if self.frame < 1:
            self.draw_ch(0, 0, curses.ACS_HLINE)
        elif self.frame < 2:
            self.draw_ch(0, 0, '\\')
        elif self.frame < 3:
            self.draw_ch(0, 0, '|')
        else:
            self.draw_ch(0, 0, '/')

        return True
项目:python2-tracer    作者:extremecoders-re    | 项目源码 | 文件源码
def rectangle(win, uly, ulx, lry, lrx):
    """Draw a rectangle with corners at the provided upper-left
    and lower-right coordinates.
    """
    win.vline(uly+1, ulx, curses.ACS_VLINE, lry - uly - 1)
    win.hline(uly, ulx+1, curses.ACS_HLINE, lrx - ulx - 1)
    win.hline(lry, ulx+1, curses.ACS_HLINE, lrx - ulx - 1)
    win.vline(uly+1, lrx, curses.ACS_VLINE, lry - uly - 1)
    win.addch(uly, ulx, curses.ACS_ULCORNER)
    win.addch(uly, lrx, curses.ACS_URCORNER)
    win.addch(lry, lrx, curses.ACS_LRCORNER)
    win.addch(lry, ulx, curses.ACS_LLCORNER)
项目:sslstrip-hsts-openwrt    作者:adde88    | 项目源码 | 文件源码
def rectangle(win, uly, ulx, lry, lrx):
    """Draw a rectangle with corners at the provided upper-left
    and lower-right coordinates.
    """
    win.vline(uly+1, ulx, curses.ACS_VLINE, lry - uly - 1)
    win.hline(uly, ulx+1, curses.ACS_HLINE, lrx - ulx - 1)
    win.hline(lry, ulx+1, curses.ACS_HLINE, lrx - ulx - 1)
    win.vline(uly+1, lrx, curses.ACS_VLINE, lry - uly - 1)
    win.addch(uly, ulx, curses.ACS_ULCORNER)
    win.addch(uly, lrx, curses.ACS_URCORNER)
    win.addch(lry, lrx, curses.ACS_LRCORNER)
    win.addch(lry, ulx, curses.ACS_LLCORNER)
项目:ouroboros    作者:pybee    | 项目源码 | 文件源码
def rectangle(win, uly, ulx, lry, lrx):
    """Draw a rectangle with corners at the provided upper-left
    and lower-right coordinates.
    """
    win.vline(uly+1, ulx, curses.ACS_VLINE, lry - uly - 1)
    win.hline(uly, ulx+1, curses.ACS_HLINE, lrx - ulx - 1)
    win.hline(lry, ulx+1, curses.ACS_HLINE, lrx - ulx - 1)
    win.vline(uly+1, lrx, curses.ACS_VLINE, lry - uly - 1)
    win.addch(uly, ulx, curses.ACS_ULCORNER)
    win.addch(uly, lrx, curses.ACS_URCORNER)
    win.addch(lry, lrx, curses.ACS_LRCORNER)
    win.addch(lry, ulx, curses.ACS_LLCORNER)
项目:ndk-python    作者:gittor    | 项目源码 | 文件源码
def rectangle(win, uly, ulx, lry, lrx):
    """Draw a rectangle with corners at the provided upper-left
    and lower-right coordinates.
    """
    win.vline(uly+1, ulx, curses.ACS_VLINE, lry - uly - 1)
    win.hline(uly, ulx+1, curses.ACS_HLINE, lrx - ulx - 1)
    win.hline(lry, ulx+1, curses.ACS_HLINE, lrx - ulx - 1)
    win.vline(uly+1, lrx, curses.ACS_VLINE, lry - uly - 1)
    win.addch(uly, ulx, curses.ACS_ULCORNER)
    win.addch(uly, lrx, curses.ACS_URCORNER)
    win.addch(lry, lrx, curses.ACS_LRCORNER)
    win.addch(lry, ulx, curses.ACS_LLCORNER)
项目:kbe_server    作者:xiaohaoppy    | 项目源码 | 文件源码
def rectangle(win, uly, ulx, lry, lrx):
    """Draw a rectangle with corners at the provided upper-left
    and lower-right coordinates.
    """
    win.vline(uly+1, ulx, curses.ACS_VLINE, lry - uly - 1)
    win.hline(uly, ulx+1, curses.ACS_HLINE, lrx - ulx - 1)
    win.hline(lry, ulx+1, curses.ACS_HLINE, lrx - ulx - 1)
    win.vline(uly+1, lrx, curses.ACS_VLINE, lry - uly - 1)
    win.addch(uly, ulx, curses.ACS_ULCORNER)
    win.addch(uly, lrx, curses.ACS_URCORNER)
    win.addch(lry, lrx, curses.ACS_LRCORNER)
    win.addch(lry, ulx, curses.ACS_LLCORNER)