本文整理汇总了Python中curses.ACS_HLINE属性的典型用法代码示例。如果您正苦于以下问题:Python curses.ACS_HLINE属性的具体用法?Python curses.ACS_HLINE怎么用?Python curses.ACS_HLINE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类curses
的用法示例。
在下文中一共展示了curses.ACS_HLINE属性的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: init_layout
# 需要导入模块: import curses [as 别名]
# 或者: from curses import ACS_HLINE [as 别名]
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()
示例2: render_tree
# 需要导入模块: import curses [as 别名]
# 或者: from curses import ACS_HLINE [as 别名]
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] = '+'
示例3: box
# 需要导入模块: import curses [as 别名]
# 或者: from curses import ACS_HLINE [as 别名]
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)
示例4: _update_game_console
# 需要导入模块: import curses [as 别名]
# 或者: from curses import ACS_HLINE [as 别名]
def _update_game_console(self, new_log_messages, console, paint_console):
"""Update game console text buffer; draw console to the screen if enabled.
Args:
new_log_messages: a list of strings containing new log messages to place
in the game console's message buffer.
console: curses window for the game console.
paint_console: if True, the console will be displayed at the next screen
refresh; if not, it won't.
"""
# First we have to format the new messages to fit within our game console.
rows, cols = console.getmaxyx()
# Split all log messages on newline characters.
split_log_messages = []
for message in new_log_messages:
split_log_messages.extend(message.splitlines())
# It's a little weird to wrap console log messages with a text wrapper
# designed for English text, but that beats writing tab expansion myself.
wrapper = textwrap.TextWrapper(
width=cols, drop_whitespace=False, break_on_hyphens=False)
for message in split_log_messages:
self._log_messages.extend(wrapper.wrap(message))
# There's only room on the screen for the last rows-1 console messages.
del self._log_messages[:(1-rows)]
# Draw the console if the console is visible.
if paint_console:
console.border(' ', ' ', curses.ACS_HLINE, ' ',
curses.ACS_ULCORNER, curses.ACS_URCORNER, ' ', ' ')
console.addstr(0, 4, '{ Console }', curses.A_BOLD)
console.addstr(1, 0, '\n'.join(self._log_messages))
console.noutrefresh()
示例5: rectangle
# 需要导入模块: import curses [as 别名]
# 或者: from curses import ACS_HLINE [as 别名]
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)
示例6: update
# 需要导入模块: import curses [as 别名]
# 或者: from curses import ACS_HLINE [as 别名]
def update(self, clear=True):
super(GridColTitles, self).update(clear = True)
_title_counter = 0
for title_cell in self._my_col_titles:
try:
title_text = self.col_titles[self.begin_col_display_at+_title_counter]
except IndexError:
title_text = None
self.update_title_cell(title_cell, title_text)
_title_counter += 1
self.parent.curses_pad.hline(self.rely+1, self.relx, curses.ACS_HLINE, self.width)
示例7: draw_form
# 需要导入模块: import curses [as 别名]
# 或者: from curses import ACS_HLINE [as 别名]
def draw_form(self):
MAXY, MAXX = self.curses_pad.getmaxyx()
self.curses_pad.hline(0, 0, curses.ACS_HLINE, MAXX)
self.draw_title_and_help()
示例8: update
# 需要导入模块: import curses [as 别名]
# 或者: from curses import ACS_HLINE [as 别名]
def update(self, clear=True):
super(GridColTitles, self).update(clear=True)
_title_counter = 0
for title_cell in self._my_col_titles:
try:
title_text = self.col_titles[self.begin_col_display_at + _title_counter]
except IndexError:
title_text = None
self.update_title_cell(title_cell, title_text)
_title_counter += 1
self.parent.curses_pad.hline(self.rely + 1, self.relx, curses.ACS_HLINE, self.width)
示例9: stdscr
# 需要导入模块: import curses [as 别名]
# 或者: from curses import ACS_HLINE [as 别名]
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
示例10: display
# 需要导入模块: import curses [as 别名]
# 或者: from curses import ACS_HLINE [as 别名]
def display(self) -> None:
"""Draws all windows and sub-features, including titles and borders.
"""
# check if the screen size has changed
self.update_parent_dimensions()
# decrement the update timer
self._update_timer -= 1
if self._update_timer <= 0:
self._update_timer = self.UPDATE_TIMEOUT
self.update()
# display the header and footer
width = self._header_window.getmaxyx()[1]
self._header_window.addstr(0, 0, " " * width)
self._header_window.addstr(0, 0, self._header_str,
curses.color_pair(6) | curses.A_BOLD)
self._footer_window.addstr(1, 0, self._footer_str[:width - 1],
curses.color_pair(6) | curses.A_BOLD)
# add window borders
self._header_window.hline(1, 0,
0, self._header_window.getmaxyx()[1],
curses.ACS_HLINE | curses.color_pair(8))
self._footer_window.hline(0, 0,
0, self._footer_window.getmaxyx()[1],
curses.ACS_HLINE | curses.color_pair(8))
# refresh updated windows
self._footer_window.refresh()
self._header_window.refresh()
# add display for current perspective
self._perspectives[self._active_perspective].display()
示例11: display
# 需要导入模块: import curses [as 别名]
# 或者: from curses import ACS_HLINE [as 别名]
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()