aboutsummaryrefslogtreecommitdiff
path: root/src/gui/tasks/widget.py
blob: 0462f54c1e0c029b4e48855d4aafa38d07e678af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from PyQt5 import QtWidgets, QtCore

import gui.tasks.signal
import gui.tasks.table.widget
import gui.icons
from model.task import ValidTaskForm

def widget(database, parent):
    widget = QtWidgets.QWidget(parent)

    layout = QtWidgets.QVBoxLayout(widget)
    widget.setLayout(layout)

    add_task_signal = gui.tasks.signal.AddTask()

    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: 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)
    layout.addWidget(table)

    return widget