2022-10-23 22:39:38 +02:00
|
|
|
import faulthandler
|
2022-09-25 11:41:20 +02:00
|
|
|
import logging
|
2022-10-29 13:17:39 +02:00
|
|
|
import multiprocessing
|
2022-10-11 21:04:28 +02:00
|
|
|
import os
|
2022-11-15 08:53:01 +01:00
|
|
|
import platform
|
2022-10-16 21:37:59 +02:00
|
|
|
import sys
|
2022-12-09 01:05:48 +01:00
|
|
|
from typing import TextIO
|
2022-10-11 21:04:28 +02:00
|
|
|
|
2023-01-05 01:30:30 +01:00
|
|
|
from PyQt6.QtCore import QTranslator, QLocale
|
2022-10-11 21:04:28 +02:00
|
|
|
from appdirs import user_log_dir
|
2022-09-24 15:46:36 +02:00
|
|
|
|
2022-10-23 22:39:38 +02:00
|
|
|
# Check for segfaults if not running in frozen mode
|
|
|
|
if getattr(sys, 'frozen', False) is False:
|
|
|
|
faulthandler.enable()
|
|
|
|
|
2022-12-09 01:05:48 +01:00
|
|
|
# Sets stderr to no-op TextIO when None (run as Windows GUI).
|
|
|
|
# Resolves https://github.com/chidiwilliams/buzz/issues/221
|
|
|
|
if sys.stderr is None:
|
|
|
|
sys.stderr = TextIO()
|
|
|
|
|
2022-10-22 22:02:49 +02:00
|
|
|
# Adds the current directory to the PATH, so the ffmpeg binary get picked up:
|
|
|
|
# https://stackoverflow.com/a/44352931/9830227
|
|
|
|
app_dir = getattr(sys, '_MEIPASS', os.path.dirname(
|
|
|
|
os.path.abspath(__file__)))
|
|
|
|
os.environ["PATH"] += os.pathsep + app_dir
|
|
|
|
|
2022-11-13 13:21:17 +01:00
|
|
|
# Add the app directory to the DLL list: https://stackoverflow.com/a/64303856
|
2022-11-15 08:53:01 +01:00
|
|
|
if platform.system() == 'Windows':
|
|
|
|
os.add_dll_directory(app_dir)
|
2022-11-13 13:21:17 +01:00
|
|
|
|
2022-10-29 13:17:39 +02:00
|
|
|
if __name__ == "__main__":
|
|
|
|
# Fixes opening new window when app has been frozen on Windows:
|
|
|
|
# https://stackoverflow.com/a/33979091
|
|
|
|
multiprocessing.freeze_support()
|
2022-10-12 08:04:42 +02:00
|
|
|
|
2022-10-11 21:04:28 +02:00
|
|
|
log_dir = user_log_dir(appname='Buzz')
|
|
|
|
os.makedirs(log_dir, exist_ok=True)
|
2022-10-09 18:11:03 +02:00
|
|
|
logging.basicConfig(
|
2022-10-11 21:04:28 +02:00
|
|
|
filename=os.path.join(log_dir, 'logs.txt'),
|
2022-10-09 18:11:03 +02:00
|
|
|
level=logging.DEBUG,
|
|
|
|
format="[%(asctime)s] %(module)s.%(funcName)s:%(lineno)d %(levelname)s -> %(message)s")
|
2022-09-24 15:46:36 +02:00
|
|
|
|
2022-11-28 14:59:15 +01:00
|
|
|
from buzz.gui import Application
|
2022-12-30 17:43:29 +01:00
|
|
|
|
2022-10-09 18:11:03 +02:00
|
|
|
app = Application()
|
2023-01-05 01:30:30 +01:00
|
|
|
|
2022-10-16 21:37:59 +02:00
|
|
|
sys.exit(app.exec())
|