diff options
Diffstat (limited to 'src/gui/tasks/form/state.py')
-rw-r--r-- | src/gui/tasks/form/state.py | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/gui/tasks/form/state.py b/src/gui/tasks/form/state.py index 9bd3ae3..5b48cd9 100644 --- a/src/gui/tasks/form/state.py +++ b/src/gui/tasks/form/state.py @@ -5,6 +5,7 @@ from model.task import ValidTaskForm from model.difficulty import Difficulty from model.priority import Priority import gui.tasks.duration +import gui.tags.list class TaskFormEdition: def __init__( @@ -13,34 +14,32 @@ class TaskFormEdition: name_signal, duration, duration_signal, - tag, - tag_signal, difficulty, difficulty_signal, priority, priority_signal, + tags_signal: gui.tags.list.SelectionSignal, description, description_signal): self._name = name self._duration = duration - self._tag = tag self._difficulty = difficulty self._priority = priority + self._tags = [] self._description = description self._signal = ValidTaskFormSignal() name_signal.connect(lambda n: self.on_name_signal(n)) duration_signal.connect(lambda d: self.on_duration_signal(d)) - tag_signal.connect(lambda t: self.on_tag_signal(t)) difficulty_signal.connect(lambda d: self.on_difficulty_signal(d)) priority_signal.connect(lambda p: self.on_priority_signal(p)) + tags_signal.connect(lambda ts: self.on_tags_signal(ts)) description_signal.connect(lambda d: self.on_description_signal(d)) def get(self) -> Optional[ValidTaskForm]: name = self._name.strip() duration = gui.tasks.duration.parse(self._duration) - tag = self._tag.strip() difficulty = self._difficulty priority = self._priority description = self._description.strip() @@ -49,9 +48,9 @@ class TaskFormEdition: return ValidTaskForm( name = name, duration = duration, - tag = tag, difficulty = difficulty, priority = priority, + tags = self._tags, description = description) else: return None @@ -64,10 +63,6 @@ class TaskFormEdition: self._duration = duration self.emit() - def on_tag_signal(self, tag: str): - self._tag = tag - self.emit() - def on_difficulty_signal(self, index: int): self._difficulty = Difficulty(index) self.emit() @@ -76,6 +71,10 @@ class TaskFormEdition: self._priority = Priority(index) self.emit() + def on_tags_signal(self, tags: [int]): + self._tags = tags + self.emit() + def on_description_signal(self, description: str): self._description = description self.emit() |