diff options
Diffstat (limited to 'src/gui/tasks/form/state.py')
-rw-r--r-- | src/gui/tasks/form/state.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/gui/tasks/form/state.py b/src/gui/tasks/form/state.py index a47aec7..12ffe36 100644 --- a/src/gui/tasks/form/state.py +++ b/src/gui/tasks/form/state.py @@ -1,7 +1,9 @@ +import re from PyQt5 import QtCore from typing import NamedTuple, Optional from model.task import ValidTaskForm +import gui.tasks.duration class TaskFormEdition: def __init__(self, name, name_signal, duration, duration_signal, tag, tag_signal): @@ -15,13 +17,13 @@ class TaskFormEdition: def get(self) -> Optional[ValidTaskForm]: name = self._name.strip() - duration = self._duration.strip() + duration = gui.tasks.duration.parse(self._duration) tag = self._tag.strip() - if name and (duration == '' or duration.isdigit()): + if name and duration != None: return ValidTaskForm( name = name, - duration = 0 if duration == '' else int(duration), + duration = duration, tag = tag) else: return None |