-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
35 lines (24 loc) · 1.04 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"""Manages the global context for the app, serving as a back-end for database access etc."""
from pathlib import Path
from accounts import AccountsDatabase
from settings import SettingsDatabase
from students import StudentsDatabase
from util import JSONDatabase
class Brand:
"""Contains branding and metadata for the app"""
APP_NAME = "Mr Leeman's System"
class App:
"""A running instance of the application"""
def __init__(self, data_directory=Path(".", "data")) -> None:
self.brand = Brand
# Store all database files in the data directory
JSONDatabase.base_path = data_directory
# Initialise the JSON databases
self.settings_database = SettingsDatabase()
self.accounts_database = AccountsDatabase()
self.students_database = StudentsDatabase(app=self)
# Store the account that is currently signed in
self.current_account = None
def signed_in(self):
"""Checks if the user is signed in with an account"""
return self.current_account is not None