project renamed as 'bauh'

This commit is contained in:
Vinicius Moreira
2019-08-12 11:50:24 -03:00
parent 6d891683da
commit 19a11434fe
69 changed files with 202 additions and 321 deletions

31
bauh/core/worker.py Normal file
View File

@@ -0,0 +1,31 @@
from io import StringIO
from threading import Thread
from colorama import Fore
from bauh.core.model import Application
class AsyncDataLoader(Thread):
def __init__(self, app: Application):
super(AsyncDataLoader, self).__init__(daemon=True)
self.id_ = '{}#{}'.format(self.__class__.__name__, id(self))
self.app = app
def log_msg(self, msg: str, color: int = None):
final_msg = StringIO()
if color:
final_msg.write(str(color))
final_msg.write('[{}] '.format(self.id_))
final_msg.write(msg)
if color:
final_msg.write(Fore.RESET)
final_msg.seek(0)
print(final_msg.read())