Files
bulk-reminders/bulk_reminders/undo.py
Xevion ce3759bd60 Prepare loading of events from load dialog into main window
Add nicer label for counting events by type
2021-08-25 07:13:24 -05:00

26 lines
519 B
Python

import json
import os
stages = []
def load() -> None:
"""Load data from the undo history file"""
with open('history.json', 'r') as history:
stages = json.load(history)
def save() -> None:
"""Save data to the undo history file."""
with open('history.json', 'w') as history:
stages = json.dump(history)
if os.path.exists('history.json'):
load()
def getTotal() -> int:
"""Returns the total number of undoable events known."""
return sum(len(stage) for stage in stages)