Some good progresspython main.py Started the edit verse functionality. The cards on dashboard now pull dynamically based on the users in the db. Will need to add 'start up' functions that allow you to input your children so everything is scalable. Need to look into auth too.

This commit is contained in:
Norm Rasmussen
2024-10-07 18:14:27 -04:00
parent a05d842a5a
commit 61094c1aac
13 changed files with 73 additions and 42 deletions

29
main.py
View File

@ -16,7 +16,9 @@ HEADERS = { 'Authorization': APIKEY}
def index_page() -> None:
with theme.frame('Homepage'):
with ui.dialog().props('persistent') as addverse:
pass
pass
with ui.dialog().props('persistent') as editverse:
pass
with ui.grid(columns=1).classes('self-center justify-items-center content-center p-2 m-2 rounded-xl'):
users = Utils.get_unique_people()
@ -60,10 +62,10 @@ def index_page() -> None:
label_verse = ui.label(text=item[0]).classes('hidden')
label_passage = ui.label(text=item[1]).classes('hidden')
label_status = ui.label(text=item[2]).classes('hidden')
ui.label(label_verse.text).classes('font-bold')
ui.label(label_verse.text).classes('font-bold text-center')
with ui.row():
ui.label(label_passage.text).classes('text-wrap')
ui.chip("Edit Verse", selectable=True, icon="edit", color="white", on_selection_change=lambda label_verse=label_verse: edit_verse(label_verse.text))
ui.chip("Edit Verse", selectable=True, icon="edit", color="white", on_selection_change=lambda label_verse=label_verse: edit_verse(label_verse.text, person, label_passage.text))
if label_status.text == '1':
ui.chip('Complete',
selectable=True, icon="add", color="positive",
@ -79,20 +81,17 @@ def index_page() -> None:
ui.separator().classes('col-span-5 h-2')
else:
showperson.clear()
addverse.close()
def edit_verse(verse):
ui.notify(f"Edit Verse function is running for {verse}")
# def toggle_completion(verse, person, status):
# ins = cur.execute(f"update tasks set status = '{status}' where person = '{person.value.lower()}' and verse = '{verse}'")
# print(f"update tasks set status = '{status}' where person = '{person.value.lower()}' and verse = '{verse}'")
# db.commit()
# show_person.refresh
# show_person(person)
def edit_verse(verse, person, passage):
editverse.open()
with editverse:
with ui.card().classes('flex-wrap items-center'):
editing = ui.textarea(label="Edit Below", placeholder=passage)
with ui.row().classes('justify-content-center'):
ui.button().props('push glossy icon=add_circle color=secondary').on('click', lambda: submit_verse(result, person))
def add_verse(person):
# TODO: Add check of existing verses so that a user can't add duplicates.
if person.value is None:
ui.notify("Oops! You haven't selected a person")
else:
@ -114,7 +113,7 @@ def index_page() -> None:
# Verify the format of a Bible Verse
if not re.match(r'((^\d\s\w{1,}\s|^\w{1,}\s)(\d{1,2}:)(\d{1,2}-\d{1,2}|\d{1,2}))', result.value):
ui.notify("Verse was input incorrectly.")
addverse.clear()
addverse.close()
else:
# Split up the string for later
colon = result.value.split(':')