-
Notifications
You must be signed in to change notification settings - Fork 2
/
falcon.py
58 lines (43 loc) · 1.37 KB
/
falcon.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
54
55
56
57
58
# -*- coding: utf-8 -*-
# Falcon startup file
# run python fal.py to execute Falcon
# Copyright (C) 2019 Yukio Nozawa <[email protected]>
# Copyright (C) 2020 yamahubuki <[email protected]>
# See window.py for application entry point
import os
import sys
# カレントディレクトリを設定
if hasattr(sys, "frozen"):
os.chdir(os.path.dirname(sys.executable))
else:
os.chdir(os.path.abspath(os.path.dirname(__file__)))
import win32timezone # ダミー
def _(string): pass # dummy
# dllをカレントディレクトリから読み込むように設定
os.add_dll_directory(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
import traceback
import app as application
import constants
import globalVars
def main():
if os.path.exists("errorLog.txt"):
os.remove("errorLog.txt")
global app
app = application.falconAppMain()
globalVars.app = app
app.initialize()
app.MainLoop()
app.config.write()
def exchandler(type, exc, tb):
msg = traceback.format_exception(type, exc, tb)
print("".join(msg))
f = open("errorLog.txt", "a")
f.writelines(msg)
f.close()
if globalVars.app:
globalVars.app.PlayErrorSound()
#global schope
sys.excepthook = exchandler
if __name__ == "__main__":
main()