forked from masonasons/FastGH
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFastGH.pyw
More file actions
52 lines (40 loc) · 1.17 KB
/
FastGH.pyw
File metadata and controls
52 lines (40 loc) · 1.17 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
"""FastGH - A fast GitHub client."""
import sys
sys.dont_write_bytecode = True
import platform
import os
# On Windows, redirect stderr to errors.log
if platform.system() != "Darwin":
if getattr(sys, 'frozen', False):
app_dir = os.path.dirname(sys.executable)
else:
app_dir = os.path.dirname(os.path.abspath(__file__))
try:
f = open(os.path.join(app_dir, "errors.log"), "a")
sys.stderr = f
except:
pass
import wx
# Create wx.App first
wx_app = wx.App(redirect=False)
# Prevent multiple instances
instance_checker = wx.SingleInstanceChecker("FastGH-" + wx.GetUserId())
if instance_checker.IsAnotherRunning():
wx.MessageBox("Another instance of FastGH is already running.", "FastGH", wx.OK | wx.ICON_WARNING)
sys.exit(1)
# Import and initialize application
import application
from application import get_app
from GUI import main, theme
# Load application (initializes accounts, preferences)
fastgh_app = get_app()
fastgh_app.load()
# Create main window
main.create_window()
# Apply theme
theme.apply_theme(main.window)
# Show window
if fastgh_app.prefs.window_shown:
main.window.Show()
# Start main loop
wx_app.MainLoop()