Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create outfile to write progress to #74

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion flomo/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
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)
6 changes: 6 additions & 0 deletions flomo/ui.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import datetime
import threading
import time
import os

import blessed
from rich.align import Align
Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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)