

def register_palette(self, palette):
    'Register a set of palette entries.\n\n        palette -- a list of (name, like_other_name) or\n        (name, foreground, background, mono, foreground_high,\n        background_high) tuples\n\n            The (name, like_other_name) format will copy the settings\n            from the palette entry like_other_name, which must appear\n            before this tuple in the list.\n\n            The mono and foreground/background_high values are\n            optional ie. the second tuple format may have 3, 4 or 6\n            values.  See register_palette_entry() for a description\n            of the tuple values.\n        '
    for item in palette:
        if (len(item) in (3, 4, 6)):
            self.register_palette_entry(*item)
            continue
        if (len(item) != 2):
            raise ScreenError(('Invalid register_palette entry: %s' % repr(item)))
        (name, like_name) = item
        if (not self._palette.has_key(like_name)):
            raise ScreenError(("palette entry '%s' doesn't exist" % like_name))
        self._palette[name] = self._palette[like_name]

dataset/ETHPy150Open AnyMesh/anyMesh-Python/example/urwid/display_common.py BaseScreen.register_palette/original