Skip to content

Commit

Permalink
Disappear the cursor while running
Browse files Browse the repository at this point in the history
  • Loading branch information
davesteele committed Jul 17, 2021
1 parent 52a844b commit ffeb47f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
30 changes: 18 additions & 12 deletions comitup_watch/comitup_mon.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,15 +343,21 @@ def print_list(self):
print(table_text)

async def run(self):
while True:
msg = await self.q.get()

if type(msg) == DeviceMonMsg:
self.proc_dev_msg(msg)
elif type(msg) == AvahiMessage:
self.proc_avahi_msg(msg)
elif type(msg) == PingMessage:
self.proc_ping_msg(msg)

if any([x.needs_update() for x in self.clist]):
self.print_list()

print("\x1b[?25l")

try:
while True:
msg = await self.q.get()

if type(msg) == DeviceMonMsg:
self.proc_dev_msg(msg)
elif type(msg) == AvahiMessage:
self.proc_avahi_msg(msg)
elif type(msg) == PingMessage:
self.proc_ping_msg(msg)

if any([x.needs_update() for x in self.clist]):
self.print_list()
finally:
print("\x1b[?25h")
1 change: 1 addition & 0 deletions comitup_watch/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ def main():
try:
loop.run_forever()
except KeyboardInterrupt:
print("\x1b[?25h")
print("\r ")

0 comments on commit ffeb47f

Please sign in to comment.