-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
53 lines (41 loc) · 1.21 KB
/
main.py
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import sys
from PyQt5.QtWidgets import QApplication
from PyQt5.QtGui import QFont
from omnibar import OmnibarWindow
from settings import load_config
import nltk
import logging
# Initialize logging
logging.basicConfig(level=logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
logger = logging.getLogger(__name__)
# Initialize NLTK data
try:
nltk.data.find('corpora/words')
nltk.data.find('corpora/brown')
except LookupError:
nltk.download('words', quiet=True)
nltk.download('brown', quiet=True)
def main():
app = QApplication(sys.argv)
# Check if another instance is running
if app.property("omnibar_running"):
sys.exit(0)
app.setProperty("omnibar_running", True)
# Set default font
font = QFont("Segoe UI", 10)
app.setFont(font)
# Load configuration
config = load_config()
# Create main window
window = OmnibarWindow()
# Auto-start if configured
if config.get('start_with_windows', False):
window.show()
return app.exec_()
if __name__ == '__main__':
try:
sys.exit(main())
except Exception as e:
logger.critical(f"Application crashed: {e}", exc_info=True)
sys.exit(1)