-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
59 lines (51 loc) · 1.44 KB
/
main.py
File metadata and controls
59 lines (51 loc) · 1.44 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
# -*- coding: utf-8 -*-
"""
http://blog.csdn.net/chenghit
"""
import wx
import threading
from frames import *
from gui import GuiManager
from util import *
from core import *
class MainAPP(wx.App):
@debug_name
def OnInit(self):
self.manager = GuiManager(self.UpdateUI)
self.frame = self.manager.GetFrame('initframe', 'INIT')
self.frame.Show()
return True
def UpdateUI(self, name, typ, **kwargs):
self.frame.Show(False)
# self.frame.DestroyLater()
self.frame = self.manager.GetFrame(name, typ, **kwargs)
self.frame.Show(True)
#
# @debug_name
def MacOpenFile(self, filename):
if filename.endswith('.rl'):
# 获得一个db并连接
filepath = filename
# parent = event.GetEventObject()
# is_new = parent.GetName() == 'newdb'
# if is_new:
# if not filepath.endswith(".rl"):
# filepath += ".rl"
# # import os
# if os.path.exists(filepath):
# res = wx.MessageBox("已存在同名Reading List,是否覆盖?", "Warning", wx.YES_NO | wx.ICON_EXCLAMATION)
# if res == wx.NO:
# event.SkipEvent()
# else:
# os.remove(filepath)
# 创建连接
res = core.safe_connect(filepath)
if res != None:
wx.MessageBox(u"连接到数据库失败,原因:%s" % res, "Error", wx.OK | wx.CENTRE | wx.ICON_ERROR)
# 读取主界面需要的数据
# OpenTable(DB_conn, '123')
# 切换到主界面
else:
self.manager.UpdateUI('mainframe', 'MAIN')
app = MainAPP()
app.MainLoop()