Refactored for better packaging

This commit is contained in:
Mike Young
2019-11-20 00:49:40 -05:00
parent 98fd28dc3f
commit 37fe006da5
169 changed files with 28672 additions and 2 deletions

33
src/backend/lib/config.py Executable file
View File

@@ -0,0 +1,33 @@
import json
import os
import sys
class Config:
"""
Main System Configuration
"""
_fp = "config.json"
print(os.path)
def __init__(self, root=os.path.abspath("../../")):
_data = self.open_file(root)
self.book_path = _data["BOOKPATH"]
self.TITLE = _data["TITLE"]
self.VERSION = _data["VERSION"]
self.TITLE = self.TITLE + " ver " + self.VERSION
self.book_shelf = _data["BOOKSHELF"]
# self.catalogue_db = "data/catalogue.db"
self.catalogue_db = root + "/" + _data["DATABASE"]
self.file_array = [
self.book_shelf,
self.catalogue_db,
]
self.root = root
self.auto_scan = True
def open_file(self, root):
with open(root + "/" + self._fp, "r") as read_file:
data = json.load(read_file)
return data