Skip to content

Commit

Permalink
Add support for rich update
Browse files Browse the repository at this point in the history
  • Loading branch information
beatro0t committed Apr 7, 2021
1 parent 0b1368b commit cd2d65c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/util/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,11 @@ def emit(self, record):
class Operation(Progress):

table = None
live = None

def __init__(self, table):
super().__init__()
self.live.vertical_overflow = "visible"
self.table = table

def get_renderables(self):
Expand Down Expand Up @@ -162,7 +164,7 @@ def item(self, message):

service = self.__class__(name=message)
service.add_column(message, justify="center")
service.thread = self.thread
service.thread = self.thread.live

self.add_row(service)
self.spacer()
Expand Down Expand Up @@ -285,7 +287,7 @@ def read(main, message, value):

while True:

with console.thread._lock:
with console.thread.live._lock:
char = readchar()
# Enter
if ord(char) == 13:
Expand Down Expand Up @@ -382,15 +384,15 @@ def _annotate(self, message="", style=None):
self.refresh()

def start(self):
if not console.thread._started:
if not console.thread.live._started:
self.thread.start()

def refresh(self):
if self.thread is not None and self.thread._started:
if self.thread is not None:
self.thread.refresh()

def stop(self):
if console.thread._started:
if console.thread.live._started:
self.thread.stop()
self.console.print()

Expand Down

0 comments on commit cd2d65c

Please sign in to comment.