From 333697394041ae40e70178cf561702d1e649bba1 Mon Sep 17 00:00:00 2001 From: Andrew Luchuk Date: Tue, 25 Nov 2025 20:55:03 -0500 Subject: [PATCH] Begin adding md parser --- codupoc/codupoc.py | 7 +++++-- codupoc/todomanager.py | 17 +++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 codupoc/todomanager.py diff --git a/codupoc/codupoc.py b/codupoc/codupoc.py index 5cb96b7..8e28e54 100644 --- a/codupoc/codupoc.py +++ b/codupoc/codupoc.py @@ -47,8 +47,11 @@ class Codupoc(App[None]): todo.focus() def insert_todo(self, title: str, scroller: VerticalScroll): - id = gen_random_base64(10) - self.todos[id] = { "title": title, "completed": False } + todo_id = gen_random_base64(10) + self.todos[todo_id] = { "title": title, "completed": False } + todo = TodoItem(self, title, id=todo_id) + scroller.mount(todo) + todo.focus() def __init__(self): diff --git a/codupoc/todomanager.py b/codupoc/todomanager.py new file mode 100644 index 0000000..b61e7c2 --- /dev/null +++ b/codupoc/todomanager.py @@ -0,0 +1,17 @@ +import sys +from os import path + +class TodoManager: + filename = "todo.md" + + def __init__(self): + self.file = None + + def does_todo_file_exist(self): + return path.exists(self.filename) + + def open_todo_file(self): + self.file = open(self.filename, "a") + return self.file + + # Parse and save file as needed. \ No newline at end of file