add basic database functionality #9
@@ -21,6 +21,8 @@ class Database:
|
||||
if is_new_database:
|
||||
self.initialize_table()
|
||||
|
||||
for i in range(0, 15):
|
||||
self.create_task(f"task{i}", bool(i%2))
|
||||
def initialize_table(self):
|
||||
self.cur.execute("CREATE TABLE tasks(title TEXT, is_done INTEGER)")
|
||||
|
||||
|
||||
@@ -1,9 +1,19 @@
|
||||
from textual.app import App, ComposeResult
|
||||
from textual.widgets import Header
|
||||
|
||||
from textual.widgets import Header, Checkbox
|
||||
from textual.containers import VerticalScroll
|
||||
from .database import Database
|
||||
|
||||
class ChoreManagerTui(App):
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.database = Database("DEBUG")
|
||||
|
||||
def compose(self) -> ComposeResult:
|
||||
yield Header()
|
||||
tasks = self.database.get_all_tasks()
|
||||
with VerticalScroll():
|
||||
for task in tasks:
|
||||
yield Checkbox(task.title, task.is_done)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user