feat: Implement application preferences with JSON persistence
Build and Push Docker Image / build-and-push (push) Has been cancelled
Build and Push Docker Image / build-and-push (push) Has been cancelled
- Added preferences management in `preferences.py` with functions to load, save, get, set, and reset preferences. - Introduced a configuration directory structure based on the operating system. - Integrated preferences into the settings window, allowing users to reset settings and manage window geometry. - Enhanced `search_filter.py` to support flexible date column names and improved filtering logic. - Updated `settings_window.py` to include options for managing backup and configuration folder paths. - Introduced an `UndoManager` class to handle undo actions for add/update/delete operations. - Improved UIManager to support sorting in tree views and added a toast notification feature.
This commit is contained in:
+10
-26
@@ -1,31 +1,15 @@
|
||||
import os
|
||||
"""App initialization: configure the root logger once per process.
|
||||
|
||||
from constants import LOG_CLEAR, LOG_LEVEL, LOG_PATH
|
||||
We delegate directory creation and file clearing to the logger utility,
|
||||
which honors LOG_PATH, LOG_LEVEL, and LOG_CLEAR.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from constants import LOG_LEVEL
|
||||
from logger import init_logger
|
||||
|
||||
if not os.path.exists(LOG_PATH):
|
||||
try:
|
||||
os.mkdir(LOG_PATH)
|
||||
print(LOG_PATH)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
log_files = (
|
||||
f"{LOG_PATH}/thechart.log",
|
||||
f"{LOG_PATH}/thechart.warning.log",
|
||||
f"{LOG_PATH}/thechart.error.log",
|
||||
)
|
||||
|
||||
testing_mode = LOG_LEVEL == "DEBUG"
|
||||
testing_mode: bool = LOG_LEVEL == "DEBUG"
|
||||
|
||||
# Expose a module-level logger for imports like `from init import logger`
|
||||
logger = init_logger(__name__, testing_mode=testing_mode)
|
||||
|
||||
if LOG_CLEAR == "True":
|
||||
try:
|
||||
for log_file in log_files:
|
||||
if os.path.exists(log_file):
|
||||
with open(log_file, "r+") as t:
|
||||
t.truncate(0)
|
||||
except Exception as e:
|
||||
logger.error(e)
|
||||
raise
|
||||
|
||||
Reference in New Issue
Block a user