Skip to content

Commit 83e79ac

Browse files
committed
Remove QSettings completely, fix default db file related bug
1 parent c55b67d commit 83e79ac

File tree

3 files changed

+4
-15
lines changed

3 files changed

+4
-15
lines changed

pyqt_openai/replicate_widget/replicateMainWidget.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import os
22

3-
from PySide6.QtCore import Qt, QSettings
3+
from PySide6.QtCore import Qt
44
from PySide6.QtWidgets import QStackedWidget, QHBoxLayout, QVBoxLayout, QWidget, QSplitter
55

66
from pyqt_openai import INI_FILE_NAME, ICON_HISTORY, ICON_SETTING, DEFAULT_SHORTCUT_LEFT_SIDEBAR_WINDOW, \

pyqt_openai/sqlite.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
from datetime import datetime
44
from typing import List
55

6-
from PySide6.QtCore import QSettings
7-
6+
from pyqt_openai.config_loader import CONFIG_MANAGER
87
from pyqt_openai import THREAD_TABLE_NAME, THREAD_TRIGGER_NAME, \
98
THREAD_TABLE_NAME_OLD, \
109
THREAD_TRIGGER_NAME_OLD, MESSAGE_TABLE_NAME_OLD, MESSAGE_TABLE_NAME, THREAD_MESSAGE_INSERTED_TR_NAME, \
@@ -19,8 +18,7 @@ def get_db_filename():
1918
"""
2019
Get the database file's name from the settings.
2120
"""
22-
settings = QSettings(INI_FILE_NAME, QSettings.Format.IniFormat)
23-
db_path = settings.value("db", DB_FILE_NAME) + ".db"
21+
db_path = CONFIG_MANAGER.get_general_property('db') + '.db'
2422
return db_path
2523

2624

pyqt_openai/util/script.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from pathlib import Path
1919

2020
import requests
21-
from PySide6.QtCore import QSettings, Qt, QUrl
21+
from PySide6.QtCore import Qt, QUrl
2222
from PySide6.QtGui import QDesktopServices
2323
from PySide6.QtWidgets import QMessageBox, QFrame
2424
from jinja2 import Template
@@ -125,15 +125,6 @@ def download_image_as_base64(url: str):
125125
base64_encoded = base64.b64decode(base64.b64encode(image_data).decode('utf-8'))
126126
return base64_encoded
127127

128-
def get_font():
129-
settings = QSettings(INI_FILE_NAME, QSettings.Format.IniFormat)
130-
font_family = settings.value("font_family", DEFAULT_FONT_FAMILY, type=str)
131-
font_size = settings.value("font_size", DEFAULT_FONT_SIZE, type=int)
132-
return {
133-
'font_family': font_family,
134-
'font_size': font_size
135-
}
136-
137128
def restart_app():
138129
# Define the arguments to be passed to the executable
139130
args = [sys.executable, MAIN_INDEX]

0 commit comments

Comments
 (0)