diff options
author | Joris | 2020-05-10 11:07:12 +0200 |
---|---|---|
committer | Joris | 2020-05-10 11:07:12 +0200 |
commit | a134f20eb62e6d174e7da81fd4adb7ff9e8b3b71 (patch) | |
tree | fe4b98d4a4636f20f28a5a7e5011a73171a2d182 /src/gui/tasks/form/state.py | |
parent | e33a5e7aff3143c50813fee7c12f10f98d132240 (diff) |
Add task description field
Diffstat (limited to 'src/gui/tasks/form/state.py')
-rw-r--r-- | src/gui/tasks/form/state.py | 21 |
1 files changed, 20 insertions, 1 deletions
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() |