add --config flag to modify config path

+ use getters instead of constants in settings classes
+ refactor previous references
+ move get_xdg_config_dir() from settings.py to app.utils.xdg_utils.py
This commit is contained in:
geoffrey45
2023-04-09 01:01:48 +03:00
parent 30256a7998
commit 1e4484b1c8
17 changed files with 149 additions and 130 deletions
-8
View File
@@ -17,14 +17,6 @@ def create_connection(db_file: str) -> SqlConn:
return conn
def get_sqlite_conn():
"""
It opens a connection to the database
:return: A connection to the database.
"""
return create_connection(Db.APP_DB_PATH)
def create_tables(conn: SqlConn, sql_query: str):
"""
Executes the specifiend SQL file to create database tables.
+2 -2
View File
@@ -78,10 +78,10 @@ class SQLiteManager:
if self.conn is not None:
return self.conn.cursor()
db_path = Db.APP_DB_PATH
db_path = Db.get_app_db_path()
if self.userdata_db:
db_path = Db.USERDATA_DB_PATH
db_path = Db.get_userdata_db_path()
self.conn = sqlite3.connect(
db_path,