-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
70 lines (50 loc) · 1.8 KB
/
Copy pathrun.py
File metadata and controls
70 lines (50 loc) · 1.8 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
"""
NeuronNotes - Open Source Second Brain
A local-first note-taking app with bidirectional linking.
Licensed under MIT License - Free forever.
"""
import sys
import os
def get_base_dir():
"""Get the base directory - handles both source and PyInstaller EXE."""
if getattr(sys, 'frozen', False):
# Running as PyInstaller EXE - use the temp folder where files extract
return sys._MEIPASS
else:
# Running as script
return os.path.dirname(os.path.abspath(__file__))
BASE_DIR = get_base_dir()
sys.path.insert(0, BASE_DIR)
from PyQt6.QtWidgets import QApplication
from PyQt6.QtGui import QFont, QIcon
from app.ui.main_window import MainWindow
from app.utils.config import Config
def set_windows_app_id():
"""Tell Windows this is a distinct app."""
try:
from ctypes import windll
app_id = "OmDautkhani.NeuronNotes.SecondBrain.1.1.0"
windll.shell32.SetCurrentProcessExplicitAppUserModelID(app_id)
except (ImportError, AttributeError, OSError):
pass
def main():
os.environ["QT_AUTO_SCREEN_SCALE_FACTOR"] = "1"
set_windows_app_id()
app = QApplication(sys.argv)
app.setApplicationName("NeuronNotes")
app.setApplicationVersion("1.1.0")
# Load icon - try bundled path first (for EXE), fallback to source
icon_path = os.path.join(BASE_DIR, "app", "assets", "icon.ico")
if os.path.exists(icon_path):
app.setWindowIcon(QIcon(icon_path))
font = QFont("Segoe UI", 10)
app.setFont(font)
# Config always uses HOME dir, not BASE_DIR (for EXE compatibility)
config = Config(os.path.expanduser("~"))
window = MainWindow(config, BASE_DIR)
if os.path.exists(icon_path):
window.setWindowIcon(QIcon(icon_path))
window.show()
sys.exit(app.exec())
if __name__ == "__main__":
main()