Mercurial > libervia-backend
diff sat_frontends/jp/cmd_debug.py @ 3047:cf843dd7c345
jp (debug): new "theme" command to print colour theme according to `background` value:
fix 321
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 01 Oct 2019 22:49:11 +0200 |
parents | fee60f17ebac |
children | 9d0df638c8b4 |
line wrap: on
line diff
--- a/sat_frontends/jp/cmd_debug.py Tue Oct 01 22:49:10 2019 +0200 +++ b/sat_frontends/jp/cmd_debug.py Tue Oct 01 22:49:11 2019 +0200 @@ -187,8 +187,34 @@ self.host.bridge.register_signal("xmlLog", self.printXML, "plugin") +class Theme(base.CommandBase): + def __init__(self, host): + base.CommandBase.__init__( + self, host, "theme", help=_("print colours used with your background") + ) + + def add_parser_options(self): + pass + + async def start(self): + for attr in dir(C): + if not attr.startswith('A_'): + continue + color = getattr(C, attr) + if attr == 'A_LEVEL_COLORS': + # This constant contains multiple colors + self.disp('LEVEL COLORS: ', no_lf=True) + for idx, c in enumerate(color): + last = idx == len(color)-1 + self.disp(c + f'LEVEL_{idx}' + A.RESET + (', ' if not last else ''), no_lf=not last) + else: + text = attr[2:] + self.disp(A.color(color, text)) + self.host.quit() + + class Debug(base.CommandBase): - subcommands = (Bridge, Monitor) + subcommands = (Bridge, Monitor, Theme) def __init__(self, host): super(Debug, self).__init__(