jp (debug): new "theme" command to print colour theme according to background value:
fix 321
This commit is contained in:
parent
1efb60a429
commit
5a2d7e2943
2 changed files with 41 additions and 1 deletions
|
|
@ -77,3 +77,17 @@ example
|
||||||
Monitor raw XML stream::
|
Monitor raw XML stream::
|
||||||
|
|
||||||
$ jp debug monitor -v
|
$ jp debug monitor -v
|
||||||
|
|
||||||
|
theme
|
||||||
|
=====
|
||||||
|
|
||||||
|
Show the colour constants in their respective colour, according to background (``light``
|
||||||
|
or ``dark``). If backround option is not set in ``sat.conf``, it will be autodetected, and
|
||||||
|
colour theme will be modified accordingly.
|
||||||
|
|
||||||
|
example
|
||||||
|
-------
|
||||||
|
|
||||||
|
Show colours with the set background::
|
||||||
|
|
||||||
|
$ jp debug theme
|
||||||
|
|
|
||||||
|
|
@ -187,8 +187,34 @@ class Monitor(base.CommandBase):
|
||||||
self.host.bridge.register_signal("xmlLog", self.printXML, "plugin")
|
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):
|
class Debug(base.CommandBase):
|
||||||
subcommands = (Bridge, Monitor)
|
subcommands = (Bridge, Monitor, Theme)
|
||||||
|
|
||||||
def __init__(self, host):
|
def __init__(self, host):
|
||||||
super(Debug, self).__init__(
|
super(Debug, self).__init__(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue