Python curses.ACS_VLINE Examples

The following are 23 code examples of curses.ACS_VLINE(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module curses , or try the search function .
Example #1
Source File: cgroup_top.py    From ctop with MIT License 6 votes vote down vote up
def render_tree(results, tree, level=0, prefix=[], node='/'):
    # Exit condition
    if node not in tree:
        return

    # Iteration
    for i, line in enumerate(tree[node]):
        cgroup = line['cgroup']

        # Build name
        if i == len(tree[node]) - 1:
            line['_tree'] = prefix + [curses.ACS_LLCORNER, curses.ACS_HLINE, ' ']
            _child_prefix = prefix + [' ', ' ', ' ']
        else:
            line['_tree'] = prefix + [curses.ACS_LTEE, curses.ACS_HLINE, ' ']
            _child_prefix = prefix + [curses.ACS_VLINE, ' ', ' ']

        # Commit, fold or recurse
        results.append(line)
        if cgroup not in CONFIGURATION['fold']:
            render_tree(results, tree, level+1, _child_prefix, cgroup)
        else:
            line['_tree'] [-2] = '+' 
Example #2
Source File: conftest.py    From rtv with MIT License 6 votes vote down vote up
def stdscr():
    with patch('curses.initscr'),               \
            patch('curses.echo'),               \
            patch('curses.flash'),              \
            patch('curses.endwin'),             \
            patch('curses.newwin'),             \
            patch('curses.noecho'),             \
            patch('curses.cbreak'),             \
            patch('curses.doupdate'),           \
            patch('curses.nocbreak'),           \
            patch('curses.curs_set'),           \
            patch('curses.init_pair'),          \
            patch('curses.color_pair'),         \
            patch('curses.has_colors'),         \
            patch('curses.start_color'),        \
            patch('curses.use_default_colors'):
        out = MockStdscr(nlines=40, ncols=80, x=0, y=0)
        curses.initscr.return_value = out
        curses.newwin.side_effect = lambda *args: out.derwin(*args)
        curses.color_pair.return_value = 23
        curses.has_colors.return_value = True
        curses.ACS_VLINE = 0
        curses.COLORS = 256
        curses.COLOR_PAIRS = 256
        yield out 
Example #3
Source File: cgroup_top.py    From python-scripts with GNU General Public License v3.0 6 votes vote down vote up
def render_tree(results, tree, level=0, prefix=[], node='/'):
    # Exit condition
    if node not in tree:
        return

    # Iteration
    for i, line in enumerate(tree[node]):
        cgroup = line['cgroup']

        # Build name
        if i == len(tree[node]) - 1:
            line['_tree'] = prefix + [curses.ACS_LLCORNER, curses.ACS_HLINE, ' ']
            _child_prefix = prefix + [' ', ' ', ' ']
        else:
            line['_tree'] = prefix + [curses.ACS_LTEE, curses.ACS_HLINE, ' ']
            _child_prefix = prefix + [curses.ACS_VLINE, ' ', ' ']

        # Commit, fold or recurse
        results.append(line)
        if cgroup not in CONFIGURATION['fold']:
            render_tree(results, tree, level+1, _child_prefix, cgroup)
        else:
            line['_tree'] [-2] = '+' 
Example #4
Source File: pytrader.py    From pytrader with MIT License 6 votes vote down vote up
def paint_candle(self, posx, candle):
        """paint a single candle"""

        sopen = self.price_to_screen(candle.opn)
        shigh = self.price_to_screen(candle.hig)
        slow = self.price_to_screen(candle.low)
        sclose = self.price_to_screen(candle.cls)

        for posy in range(self.height):
            if posy >= shigh and posy < sopen and posy < sclose:
                # upper wick
                self.addch(posy, posx, curses.ACS_VLINE, COLOR_PAIR["chart_text"])
            if posy >= sopen and posy < sclose:
                # red body
                self.addch(posy, posx, self.body_char, self.body_attr + COLOR_PAIR["chart_down"])
            if posy >= sclose and posy < sopen:
                # green body
                self.addch(posy, posx, self.body_char, self.body_attr + COLOR_PAIR["chart_up"])
            if posy >= sopen and posy >= sclose and posy < slow:
                # lower wick
                self.addch(posy, posx, curses.ACS_VLINE, COLOR_PAIR["chart_text"]) 
Example #5
Source File: textpad.py    From Splunking-Crime with GNU Affero General Public License v3.0 5 votes vote down vote up
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) 
Example #6
Source File: sifter.py    From sandsifter with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def bracket(self, window, x, y, h, color):
        for i in xrange(1, h - 1):
            window.addch(y + i, x, curses.ACS_VLINE, color)
        window.addch(y, x, curses.ACS_ULCORNER, color)
        window.addch(y + h - 1, x, curses.ACS_LLCORNER, color) 
Example #7
Source File: textpad.py    From PokemonGo-DesktopMap with MIT License 5 votes vote down vote up
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) 
Example #8
Source File: queueperspective.py    From castero with MIT License 5 votes vote down vote up
def display(self) -> None:
        """Draws all windows and sub-features, including titles and borders.

        Overrides method from Perspective; see documentation in that class.
        """
        # clear dynamic menu headers
        self._queue_window.addstr(0, 0, " " * self._queue_window.getmaxyx()[1])

        # add window headers
        self._queue_window.addstr(0, 0, self._queue_menu.title,
                                  curses.color_pair(7) | curses.A_BOLD)
        self._metadata_window.addstr(0, 0, "Metadata",
                                     curses.color_pair(7) | curses.A_BOLD)

        # add window borders
        self._queue_window.hline(1, 0,
                                 0, self._queue_window.getmaxyx()[1],
                                 curses.ACS_HLINE | curses.color_pair(8))
        self._metadata_window.hline(1, 0,
                                    0, self._metadata_window.getmaxyx()[1] - 1,
                                    curses.ACS_HLINE | curses.color_pair(8))
        if not helpers.is_true(Config["disable_vertical_borders"]):
            self._queue_window.vline(0, self._queue_window.getmaxyx()[1] - 1,
                                     0, self._queue_window.getmaxyx()[0] - 2,
                                     curses.ACS_VLINE | curses.color_pair(8))

        # draw metadata
        if not self._metadata_updated:
            self._draw_metadata(self._metadata_window)
            self._metadata_window.refresh()
            self._metadata_updated = True

        self._queue_window.refresh() 
Example #9
Source File: downloadedperspective.py    From castero with MIT License 5 votes vote down vote up
def display(self) -> None:
        """Draws all windows and sub-features, including titles and borders.

        Overrides method from Perspective; see documentation in that class.
        """
        # clear dynamic menu headers
        self._downloaded_window.addstr(
            0, 0, " " * self._downloaded_window.getmaxyx()[1])

        # add window headers
        self._downloaded_window.addstr(
            0, 0, self._downloaded_menu.title,
            curses.color_pair(7) | curses.A_BOLD)
        self._metadata_window.addstr(
            0, 0, "Metadata",
            curses.color_pair(7) | curses.A_BOLD)

        # add window borders
        self._downloaded_window.hline(
            1, 0,
            0, self._downloaded_window.getmaxyx()[1],
            curses.ACS_HLINE | curses.color_pair(8))
        self._metadata_window.hline(
            1, 0,
            0, self._metadata_window.getmaxyx()[1] - 1,
            curses.ACS_HLINE | curses.color_pair(8))
        if not helpers.is_true(Config["disable_vertical_borders"]):
            self._downloaded_window.vline(
                0, self._downloaded_window.getmaxyx()[1] - 1,
                0, self._downloaded_window.getmaxyx()[0] - 2,
                curses.ACS_VLINE | curses.color_pair(8))

        # draw metadata
        if not self._metadata_updated:
            self._draw_metadata(self._metadata_window)
            self._metadata_window.refresh()
            self._metadata_updated = True

        self._downloaded_window.refresh() 
Example #10
Source File: simpleperspective.py    From castero with MIT License 5 votes vote down vote up
def display(self) -> None:
        """Draws all windows and sub-features, including titles and borders.

        Overrides method from Perspective; see documentation in that class.
        """
        # clear dynamic menu headers
        self._feed_window.addstr(0, 0, " " * self._feed_window.getmaxyx()[1])
        self._episode_window.addstr(0, 0,
                                    " " * self._episode_window.getmaxyx()[1])

        # add window headers
        self._feed_window.addstr(0, 0, self._feed_menu.title,
                                 curses.color_pair(7) | curses.A_BOLD)
        self._episode_window.addstr(0, 0, self._episode_menu.title,
                                    curses.color_pair(7) | curses.A_BOLD)

        # add window borders
        self._feed_window.hline(1, 0,
                                0, self._feed_window.getmaxyx()[1],
                                curses.ACS_HLINE | curses.color_pair(8))
        self._episode_window.hline(1, 0,
                                   0, self._episode_window.getmaxyx()[1],
                                   curses.ACS_HLINE | curses.color_pair(8))
        if not helpers.is_true(Config["disable_vertical_borders"]):
            self._feed_window.vline(0, self._feed_window.getmaxyx()[1] - 1,
                                    0, self._feed_window.getmaxyx()[0] - 2,
                                    curses.ACS_VLINE | curses.color_pair(8))

        self._feed_window.refresh()
        self._episode_window.refresh() 
Example #11
Source File: conftest.py    From castero with MIT License 5 votes vote down vote up
def stdscr():
    with mock.patch('curses.initscr'), \
            mock.patch('curses.echo'), \
            mock.patch('curses.flash'), \
            mock.patch('curses.endwin'), \
            mock.patch('curses.newwin'), \
            mock.patch('curses.newpad'), \
            mock.patch('curses.noecho'), \
            mock.patch('curses.cbreak'), \
            mock.patch('curses.doupdate'), \
            mock.patch('curses.nocbreak'), \
            mock.patch('curses.curs_set'), \
            mock.patch('curses.init_pair'), \
            mock.patch('curses.color_pair'), \
            mock.patch('curses.has_colors'), \
            mock.patch('curses.start_color'), \
            mock.patch('curses.use_default_colors'):
        result = MockStdscr(nlines=24, ncols=100, x=0, y=0)
        curses.initscr.return_value = result
        curses.newwin.side_effect = lambda *args: result.derwin(*args)
        curses.color_pair.return_value = 1
        curses.has_colors.return_value = True
        curses.ACS_VLINE = 0
        curses.ACS_HLINE = 0
        curses.COLORS = 16
        curses.COLOR_PAIRS = 16
        yield result 
Example #12
Source File: gui.py    From sandsifter with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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) 
Example #13
Source File: textpad.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
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) 
Example #14
Source File: textpad.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
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) 
Example #15
Source File: render.py    From ricedb with GNU General Public License v3.0 5 votes vote down vote up
def populate(self, results):
        if not self.results == None:
          del self.results
        self.results = curses.newpad(max(len(results), curses.LINES - 1), curses.COLS//2)
        self.results.clear()
        for i in range(curses.LINES - SEARCHBAR_OFFSET):
          self.results.insch(i, curses.COLS//2 - 2, curses.ACS_VLINE)
        i = 0
        for result in results:
          # print(result)
          self.results.addstr(i, 0, result.name)
          if (not result.images == None) and (self.w3m_enabled):
            try:
                images_array = ast.literal_eval(result.images) 
                temp_file = util.RDBDIR + 'tmp'
                #os.remove(temp_file)
                # print(result.images[0])
                request.urlretrieve(images_array[0], temp_file)
                self.draw_image(temp_file, curses.COLS - curses.COLS/2, SEARCHBAR_OFFSET, curses.COLS/2, curses.LINES - SEARCHBAR_OFFSET)
                if self.first_pic:
                  self.first_pic = False
            except Exception as e:
                # Who cares? it's just a picture.
                self.end()
                print(str(e))
                pass
          i += 1

        self.results.noutrefresh(0, 0, SEARCHBAR_OFFSET, 0, curses.LINES-1, curses.COLS-1) 
Example #16
Source File: sifter.py    From sandsifter with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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) 
Example #17
Source File: textpad.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
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) 
Example #18
Source File: textpad.py    From Imogen with MIT License 5 votes vote down vote up
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) 
Example #19
Source File: gui.py    From sandsifter with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def bracket(self, window, x, y, h, color):
        for i in xrange(1, h - 1):
            window.addch(y + i, x, curses.ACS_VLINE, color)
        window.addch(y, x, curses.ACS_ULCORNER, color)
        window.addch(y + h - 1, x, curses.ACS_LLCORNER, color) 
Example #20
Source File: textpad.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
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) 
Example #21
Source File: textpad.py    From oss-ftp with MIT License 5 votes vote down vote up
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) 
Example #22
Source File: textpad.py    From BinderFilter with MIT License 5 votes vote down vote up
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) 
Example #23
Source File: primaryperspective.py    From castero with MIT License 4 votes vote down vote up
def display(self) -> None:
        """Draws all windows and sub-features, including titles and borders.

        Overrides method from Perspective; see documentation in that class.
        """
        # clear dynamic menu headers
        self._feed_window.addstr(0, 0, " " * self._feed_window.getmaxyx()[1])
        self._episode_window.addstr(0, 0,
                                    " " * self._episode_window.getmaxyx()[1])

        # add window headers
        self._feed_window.addstr(0, 0, self._feed_menu.title,
                                 curses.color_pair(7) | curses.A_BOLD)
        self._episode_window.addstr(0, 0, self._episode_menu.title,
                                    curses.color_pair(7) | curses.A_BOLD)
        self._metadata_window.addstr(0, 0, "Metadata",
                                     curses.color_pair(7) | curses.A_BOLD)

        # add window borders
        self._feed_window.hline(1, 0,
                                0, self._feed_window.getmaxyx()[1],
                                curses.ACS_HLINE | curses.color_pair(8))
        self._episode_window.hline(1, 0,
                                   0, self._episode_window.getmaxyx()[1],
                                   curses.ACS_HLINE | curses.color_pair(8))
        self._metadata_window.hline(1, 0,
                                    0, self._metadata_window.getmaxyx()[1] - 1,
                                    curses.ACS_HLINE | curses.color_pair(8))
        if not helpers.is_true(Config["disable_vertical_borders"]):
            self._feed_window.vline(0, self._feed_window.getmaxyx()[1] - 1,
                                    0, self._feed_window.getmaxyx()[0] - 2,
                                    curses.ACS_VLINE | curses.color_pair(8))
            self._episode_window.vline(0,
                                       self._episode_window.getmaxyx()[1] - 1,
                                       0,
                                       self._episode_window.getmaxyx()[0] - 2,
                                       curses.ACS_VLINE | curses.color_pair(8))

        # draw metadata
        if not self._metadata_updated:
            self._draw_metadata(self._metadata_window)
            self._metadata_window.refresh()
            self._metadata_updated = True

        self._feed_window.refresh()
        self._episode_window.refresh()