From 13a15b95ade73f4455db648b70e1de784c515039 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Sun, 14 Jan 2024 03:25:15 +0100 Subject: [PATCH] Improve accounting scripts. --- ledger.py | 261 ++++++------ todo.py | 754 ++++++++++++++++++++++++++--------- todo_templates/base.html | 12 +- todo_templates/calendar.html | 11 +- todo_templates/day.html | 2 +- todo_templates/task.html | 2 + todo_templates/tasks.html | 26 +- todo_templates/todo.html | 31 +- 8 files changed, 785 insertions(+), 314 deletions(-) diff --git a/ledger.py b/ledger.py index aa295d2..a26ca0f 100755 --- a/ledger.py +++ b/ledger.py @@ -15,6 +15,21 @@ class EditableException(PlomException): super().__init__(*args, **kwargs) +class LedgerTextLine: + + def __init__(self, text_line): + self.text_line = text_line + self.comment = '' + split_by_comment = text_line.rstrip().split(sep=';', maxsplit=1) + self.non_comment = split_by_comment[0].rstrip() + self.empty = len(split_by_comment) == 1 and len(self.non_comment) == 0 + if self.empty: + return + if len(split_by_comment) == 2: + self.comment = split_by_comment[1].lstrip() + + + # html_head = """ # -tasks: list add | day: -choose tasks -do tasks -| calendar -| unset cookie +tasks: list add | day: +choose tasks +do tasks +do day +| calendar +| unset cookie +| NEW
{% block content %} {% endblock %} diff --git a/todo_templates/calendar.html b/todo_templates/calendar.html index 5d49b5a..1bfb883 100644 --- a/todo_templates/calendar.html +++ b/todo_templates/calendar.html @@ -1,7 +1,8 @@ {% extends 'base.html' %} {% block css %} +tr td { background-color: white; } tr.week_row td { height: 0.1em; background-color: black; } -tr.day_row td { background-color: #f2f2f2 } +tr.day_row td { background-color: #cccccc } td.checkbox { width: 0.1em; height: 0.1em; padding: 0em; text-align: center; } {% endblock %} {% block content %} @@ -14,11 +15,13 @@ to: {% for date, day in days.items() | sort() %} {% if day.weekday == 'Mo' %}{% endif %} -{{ day.weekday }} {{ date }} |{{ '%04.1f' % day.todos_sum|round(2) }}| {{ day.comment|e }} -{% for task, todo in day.todos.items() | sort(attribute='1.title', reverse=True) %} +{{ day.weekday }} {{ date }} |{{ '%04.1f' % day.todos_sum|round(2) }}| {{ day.comment|e }} +{% for todo in day.linked_todos_as_list %} + {% if todo.visible %} -{% if todo.done %}✓{% else %}  {% endif %}{%if "cancelled" in todo.tags%}{% endif %}{% if "deadline" in todo.tags %}DEADLINE: {% endif %}{{ todo.title|e }}{%if "cancelled" in todo.tags%}{% endif %}{{ todo.comment|e }} +{% if todo.done and not "cancelled" in todo.tags%}✓{% else %}  {% endif %}{% if "cancelled" in todo.tags %}{% endif %}{% if "deadline" in todo.tags %}DEADLINE: {% endif %}{{ todo.title|e }}{%if "cancelled" in todo.tags%}{% endif %}{{ todo.comment|e }} {% endif %} + {% endfor %} {% endfor %} diff --git a/todo_templates/day.html b/todo_templates/day.html index 6231aea..05b5fd7 100644 --- a/todo_templates/day.html +++ b/todo_templates/day.html @@ -1,7 +1,7 @@ {% extends 'base.html' %} {% block css %} table.alternating tr:nth-child(even) { - background-color: #e2e2e2; + background-color: #cccccc; } table.alternating tr:nth-child(odd) { background-color: #ffffff; diff --git a/todo_templates/task.html b/todo_templates/task.html index b0ed3e8..e752b27 100644 --- a/todo_templates/task.html +++ b/todo_templates/task.html @@ -14,6 +14,8 @@ textarea { width: 100% }; + +
title
history
    {% for k,v in task.title_history.items() | sort(attribute='0', reverse=True) %}
  • {{ k }}: {{ v|e }}{% endfor %}
selected for {{db.selected_date}}
comment
default effort
history
    {% for k,v in task.default_effort_history.items() | sort(attribute='0', reverse=True) %}
  • {{ k }}: {{ v|e }}{% endfor %}
tags diff --git a/todo_templates/tasks.html b/todo_templates/tasks.html index 7d245dc..7943b82 100644 --- a/todo_templates/tasks.html +++ b/todo_templates/tasks.html @@ -1,12 +1,13 @@ {% extends 'base.html' %} {% block css %} table.alternating tr:nth-child(even) { - background-color: #e2e2e2; + background-color: #cccccc; } table.alternating tr:nth-child(odd) { background-color: #ffffff; } td.number { text-align: right; } +tr.expanded { color: #888888; } {% endblock %} {% block content %}
@@ -14,14 +15,35 @@ td.number { text-align: right; }
+ {% for uuid, t in db.tasks.items() | sort(attribute='1.title') %} {% if t.visible %} + - + + + + +{% if uuid == expand_uuid %} +{% for uuid, t in expanded_tasks.items() %} + + + + +{% endfor %} +{% endif %} + {% endif %} {% endfor %} +
default
effort
tasktags
{{ t.default_effort }}{{ t.title|e }} +{% if uuid == expand_uuid %} +[-] +{% elif t.links|count > 0 %} +[+] +{% endif %} +{{ t.title|e }}{% for tag in t.tags | sort %}{{ tag }} {% endfor %}
{{ t.default_effort }}  [+] {{ t.title|e }} {% for tag in t.tags | sort %}{{ tag }} {% endfor %}
{% endblock %} diff --git a/todo_templates/todo.html b/todo_templates/todo.html index af48a47..09aaf45 100644 --- a/todo_templates/todo.html +++ b/todo_templates/todo.html @@ -8,16 +8,32 @@ input[type="text"] { width: 100% } textarea { width: 100% }; {% endblock %} {% block content %} -
+

edit todo

- - - + + - - + + + + @@ -31,5 +47,8 @@ add:
task{{ todo.task.title|e }}
default effort{{ todo.default_effort }}
day{{ todo.day.date }}
day effort
efforts + + +{% for date, effort in todo.efforts.items() %} + + + + +{% endfor %} + + + + +
dateeffortdelete
+
+
importance
comment
done
+
+ +
{% endblock %} -- 2.30.2