aboutsummaryrefslogtreecommitdiff
path: root/src/gui/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/tasks')
-rw-r--r--src/gui/tasks/dialog.py8
-rw-r--r--src/gui/tasks/duration.py18
-rw-r--r--src/gui/tasks/form/state.py2
-rw-r--r--src/gui/tasks/form/widget.py20
-rw-r--r--src/gui/tasks/signal.py4
-rw-r--r--src/gui/tasks/table/menu.py4
-rw-r--r--src/gui/tasks/table/widget.py10
-rw-r--r--src/gui/tasks/widget.py2
8 files changed, 34 insertions, 34 deletions
diff --git a/src/gui/tasks/dialog.py b/src/gui/tasks/dialog.py
index a28ecb0..1471910 100644
--- a/src/gui/tasks/dialog.py
+++ b/src/gui/tasks/dialog.py
@@ -15,7 +15,7 @@ def add(parent_widget, add_task_signal):
task = service.tasks.create(database.cursor(), task_form)
add_task_signal.emit(task, task_form.tags)
- return widget(parent_widget, 'Add a task', 'add', None, [], on_add)
+ 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]):
@@ -23,13 +23,13 @@ def update(parent_widget, update_task_signal, row: int, task: Task, tags: List[i
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)
+ return widget(parent_widget, "Modify a task", "modify", task, tags, on_update)
def show_delete(parent, rows: List[int], on_delete):
confirm = QtWidgets.QMessageBox.question(
parent,
- 'Task deletion',
- 'Do you really want to delete the selected tasks ?',
+ "Task deletion",
+ "Do you really want to delete the selected tasks ?",
QtWidgets.QMessageBox.No | QtWidgets.QMessageBox.Yes,
QtWidgets.QMessageBox.Yes)
diff --git a/src/gui/tasks/duration.py b/src/gui/tasks/duration.py
index 3ce8203..dc948e6 100644
--- a/src/gui/tasks/duration.py
+++ b/src/gui/tasks/duration.py
@@ -7,21 +7,21 @@ import gui.color
def format(minutes: int):
if minutes >= 60 * 24:
- return '' + format_decimal(minutes / 60 / 24) + 'd'
+ return "" + format_decimal(minutes / 60 / 24) + "d"
elif minutes >= 60:
- return '' + format_decimal(minutes / 60) + 'h'
+ return "" + format_decimal(minutes / 60) + "h"
elif minutes > 0:
- return '' + str(minutes) + 'm'
+ return "" + str(minutes) + "m"
else:
- return ''
+ return ""
def format_decimal(d: float) -> str:
- return '{0:.2g}'.format(d)
+ return "{0:.2g}".format(d)
def parse(duration: str) -> Optional[int]:
duration = duration.strip()
if duration:
- result = re.match('^(\d+)(\.(\d+))?([mhd])$', duration.strip())
+ result = re.match("^(\d+)(\.(\d+))?([mhd])$", duration.strip())
if result:
n = int(result.group(1))
if result.group(3):
@@ -30,11 +30,11 @@ def parse(duration: str) -> Optional[int]:
d = 0
num = n + d
unit = result.group(4)
- if unit == 'm':
+ if unit == "m":
return math.floor(num)
- elif unit == 'h':
+ elif unit == "h":
return math.floor(num * 60)
- elif unit == 'd':
+ elif unit == "d":
return math.floor(num * 60 * 24)
else:
return None
diff --git a/src/gui/tasks/form/state.py b/src/gui/tasks/form/state.py
index 5b48cd9..09e658e 100644
--- a/src/gui/tasks/form/state.py
+++ b/src/gui/tasks/form/state.py
@@ -88,7 +88,7 @@ class TaskFormEdition:
return self._signal
class ValidTaskFormSignal(QtCore.QObject):
- _signal = QtCore.pyqtSignal(ValidTaskForm, name = 'validTaskForm')
+ _signal = QtCore.pyqtSignal(ValidTaskForm, name = "validTaskForm")
def __init__(self):
QtCore.QObject.__init__(self)
diff --git a/src/gui/tasks/form/widget.py b/src/gui/tasks/form/widget.py
index 49339e1..9be2589 100644
--- a/src/gui/tasks/form/widget.py
+++ b/src/gui/tasks/form/widget.py
@@ -10,7 +10,7 @@ import gui.tasks.duration
import gui.tags.list
class TextEditSignal(QtCore.QObject):
- _signal = QtCore.pyqtSignal(str, name = 'textEdit')
+ _signal = QtCore.pyqtSignal(str, name = "textEdit")
def __init__(self):
QtCore.QObject.__init__(self)
@@ -38,18 +38,18 @@ def widget(
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_name = task.name if task is not None else ""
+ name_input = line_edit(grid, grid_layout, 0, "Name", init_name)
- 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_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_difficulty = task.difficulty if task is not None else difficulty.Difficulty.NORMAL
difficulty_input = combo_box(
grid,
grid_layout,
3,
- 'Difficulty',
+ "Difficulty",
[difficulty.format(d) for d in difficulty.values],
int(init_difficulty))
@@ -58,15 +58,15 @@ def widget(
grid,
grid_layout,
4,
- 'Priority',
+ "Priority",
[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)
+ init_description = task.description if task is not None else ""
+ (description_input, description_signal) = text_edit(widget, "Description", init_description)
layout.addWidget(description_input)
task_form_edition = gui.tasks.form.state.TaskFormEdition(
@@ -176,7 +176,7 @@ def buttons(parent, action_title, task_form_signal, on_validate, on_cancel):
task_form_signal.connect(on_task_form_signal)
- cancel = QtWidgets.QPushButton('cancel', widget)
+ cancel = QtWidgets.QPushButton("cancel", widget)
cancel.setIcon(gui.icon.dialog_cancel(cancel.style()))
cancel.clicked.connect(on_cancel)
layout.addWidget(cancel)
diff --git a/src/gui/tasks/signal.py b/src/gui/tasks/signal.py
index e62a838..074e8ec 100644
--- a/src/gui/tasks/signal.py
+++ b/src/gui/tasks/signal.py
@@ -4,7 +4,7 @@ from typing import List
from model.task import Task
class AddTask(QtCore.QObject):
- _signal = QtCore.pyqtSignal(Task, list, name = 'addTask')
+ _signal = QtCore.pyqtSignal(Task, list, name = "addTask")
def __init__(self):
QtCore.QObject.__init__(self)
@@ -16,7 +16,7 @@ class AddTask(QtCore.QObject):
self._signal.connect(f)
class UpdateTask(QtCore.QObject):
- _signal = QtCore.pyqtSignal(int, Task, list, name = 'updateTask')
+ _signal = QtCore.pyqtSignal(int, Task, list, name = "updateTask")
def __init__(self):
QtCore.QObject.__init__(self)
diff --git a/src/gui/tasks/table/menu.py b/src/gui/tasks/table/menu.py
index 5404d6c..db89551 100644
--- a/src/gui/tasks/table/menu.py
+++ b/src/gui/tasks/table/menu.py
@@ -12,11 +12,11 @@ def open(table, update_task_signal, position):
menu = QtWidgets.QMenu(table)
if len(rows) == 1:
- modify_action = menu.addAction(gui.icon.dialog_open(menu.style()), 'modify')
+ modify_action = menu.addAction(gui.icon.dialog_open(menu.style()), "modify")
else:
modify_action = QtWidgets.QAction(menu)
- delete_action = menu.addAction(gui.icon.trash(menu.style()), 'delete')
+ delete_action = menu.addAction(gui.icon.trash(menu.style()), "delete")
action = menu.exec_(table.mapToGlobal(position + QtCore.QPoint(15, 20)))
if action == modify_action and len(rows) == 1:
diff --git a/src/gui/tasks/table/widget.py b/src/gui/tasks/table/widget.py
index 82c0456..fe8ea2e 100644
--- a/src/gui/tasks/table/widget.py
+++ b/src/gui/tasks/table/widget.py
@@ -88,7 +88,7 @@ class Widget(QtWidgets.QTableWidget):
self._sort_is_ascending = True
self._sort_column = column
self.sort()
- self._header_model.setItem(column, QtGui.QStandardItem('Hey!'))
+ # self._header_model.setItem(column, QtGui.QStandardItem("Hey!"))
self.update_view()
def sort(self):
@@ -214,13 +214,13 @@ def item(text: str):
def age_since(timestamp):
diff = int(time.time()) - timestamp
if diff >= 60 * 60 * 24:
- return '' + str(math.floor(diff / 60 / 60 / 24)) + 'd'
+ return "" + str(math.floor(diff / 60 / 60 / 24)) + "d"
elif diff >= 60 * 60:
- return '' + str(math.floor(diff / 60 / 60)) + 'h'
+ return "" + str(math.floor(diff / 60 / 60)) + "h"
elif diff >= 60:
- return '' + str(math.floor(diff / 60)) + 'm'
+ return "" + str(math.floor(diff / 60)) + "m"
else:
- return '1m'
+ return "1m"
def colored_label(parent, text: str, color: QtGui.QColor):
label = QtWidgets.QLabel(text)
diff --git a/src/gui/tasks/widget.py b/src/gui/tasks/widget.py
index 36fb743..3134124 100644
--- a/src/gui/tasks/widget.py
+++ b/src/gui/tasks/widget.py
@@ -13,7 +13,7 @@ def widget(parent, on_show: gui.signal.Reload):
add_task_signal = gui.tasks.signal.AddTask()
- add_task_button = QtWidgets.QPushButton('Add a task', widget)
+ add_task_button = QtWidgets.QPushButton("Add a task", widget)
add_task_button.setIcon(gui.icon.new_folder(widget.style()))
add_task_button.clicked.connect(lambda: gui.tasks.dialog.add(widget, add_task_signal).exec_())
layout.addWidget(add_task_button)