cli: rich initial integration
This commit is contained in:
parent
ab7a7832c2
commit
bd2db73ee5
1 changed files with 20 additions and 0 deletions
|
|
@ -52,6 +52,7 @@ from libervia.frontends.bridge.bridge_frontend import BridgeException
|
|||
from libervia.frontends.tools import misc
|
||||
import xml.etree.ElementTree as ET # FIXME: used temporarily to manage XMLUI
|
||||
from collections import OrderedDict
|
||||
from rich import console
|
||||
|
||||
## bridge handling
|
||||
# we get bridge name from conf and initialise the right class accordingly
|
||||
|
|
@ -106,6 +107,7 @@ class LiberviaCli:
|
|||
@attribute progress_failure(callable): method to call when progress failed
|
||||
by default display a message
|
||||
"""
|
||||
self.console = console.Console(theme=C.THEME_DEFAULT)
|
||||
self.sat_conf = main_config
|
||||
self.set_color_theme()
|
||||
bridge_module = dynamic_import.bridge(bridge_name, 'libervia.frontends.bridge')
|
||||
|
|
@ -734,6 +736,7 @@ class LiberviaCli:
|
|||
def run(cls):
|
||||
cls()._run()
|
||||
|
||||
|
||||
def _read_stdin(self, stdin_fut):
|
||||
"""Callback called by ainput to read stdin"""
|
||||
line = sys.stdin.readline()
|
||||
|
|
@ -1122,6 +1125,13 @@ class CommandBase:
|
|||
def progress_id(self):
|
||||
return self.host.progress_id
|
||||
|
||||
@property
|
||||
def console(self):
|
||||
return self.host.console
|
||||
|
||||
def print(self, *args, **kwargs):
|
||||
self.host.console.print(*args, **kwargs)
|
||||
|
||||
async def set_progress_id(self, progress_id):
|
||||
return await self.host.set_progress_id(progress_id)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue