diff --git a/flomo/helpers.py b/flomo/helpers.py index b5738dd..72315f7 100644 --- a/flomo/helpers.py +++ b/flomo/helpers.py @@ -89,4 +89,12 @@ def tag_color(tag: str) -> str: for k, v in config.Config().get_config(config.TAG_COLORS).items() } - return tag_colors.get(tag, "blue") \ No newline at end of file + return tag_colors.get(tag, "blue") + +def outfile(status: str, file: str, time: int) -> str: + + with open(file, "w") as f: + f.write(f"{format_time(time)} - {status}") + +if __name__ == "__main__": + outfile(1, "tst", 22) diff --git a/flomo/ui.py b/flomo/ui.py index d45f587..9ace80b 100644 --- a/flomo/ui.py +++ b/flomo/ui.py @@ -1,6 +1,7 @@ import datetime import threading import time +import os import blessed from rich.align import Align @@ -31,6 +32,7 @@ def __init__( f"bold {self.tag_color}" if self.status == 0 else "bold red" ) + self.out = helpers.get_path("outfile", in_data=True) self.terminal = blessed.Terminal() @@ -58,10 +60,13 @@ def show_live_panel(self): time.sleep(1) if self.status == 0: self.stopwatch += 1 + helpers.outfile("flowing", self.out, self.stopwatch) elif self.status == 1 and self.chilling_time: if not (self.chilling_time > 1): break self.chilling_time -= 1 + helpers.outfile("chillin", self.out, self.chilling_time) + _live.update(self.generate_panel()) def get_input(self): @@ -128,3 +133,4 @@ def main(tag: str, name: str, session_id: str): # chilling_panel_thread.join() finally: tracker.end_session(session_id) + os.remove(UI("","","").out)