Refactor initialization: streamline log and config directory creation; enhance module exports in backend and UI widgets
This commit is contained in:
@@ -8,25 +8,24 @@ from appdirs import AppDirs
|
||||
|
||||
from config import Config
|
||||
|
||||
|
||||
app = AppDirs("SemesterApparatsManager", "SAM")
|
||||
LOG_DIR = app.user_log_dir
|
||||
CONFIG_DIR = app.user_config_dir
|
||||
if not os.path.exists(LOG_DIR):
|
||||
os.makedirs(LOG_DIR)
|
||||
if not os.path.exists(CONFIG_DIR):
|
||||
os.makedirs(CONFIG_DIR)
|
||||
LOG_DIR: str = app.user_log_dir # type: ignore
|
||||
CONFIG_DIR: str = app.user_config_dir # type: ignore
|
||||
if not os.path.exists(LOG_DIR): # type: ignore
|
||||
os.makedirs(LOG_DIR) # type: ignore
|
||||
if not os.path.exists(CONFIG_DIR): # type: ignore
|
||||
os.makedirs(CONFIG_DIR) # type: ignore
|
||||
|
||||
|
||||
settings = Config(f"{CONFIG_DIR}/config.yaml")
|
||||
DATABASE_DIR = (
|
||||
app.user_config_dir if settings.database.path is None else settings.database.path
|
||||
DATABASE_DIR = ( # type: ignore
|
||||
app.user_config_dir if settings.database.path is None else settings.database.path # type: ignore
|
||||
)
|
||||
if not os.path.exists(DATABASE_DIR):
|
||||
os.makedirs(DATABASE_DIR)
|
||||
if not os.path.exists(DATABASE_DIR): # type: ignore
|
||||
os.makedirs(DATABASE_DIR) # type: ignore
|
||||
first_launch = settings.exists
|
||||
if not os.path.exists(settings.database.temp.expanduser()):
|
||||
settings.database.temp.expanduser().mkdir(parents=True, exist_ok=True)
|
||||
if not os.path.exists(settings.database.temp.expanduser()): # type: ignore
|
||||
settings.database.temp.expanduser().mkdir(parents=True, exist_ok=True) # type: ignore
|
||||
from .utils.icon import Icon
|
||||
|
||||
if not os.path.exists("logs"):
|
||||
|
||||
@@ -9,6 +9,7 @@ __all__ = [
|
||||
"NewEditionCheckerThread",
|
||||
"recreateElsaFile",
|
||||
"recreateFile",
|
||||
"Catalogue"
|
||||
]
|
||||
|
||||
from .admin_console import AdminCommands
|
||||
@@ -20,3 +21,4 @@ from .thread_bookgrabber import BookGrabber
|
||||
from .thread_neweditions import NewEditionCheckerThread
|
||||
from .threads_autoadder import AutoAdder
|
||||
from .threads_availchecker import AvailChecker
|
||||
from .catalogue import Catalogue
|
||||
|
||||
@@ -11,6 +11,9 @@ __all__ = [
|
||||
"EditProf",
|
||||
"IconWidget",
|
||||
"NewEditionChecker",
|
||||
"NewEditionCheckSelector",
|
||||
"UpdateSignatures",
|
||||
"UpdaterThread"
|
||||
]
|
||||
|
||||
from .admin_create_user import UserCreate
|
||||
@@ -23,5 +26,7 @@ from .filepicker import FilePicker
|
||||
from .graph import DataQtGraph
|
||||
from .iconLine import IconWidget
|
||||
from .MessageCalendar import MessageCalendar
|
||||
from .new_edition_check import NewEditionChecker
|
||||
from .new_edition_check import NewEditionChecker, NewEditionCheckSelector
|
||||
from .searchPage import SearchStatisticPage
|
||||
from .signature_update import UpdateSignatures, UpdaterThread
|
||||
|
||||
|
||||
Reference in New Issue
Block a user