aboutsummaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorJoris2020-05-10 14:43:24 +0200
committerJoris2020-05-10 14:43:24 +0200
commit2b479fae26b7446f9269223d1e1fb4073839f5cc (patch)
tree8a15017b80e94e778857fe856160c36865568a1d /src/gui
parent7372ab407535ade48ce0b642ae051990e3bef7ed (diff)
Improve difficulty and priority reading
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/color.py9
-rw-r--r--src/gui/icon.py (renamed from src/gui/icons.py)0
-rw-r--r--src/gui/tasks/form/widget.py10
-rw-r--r--src/gui/tasks/table/menu.py4
-rw-r--r--src/gui/tasks/table/model.py16
-rw-r--r--src/gui/tasks/widget.py4
6 files changed, 22 insertions, 21 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)