starts first draft
This commit is contained in:
80
xerus/__main__.py
Normal file
80
xerus/__main__.py
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
# -*- coding:utf-8 -*-
|
||||||
|
|
||||||
|
import tkinter as tk
|
||||||
|
from tkinter import ttk
|
||||||
|
|
||||||
|
def new_frame_horiz(parent):
|
||||||
|
frame = tk.Frame(parent)
|
||||||
|
frame.pack(fill=tk.X, expand=True)
|
||||||
|
return frame
|
||||||
|
|
||||||
|
window = tk.Tk()
|
||||||
|
window.title("Xerus")
|
||||||
|
|
||||||
|
header = tk.Frame(window)
|
||||||
|
header.pack(side=tk.TOP, fill=tk.X, expand=True)
|
||||||
|
|
||||||
|
# Subjects choice list
|
||||||
|
subjectFrame = new_frame_horiz(header)
|
||||||
|
subjects = ["Henri", "Étienne", "Julia"]
|
||||||
|
subjectLabel = tk.Label(subjectFrame, text="Résident")
|
||||||
|
subjectLabel.pack(side=tk.LEFT)
|
||||||
|
subjectChoice = ttk.Combobox(subjectFrame, values=subjects)
|
||||||
|
subjectChoice.pack(side=tk.RIGHT, expand=True, fill=tk.X)
|
||||||
|
|
||||||
|
# Category choice list
|
||||||
|
categoryFrame = new_frame_horiz(header)
|
||||||
|
categories = ["Santé", "Comportement", "Quotidien", "Infos", "Activité"]
|
||||||
|
categoryLabel = tk.Label(categoryFrame, text="Catégorie")
|
||||||
|
categoryLabel.pack(side=tk.LEFT)
|
||||||
|
categoryChoice = ttk.Combobox(categoryFrame, values=categories)
|
||||||
|
categoryChoice.current(0)
|
||||||
|
toLeft = tk.Button(categoryFrame, text="<")
|
||||||
|
toRight = tk.Button(categoryFrame, text=">")
|
||||||
|
|
||||||
|
toRight.pack(side=tk.RIGHT)
|
||||||
|
categoryChoice.pack(side=tk.RIGHT, fill=tk.X, expand=True)
|
||||||
|
toLeft.pack(side=tk.RIGHT)
|
||||||
|
|
||||||
|
|
||||||
|
# Text view
|
||||||
|
textView = tk.Frame(window)
|
||||||
|
textView.pack()
|
||||||
|
|
||||||
|
textStore = {
|
||||||
|
"23 mars 2020": [
|
||||||
|
{ 'time': "Matin", 'text': "Bien mangé ce matin. Sorti faire un tour pour voir les poules", },
|
||||||
|
{ 'time': "Après-midi", 'text': "Rien de particulier" },
|
||||||
|
],
|
||||||
|
"24 mars 2020": [
|
||||||
|
{ 'time': "Matin", 'text': "Bien mangé ce matin. Sorti faire un tour pour voir les poules", },
|
||||||
|
{ 'time': "Après-midi", 'text': "Rien de particulier" },
|
||||||
|
],
|
||||||
|
"25 mars 2020": [
|
||||||
|
{ 'time': "Matin", 'text': "Bien mangé ce matin. Sorti faire un tour pour voir les poules", },
|
||||||
|
{ 'time': "Après-midi", 'text': "Rien de particulier" },
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
scrollbar = tk.Scrollbar(textView)
|
||||||
|
scrollbar.pack(side=tk.RIGHT, fill=tk.Y)
|
||||||
|
text = tk.Text(textView, yscrollcommand=scrollbar.set)
|
||||||
|
scrollbar.config(command=text.yview)
|
||||||
|
text.tag_config("d", underline=1) # Dates
|
||||||
|
text.tag_config("t", foreground="grey") # Times
|
||||||
|
text.pack()
|
||||||
|
|
||||||
|
for date, items in textStore.items():
|
||||||
|
# Date header
|
||||||
|
text.insert(tk.INSERT, f"{date}\n\n", "d")
|
||||||
|
# Text
|
||||||
|
for i in items:
|
||||||
|
text.insert(tk.INSERT, f"{i['time']}. ", "t")
|
||||||
|
text.insert(tk.INSERT, f"{i['text']}\n")
|
||||||
|
text.insert(tk.INSERT, "\n")
|
||||||
|
|
||||||
|
text.config(state=tk.DISABLED)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
window.mainloop()
|
||||||
16
xerus/notes.py
Normal file
16
xerus/notes.py
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from enum import Enum
|
||||||
|
|
||||||
|
Category = Enum('Category', 'SANTE COMPORTEMENT QUOTIDIEN ACTIVITE INFOS')
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class Note:
|
||||||
|
""" A chunk of text related to a subject and a category
|
||||||
|
|
||||||
|
It contains the content of a cell in xls table
|
||||||
|
"""
|
||||||
|
|
||||||
|
subject: str
|
||||||
|
category: int
|
||||||
|
text: str
|
||||||
|
|
||||||
Reference in New Issue
Block a user