diff options
author | Joris | 2020-06-06 17:44:26 +0200 |
---|---|---|
committer | Joris | 2020-06-06 19:54:03 +0200 |
commit | 1595e0de940a86a7810df0e02e43838d97c0d846 (patch) | |
tree | 9701eeec0d98baa9f6044b1911df68e4c8539819 /src/gui/tasks/dialog.py | |
parent | 6b9195000eb5404c247288b384d7ca2bacc1ab23 (diff) |
Provide nix build
Diffstat (limited to 'src/gui/tasks/dialog.py')
-rw-r--r-- | src/gui/tasks/dialog.py | 78 |
1 files changed, 0 insertions, 78 deletions
diff --git a/src/gui/tasks/dialog.py b/src/gui/tasks/dialog.py deleted file mode 100644 index 2bf3b6b..0000000 --- a/src/gui/tasks/dialog.py +++ /dev/null @@ -1,78 +0,0 @@ -from PyQt5 import QtCore, QtWidgets -from typing import List - -from model.tag import Tag -from model.task import Task, ValidTaskForm -from model.status import Status -import database -import db.task_tags -import db.tasks -import gui.tasks.form.widget -import service.tasks - -def add(parent_widget, status: Status, add_task_signal): - - def on_add(task_form: ValidTaskForm): - task = service.tasks.create(database.cursor(), status, task_form) - add_task_signal.emit(task, task_form.tags) - - return widget(parent_widget, "Add a task", "add", None, [], on_add) - -def update(parent_widget, update_task_signal, row: int, task: Task, tags: List[int]): - - def on_update(task_form: ValidTaskForm): - updated_task = service.tasks.update(database.cursor(), task, task_form) - update_task_signal.emit(row, updated_task, task_form.tags) - - return widget(parent_widget, "Modify a task", "modify", task, tags, on_update) - -def confirm_delete(parent, rows: List[int], on_confirm): - confirm = QtWidgets.QMessageBox.question( - parent, - "Task deletion", - "Do you really want to delete the selected tasks ?", - QtWidgets.QMessageBox.No | QtWidgets.QMessageBox.Yes, - QtWidgets.QMessageBox.Yes) - - if confirm == QtWidgets.QMessageBox.Yes: - on_confirm() - -def confirm_move(parent, rows: List[int], move_to: Status, on_confirm): - confirm = QtWidgets.QMessageBox.question( - parent, - "Task move", - "Do you really want to move the selected tasks ?", - QtWidgets.QMessageBox.No | QtWidgets.QMessageBox.Yes, - QtWidgets.QMessageBox.Yes) - - if confirm == QtWidgets.QMessageBox.Yes: - on_confirm() - -def widget( - parent: QtWidgets.QWidget, - title: str, - action_title: str, - task: Task, - tags: List[int], - on_validated): - - dialog = QtWidgets.QDialog(parent) - dialog.setWindowTitle(title) - dialog.setMinimumSize(QtCore.QSize(320, 240)) - - layout = QtWidgets.QVBoxLayout(dialog) - dialog.setLayout(layout) - - def on_dialog_validated(form): - dialog.accept() - on_validated(form) - - layout.addWidget(gui.tasks.form.widget.widget( - parent = dialog, - action_title = action_title, - task = task, - tags = tags, - on_validated = on_dialog_validated, - on_cancel = lambda: dialog.reject())) - - return dialog |