-
Notifications
You must be signed in to change notification settings - Fork 5
/
main.py
40 lines (31 loc) · 970 Bytes
/
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
import os
from contextlib import contextmanager
from gui_handlers import MyFrame
import wx
import wx.lib.mixins.inspection
from pathlib import Path
import warnings
warnings.filterwarnings("ignore", category=DeprecationWarning)
@contextmanager
def cd(newdir):
"""https://stackoverflow.com/a/24176022"""
prevdir = os.getcwd()
os.chdir(os.path.expanduser(newdir))
try:
yield
finally:
os.chdir(prevdir)
class LoguetoolsWxApp(wx.App, wx.lib.mixins.inspection.InspectionMixin):
"""The main application class - added a wxPython inspection tool
http://wiki.wxpython.org/Widget%20Inspection%20Tool
"""
def OnInit(self):
self.Init() # initialize the inspection tool
self.m_frame = MyFrame(None)
self.m_frame.Show()
self.SetTopWindow(self.m_frame)
return True
if __name__ == '__main__':
with cd(Path(__file__).parent):
app = LoguetoolsWxApp(0)
app.MainLoop()