diff options
Diffstat (limited to 'src/gui/tasks/form/widget.py')
-rw-r--r-- | src/gui/tasks/form/widget.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/gui/tasks/form/widget.py b/src/gui/tasks/form/widget.py index 9feaad0..49339e1 100644 --- a/src/gui/tasks/form/widget.py +++ b/src/gui/tasks/form/widget.py @@ -2,10 +2,12 @@ from PyQt5 import QtWidgets, QtCore from typing import Optional, Tuple, List, Any from model.task import Task, ValidTaskForm +from model.tag import Tag from model import difficulty, priority import gui.icon import gui.tasks.form.state import gui.tasks.duration +import gui.tags.list class TextEditSignal(QtCore.QObject): _signal = QtCore.pyqtSignal(str, name = 'textEdit') @@ -23,6 +25,7 @@ def widget( parent: QtWidgets.QWidget, action_title: str, task: Task, + tags: List[int], on_validated, on_cancel): @@ -41,9 +44,6 @@ def widget( init_duration = gui.tasks.duration.format(task.duration) if task is not None else '' duration_input = line_edit(grid, grid_layout, 1, 'Duration', init_duration) - init_tag = task.tag if task is not None else '' - tag_input = line_edit(grid, grid_layout, 2, 'Tag', init_tag) - init_difficulty = task.difficulty if task is not None else difficulty.Difficulty.NORMAL difficulty_input = combo_box( grid, @@ -62,6 +62,9 @@ def widget( [priority.format(d) for d in priority.values], int(init_priority)) + (tags_list_widget, tags_signal) = tags_selection(widget, tags) + layout.addWidget(tags_list_widget) + init_description = task.description if task is not None else '' (description_input, description_signal) = text_edit(widget, 'Description', init_description) layout.addWidget(description_input) @@ -71,12 +74,11 @@ def widget( name_input.textChanged, init_duration, duration_input.textChanged, - init_tag, - tag_input.textChanged, init_difficulty, difficulty_input.currentIndexChanged, init_priority, priority_input.currentIndexChanged, + tags_signal, init_description, description_signal) @@ -131,6 +133,9 @@ def combo_box( return box +def tags_selection(parent, init_tags: List[int]) -> QtWidgets.QWidget: + return gui.tags.list.widget(parent, init_tags) + def text_edit( parent, label: str, |