1c885e3fc5
- show_error_dialog() aborted when QApplication construction itself was
the failure; fall back to stderr so the real error is visible.
- Auto-update QThread cleanup dropped the last Python reference while
run() could still be unwinding ("QThread: Destroyed while thread is
still running"); defer destruction to deleteLater on finished.
- macOS ffmpeg install no longer curl|bash-es the Homebrew bootstrap
script unattended; it now asks the user to install Homebrew
themselves and fails cleanly.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
41 lines
1.3 KiB
Python
41 lines
1.3 KiB
Python
import sys
|
|
|
|
from PySide6.QtWidgets import QApplication, QMessageBox
|
|
|
|
from .utils.ytsage_logger import logger
|
|
from .gui.ytsage_gui_main import YTSageApp # Import the main application class from ytsage_gui_main
|
|
|
|
|
|
def show_error_dialog(message):
|
|
# A QMessageBox needs a live QApplication; if startup failed before (or
|
|
# while) creating one, constructing the dialog would abort the process
|
|
# and swallow the real error.
|
|
if QApplication.instance() is None:
|
|
print(f"Application Error: {message}", file=sys.stderr)
|
|
return
|
|
error_dialog = QMessageBox()
|
|
error_dialog.setIcon(QMessageBox.Icon.Critical)
|
|
error_dialog.setText("Application Error")
|
|
error_dialog.setInformativeText(message)
|
|
error_dialog.setWindowTitle("Error")
|
|
error_dialog.exec()
|
|
|
|
|
|
def main():
|
|
try:
|
|
logger.info("Starting YTSage application")
|
|
app = QApplication(sys.argv)
|
|
|
|
window = YTSageApp() # Instantiate the main application class
|
|
window.show()
|
|
logger.info("Application window shown, entering main loop")
|
|
sys.exit(app.exec())
|
|
except Exception as e:
|
|
logger.critical(f"Critical application error: {e}", exc_info=True)
|
|
show_error_dialog(f"Critical error: {e}")
|
|
sys.exit(1)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|