diff options
Diffstat (limited to 'src/gui/tasks/widget.py')
-rw-r--r-- | src/gui/tasks/widget.py | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/src/gui/tasks/widget.py b/src/gui/tasks/widget.py index 6fa8bf0..0462f54 100644 --- a/src/gui/tasks/widget.py +++ b/src/gui/tasks/widget.py @@ -1,6 +1,5 @@ from PyQt5 import QtWidgets, QtCore -import db.tasks import gui.tasks.signal import gui.tasks.table.widget import gui.icons @@ -16,24 +15,11 @@ def widget(database, parent): add_task_button = QtWidgets.QPushButton('Add a task', widget) add_task_button.setIcon(gui.icons.new_folder(widget.style())) - add_task_button.clicked.connect(lambda: show_add_dialog(database, widget, add_task_signal)) + add_task_button.clicked.connect(lambda: gui.tasks.dialog.add( + database, widget, add_task_signal).exec_()) layout.addWidget(add_task_button) - table = gui.tasks.table.widget.widget(database, widget, add_task_signal) + table = gui.tasks.table.widget.Widget(database, widget, add_task_signal) layout.addWidget(table) return widget - -def show_add_dialog(database, parent_widget, add_task_signal): - dialog = gui.tasks.modal.dialog( - parent_widget, - 'Add a task', - 'add', - None, - lambda form: on_add(database, form, add_task_signal)) - dialog.exec_() - -def on_add(database, form: ValidTaskForm, add_task_signal): - task = db.tasks.insert(database.cursor(), form) - database.commit() - add_task_signal.emit(task) |