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


Python curses.A_BOLD属性代码示例

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


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

示例1: show_nmea

# 需要导入模块: import curses [as 别名]
# 或者: from curses import A_BOLD [as 别名]
def show_nmea():
    """NMEA output in curses terminal"""
    data_window = curses.newwin(24, 79, 0, 0)

    for new_data in gpsd_socket:
        if new_data:
            screen.nodelay(1)
            key_press = screen.getch()
            if key_press == ord('q'):
                shut_down()
            elif key_press == ord('j'):  # raw
                gpsd_socket.watch(enable=False, gpsd_protocol='nmea')
                gpsd_socket.watch(gpsd_protocol='json')
                show_human()

            data_window.border(0)
            data_window.addstr(0, 2, 'GPS3 Python {}.{}.{} GPSD Interface Showing NMEA protocol'.format(*sys.version_info), curses.A_BOLD)
            data_window.addstr(2, 2, '{}'.format(gpsd_socket.response))
            data_window.refresh()
        else:
            sleep(.1) 
开发者ID:wadda,项目名称:gps3,代码行数:23,代码来源:human.py

示例2: show_nmea

# 需要导入模块: import curses [as 别名]
# 或者: from curses import A_BOLD [as 别名]
def show_nmea():
    """NMEA output in curses terminal"""
    data_window = curses.newwin(24, 79, 0, 0)

    for new_data in gpsd_socket:
        if new_data:
            screen.nodelay(1)
            key_press = screen.getch()
            if key_press == ord('q'):
                shut_down()
            elif key_press == ord('j'):  # raw
                gpsd_socket.watch(enable=False, gpsd_protocol='nmea')
                gpsd_socket.watch(gpsd_protocol='json')
                show_human()

            data_window.border(0)
            data_window.addstr(0, 2, 'AGPS3 Python {}.{}.{} GPSD Interface Showing NMEA protocol'.format(*sys.version_info), curses.A_BOLD)
            data_window.addstr(2, 2, '{}'.format(gpsd_socket.response))
            data_window.refresh()
        else:
            sleep(.1) 
开发者ID:wadda,项目名称:gps3,代码行数:23,代码来源:ahuman.py

示例3: _screen_create_command_textbox

# 需要导入模块: import curses [as 别名]
# 或者: from curses import A_BOLD [as 别名]
def _screen_create_command_textbox(self, existing_command=None):
    """Create command textbox on screen.

    Args:
      existing_command: (str) A command string to put in the textbox right
        after its creation.
    """

    # Display the tfdbg prompt.
    self._stdscr.addstr(self._max_y - self._command_textbox_height, 0,
                        self.CLI_PROMPT, curses.A_BOLD)
    self._stdscr.refresh()

    self._command_window.clear()

    # Command text box.
    self._command_textbox = textpad.Textbox(
        self._command_window, insert_mode=True)

    # Enter existing command.
    self._auto_key_in(existing_command) 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:23,代码来源:curses_ui.py

示例4: _screen_create_command_textbox

# 需要导入模块: import curses [as 别名]
# 或者: from curses import A_BOLD [as 别名]
def _screen_create_command_textbox(self, existing_command):
    """Create command textbox on screen.

    Args:
      existing_command: (str) A command string to put in the textbox right
        after its creation.
    """

    # Display the tfdbg prompt.
    self._stdscr.addstr(self._max_y - self._command_textbox_height, 0,
                        self.CLI_PROMPT, curses.A_BOLD)
    self._stdscr.refresh()

    self._command_window.clear()

    # Command text box.
    self._command_textbox = textpad.Textbox(
        self._command_window, insert_mode=True)

    # Enter existing command.
    self._auto_key_in(existing_command) 
开发者ID:abhisuri97,项目名称:auto-alt-text-lambda-api,代码行数:23,代码来源:curses_ui.py

示例5: draw_fancy_text

# 需要导入模块: import curses [as 别名]
# 或者: from curses import A_BOLD [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

示例6: print_balance

# 需要导入模块: import curses [as 别名]
# 或者: from curses import A_BOLD [as 别名]
def print_balance(self):
        if not self.network:
            msg = _("Offline")
        elif self.network.is_connected():
            if not self.wallet.up_to_date:
                msg = _("Synchronizing...")
            else: 
                c, u =  self.wallet.get_balance()
                msg = _("Balance")+": %f  "%(Decimal( c ) / 100000000)
                if u: msg += "  [%f unconfirmed]"%(Decimal( u ) / 100000000)
        else:
            msg = _("Not connected")
            
        self.stdscr.addstr( self.maxy -1, 3, msg)

        for i in range(self.num_tabs):
            self.stdscr.addstr( 0, 2 + 2*i + len(''.join(self.tab_names[0:i])), ' '+self.tab_names[i]+' ', curses.A_BOLD if self.tab == i else 0)
            
        self.stdscr.addstr( self.maxy -1, self.maxx-30, ' '.join([_("Settings"), _("Network"), _("Quit")])) 
开发者ID:mazaclub,项目名称:encompass,代码行数:21,代码来源:text.py

示例7: draw_window

# 需要导入模块: import curses [as 别名]
# 或者: from curses import A_BOLD [as 别名]
def draw_window(state, window):
    window.clear()
    window.refresh()
    win_header = curses.newwin(2, 76, 0, 0)

    unit = 'BTC'
    if 'testnet' in state:
        if state['testnet']:
            unit = 'TNC'

    if 'wallet' in state:
        if 'balance' in state:
            balance_string = "balance: " + "%0.8f" % state['balance'] + " " + unit
            if 'unconfirmedbalance' in state:
                if state['unconfirmedbalance'] != 0:
                    balance_string += " (+" + "%0.8f" % state['unconfirmedbalance'] + " unconf)"
            window.addstr(0, 1, balance_string, curses.A_BOLD)

        draw_transactions(state)

    else:
        win_header.addstr(0, 1, "no wallet information loaded", curses.A_BOLD + curses.color_pair(3))
        win_header.addstr(1, 1, "loading... (is -disablewallet on?)", curses.A_BOLD)

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

示例8: draw_transactions

# 需要导入模块: import curses [as 别名]
# 或者: from curses import A_BOLD [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

示例9: draw_window

# 需要导入模块: import curses [as 别名]
# 或者: from curses import A_BOLD [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

示例10: draw_window

# 需要导入模块: import curses [as 别名]
# 或者: from curses import A_BOLD [as 别名]
def draw_window(state, window):
    window.clear()
    window.refresh()

    win_header = curses.newwin(3, 75, 0, 0)

    if 'peerinfo' in state:
        win_header.addstr(0, 1, "connected peers: " + str(len(state['peerinfo'])).ljust(10) + "                             (UP/DOWN: scroll)", curses.A_BOLD)
        win_header.addstr(2, 1, "  Node IP              Version        Recv      Sent         Time  Height", curses.A_BOLD + curses.color_pair(5))
        draw_peers(state)

    else:
        win_header.addstr(0, 1, "no peer information loaded", curses.A_BOLD + curses.color_pair(3))
        win_header.addstr(1, 1, "loading...", curses.A_BOLD)

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

示例11: draw_window

# 需要导入模块: import curses [as 别名]
# 或者: from curses import A_BOLD [as 别名]
def draw_window(state, window):
    window.clear()
    window.refresh()

    win_header = curses.newwin(3, 75, 0, 0)

    if 'chaintips' in state:
        win_header.addstr(0, 1, "chain tips: " + str(len(state['chaintips'])).ljust(10) + "                 (UP/DOWN: scroll, F: refresh)", curses.A_BOLD)
        win_header.addstr(1, 1, "key: Active/Invalid/HeadersOnly/ValidFork/ValidHeaders", curses.A_BOLD)
        win_header.addstr(2, 1, "height length status 0-prefix hash", curses.A_BOLD + curses.color_pair(5))
        draw_tips(state)

    else:
        win_header.addstr(0, 1, "no chain tip information loaded", curses.A_BOLD + curses.color_pair(3))
        win_header.addstr(1, 1, "loading... (press F to try again)", curses.A_BOLD)

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

示例12: paint_item

# 需要导入模块: import curses [as 别名]
# 或者: from curses import A_BOLD [as 别名]
def paint_item(self, posy, index):
        """paint one single order"""
        order = self.items[index]
        # self.instance.debug("order: %s, selected: %s" % (order, self.selected))
        if order in self.selected:
            marker = "*"
            if index == self.item_sel:
                attr = COLOR_PAIR["dialog_sel_sel"]
            else:
                attr = COLOR_PAIR["dialog_sel_text"] + curses.A_BOLD
        else:
            marker = ""
            if index == self.item_sel:
                attr = COLOR_PAIR["dialog_sel"]
            else:
                attr = COLOR_PAIR["dialog_text"]

        self.addstr(posy, 2, marker, attr)
        self.addstr(posy, 5, order.typ, attr)
        self.addstr(posy, 9, str(order.price), attr)
        self.addstr(posy, 22, str(order.volume), attr) 
开发者ID:caktux,项目名称:pytrader,代码行数:23,代码来源:pytrader.py

示例13: depict_workspace_object

# 需要导入模块: import curses [as 别名]
# 或者: from curses import A_BOLD [as 别名]
def depict_workspace_object(self, w, row, column, o, maxImportance, description_structures):
        if maxImportance != 0.0 and o.relativeImportance == maxImportance:
            attr = curses.A_BOLD
        else:
            attr = curses.A_NORMAL
        w.addstr(row, column, str(o), attr)
        column += len(str(o))
        if o.descriptions:
            w.addstr(row, column, ' (', curses.A_NORMAL)
            column += 2
            for i, d in enumerate(o.descriptions):
                if i != 0:
                    w.addstr(row, column, ', ', curses.A_NORMAL)
                    column += 2
                s, attr = self.slipnode_name_and_attr(d.descriptor)
                if d not in description_structures:
                    s = '[%s]' % s
                w.addstr(row, column, s, attr)
                column += len(s)
            w.addstr(row, column, ')', curses.A_NORMAL)
            column += 1
        return column 
开发者ID:fargonauts,项目名称:copycat,代码行数:24,代码来源:curses_reporter.py

示例14: drawWorld

# 需要导入模块: import curses [as 别名]
# 或者: from curses import A_BOLD [as 别名]
def drawWorld(self, world, draw_actors=True):
        for i in range(world.worldmap.shape[0]):
            for j in range(world.worldmap.shape[1]):
                if world.worldmap[i, j] == W.DirectionEast:
                    self.stdscr.addstr(i, j, '>', curses.color_pair(0))
                elif world.worldmap[i, j] == W.DirectionWest:
                    self.stdscr.addstr(i, j, '<', curses.color_pair(0))
                elif world.worldmap[i, j] == W.DirectionNorth:
                    self.stdscr.addstr(i, j, '^', curses.color_pair(0))
                elif world.worldmap[i, j] == W.DirectionSouth:
                    self.stdscr.addstr(i, j, 'v', curses.color_pair(0))
                elif world.worldmap[i, j] == W.Sidewalk:
                    self.stdscr.addstr(i, j, '#', curses.color_pair(0))
                elif world.worldmap[i, j] == W.Intersection:
                    self.stdscr.addstr(i, j, 'X', curses.color_pair(0))
                else:
                    self.stdscr.addstr(i, j, ' ')

        if draw_actors:
            for actor in world.actors:
                if actor.state.x >= 0 and actor.state.y >= 0:
                    self.stdscr.addstr(
                        actor.state.y, actor.state.x, actor.name, curses.color_pair(1) + curses.A_BOLD + curses.A_UNDERLINE)

        self.bottom_row = i 
开发者ID:jhu-lcsr,项目名称:costar_plan,代码行数:27,代码来源:graphics.py

示例15: print_time

# 需要导入模块: import curses [as 别名]
# 或者: from curses import A_BOLD [as 别名]
def print_time(now):
    """main time function"""
    twentyfourhours = twentyfourhourarg
    time_line = now.strftime("%H:%M:%S" if twentyfourhours else "%I:%M:%S")
    time_array = ["" for i in range(0, 7)]

    for char in time_line:
        char_array = glyph[char]
        for row in range(0, len(char_array)):
            time_array[row] += char_array[row]

    for y in range(0, len(time_array)):
        for x in range(0, len(time_array[y])):
            char = time_array[y][x]
            color = 1 if char == " " else 3

            # If we run in 24-hour mode, the AM/PM will be omitted.
            # This then leads to a misaligned clock, thus
            # we need to move the clock to the right 2 columns
            addstr(y, x if not twentyfourhours else x + 2, " ",
                   curses.color_pair(color))

    if not twentyfourhours:
        addstr(6, len(time_array[0]), now.strftime("%p"),
               curses.color_pair(2) | curses.A_BOLD) 
开发者ID:shaggytwodope,项目名称:clockr,代码行数:27,代码来源:clockr.py


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