fix: move schema file to build folder

This commit is contained in:
Chidi Williams 2024-03-15 00:50:07 +00:00
commit ebe9539605
7 changed files with 22 additions and 24 deletions

View file

@ -23,6 +23,7 @@ datas += collect_data_files("transformers", include_py_files=True)
datas += collect_data_files("whisper")
datas += [("buzz/assets/*", "assets")]
datas += [("buzz/locale", "locale")]
datas += [("buzz/schema.sql", ".")]
block_cipher = None

View file

@ -2,7 +2,7 @@ import os
import sys
def get_asset_path(path: str):
def get_path(path: str):
if getattr(sys, "frozen", False):
return os.path.join(os.path.dirname(sys.executable), path)
return os.path.join(os.path.dirname(__file__), path)

View file

@ -2,6 +2,7 @@ import os
from datetime import datetime
from sqlite3 import Connection
from buzz.assets import get_path
from buzz.cache import TasksCache
from buzz.db.migrator import dumb_migrate_db
@ -64,7 +65,7 @@ def copy_transcriptions_from_json_to_sqlite(conn: Connection):
def run_sqlite_migrations(db: Connection):
schema_path = os.path.join(os.path.dirname(__file__), "schema.sql")
schema_path = get_path("schema.sql")
with open(schema_path) as schema_file:
schema = schema_file.read()

View file

@ -2,10 +2,10 @@ import gettext
from PyQt6.QtCore import QLocale
from buzz.assets import get_asset_path
from buzz.assets import get_path
from buzz.settings.settings import APP_NAME
locale_dir = get_asset_path("locale")
locale_dir = get_path("locale")
gettext.bindtextdomain("buzz", locale_dir)
translate = gettext.translation(

View file

@ -1,7 +1,7 @@
from PyQt6.QtGui import QIcon, QPixmap, QPainter, QColor
from PyQt6.QtWidgets import QWidget
from buzz.assets import get_asset_path
from buzz.assets import get_path
class Icon(QIcon):
@ -51,38 +51,34 @@ class Icon(QIcon):
class PlayIcon(Icon):
def __init__(self, parent: QWidget):
super().__init__(get_asset_path("assets/play_arrow_black_24dp.svg"), parent)
super().__init__(get_path("assets/play_arrow_black_24dp.svg"), parent)
class PauseIcon(Icon):
def __init__(self, parent: QWidget):
super().__init__(get_asset_path("assets/pause_black_24dp.svg"), parent)
super().__init__(get_path("assets/pause_black_24dp.svg"), parent)
class UndoIcon(Icon):
def __init__(self, parent: QWidget):
super().__init__(
get_asset_path("assets/undo_FILL0_wght700_GRAD0_opsz48.svg"), parent
)
super().__init__(get_path("assets/undo_FILL0_wght700_GRAD0_opsz48.svg"), parent)
class RedoIcon(Icon):
def __init__(self, parent: QWidget):
super().__init__(
get_asset_path("assets/redo_FILL0_wght700_GRAD0_opsz48.svg"), parent
)
super().__init__(get_path("assets/redo_FILL0_wght700_GRAD0_opsz48.svg"), parent)
class FileDownloadIcon(Icon):
def __init__(self, parent: QWidget):
super().__init__(get_asset_path("assets/file_download_black_24dp.svg"), parent)
super().__init__(get_path("assets/file_download_black_24dp.svg"), parent)
BUZZ_ICON_PATH = get_asset_path("assets/buzz.ico")
BUZZ_LARGE_ICON_PATH = get_asset_path("assets/buzz-icon-1024.png")
BUZZ_ICON_PATH = get_path("assets/buzz.ico")
BUZZ_LARGE_ICON_PATH = get_path("assets/buzz-icon-1024.png")
RECORD_ICON_PATH = get_asset_path("assets/mic_FILL0_wght700_GRAD0_opsz48.svg")
EXPAND_ICON_PATH = get_asset_path("assets/open_in_full_FILL0_wght700_GRAD0_opsz48.svg")
ADD_ICON_PATH = get_asset_path("assets/add_FILL0_wght700_GRAD0_opsz48.svg")
TRASH_ICON_PATH = get_asset_path("assets/delete_FILL0_wght700_GRAD0_opsz48.svg")
CANCEL_ICON_PATH = get_asset_path("assets/cancel_FILL0_wght700_GRAD0_opsz48.svg")
RECORD_ICON_PATH = get_path("assets/mic_FILL0_wght700_GRAD0_opsz48.svg")
EXPAND_ICON_PATH = get_path("assets/open_in_full_FILL0_wght700_GRAD0_opsz48.svg")
ADD_ICON_PATH = get_path("assets/add_FILL0_wght700_GRAD0_opsz48.svg")
TRASH_ICON_PATH = get_path("assets/delete_FILL0_wght700_GRAD0_opsz48.svg")
CANCEL_ICON_PATH = get_path("assets/cancel_FILL0_wght700_GRAD0_opsz48.svg")

View file

@ -3,7 +3,7 @@ from typing import Optional
from PyQt6.QtCore import pyqtSignal
from PyQt6.QtWidgets import QWidget, QLineEdit
from buzz.assets import get_asset_path
from buzz.assets import get_path
from buzz.widgets.icon import Icon
from buzz.widgets.line_edit import LineEdit
@ -17,10 +17,10 @@ class OpenAIAPIKeyLineEdit(LineEdit):
self.key = key
self.visible_on_icon = Icon(
get_asset_path("assets/visibility_FILL0_wght700_GRAD0_opsz48.svg"), self
get_path("assets/visibility_FILL0_wght700_GRAD0_opsz48.svg"), self
)
self.visible_off_icon = Icon(
get_asset_path("assets/visibility_off_FILL0_wght700_GRAD0_opsz48.svg"), self
get_path("assets/visibility_off_FILL0_wght700_GRAD0_opsz48.svg"), self
)
self.setPlaceholderText("sk-...")