From a134f20eb62e6d174e7da81fd4adb7ff9e8b3b71 Mon Sep 17 00:00:00 2001 From: Joris Date: Sun, 10 May 2020 11:07:12 +0200 Subject: Add task description field --- src/gui/tasks/form/state.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'src/gui/tasks/form/state.py') diff --git a/src/gui/tasks/form/state.py b/src/gui/tasks/form/state.py index 12ffe36..46e2909 100644 --- a/src/gui/tasks/form/state.py +++ b/src/gui/tasks/form/state.py @@ -6,23 +6,38 @@ from model.task import ValidTaskForm import gui.tasks.duration class TaskFormEdition: - def __init__(self, name, name_signal, duration, duration_signal, tag, tag_signal): + def __init__( + self, + name, + name_signal, + description, + description_signal, + duration, + duration_signal, + tag, + tag_signal): + self._name = name + self._description = description self._duration = duration self._tag = tag self._signal = ValidTaskFormSignal() + name_signal.connect(lambda name: self.on_name_signal(name)) + description_signal.connect(lambda description: self.on_description_signal(description)) duration_signal.connect(lambda duration: self.on_duration_signal(duration)) tag_signal.connect(lambda tag: self.on_tag_signal(tag)) def get(self) -> Optional[ValidTaskForm]: name = self._name.strip() + description = self._description.strip() duration = gui.tasks.duration.parse(self._duration) tag = self._tag.strip() if name and duration != None: return ValidTaskForm( name = name, + description = description, duration = duration, tag = tag) else: @@ -32,6 +47,10 @@ class TaskFormEdition: self._name = name self.emit() + def on_description_signal(self, description: str): + self._description = description + self.emit() + def on_duration_signal(self, duration: str): self._duration = duration self.emit() -- cgit v1.2.3