本文整理汇总了Python中curses.use_default_colors方法的典型用法代码示例。如果您正苦于以下问题:Python curses.use_default_colors方法的具体用法?Python curses.use_default_colors怎么用?Python curses.use_default_colors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类curses
的用法示例。
在下文中一共展示了curses.use_default_colors方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import curses [as 别名]
# 或者: from curses import use_default_colors [as 别名]
def __init__(self):
#curses.use_default_colors()
self.define_colour_numbers()
self._defined_pairs = {}
self._names = {}
try:
self._max_pairs = curses.COLOR_PAIRS - 1
do_color = True
except AttributeError:
# curses.start_color has failed or has not been called
do_color = False
# Disable all color use across the application
disableColor()
if do_color and curses.has_colors():
self.initialize_pairs()
self.initialize_names()
示例2: __init__
# 需要导入模块: import curses [as 别名]
# 或者: from curses import use_default_colors [as 别名]
def __init__(self, scanner):
self.scanner = scanner
self.screen = curses.initscr()
curses.noecho()
curses.cbreak()
self.screen.keypad(1)
self.screen.scrollok(True)
self.x, self.y = self.screen.getmaxyx()
curses.start_color()
curses.use_default_colors()
try:
self.screen.curs_set(0)
except:
try:
self.screen.curs_set(1)
except:
pass
示例3: setup
# 需要导入模块: import curses [as 别名]
# 或者: from curses import use_default_colors [as 别名]
def setup(stdscr):
# curses
curses.use_default_colors()
curses.init_pair(1, curses.COLOR_RED, -1)
curses.init_pair(2, curses.COLOR_RED, curses.COLOR_RED)
curses.init_pair(3, curses.COLOR_GREEN, -1)
curses.init_pair(4, -1, curses.COLOR_RED)
try:
curses.curs_set(False)
except curses.error:
# fails on some terminals
pass
stdscr.timeout(0)
# prepare input thread mechanisms
curses_lock = Lock()
input_queue = Queue()
quit_event = Event()
return (curses_lock, input_queue, quit_event)
示例4: _init_screen
# 需要导入模块: import curses [as 别名]
# 或者: from curses import use_default_colors [as 别名]
def _init_screen() -> 'curses._CursesWindow':
# set the escape delay so curses does not pause waiting for sequences
if sys.version_info >= (3, 9): # pragma: no cover
curses.set_escdelay(25)
else: # pragma: no cover
os.environ.setdefault('ESCDELAY', '25')
stdscr = curses.initscr()
curses.noecho()
curses.cbreak()
# <enter> is not transformed into '\n' so it can be differentiated from ^J
curses.nonl()
# ^S / ^Q / ^Z / ^\ are passed through
curses.raw()
stdscr.keypad(True)
with contextlib.suppress(curses.error):
curses.start_color()
curses.use_default_colors()
return stdscr
示例5: __init__
# 需要导入模块: import curses [as 别名]
# 或者: from curses import use_default_colors [as 别名]
def __init__(self, ts, injector, tests, do_tick, disassembler=disas_capstone):
self.ts = ts;
self.injector = injector
self.T = tests
self.gui_thread = None
self.do_tick = do_tick
self.ticks = 0
self.last_ins_count = 0
self.delta_log = deque(maxlen=self.RATE_Q)
self.time_log = deque(maxlen=self.RATE_Q)
self.disas = disassembler
self.stdscr = curses.initscr()
curses.start_color()
# doesn't work
# self.orig_colors = [curses.color_content(x) for x in xrange(256)]
curses.use_default_colors()
curses.noecho()
curses.cbreak()
curses.curs_set(0)
self.stdscr.nodelay(1)
self.sx = 0
self.sy = 0
self.init_colors()
self.stdscr.bkgd(curses.color_pair(self.WHITE))
self.last_time = time.time()
示例6: start
# 需要导入模块: import curses [as 别名]
# 或者: from curses import use_default_colors [as 别名]
def start(self, no_delay):
self.window = curses.initscr()
curses.start_color()
curses.use_default_colors()
curses.noecho()
curses.cbreak()
curses.curs_set(0)
self.window.nodelay(no_delay)
self.init_colors()
self.window.bkgd(curses.color_pair(self.WHITE))
locale.setlocale(locale.LC_ALL, '') # set your locale
self.code = locale.getpreferredencoding()
示例7: main
# 需要导入模块: import curses [as 别名]
# 或者: from curses import use_default_colors [as 别名]
def main(stdscr, *args, **kwargs):
try:
curses.use_default_colors()
except (AttributeError, _curses.error):
pass
try:
curses.curs_set(False)
except (AttributeError, _curses.error):
pass
Viewer(stdscr, *args, **kwargs).run()
示例8: __init__
# 需要导入模块: import curses [as 别名]
# 或者: from curses import use_default_colors [as 别名]
def __init__(self, stdscr, player, timeout):
self.stdscr = stdscr
self.height, self.width = stdscr.getmaxyx()
self.player = player
self.scroll_pad = curses.newpad(self.player.track.length + 2,
self.player.track.width + 2)
self.current_pos = 0
self.pad_offset = 1
self.text_padding = 5
self.keys = Key()
curses.use_default_colors()
self.stdscr.timeout(timeout)
self.set_up()
示例9: __init__
# 需要导入模块: import curses [as 别名]
# 或者: from curses import use_default_colors [as 别名]
def __init__(self, stdscr):
self._stdscr = stdscr
# Mappings of names to the curses color attribute. Initially these all
# reference black text, but if the terminal can handle color then
# they're set with that foreground color.
self._colors = dict([(color, 0) for color in COLOR_LIST])
# allows for background transparency
try:
curses.use_default_colors()
except curses.error:
pass
# makes the cursor invisible
try:
curses.curs_set(0)
except curses.error:
pass
# initializes colors if the terminal can handle them
try:
if curses.has_colors():
color_pair = 1
for name, foreground in COLOR_LIST.items():
background = -1 # allows for default (possibly transparent) background
curses.init_pair(color_pair, foreground, background)
self._colors[name] = curses.color_pair(color_pair)
color_pair += 1
except curses.error:
pass
示例10: _screen_color_init
# 需要导入模块: import curses [as 别名]
# 或者: from curses import use_default_colors [as 别名]
def _screen_color_init(self):
"""Initialization of screen colors."""
curses.start_color()
curses.use_default_colors()
self._color_pairs = {}
color_index = 0
# Prepare color pairs.
for fg_color in self._FOREGROUND_COLORS:
for bg_color in self._BACKGROUND_COLORS:
color_index += 1
curses.init_pair(color_index, self._FOREGROUND_COLORS[fg_color],
self._BACKGROUND_COLORS[bg_color])
color_name = fg_color
if bg_color != "transparent":
color_name += "_on_" + bg_color
self._color_pairs[color_name] = curses.color_pair(color_index)
# Try getting color(s) available only under 256-color support.
try:
color_index += 1
curses.init_pair(color_index, 245, -1)
self._color_pairs[cli_shared.COLOR_GRAY] = curses.color_pair(color_index)
except curses.error:
# Use fall-back color(s):
self._color_pairs[cli_shared.COLOR_GRAY] = (
self._color_pairs[cli_shared.COLOR_GREEN])
# A_BOLD or A_BLINK is not really a "color". But place it here for
# convenience.
self._color_pairs["bold"] = curses.A_BOLD
self._color_pairs["blink"] = curses.A_BLINK
self._color_pairs["underline"] = curses.A_UNDERLINE
# Default color pair to use when a specified color pair does not exist.
self._default_color_pair = self._color_pairs[cli_shared.COLOR_WHITE]
示例11: conf_scr
# 需要导入模块: import curses [as 别名]
# 或者: from curses import use_default_colors [as 别名]
def conf_scr():
'''Configure the screen and colors/etc'''
curses.curs_set(0)
curses.start_color()
curses.use_default_colors()
text, banner, banner_text, background = get_theme_colors()
curses.init_pair(2, text, background)
curses.init_pair(3, banner_text, banner)
curses.halfdelay(10)
示例12: __init__
# 需要导入模块: import curses [as 别名]
# 或者: from curses import use_default_colors [as 别名]
def __init__(self, stdscr, args):
self._stdscr = stdscr
self._dbase = database.load_file(args.database,
encoding=args.encoding,
frame_id_mask=args.frame_id_mask,
strict=not args.no_strict)
self._single_line = args.single_line
self._filtered_sorted_message_names = []
self._filter = ''
self._compiled_filter = None
self._formatted_messages = {}
self._playing = True
self._modified = True
self._show_filter = False
self._queue = Queue()
self._nrows, self._ncols = stdscr.getmaxyx()
self._received = 0
self._discarded = 0
self._basetime = None
self._page = 0
stdscr.keypad(True)
stdscr.nodelay(True)
curses.use_default_colors()
curses.curs_set(False)
curses.init_pair(1, curses.COLOR_BLACK, curses.COLOR_GREEN)
curses.init_pair(2, curses.COLOR_BLACK, curses.COLOR_CYAN)
bus = self.create_bus(args)
self._notifier = can.Notifier(bus, [self])
示例13: __init__
# 需要导入模块: import curses [as 别名]
# 或者: from curses import use_default_colors [as 别名]
def __init__(self, *args, **keywords):
curses.use_default_colors()
super(TransparentThemeDarkText, self).__init__(*args, **keywords)
示例14: __init__
# 需要导入模块: import curses [as 别名]
# 或者: from curses import use_default_colors [as 别名]
def __init__(self):
self.screen = curses.initscr()
self.screen.timeout(100) # the screen refresh every 100ms
# charactor break buffer
curses.cbreak()
self.screen.keypad(1)
curses.start_color()
if Config().get("curses_transparency"):
curses.use_default_colors()
curses.init_pair(1, curses.COLOR_GREEN, -1)
curses.init_pair(2, curses.COLOR_CYAN, -1)
curses.init_pair(3, curses.COLOR_RED, -1)
curses.init_pair(4, curses.COLOR_YELLOW, -1)
else:
curses.init_pair(1, curses.COLOR_GREEN, curses.COLOR_BLACK)
curses.init_pair(2, curses.COLOR_CYAN, curses.COLOR_BLACK)
curses.init_pair(3, curses.COLOR_RED, curses.COLOR_BLACK)
curses.init_pair(4, curses.COLOR_YELLOW, curses.COLOR_BLACK)
# term resize handling
size = terminalsize.get_terminal_size()
self.x = max(size[0], 10)
self.y = max(size[1], 25)
self.startcol = int(float(self.x) / 5)
self.indented_startcol = max(self.startcol - 3, 0)
self.update_space()
self.lyric = ""
self.now_lyric = ""
self.post_lyric = ""
self.now_lyric_index = 0
self.tlyric = ""
self.storage = Storage()
self.config = Config()
self.newversion = False
示例15: init_curses
# 需要导入模块: import curses [as 别名]
# 或者: from curses import use_default_colors [as 别名]
def init_curses(self):
self.stdscr = curses.initscr()
curses.start_color()
curses.use_default_colors()
curses.init_pair(1, curses.COLOR_RED, -1)
curses.init_pair(2, curses.COLOR_YELLOW, -1)
curses.init_pair(3, curses.COLOR_CYAN, -1)
curses.init_pair(4, curses.COLOR_GREEN, -1)
curses.init_pair(5, curses.COLOR_BLUE, -1)