-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
35 lines (25 loc) · 840 Bytes
/
app.py
File metadata and controls
35 lines (25 loc) · 840 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"""Application bootstrap helpers."""
from __future__ import annotations
import sys
from typing import Optional
from PyQt6.QtCore import QTimer
from PyQt6.QtWidgets import QApplication
from .mainwindow import MainWindow
from .theme import apply_theme, load_theme_preference
def run(initial_path: Optional[str] = None) -> int:
"""Launch the Qt application."""
app = QApplication.instance()
owns_app = False
if app is None:
app = QApplication(sys.argv)
app.setApplicationName("SQLite View")
app.setOrganizationName("SQLiteView")
owns_app = True
apply_theme(load_theme_preference(), app)
window = MainWindow()
window.show()
if initial_path:
QTimer.singleShot(0, lambda: window.open_database(initial_path))
if owns_app:
return app.exec()
return 0