diff options
-rw-r--r-- | src/gui/color.py | 9 | ||||
-rw-r--r-- | src/gui/icon.py (renamed from src/gui/icons.py) | 0 | ||||
-rw-r--r-- | src/gui/tasks/form/widget.py | 10 | ||||
-rw-r--r-- | src/gui/tasks/table/menu.py | 4 | ||||
-rw-r--r-- | src/gui/tasks/table/model.py | 16 | ||||
-rw-r--r-- | src/gui/tasks/widget.py | 4 | ||||
-rw-r--r-- | src/model/difficulty.py | 36 | ||||
-rw-r--r-- | src/model/priority.py | 12 |
8 files changed, 46 insertions, 45 deletions
diff --git a/src/gui/color.py b/src/gui/color.py index dcb21ea..fa7df8e 100644 --- a/src/gui/color.py +++ b/src/gui/color.py @@ -1,13 +1,14 @@ from PyQt5 import QtGui red: QtGui.QColor = QtGui.QColor(200, 30, 30) +orange: QtGui.QColor = QtGui.QColor(200, 100, 30) green: QtGui.QColor = QtGui.QColor(30, 180, 30) blue: QtGui.QColor = QtGui.QColor(30, 30, 200) -low_difficulty = green -medium_difficulty = blue -high_difficulty = red +easy_difficulty = green +normal_difficulty = orange +hard_difficulty = red low_priority = green -medium_priority = blue +middle_priority = orange high_priority = red diff --git a/src/gui/icons.py b/src/gui/icon.py index 2f8830e..2f8830e 100644 --- a/src/gui/icons.py +++ b/src/gui/icon.py diff --git a/src/gui/tasks/form/widget.py b/src/gui/tasks/form/widget.py index 846ce90..adaf757 100644 --- a/src/gui/tasks/form/widget.py +++ b/src/gui/tasks/form/widget.py @@ -4,7 +4,7 @@ from typing import Optional, Tuple, List, Any import db.tasks from model.task import Task, ValidTaskForm from model import difficulty, priority -import gui.icons +import gui.icon import gui.tasks.form.state import gui.tasks.duration @@ -45,7 +45,7 @@ def widget( init_tag = task.tag if task is not None else '' tag_input = line_edit(grid, grid_layout, 2, 'Tag', init_tag) - init_difficulty = task.difficulty if task is not None else difficulty.Difficulty.MEDIUM + init_difficulty = task.difficulty if task is not None else difficulty.Difficulty.NORMAL difficulty_input = combo_box( grid, grid_layout, @@ -54,7 +54,7 @@ def widget( [difficulty.format(d) for d in difficulty.values], int(init_difficulty)) - init_priority = task.priority if task is not None else priority.Priority.MEDIUM + init_priority = task.priority if task is not None else priority.Priority.MIDDLE priority_input = combo_box( grid, grid_layout, @@ -160,7 +160,7 @@ def buttons(parent, action_title, task_form_signal, on_validate, on_cancel): validate = QtWidgets.QPushButton(action_title, widget) validate.setDisabled(True) - validate.setIcon(gui.icons.dialog_apply(validate.style())) + validate.setIcon(gui.icon.dialog_apply(validate.style())) validate.clicked.connect(on_validate); layout.addWidget(validate) @@ -173,7 +173,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.setIcon(gui.icons.dialog_cancel(cancel.style())) + cancel.setIcon(gui.icon.dialog_cancel(cancel.style())) cancel.clicked.connect(on_cancel) layout.addWidget(cancel) diff --git a/src/gui/tasks/table/menu.py b/src/gui/tasks/table/menu.py index 51f7330..edc9833 100644 --- a/src/gui/tasks/table/menu.py +++ b/src/gui/tasks/table/menu.py @@ -10,11 +10,11 @@ def open(database, table, update_task_signal, position): menu = QtWidgets.QMenu(table) if len(rows) == 1: - modify_action = menu.addAction(gui.icons.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.icons.trash(menu.style()), 'Delete') + delete_action = menu.addAction(gui.icon.trash(menu.style()), 'Delete') action = menu.exec_(table.mapToGlobal(position)) if action == modify_action and len(rows) == 1: diff --git a/src/gui/tasks/table/model.py b/src/gui/tasks/table/model.py index 5013569..062ded6 100644 --- a/src/gui/tasks/table/model.py +++ b/src/gui/tasks/table/model.py @@ -139,17 +139,17 @@ def is_reversed(row: int, order: Qt.SortOrder) -> bool: return order == Qt.DescendingOrder def difficulty_color(d: Difficulty) -> QtGui.QColor: - if d == Difficulty.LOW: - return gui.color.low_difficulty - elif d == Difficulty.MEDIUM: - return gui.color.medium_difficulty - elif d == Difficulty.HIGH: - return gui.color.high_difficulty + if d == Difficulty.EASY: + return gui.color.easy_difficulty + elif d == Difficulty.NORMAL: + return gui.color.normal_difficulty + elif d == Difficulty.HARD: + return gui.color.hard_difficulty def priority_color(p: Priority) -> QtGui.QColor: if p == Priority.LOW: return gui.color.low_priority - elif p == Priority.MEDIUM: - return gui.color.medium_priority + elif p == Priority.MIDDLE: + return gui.color.middle_priority elif p == Priority.HIGH: return gui.color.high_priority diff --git a/src/gui/tasks/widget.py b/src/gui/tasks/widget.py index 0462f54..61ad605 100644 --- a/src/gui/tasks/widget.py +++ b/src/gui/tasks/widget.py @@ -2,7 +2,7 @@ from PyQt5 import QtWidgets, QtCore import gui.tasks.signal import gui.tasks.table.widget -import gui.icons +import gui.icon from model.task import ValidTaskForm def widget(database, parent): @@ -14,7 +14,7 @@ def widget(database, parent): 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.setIcon(gui.icon.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) diff --git a/src/model/difficulty.py b/src/model/difficulty.py index 595f844..cbabd1e 100644 --- a/src/model/difficulty.py +++ b/src/model/difficulty.py @@ -2,29 +2,29 @@ from enum import IntEnum from typing import Optional class Difficulty(IntEnum): - LOW = 0 - MEDIUM = 1 - HIGH = 2 + EASY = 0 + NORMAL = 1 + HARD = 2 values = [ - Difficulty.LOW, - Difficulty.MEDIUM, - Difficulty.HIGH] + Difficulty.EASY, + Difficulty.NORMAL, + Difficulty.HARD] def format(difficulty: Difficulty) -> str: - if difficulty == Difficulty.LOW: - return 'Low' - elif difficulty == Difficulty.MEDIUM: - return 'Medium' - elif difficulty == Difficulty.HIGH: - return 'High' + if difficulty == Difficulty.EASY: + return 'Easy' + elif difficulty == Difficulty.NORMAL: + return 'Normal' + elif difficulty == Difficulty.HARD: + return 'Hard' def parse(string: str) -> Optional[Difficulty]: - if string == 'Low': - return Difficulty.LOW - elif string == 'Medium': - return Difficulty.MEDIUM - elif string == 'High': - return Difficulty.HIGH + if string == 'Easy': + return Difficulty.EASY + elif string == 'Normal': + return Difficulty.MIDDLE + elif string == 'Hard': + return Difficulty.HARD else: return None diff --git a/src/model/priority.py b/src/model/priority.py index 873369d..76cfd62 100644 --- a/src/model/priority.py +++ b/src/model/priority.py @@ -3,27 +3,27 @@ from typing import Optional class Priority(IntEnum): LOW = 0 - MEDIUM = 1 + MIDDLE = 1 HIGH = 2 values = [ Priority.LOW, - Priority.MEDIUM, + Priority.MIDDLE, Priority.HIGH] def format(priority: Priority) -> str: if priority == Priority.LOW: return 'Low' - elif priority == Priority.MEDIUM: - return 'Medium' + elif priority == Priority.MIDDLE: + return 'Middle' elif priority == Priority.HIGH: return 'High' def parse(string: str) -> Optional[Priority]: if string == 'Low': return Priority.LOW - elif string == 'Medium': - return Priority.MEDIUM + elif string == 'Middle': + return Priority.MIDDLE elif string == 'High': return Priority.HIGH else: |