当前位置: 首页>>代码示例>>Python>>正文


Python curses.A_REVERSE属性代码示例

本文整理汇总了Python中curses.A_REVERSE属性的典型用法代码示例。如果您正苦于以下问题:Python curses.A_REVERSE属性的具体用法?Python curses.A_REVERSE怎么用?Python curses.A_REVERSE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在curses的用法示例。


在下文中一共展示了curses.A_REVERSE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: curses_input

# 需要导入模块: import curses [as 别名]
# 或者: from curses import A_REVERSE [as 别名]
def curses_input(self, stdscr, row, col, prompt_string, ascii_mode=False):
        """
        Get an input string with curses.

        Row and col are the start position ot the prompt_string.
        """
        curses.echo()
        stdscr.addstr(row, col, str(prompt_string), curses.A_REVERSE)
        stdscr.addstr(row + 1, col, " " * (curses.COLS - 1))
        stdscr.refresh()
        input_val = ""

        while len(input_val) <= 0:
            if ascii_mode:
                input_val = chr(stdscr.getch())
                break
            else:
                input_val = stdscr.getstr(row + 1, col, 20)

        return input_val 
开发者ID:aaronjanse,项目名称:asciidots,代码行数:22,代码来源:__main__.py

示例2: draw

# 需要导入模块: import curses [as 别名]
# 或者: from curses import A_REVERSE [as 别名]
def draw(self):
        i = 0
        while i < self.height:
            if self.win_y + i < len(self.token_lines):
                self.print_line(i)
            else:
                # force to clear the entire line
                self.screen.move(i, 0)
            self.screen.clrtoeol()
            i += 1

        # Print the scroll cursor on the right. It uses utf-8 block characters.

        y = self.get_y_scroll()
        i = y % 8
        y = y // 8

        self.screen.insstr(y, self.width - 1,
            self.cursor_position_utf8[i],
            color_pair(COLOR_SCROLL_CURSOR))

        if i != 0 and y + 1 < self.height:
            self.screen.insstr(y + 1, self.width - 1,
                self.cursor_position_utf8[i],
                color_pair(COLOR_SCROLL_CURSOR) | A_REVERSE) 
开发者ID:plasma-disassembler,项目名称:plasma,代码行数:27,代码来源:listbox.py

示例3: draw_fancy_text

# 需要导入模块: import curses [as 别名]
# 或者: from curses import A_REVERSE [as 别名]
def draw_fancy_text(self, text, y, x, attr=0):
        """
        Displays text. A unicode `Superscript Two` (U+00B2) toggles bold
        formatting; a unicode `Superscript Three` (U+00B3) toggles
        color inversion. The bold and inversion formatting flags are
        ORed with the `attr` parameter.
        """
        # TODO: Allow formatting other than bold (possibly using other exotic Unicode characters).
        pos = 0
        for i in range(len(text)):
            if text[i] == "\xb2":
                attr ^= curses.A_BOLD
            elif text[i] == "\xb3":
                attr ^= curses.A_REVERSE
            else:
                self.window.addch(y, x + pos, text[i], attr)
                pos += 1 
开发者ID:ethan2-0,项目名称:onion-expose,代码行数:19,代码来源:displayutil.py

示例4: print_line

# 需要导入模块: import curses [as 别名]
# 或者: from curses import A_REVERSE [as 别名]
def print_line(line, highlight=False):
    """A thin wrapper around curses's addstr()."""
    global lineno
    try:
        if highlight:
            line += " " * (win.getmaxyx()[1] - len(line))
            win.addstr(lineno, 0, line, curses.A_REVERSE)
        else:
            win.addstr(lineno, 0, line, 0)
    except curses.error:
        lineno = 0
        win.refresh()
        raise
    else:
        lineno += 1

# --- /curses stuff 
开发者ID:giampaolo,项目名称:psutil,代码行数:19,代码来源:top.py

示例5: draw_transactions

# 需要导入模块: import curses [as 别名]
# 或者: from curses import A_REVERSE [as 别名]
def draw_transactions(state):
    window_height = state['y'] - 3
    win_transactions = curses.newwin(window_height, 76, 2, 0)

    win_transactions.addstr(0, 1, "transactions:                               (UP/DOWN: scroll, ENTER: view)", curses.A_BOLD + curses.color_pair(5))

    offset = state['wallet']['offset']

    for index in range(offset, offset+window_height-1):
        if index < len(state['wallet']['view_string']):
                condition = (index == offset+window_height-2) and (index+1 < len(state['wallet']['view_string']))
                condition = condition or ( (index == offset) and (index > 0) )

                if condition:
                    win_transactions.addstr(index+1-offset, 1, "...")
                else:
                    win_transactions.addstr(index+1-offset, 1, state['wallet']['view_string'][index])

                if index == (state['wallet']['cursor']*4 + 1):
                    win_transactions.addstr(index+1-offset, 1, ">", curses.A_REVERSE + curses.A_BOLD)

    win_transactions.refresh() 
开发者ID:esotericnonsense,项目名称:bitcoind-ncurses,代码行数:24,代码来源:wallet.py

示例6: draw_window

# 需要导入模块: import curses [as 别名]
# 或者: from curses import A_REVERSE [as 别名]
def draw_window(state):
    win_footer = curses.newwin(1, 76, state['y']-1, 0)

    color = curses.color_pair(1)
    if 'testnet' in state:
        if state['testnet']:
            color = curses.color_pair(2)

    win_footer.addstr(0, 1, "ncurses", color + curses.A_BOLD)

    x = 10
    for mode_string in g.modes:
        modifier = curses.A_BOLD
        if state['mode'] == mode_string:
            modifier += curses.A_REVERSE
        win_footer.addstr(0, x, mode_string[0].upper(), modifier + curses.color_pair(5)) 
        win_footer.addstr(0, x+1, mode_string[1:], modifier)
        x += len(mode_string) + 2

    win_footer.refresh() 
开发者ID:esotericnonsense,项目名称:bitcoind-ncurses,代码行数:22,代码来源:footer.py

示例7: __init__

# 需要导入模块: import curses [as 别名]
# 或者: from curses import A_REVERSE [as 别名]
def __init__(self, stdscr, instance):
        self.instance = instance
        self.pmin = 0
        self.pmax = 0
        self.change_type = None
        instance.history.signal_changed.connect(self.slot_history_changed)
        instance.orderbook.signal_changed.connect(self.slot_orderbook_changed)

        # some terminals do not support reverse video
        # so we cannot use reverse space for candle bodies
        if curses.A_REVERSE & curses.termattrs():
            self.body_char = " "
            self.body_attr = curses.A_REVERSE
        else:
            self.body_char = curses.ACS_CKBOARD
            self.body_attr = 0

        Win.__init__(self, stdscr) 
开发者ID:caktux,项目名称:pytrader,代码行数:20,代码来源:pytrader.py

示例8: update

# 需要导入模块: import curses [as 别名]
# 或者: from curses import A_REVERSE [as 别名]
def update(self, s):
        self.win.erase()
        self.addstr(1, 0, "CLIENT           PORT S I   QUEUED    RECVD     SENT", curses.A_REVERSE)
        self.sessions[s.server_id] = s.sessions
        items = []
        for l in self.sessions:
            items.extend(l)
        items.sort(key=lambda x: int(x.queued), reverse=True)
        for i, session in enumerate(items):
            try:
                #ugh, need to handle if slow - thread for async resolver?
                host = self.hostname(session) if options.names else session.host
                self.addstr(i + 2, 0, "%-15s %5s %1s %1s %8s %8s %8s" %
                            (host[:15], session.port, session.server_id, session.interest_ops,
                             session.queued, session.recved, session.sent))
            except:
                break 
开发者ID:soarpenguin,项目名称:python-scripts,代码行数:19,代码来源:zktop.py

示例9: highlight_until

# 需要导入模块: import curses [as 别名]
# 或者: from curses import A_REVERSE [as 别名]
def highlight_until(self, lines: Buf, idx: int) -> None:
        if self.start is None or self.end is None:
            return

        # XXX: this assumes pair 1 is the background
        attr = curses.A_REVERSE | curses.A_DIM | curses.color_pair(1)
        (s_y, s_x), (e_y, e_x) = self.get()
        if s_y == e_y:
            self.regions[s_y] = (HL(x=s_x, end=e_x, attr=attr),)
        else:
            self.regions[s_y] = (
                HL(x=s_x, end=len(lines[s_y]) + 1, attr=attr),
            )
            for l_y in range(s_y + 1, e_y):
                self.regions[l_y] = (
                    HL(x=0, end=len(lines[l_y]) + 1, attr=attr),
                )
            self.regions[e_y] = (HL(x=0, end=e_x, attr=attr),) 
开发者ID:asottile,项目名称:babi,代码行数:20,代码来源:selection.py

示例10: test_theme_from_file

# 需要导入模块: import curses [as 别名]
# 或者: from curses import A_REVERSE [as 别名]
def test_theme_from_file():

    with _ephemeral_directory() as dirname:
        with NamedTemporaryFile(mode='w+', dir=dirname) as fp:

            with pytest.raises(ConfigError):
                Theme.from_file(fp.name, 'installed')

            fp.write('[theme]\n')
            fp.write('Unknown = - -\n')
            fp.write('Upvote = - red\n')
            fp.write('Downvote = ansi_255 default bold\n')
            fp.write('NeutralVote = #000000 #ffffff bold+reverse\n')
            fp.flush()

            theme = Theme.from_file(fp.name, 'installed')
            assert theme.source == 'installed'
            assert 'Unknown' not in theme.elements
            assert theme.elements['Upvote'] == (
                -1, curses.COLOR_RED, curses.A_NORMAL)
            assert theme.elements['Downvote'] == (
                255, -1, curses.A_BOLD)
            assert theme.elements['NeutralVote'] == (
                16, 231, curses.A_BOLD | curses.A_REVERSE) 
开发者ID:michael-lazar,项目名称:rtv,代码行数:26,代码来源:test_theme.py

示例11: set_titlebar

# 需要导入模块: import curses [as 别名]
# 或者: from curses import A_REVERSE [as 别名]
def set_titlebar(self):
		track_info = self.player.track.track_info(self.width - 1)
		# track_info -> ['title', 'artist', 'album'] - all algined
		self.stdscr.addstr(0, 1, track_info[0], curses.A_REVERSE)
		self.stdscr.addstr(1, 1, track_info[1], 
					curses.A_REVERSE | curses.A_BOLD | curses.A_DIM)
		self.stdscr.addstr(2, 1, track_info[2], curses.A_REVERSE) 
开发者ID:Jugran,项目名称:lyrics-in-terminal,代码行数:9,代码来源:window.py

示例12: scroll_down

# 需要导入模块: import curses [as 别名]
# 或者: from curses import A_REVERSE [as 别名]
def scroll_down(self, step=1):
		if self.current_pos < self.player.track.length - (self.height * 0.5):
			self.current_pos += step
		else:
			self.stdscr.addstr(self.height - 1, 1, 'END', curses.A_REVERSE) 
开发者ID:Jugran,项目名称:lyrics-in-terminal,代码行数:7,代码来源:window.py

示例13: _titleyx

# 需要导入模块: import curses [as 别名]
# 或者: from curses import A_REVERSE [as 别名]
def _titleyx(self, y: int, x: int, line, w=80):
        if len(line) < w:
            line += " " * (w - len(line))
        return self._printyx(y, x, [line], curses.A_REVERSE | curses.A_BOLD) 
开发者ID:robertmuth,项目名称:PyZwaver,代码行数:6,代码来源:example_simple.py

示例14: print_line

# 需要导入模块: import curses [as 别名]
# 或者: from curses import A_REVERSE [as 别名]
def print_line(line, highlight=False):
    """A thin wrapper around curses's addstr()."""
    global lineno
    try:
        if highlight:
            line += " " * (win.getmaxyx()[1] - len(line))
            win.addstr(lineno, 0, line, curses.A_REVERSE)
        else:
            win.addstr(lineno, 0, line, 0)
    except curses.error:
        lineno = 0
        win.refresh()
        raise
    else:
        lineno += 1 
开发者ID:giampaolo,项目名称:psutil,代码行数:17,代码来源:iotop.py

示例15: get_string

# 需要导入模块: import curses [as 别名]
# 或者: from curses import A_REVERSE [as 别名]
def get_string(self, y, x):
        self.set_cursor(1)
        curses.echo()
        self.stdscr.addstr( y, x, " "*20, curses.A_REVERSE)
        s = self.stdscr.getstr(y,x)
        curses.noecho()
        self.set_cursor(0)
        return s 
开发者ID:mazaclub,项目名称:encompass,代码行数:10,代码来源:text.py


注:本文中的curses.A_REVERSE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。