當前位置: 首頁>>代碼示例>>Python>>正文


Python curses.COLOR_BLUE屬性代碼示例

本文整理匯總了Python中curses.COLOR_BLUE屬性的典型用法代碼示例。如果您正苦於以下問題:Python curses.COLOR_BLUE屬性的具體用法?Python curses.COLOR_BLUE怎麽用?Python curses.COLOR_BLUE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在curses的用法示例。


在下文中一共展示了curses.COLOR_BLUE屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: import curses [as 別名]
# 或者: from curses import COLOR_BLUE [as 別名]
def __init__(self, use_colors):
		logging.Handler.__init__(self)
		self.use_colors = use_colors

		# Initialize environment
		curses.setupterm()

		# Get the foreground color attribute for this environment
		self.fcap = curses.tigetstr('setaf')

		#Get the normal attribute
		self.COLOR_NORMAL = curses.tigetstr('sgr0')

		# Get + Save the color sequences
		self.COLOR_INFO = curses.tparm(self.fcap, curses.COLOR_GREEN)
		self.COLOR_ERROR = curses.tparm(self.fcap, curses.COLOR_RED)
		self.COLOR_WARNING = curses.tparm(self.fcap, curses.COLOR_YELLOW)
		self.COLOR_DEBUG = curses.tparm(self.fcap, curses.COLOR_BLUE) 
開發者ID:imalisamar,項目名稱:emailhunter-clone,代碼行數:20,代碼來源:ColorStreamHandler.py

示例2: setup

# 需要導入模塊: import curses [as 別名]
# 或者: from curses import COLOR_BLUE [as 別名]
def setup(self):
        curses.start_color()
        curses.init_pair(1, curses.COLOR_WHITE, curses.COLOR_BLUE)

        curses.cbreak()
        curses.echo()

        lines, cols = self.stdscr.getmaxyx()
        self.logwin = self.stdscr.subwin(lines - 2, cols, 0, 0)
        self.sepwin = self.stdscr.subwin(1, cols, lines - 2, 0)
        self.cmdwin = self.stdscr.subwin(1, cols, lines - 1, 0)

        self.logwin.scrollok(True)

        self.sepwin.bkgd(curses.color_pair(1))
        self.sepwin.refresh() 
開發者ID:flux3dp,項目名稱:fluxclient,代碼行數:18,代碼來源:console.py

示例3: _initialize_colors

# 需要導入模塊: import curses [as 別名]
# 或者: from curses import COLOR_BLUE [as 別名]
def _initialize_colors(self):
        """Function for initialzing curses colors. Called when CUI is first created.
        """

        # Start colors in curses
        curses.start_color()
        curses.init_pair(WHITE_ON_BLACK,    curses.COLOR_WHITE,     curses.COLOR_BLACK)
        curses.init_pair(BLACK_ON_GREEN,    curses.COLOR_BLACK,     curses.COLOR_GREEN)
        curses.init_pair(BLACK_ON_WHITE,    curses.COLOR_BLACK,     curses.COLOR_WHITE)
        curses.init_pair(WHITE_ON_RED,      curses.COLOR_WHITE,     curses.COLOR_RED)
        curses.init_pair(YELLOW_ON_BLACK,   curses.COLOR_YELLOW,    curses.COLOR_BLACK)
        curses.init_pair(RED_ON_BLACK,      curses.COLOR_RED,       curses.COLOR_BLACK)
        curses.init_pair(CYAN_ON_BLACK,     curses.COLOR_CYAN,      curses.COLOR_BLACK)
        curses.init_pair(MAGENTA_ON_BLACK,  curses.COLOR_MAGENTA,   curses.COLOR_BLACK)
        curses.init_pair(GREEN_ON_BLACK,    curses.COLOR_GREEN,     curses.COLOR_BLACK)
        curses.init_pair(BLUE_ON_BLACK,     curses.COLOR_BLUE,      curses.COLOR_BLACK) 
開發者ID:jwlodek,項目名稱:py_cui,代碼行數:18,代碼來源:__init__.py

示例4: setup_palette

# 需要導入模塊: import curses [as 別名]
# 或者: from curses import COLOR_BLUE [as 別名]
def setup_palette(class_):
        curses.init_pair(1, curses.COLOR_WHITE, curses.COLOR_BLACK)
        curses.init_pair(2, curses.COLOR_BLUE, curses.COLOR_BLACK)
        curses.init_pair(3, curses.COLOR_GREEN, curses.COLOR_BLACK)
        curses.init_pair(4, curses.COLOR_YELLOW, curses.COLOR_BLACK)
        curses.init_pair(5, curses.COLOR_RED, curses.COLOR_BLACK)
        curses.init_pair(6, curses.COLOR_CYAN, curses.COLOR_BLACK)
        curses.init_pair(7, curses.COLOR_MAGENTA, curses.COLOR_BLACK)
        curses.init_pair(8, curses.COLOR_WHITE, curses.COLOR_BLUE)
        curses.init_pair(9, curses.COLOR_WHITE, curses.COLOR_RED)

        class_.WHITE = curses.color_pair(1)
        class_.BLUE = curses.color_pair(2)
        class_.GREEN = curses.color_pair(3)
        class_.YELLOW = curses.color_pair(4)
        class_.RED = curses.color_pair(5)
        class_.CYAN = curses.color_pair(6)
        class_.MAGENTA = curses.color_pair(7)
        class_.WHITE_ON_BLUE = curses.color_pair(8)
        class_.WHITE_ON_RED = curses.color_pair(9)

        class_.HASHTAG = class_.BLUE | curses.A_BOLD 
開發者ID:ihabunek,項目名稱:toot,代碼行數:24,代碼來源:app.py

示例5: init_colors

# 需要導入模塊: import curses [as 別名]
# 或者: from curses import COLOR_BLUE [as 別名]
def init_colors(self):

        if curses.has_colors() and curses.can_change_color():
            curses.init_color(self.COLOR_BLACK, 0, 0, 0)
            curses.init_color(self.COLOR_WHITE, 1000, 1000, 1000)
            curses.init_color(self.COLOR_BLUE, 0, 0, 1000)
            curses.init_color(self.COLOR_RED, 1000, 0, 0)
            curses.init_color(self.COLOR_GREEN, 0, 1000, 0)

            for i in xrange(0, self.GRAYS):
                curses.init_color(
                        self.GRAY_BASE + i,
                        i * 1000 / (self.GRAYS - 1),
                        i * 1000 / (self.GRAYS - 1),
                        i * 1000 / (self.GRAYS - 1)
                        )
                curses.init_pair(
                        self.GRAY_BASE + i,
                        self.GRAY_BASE + i,
                        self.COLOR_BLACK
                        )

        else:
            self.COLOR_BLACK = curses.COLOR_BLACK
            self.COLOR_WHITE = curses.COLOR_WHITE
            self.COLOR_BLUE = curses.COLOR_BLUE
            self.COLOR_RED = curses.COLOR_RED
            self.COLOR_GREEN = curses.COLOR_GREEN

            for i in xrange(0, self.GRAYS):
                curses.init_pair(
                        self.GRAY_BASE + i,
                        self.COLOR_WHITE,
                        self.COLOR_BLACK
                        )

        curses.init_pair(self.BLACK, self.COLOR_BLACK, self.COLOR_BLACK)
        curses.init_pair(self.WHITE, self.COLOR_WHITE, self.COLOR_BLACK)
        curses.init_pair(self.BLUE, self.COLOR_BLUE, self.COLOR_BLACK)
        curses.init_pair(self.RED, self.COLOR_RED, self.COLOR_BLACK)
        curses.init_pair(self.GREEN, self.COLOR_GREEN, self.COLOR_BLACK) 
開發者ID:Battelle,項目名稱:sandsifter,代碼行數:43,代碼來源:gui.py

示例6: setup

# 需要導入模塊: import curses [as 別名]
# 或者: from curses import COLOR_BLUE [as 別名]
def setup(self, stdscr):
        fm_log(logger, 'init baidufm fm cli')
        self.stdscr = stdscr

        # init color
        curses.init_pair(1, curses.COLOR_CYAN, curses.COLOR_BLACK)
        curses.init_pair(2, curses.COLOR_BLUE, curses.COLOR_BLACK)
        curses.init_pair(3, curses.COLOR_YELLOW, curses.COLOR_BLACK)
        curses.init_pair(4, curses.COLOR_GREEN, curses.COLOR_BLACK)
        curses.init_pair(5, curses.COLOR_WHITE, curses.COLOR_BLACK)
        curses.init_pair(6, curses.COLOR_BLACK, curses.COLOR_MAGENTA)
        curses.init_pair(7, curses.COLOR_BLACK, curses.COLOR_GREEN)
        curses.init_pair(8, curses.COLOR_MAGENTA, curses.COLOR_BLACK)
        curses.init_pair(9, curses.COLOR_GREEN, curses.COLOR_BLACK)
        curses.init_pair(10, curses.COLOR_RED, curses.COLOR_BLACK)

        curses.start_color()
        for i in range(0, curses.COLORS):
            if i < 10:
                continue
            curses.init_pair(i + 1, curses.COLOR_BLACK, i)

        self.player = choose_player()(self.footer, self.event)

        self.stdscr.nodelay(0)
        self.setup_and_draw_screen()
        self.run() 
開發者ID:tdoly,項目名稱:baidufm-py,代碼行數:29,代碼來源:fm_cli.py

示例7: init_curses

# 需要導入模塊: import curses [as 別名]
# 或者: from curses import COLOR_BLUE [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) 
開發者ID:IC3Net,項目名稱:IC3Net,代碼行數:11,代碼來源:traffic_junction_env.py

示例8: __init__

# 需要導入模塊: import curses [as 別名]
# 或者: from curses import COLOR_BLUE [as 別名]
def __init__(self):
        """
        Setup the main screen, progress bars and logging box
        """
        self.screen = curses.initscr()
        curses.curs_set(0)

        curses.start_color()
        curses.init_pair(1, curses.COLOR_RED, curses.COLOR_BLACK)
        curses.init_pair(2, curses.COLOR_GREEN, curses.COLOR_BLACK)
        curses.init_pair(3, curses.COLOR_MAGENTA, curses.COLOR_BLACK)
        curses.init_pair(4, curses.COLOR_CYAN, curses.COLOR_BLACK)
        curses.init_pair(5, curses.COLOR_BLUE, curses.COLOR_BLACK)
        curses.init_pair(6, curses.COLOR_YELLOW, curses.COLOR_BLACK)

        self.height, self.width = self.screen.getmaxyx()
        self.screen.border()

        self.preptotal()
        self.prepcurrent()
        self.preplog()
        self.banner()
        self.sig()

        self.drives = len(glob.glob("/dev/sd?1"))
        self.donedrives = 0
        self.prevprogress = 0
        self.loglines = []
        self.idx = 1 
開發者ID:AonCyberLabs,項目名稱:EvilAbigail,代碼行數:31,代碼來源:evilmaid.py

示例9: show_model

# 需要導入模塊: import curses [as 別名]
# 或者: from curses import COLOR_BLUE [as 別名]
def show_model(model, cfg={}, num_frozen=0):
    """
    Shows an interactive view of the model on a connected TTY.

    @type model
      A model instance from this module.
    """
    full_cfg = dict(DEFAULT_CFG)
    full_cfg.update(cfg)
    cfg = full_cfg

    view = GridView(model, cfg, num_frozen=num_frozen)
    scr = curses.initscr()

    curses.start_color()
    curses.use_default_colors()
    curses.init_pair(1, -1, -1)                                     # normal
    curses.init_pair(2, curses.COLOR_BLUE, -1)                      # frozen
    curses.init_pair(3, -1, -1)                                     # separator
    curses.init_pair(4, -1, -1)                                     # footer
    curses.init_pair(5, curses.COLOR_BLACK, curses.COLOR_WHITE)     # cursor
    curses.init_pair(6, curses.COLOR_WHITE, curses.COLOR_BLUE)      # selection
    curses.init_pair(7, curses.COLOR_BLUE,  curses.COLOR_WHITE)     # frz sel

    try:
        curses.noecho()
        curses.cbreak()
        scr.keypad(1)
        view.set_screen(scr, locale.getpreferredencoding())
        view.show()
    finally:
        curses.nocbreak()
        scr.keypad(0)
        curses.echo()
        curses.endwin() 
開發者ID:twosigma,項目名稱:ngrid,代碼行數:37,代碼來源:grid.py

示例10: gather_info

# 需要導入模塊: import curses [as 別名]
# 或者: from curses import COLOR_BLUE [as 別名]
def gather_info(self, screen, info):
        """
        Get the information from pywifiphisher and print them out
        :param self: A TuiMain object
        :param screen: A curses window object
        :param info: A namedtuple of printing information
        :type self: TuiMain
        :type screen: _curses.curses.window
        :type info: namedtuple
        :return: None
        :rtype: None
        """

        # setup curses
        try:
            curses.curs_set(0)
        except curses.error:
            pass
        screen.nodelay(True)
        curses.init_pair(1, curses.COLOR_BLUE, screen.getbkgd())
        curses.init_pair(2, curses.COLOR_YELLOW, screen.getbkgd())
        curses.init_pair(3, curses.COLOR_RED, screen.getbkgd())
        self.blue_text = curses.color_pair(1) | curses.A_BOLD
        self.yellow_text = curses.color_pair(2) | curses.A_BOLD
        self.red_text = curses.color_pair(3) | curses.A_BOLD

        while True:
            # catch the exception when screen size is smaller than
            # the text length
            is_done = self.display_info(screen, info)
            if is_done:
                return 
開發者ID:wifiphisher,項目名稱:wifiphisher,代碼行數:34,代碼來源:tui.py

示例11: init_curses

# 需要導入模塊: import curses [as 別名]
# 或者: from curses import COLOR_BLUE [as 別名]
def init_curses(self):
		"""
		This initializes the screen for curses useage.  It must be
		called before Curses can be used.
		"""
		self.user_marker_pos = 1  # Used with curses
		self.curses_row_offset = 0  # Used for marking the visible rows on the screen to allow scrolling
		self.curses_row_offset_store = 0  # Used for storing the row offset when switching from detailed to non-detailed view modes
		self.curses_detailed = None  # Used with curses
		self.screen = curses.initscr()
		curses.start_color()
		curses.init_pair(1, curses.COLOR_BLUE, curses.COLOR_WHITE)
		size = self.screen.getmaxyx()
		if size[0] < CURSES_MIN_Y or size[1] < CURSES_MIN_X:
			curses.endwin()
			return 1
		self.curses_max_rows = size[0] - 2  # Minus 2 for the border on the top and bottom
		self.curses_max_columns = size[1] - 2

		self.screen.border(0)
		self.screen.addstr(2, TAB_LENGTH, 'EAPeak Capturing Live')
		self.screen.addstr(3, TAB_LENGTH, 'Found 0 Networks')
		self.screen.addstr(4, TAB_LENGTH, 'Processed 0 Packets')
		self.screen.addstr(self.user_marker_pos + USER_MARKER_OFFSET, TAB_LENGTH, USER_MARKER)
		self.screen.refresh()
		try:
			curses.curs_set(1)
			curses.curs_set(0)
		except curses.error:  # Ignore exceptions from terminals that don't support setting the cursor's visibility
			pass
		curses.noecho()
		curses.cbreak()
		self.curses_enabled = True
		self.curses_lower_refresh_counter = 1
		return 0 
開發者ID:rsmusllp,項目名稱:eapeak,代碼行數:37,代碼來源:parse.py

示例12: __init__

# 需要導入模塊: import curses [as 別名]
# 或者: from curses import COLOR_BLUE [as 別名]
def __init__(self, map_name='world', map_conf=None, window=None, encoding=None):
        if map_conf is None:
            map_conf = MAPS[map_name]
        self.map = map_conf['data']
        self.coords = map_conf['coords']
        self.corners = map_conf['corners']
        if window is None:
            window = curses.newwin(0, 0)
        self.window = window

        self.data = []
        self.data_timestamp = None

        # JSON contents _should_ be UTF8 (so, python internal unicode here...)
        if encoding is None:
            encoding = locale.getpreferredencoding()
        self.encoding = encoding

        # check if we can use transparent background or not
        if curses.can_change_color():
            curses.use_default_colors()
            background = -1
        else:
            background = curses.COLOR_BLACK

        tmp_colors = [
            ('red', curses.COLOR_RED, background),
            ('blue', curses.COLOR_BLUE, background),
            ('pink', curses.COLOR_MAGENTA, background)
        ]

        self.colors = {}
        if curses.has_colors():
            for i, (name, fgcolor, bgcolor) in enumerate(tmp_colors, 1):
                curses.init_pair(i, fgcolor, bgcolor)
                self.colors[name] = i 
開發者ID:sabri-zaki,項目名稱:EasY_HaCk,代碼行數:38,代碼來源:worldmap.py

示例13: updateDecoratedMatch

# 需要導入模塊: import curses [as 別名]
# 或者: from curses import COLOR_BLUE [as 別名]
def updateDecoratedMatch(self, maxLen=None):
        '''Update the cached decorated match formatted string, and
        dirty the line, if needed'''
        if self.hovered and self.selected:
            attributes = (curses.COLOR_WHITE, curses.COLOR_RED,
                          FormattedText.BOLD_ATTRIBUTE)
        elif self.hovered:
            attributes = (curses.COLOR_WHITE, curses.COLOR_BLUE,
                          FormattedText.BOLD_ATTRIBUTE)
        elif self.selected:
            attributes = (curses.COLOR_WHITE, curses.COLOR_GREEN,
                          FormattedText.BOLD_ATTRIBUTE)
        elif not self.allInput:
            attributes = (0, 0, FormattedText.UNDERLINE_ATTRIBUTE)
        else:
            attributes = (0, 0, 0)

        decoratorText = self.getDecorator()

        # we may not be connected to a controller (during processInput,
        # for example)
        if self.controller:
            self.controller.dirtyLine(self.index)

        plainText = decoratorText + self.getMatch()
        if maxLen and len(plainText + str(self.beforeText)) > maxLen:
            # alright, we need to chop the ends off of our
            # decorated match and glue them together with our
            # truncation decorator. We subtract the length of the
            # before text since we consider that important too.
            spaceAllowed = maxLen - len(self.TRUNCATE_DECORATOR) \
                - len(decoratorText) \
                - len(str(self.beforeText))
            midPoint = int(spaceAllowed / 2)
            beginMatch = plainText[0:midPoint]
            endMatch = plainText[-midPoint:len(plainText)]
            plainText = beginMatch + self.TRUNCATE_DECORATOR + endMatch

        self.decoratedMatch = FormattedText(
            FormattedText.getSequenceForAttributes(*attributes) +
            plainText) 
開發者ID:facebook,項目名稱:PathPicker,代碼行數:43,代碼來源:format.py

示例14: define_colors

# 需要導入模塊: import curses [as 別名]
# 或者: from curses import COLOR_BLUE [as 別名]
def define_colors(self):
        # TODO: implement colors
        # set curses color pairs manually
        curses.init_pair(1, curses.COLOR_BLACK, curses.COLOR_WHITE)
        curses.init_pair(2, curses.COLOR_WHITE, curses.COLOR_BLACK)
        curses.init_pair(3, curses.COLOR_GREEN, curses.COLOR_BLACK)
        curses.init_pair(4, curses.COLOR_BLUE, curses.COLOR_BLACK)
        curses.init_pair(5, curses.COLOR_MAGENTA, curses.COLOR_BLACK)
        curses.init_pair(6, curses.COLOR_YELLOW, curses.COLOR_BLACK)
        curses.init_pair(7, curses.COLOR_RED, curses.COLOR_BLACK)
        curses.init_pair(8, curses.COLOR_CYAN, curses.COLOR_BLACK) 
開發者ID:jifunks,項目名稱:botany,代碼行數:13,代碼來源:menu_screen.py

示例15: init_colors

# 需要導入模塊: import curses [as 別名]
# 或者: from curses import COLOR_BLUE [as 別名]
def init_colors(self):
        if curses.has_colors() and curses.can_change_color():
            curses.init_color(self.COLOR_BLACK, 0, 0, 0)
            curses.init_color(self.COLOR_WHITE, 1000, 1000, 1000)
            curses.init_color(self.COLOR_BLUE, 0, 0, 1000)
            curses.init_color(self.COLOR_RED, 1000, 0, 0)
            curses.init_color(self.COLOR_GREEN, 0, 1000, 0)

            # this will remove flicker, but gives boring colors
            '''
            self.COLOR_BLACK = curses.COLOR_BLACK
            self.COLOR_WHITE = curses.COLOR_WHITE
            self.COLOR_BLUE = curses.COLOR_BLUE
            self.COLOR_RED = curses.COLOR_RED
            self.COLOR_GREEN = curses.COLOR_GREEN
            '''

            for i in xrange(0, self.GRAYS):
                curses.init_color(
                        self.GRAY_BASE + i,
                        i * 1000 / (self.GRAYS - 1),
                        i * 1000 / (self.GRAYS - 1),
                        i * 1000 / (self.GRAYS - 1)
                        )
                curses.init_pair(
                        self.GRAY_BASE + i,
                        self.GRAY_BASE + i,
                        self.COLOR_BLACK
                        )

        else:
            self.COLOR_BLACK = curses.COLOR_BLACK
            self.COLOR_WHITE = curses.COLOR_WHITE
            self.COLOR_BLUE = curses.COLOR_BLUE
            self.COLOR_RED = curses.COLOR_RED
            self.COLOR_GREEN = curses.COLOR_GREEN

            for i in xrange(0, self.GRAYS):
                curses.init_pair(
                        self.GRAY_BASE + i,
                        self.COLOR_WHITE,
                        self.COLOR_BLACK
                        )

        curses.init_pair(self.BLACK, self.COLOR_BLACK, self.COLOR_BLACK)
        curses.init_pair(self.WHITE, self.COLOR_WHITE, self.COLOR_BLACK)
        curses.init_pair(self.BLUE, self.COLOR_BLUE, self.COLOR_BLACK)
        curses.init_pair(self.RED, self.COLOR_RED, self.COLOR_BLACK)
        curses.init_pair(self.GREEN, self.COLOR_GREEN, self.COLOR_BLACK) 
開發者ID:Battelle,項目名稱:sandsifter,代碼行數:51,代碼來源:sifter.py


注:本文中的curses.COLOR_BLUE屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。