OSDN Git Service

creating gui
[amulettoolsmh4/main.git] / view / mainframe.py
1 # -*- coding: utf-8 -*-
2
3 # GUIのメインフレーム
4 # 2013/12/05 written by kei9
5 import wx
6 import wx.xrc
7
8 import constnumbers
9
10 class MainFrame(wx.App):
11     u""" メインのフレームクラス """
12     def OnInit(self):
13         self.res = wx.xrc.XmlResource("mainframe.xrc")
14         self.init_frame()
15         return True
16
17     def init_frame(self):
18         # load controls
19         self.frame = self.res.LoadFrame(None, "mainframe")
20
21         # buttons
22         self.button_seed_seaerch = wx.xrc.XRCCTRL(self.frame, "button_seed_search")
23         self.button_seed_clear = wx.xrc.XRCCTRL(self.frame, "button_seed_clear")
24         self.button_skill_ok = wx.xrc.XRCCTRL(self.frame, "button_skill_ok")
25         self.button_amusearch_seaerch = wx.xrc.XRCCTRL(self.frame, "button_amusearch_search")
26         self.button_amusearch_clear = wx.xrc.XRCCTRL(self.frame, "button_amusearch_clear")
27
28         # menu
29         self.menuitem_close = wx.xrc.XRCCTRL(self.frame, "MenuItemExit")
30         self.menuitem_about = wx.xrc.XRCCTRL(self.frame, "MenuItemAbout")
31         self.frame.Bind(wx.EVT_MENU, self.OnClose, self.menuitem_close)
32         self.frame.Bind(wx.EVT_MENU, self.OnAboutBox, self.menuitem_about)
33
34         # event
35         self.frame.Show()
36
37     def OnClose(self, evt):
38         self.frame.Close(True)
39
40     def OnAboutBox(self, evt):
41         u""" Show About Box """
42         info = wx.AboutDialogInfo()
43         info.Name = constnumbers.NAME
44         info.Version = constnumbers.VERSION
45         info.Copyright = constnumbers.COPYRIGHT
46         info.Description = constnumbers.DESCRIPTION
47         info.WebSite = (constnumbers.WEBSITE_LINK, constnumbers.WEBSITE_TEXT)
48         info.Developers = constnumbers.DEVELOPERS
49         info.License = constnumbers.LICENSE_TEXT
50         wx.AboutBox(info)
51
52
53
54 if __name__ == "__main__":
55     app = MainFrame(False)
56     app.MainLoop()