-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
33 lines (23 loc) · 740 Bytes
/
app.py
File metadata and controls
33 lines (23 loc) · 740 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
"""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
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
window = MainWindow()
window.show()
if initial_path:
QTimer.singleShot(0, lambda: window.open_database(initial_path))
if owns_app:
return app.exec()
return 0