From e89b964d271221b0af2f946141ca71615e7c68b1 Mon Sep 17 00:00:00 2001 From: KenwoodFox Date: Sat, 27 Nov 2021 14:59:23 -0500 Subject: [PATCH] Who even needs a window manager anyway --- companion_software/dashboard/dash.py | 37 +++++++++++++------ companion_software/dashboard/requirements.txt | 3 +- 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/companion_software/dashboard/dash.py b/companion_software/dashboard/dash.py index 215b1f5..b4fb530 100644 --- a/companion_software/dashboard/dash.py +++ b/companion_software/dashboard/dash.py @@ -1,15 +1,30 @@ -import urwid +import time +import logging +import verboselogs +import coloredlogs + +verboselogs.install() + +# Create a logger object. +logger = logging.getLogger(__name__) + +# By default the install() function installs a handler on the root logger, +# this means that log messages from your code and log messages from the +# libraries that you use will all show up on the terminal. +coloredlogs.install(level='DEBUG') -def exit_on_q(key): - if key in ('q', 'Q'): - raise urwid.ExitMainLoop() +# If you don't want to see log messages from libraries, you can pass a +# specific logger object to the install() function. In this case only log +# messages originating from that logger will show up on the terminal. +coloredlogs.install(level='DEBUG', logger=logger) +logger.success('Program Started') -txt = urwid.BigText(u" Greatness Awaits... ", urwid.HalfBlock5x4Font()) -test = urwid.Padding(txt, 'center', None) -test = urwid.Filler(test, 'middle', None, 7) - - -loop = urwid.MainLoop(test, unhandled_input=exit_on_q) -loop.run() +# Junk~ +while True: + try: + logger.info('Nothing to do.') + time.sleep(1) + except KeyboardInterrupt: + break diff --git a/companion_software/dashboard/requirements.txt b/companion_software/dashboard/requirements.txt index 0ac3eb6..76b7e67 100644 --- a/companion_software/dashboard/requirements.txt +++ b/companion_software/dashboard/requirements.txt @@ -1 +1,2 @@ -urwid +coloredlogs +verboselogs