summaryrefslogtreecommitdiff
path: root/src/main.py
diff options
context:
space:
mode:
authorLouie S <louie@example.com>2023-09-18 13:46:56 -0400
committerLouie S <louie@example.com>2023-09-18 13:55:07 -0400
commit1d26be43535c34b05513c92e700d5cc92610fa63 (patch)
tree5f96ced98677245031fa1d6460873e00ef0ccb72 /src/main.py
parent9e18638dbd378db5737c9ddd9ef5c16a7e8ca4c7 (diff)
Functional rules dialog and backend
Diffstat (limited to 'src/main.py')
-rw-r--r--src/main.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/main.py b/src/main.py
index 1b82204..008e310 100644
--- a/src/main.py
+++ b/src/main.py
@@ -12,6 +12,7 @@ from src.add_entry_form import addEntryForm
from src.edit_entry_form import editEntryForm
import src.globals as Globals
import src.db_sqlite as DB
+from src.rules_dialog import RulesDialog
class AssignmentList(QMainWindow):
def __init__(self):
@@ -39,7 +40,6 @@ class AssignmentList(QMainWindow):
self.preferences_act.setShortcut("Alt+Return")
self.preferences_act.triggered.connect(self.preferences)
file_menu.addAction(self.preferences_act)
- # TODO implement reload of DB that works
self.reload_act = QAction("Reload", self)
self.reload_act.setShortcut("F5")
self.reload_act.triggered.connect(self.reload)
@@ -184,6 +184,12 @@ class AssignmentList(QMainWindow):
Globals.entries = list(filter(lambda e: e.id != id, Globals.entries))
self.drawGroups()
+ def editRules(self, id):
+ pass
+ need_redraw = RulesDialog(id)
+ if need_redraw:
+ self.drawGroups()
+
def entryContextMenu(self, entry_id):
menu = QMenu()
@@ -191,6 +197,10 @@ class AssignmentList(QMainWindow):
edit_entry_act.triggered.connect((lambda id: lambda: self.editEntry(id))(entry_id))
menu.addAction(edit_entry_act)
+ rules_act = QAction("Rules")
+ rules_act.triggered.connect((lambda id: lambda: self.editRules(id))(entry_id))
+ menu.addAction(rules_act)
+
mark_done_act = QAction("Done", checkable=True)
if list(filter(lambda e: e.id == entry_id, Globals.entries))[0].done:
mark_done_act.setChecked(True)
@@ -206,7 +216,6 @@ class AssignmentList(QMainWindow):
def preferences(self):
# TODO not sure if this is working exactly how I think it does, but it works
need_reload = PreferencesDialog()
- print(need_reload)
if need_reload:
self.reload()
@@ -238,6 +247,9 @@ class AssignmentList(QMainWindow):
# Sort the entries
Globals.entries = sorted(Globals.entries, key=lambda e: (e.parent_id, (e.due if e.due else QDate.currentDate()), e.done, e.id))
+ # Sort the rules
+ Globals.rules = sorted(Globals.rules, key=lambda r: (r.id))
+
# Create columns as vertical boxes
column_left = QVBoxLayout()
column_right = QVBoxLayout()