aboutsummaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/signal.py2
-rw-r--r--src/gui/tags/list.py4
-rw-r--r--src/gui/tags/panel/dialog.py8
-rw-r--r--src/gui/tags/panel/form/state.py2
-rw-r--r--src/gui/tags/panel/form/widget.py10
-rw-r--r--src/gui/tags/panel/signal.py4
-rw-r--r--src/gui/tags/panel/table/menu.py4
-rw-r--r--src/gui/tags/panel/table/model.py2
-rw-r--r--src/gui/tags/panel/widget.py2
-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
-rw-r--r--src/gui/window.py4
18 files changed, 55 insertions, 55 deletions
diff --git a/src/gui/signal.py b/src/gui/signal.py
index b604929..99100f1 100644
--- a/src/gui/signal.py
+++ b/src/gui/signal.py
@@ -1,7 +1,7 @@
from PyQt5 import QtCore
class Reload(QtCore.QObject):
- _signal = QtCore.pyqtSignal(name = 'reload')
+ _signal = QtCore.pyqtSignal(name = "reload")
def __init__(self):
QtCore.QObject.__init__(self)
diff --git a/src/gui/tags/list.py b/src/gui/tags/list.py
index ad70dd0..f7eeba3 100644
--- a/src/gui/tags/list.py
+++ b/src/gui/tags/list.py
@@ -6,7 +6,7 @@ import db.tags
import database
class SelectionSignal(QtCore.QObject):
- _signal = QtCore.pyqtSignal(list, name = 'selection')
+ _signal = QtCore.pyqtSignal(list, name = "selection")
def __init__(self):
QtCore.QObject.__init__(self)
@@ -24,7 +24,7 @@ def widget(parent, init_tags: List[int]) -> Tuple[QtWidgets.QWidget, SelectionSi
layout = QtWidgets.QVBoxLayout(widget)
widget.setLayout(layout)
- layout.addWidget(QtWidgets.QLabel('Tags'))
+ layout.addWidget(QtWidgets.QLabel("Tags"))
list_widget = QtWidgets.QListWidget()
list_widget.setSelectionMode(QtWidgets.QAbstractItemView.MultiSelection)
diff --git a/src/gui/tags/panel/dialog.py b/src/gui/tags/panel/dialog.py
index 7a6d3bc..f0ca986 100644
--- a/src/gui/tags/panel/dialog.py
+++ b/src/gui/tags/panel/dialog.py
@@ -13,7 +13,7 @@ def add(parent_widget, add_tag_signal):
database.commit()
add_tag_signal.emit(tag)
- return widget(parent_widget, 'Add a tag', 'add', None, on_add)
+ return widget(parent_widget, "Add a tag", "add", None, on_add)
def update(parent_widget, update_tag_signal, row, tag):
@@ -22,13 +22,13 @@ def update(parent_widget, update_tag_signal, row, tag):
update_tag_signal.emit(row, updated_tag)
database.commit()
- return widget(parent_widget, 'Modify a tag', 'modify', tag, on_update)
+ return widget(parent_widget, "Modify a tag", "modify", tag, on_update)
def show_delete(table, rows):
confirm = QtWidgets.QMessageBox.question(
table,
- 'Tag deletion',
- 'Do you really want to delete the selected tags ?',
+ "Tag deletion",
+ "Do you really want to delete the selected tags ?",
QtWidgets.QMessageBox.No | QtWidgets.QMessageBox.Yes,
QtWidgets.QMessageBox.Yes)
diff --git a/src/gui/tags/panel/form/state.py b/src/gui/tags/panel/form/state.py
index 931e67a..fbec956 100644
--- a/src/gui/tags/panel/form/state.py
+++ b/src/gui/tags/panel/form/state.py
@@ -46,7 +46,7 @@ class TagFormEdition:
return self._signal
class ValidTagFormSignal(QtCore.QObject):
- _signal = QtCore.pyqtSignal(ValidTagForm, name = 'validTagForm')
+ _signal = QtCore.pyqtSignal(ValidTagForm, name = "validTagForm")
def __init__(self):
QtCore.QObject.__init__(self)
diff --git a/src/gui/tags/panel/form/widget.py b/src/gui/tags/panel/form/widget.py
index 5627e3b..eb9cec8 100644
--- a/src/gui/tags/panel/form/widget.py
+++ b/src/gui/tags/panel/form/widget.py
@@ -23,11 +23,11 @@ def widget(
grid_layout = QtWidgets.QGridLayout(grid)
grid.setLayout(grid_layout)
- init_name = tag.name if tag is not None else ''
- name_input = line_edit(grid, grid_layout, 0, 'Name', init_name)
+ init_name = tag.name if tag is not None else ""
+ name_input = line_edit(grid, grid_layout, 0, "Name", init_name)
- init_color = tag.color if tag is not None else '#FFFFFF'
- color_input = color_edit(grid, grid_layout, 1, 'Color', QtGui.QColor(init_color))
+ init_color = tag.color if tag is not None else "#FFFFFF"
+ color_input = color_edit(grid, grid_layout, 1, "Color", QtGui.QColor(init_color))
tag_form_edition = gui.tags.panel.form.state.TagFormEdition(
init_name,
@@ -129,7 +129,7 @@ def buttons(parent, action_title, tag_form_signal, on_validate, on_cancel):
tag_form_signal.connect(on_tag_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/tags/panel/signal.py b/src/gui/tags/panel/signal.py
index 9417530..022abde 100644
--- a/src/gui/tags/panel/signal.py
+++ b/src/gui/tags/panel/signal.py
@@ -3,7 +3,7 @@ from PyQt5 import QtCore
from model.tag import Tag
class AddTag(QtCore.QObject):
- _signal = QtCore.pyqtSignal(Tag, name = 'addTag')
+ _signal = QtCore.pyqtSignal(Tag, name = "addTag")
def __init__(self):
QtCore.QObject.__init__(self)
@@ -15,7 +15,7 @@ class AddTag(QtCore.QObject):
self._signal.connect(f)
class UpdateTag(QtCore.QObject):
- _signal = QtCore.pyqtSignal(int, Tag, name = 'updateTag')
+ _signal = QtCore.pyqtSignal(int, Tag, name = "updateTag")
def __init__(self):
QtCore.QObject.__init__(self)
diff --git a/src/gui/tags/panel/table/menu.py b/src/gui/tags/panel/table/menu.py
index 6bf812e..f9ee148 100644
--- a/src/gui/tags/panel/table/menu.py
+++ b/src/gui/tags/panel/table/menu.py
@@ -14,14 +14,14 @@ def open(table, update_tag_signal, position):
actions = 0
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")
actions += 1
else:
modify_action = QtWidgets.QAction(menu)
tags = table.model().row_ids(rows)
if not db.task_tags.one_is_used(database.cursor(), tags):
- delete_action = menu.addAction(gui.icon.trash(menu.style()), 'delete')
+ delete_action = menu.addAction(gui.icon.trash(menu.style()), "delete")
actions += 1
else:
delete_action = QtWidgets.QAction(menu)
diff --git a/src/gui/tags/panel/table/model.py b/src/gui/tags/panel/table/model.py
index 353f747..00ca785 100644
--- a/src/gui/tags/panel/table/model.py
+++ b/src/gui/tags/panel/table/model.py
@@ -11,7 +11,7 @@ import gui.color
columns = 1
-headers = ['Name', 'Color']
+headers = ["Name", "Color"]
default_sort = (0, Qt.AscendingOrder)
diff --git a/src/gui/tags/panel/widget.py b/src/gui/tags/panel/widget.py
index 3da55c9..fb51385 100644
--- a/src/gui/tags/panel/widget.py
+++ b/src/gui/tags/panel/widget.py
@@ -13,7 +13,7 @@ def widget(parent):
add_tag_signal = gui.tags.panel.signal.AddTag()
- add_tag_button = QtWidgets.QPushButton('Add a tag', widget)
+ add_tag_button = QtWidgets.QPushButton("Add a tag", widget)
add_tag_button.setIcon(gui.icon.new_folder(widget.style()))
add_tag_button.clicked.connect(lambda: gui.tags.panel.dialog.add(widget, add_tag_signal).exec_())
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)
diff --git a/src/gui/window.py b/src/gui/window.py
index 4865edf..f2a5910 100644
--- a/src/gui/window.py
+++ b/src/gui/window.py
@@ -19,7 +19,7 @@ def get():
open_tasks.emit()
tabs.currentChanged.connect(on_current_tab_changed)
- tabs.addTab(gui.tasks.widget.widget(tabs, open_tasks), 'Tasks')
- tabs.addTab(gui.tags.panel.widget.widget(tabs), 'Tags')
+ tabs.addTab(gui.tasks.widget.widget(tabs, open_tasks), "Tasks")
+ tabs.addTab(gui.tags.panel.widget.widget(tabs), "Tags")
return window