- Updated the `from_tuple` method in `Prof` class to specify return type. - Added type hints for various methods in `LehmannsClient`, `OpenAI`, `WebRequest`, and `ZoteroController` classes to improve code clarity and type safety. - Modified `pdf_to_csv` function to return a string instead of a DataFrame. - Enhanced error handling and type hints in `wordparser` and `xmlparser` modules. - Removed unused UI file `Ui_medianadder.ts`. - Improved the layout and structure of the `semesterapparat_ui` to enhance user experience. - Updated file picker to support `.doc` files in addition to `.docx`. - Added unique item handling in `Ui` class to prevent duplicates in apparat list. - General code cleanup and consistency improvements across various files.
36 lines
1.2 KiB
Python
36 lines
1.2 KiB
Python
__version__ = "1.0.0"
|
|
__author__ = "Alexander Kirchner"
|
|
__all__ = ["__version__", "__author__", "Icon", "settings"]
|
|
|
|
import os
|
|
from pathlib import Path
|
|
from typing import Union
|
|
|
|
from appdirs import AppDirs
|
|
|
|
from config import Config
|
|
|
|
app = AppDirs("SemesterApparatsManager", "SAM")
|
|
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: Union[Path, str] = ( # 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): # type: ignore
|
|
os.makedirs(DATABASE_DIR) # type: ignore
|
|
first_launch = settings.exists
|
|
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"):
|
|
os.mkdir("logs")
|
|
# open and close the file to create it
|