aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--todo/gui/tasks/dialog.py2
-rw-r--r--todo/gui/tasks/form/widget.py28
2 files changed, 26 insertions, 4 deletions
diff --git a/todo/gui/tasks/dialog.py b/todo/gui/tasks/dialog.py
index 3d9e3c0..c9e3734 100644
--- a/todo/gui/tasks/dialog.py
+++ b/todo/gui/tasks/dialog.py
@@ -45,7 +45,7 @@ def widget(
dialog = QtWidgets.QDialog(parent)
dialog.setWindowTitle(title)
- dialog.setMinimumSize(QtCore.QSize(320, 240))
+ dialog.setMinimumSize(QtCore.QSize(600, 240))
layout = QtWidgets.QVBoxLayout(dialog)
dialog.setLayout(layout)
diff --git a/todo/gui/tasks/form/widget.py b/todo/gui/tasks/form/widget.py
index e547d55..5950a93 100644
--- a/todo/gui/tasks/form/widget.py
+++ b/todo/gui/tasks/form/widget.py
@@ -33,14 +33,14 @@ def widget(
layout = QtWidgets.QVBoxLayout(widget)
widget.setLayout(layout)
+ init_name = task.name if task is not None else ""
+ name_input = name_edit(widget, layout, "Name", init_name)
+
grid = QtWidgets.QWidget(widget)
layout.addWidget(grid)
grid_layout = QtWidgets.QGridLayout(grid)
grid.setLayout(grid_layout)
- init_name = task.name if task is not None else ""
- name_input = line_edit(grid, grid_layout, 0, "Name", init_name)
-
init_duration = todo.gui.tasks.duration.format(task.duration) if task is not None else ""
duration_input = line_edit(grid, grid_layout, 1, "Duration", init_duration)
@@ -97,6 +97,28 @@ def widget(
return widget
+def name_edit(
+ parent,
+ layout: QtWidgets.QVBoxLayout,
+ label: str,
+ default_value: str) -> QtWidgets.QLineEdit:
+
+ widget = QtWidgets.QWidget(parent)
+ layout.addWidget(widget)
+
+ inner_layout = QtWidgets.QVBoxLayout(widget)
+ widget.setLayout(layout)
+
+ label = QtWidgets.QLabel(label, parent)
+ inner_layout.addWidget(label)
+
+ edit = QtWidgets.QLineEdit(parent)
+ if default_value != None:
+ edit.setText(default_value)
+ inner_layout.addWidget(edit)
+
+ return edit
+
def line_edit(
parent,
layout: QtWidgets.QGridLayout,