Show More
@@ -1,272 +1,273 b'' | |||||
1 | #!/usr/bin/python |
|
1 | #!/usr/bin/python | |
2 | # -*- coding: iso-8859-15 -*- |
|
2 | # -*- coding: iso-8859-15 -*- | |
3 |
|
3 | |||
4 | import sys |
|
4 | import sys | |
5 | try: |
|
5 | try: | |
|
6 | import wxversion; wxversion.ensureMinimal("2.8") | |||
6 | import wx.aui |
|
7 | import wx.aui | |
7 | except ImportError: |
|
8 | except ImportError: | |
8 | print "Can't laod wx.aui module, please check that you have installed wxpython > 2.8 and taht it is your default install" |
|
9 | print "Can't laod wx.aui module, please check that you have installed wxpython > 2.8 and taht it is your default install" | |
9 | sys.exit(1) |
|
10 | sys.exit(1) | |
10 |
|
11 | |||
11 | #used for about dialog |
|
12 | #used for about dialog | |
12 | from wx.lib.wordwrap import wordwrap |
|
13 | from wx.lib.wordwrap import wordwrap | |
13 |
|
14 | |||
14 | #used for ipython GUI objects |
|
15 | #used for ipython GUI objects | |
15 | from IPython.gui.wx.ipython_view import IPShellWidget |
|
16 | from IPython.gui.wx.ipython_view import IPShellWidget | |
16 | from IPython.gui.wx.ipython_history import IPythonHistoryPanel |
|
17 | from IPython.gui.wx.ipython_history import IPythonHistoryPanel | |
17 |
|
18 | |||
18 | #used to invoke ipython1 wx implementation |
|
19 | #used to invoke ipython1 wx implementation | |
19 | ### FIXME ### temporary disabled due to interference with 'show_in_pager' hook |
|
20 | ### FIXME ### temporary disabled due to interference with 'show_in_pager' hook | |
20 | is_sync_frontend_ok = False |
|
21 | is_sync_frontend_ok = False | |
21 | try: |
|
22 | try: | |
22 | from IPython.frontend.wx.ipythonx import IPythonXController |
|
23 | from IPython.frontend.wx.ipythonx import IPythonXController | |
23 | except ImportError: |
|
24 | except ImportError: | |
24 | is_sync_frontend_ok = False |
|
25 | is_sync_frontend_ok = False | |
25 |
|
26 | |||
26 | #used to create options.conf file in user directory |
|
27 | #used to create options.conf file in user directory | |
27 | from IPython.ipapi import get |
|
28 | from IPython.ipapi import get | |
28 |
|
29 | |||
29 | __version__ = 0.10 |
|
30 | __version__ = 0.10 | |
30 | __version_str__ = "0.10" |
|
31 | __version_str__ = "0.10" | |
31 | __author__ = "Laurent Dufrechou" |
|
32 | __author__ = "Laurent Dufrechou" | |
32 | __email__ = "laurent.dufrechou _at_ gmail.com" |
|
33 | __email__ = "laurent.dufrechou _at_ gmail.com" | |
33 | __license__ = "BSD" |
|
34 | __license__ = "BSD" | |
34 |
|
35 | |||
35 | #----------------------------------------- |
|
36 | #----------------------------------------- | |
36 | # Creating one main frame for our |
|
37 | # Creating one main frame for our | |
37 | # application with movables windows |
|
38 | # application with movables windows | |
38 | #----------------------------------------- |
|
39 | #----------------------------------------- | |
39 | class MyFrame(wx.Frame): |
|
40 | class MyFrame(wx.Frame): | |
40 | """Creating one main frame for our |
|
41 | """Creating one main frame for our | |
41 | application with movables windows""" |
|
42 | application with movables windows""" | |
42 | def __init__(self, parent=None, id=-1, title="WxIPython", |
|
43 | def __init__(self, parent=None, id=-1, title="WxIPython", | |
43 | pos=wx.DefaultPosition, |
|
44 | pos=wx.DefaultPosition, | |
44 | size=(800, 600), style=wx.DEFAULT_FRAME_STYLE, sync_ok=False): |
|
45 | size=(800, 600), style=wx.DEFAULT_FRAME_STYLE, sync_ok=False): | |
45 | wx.Frame.__init__(self, parent, id, title, pos, size, style) |
|
46 | wx.Frame.__init__(self, parent, id, title, pos, size, style) | |
46 | self._mgr = wx.aui.AuiManager() |
|
47 | self._mgr = wx.aui.AuiManager() | |
47 |
|
48 | |||
48 | # notify PyAUI which frame to use |
|
49 | # notify PyAUI which frame to use | |
49 | self._mgr.SetManagedWindow(self) |
|
50 | self._mgr.SetManagedWindow(self) | |
50 |
|
51 | |||
51 | #create differents panels and make them persistant |
|
52 | #create differents panels and make them persistant | |
52 | self.history_panel = IPythonHistoryPanel(self) |
|
53 | self.history_panel = IPythonHistoryPanel(self) | |
53 |
|
54 | |||
54 | self.history_panel.setOptionTrackerHook(self.optionSave) |
|
55 | self.history_panel.setOptionTrackerHook(self.optionSave) | |
55 |
|
56 | |||
56 | self.ipython_panel = IPShellWidget(self,background_color = "BLACK") |
|
57 | self.ipython_panel = IPShellWidget(self,background_color = "BLACK") | |
57 | #self.ipython_panel = IPShellWidget(self,background_color = "WHITE") |
|
58 | #self.ipython_panel = IPShellWidget(self,background_color = "WHITE") | |
58 | if(sync_ok): |
|
59 | if(sync_ok): | |
59 | self.ipython_panel2 = IPythonXController(self) |
|
60 | self.ipython_panel2 = IPythonXController(self) | |
60 | else: |
|
61 | else: | |
61 | self.ipython_panel2 = None |
|
62 | self.ipython_panel2 = None | |
62 | self.ipython_panel.setHistoryTrackerHook(self.history_panel.write) |
|
63 | self.ipython_panel.setHistoryTrackerHook(self.history_panel.write) | |
63 | self.ipython_panel.setStatusTrackerHook(self.updateStatus) |
|
64 | self.ipython_panel.setStatusTrackerHook(self.updateStatus) | |
64 | self.ipython_panel.setAskExitHandler(self.OnExitDlg) |
|
65 | self.ipython_panel.setAskExitHandler(self.OnExitDlg) | |
65 | self.ipython_panel.setOptionTrackerHook(self.optionSave) |
|
66 | self.ipython_panel.setOptionTrackerHook(self.optionSave) | |
66 |
|
67 | |||
67 | #Create a notebook to display different IPython shell implementations |
|
68 | #Create a notebook to display different IPython shell implementations | |
68 | self.nb = wx.aui.AuiNotebook(self) |
|
69 | self.nb = wx.aui.AuiNotebook(self) | |
69 |
|
70 | |||
70 | self.optionLoad() |
|
71 | self.optionLoad() | |
71 |
|
72 | |||
72 | self.statusbar = self.createStatus() |
|
73 | self.statusbar = self.createStatus() | |
73 | self.createMenu() |
|
74 | self.createMenu() | |
74 |
|
75 | |||
75 | ######################################################################## |
|
76 | ######################################################################## | |
76 | ### add the panes to the manager |
|
77 | ### add the panes to the manager | |
77 | # main panels |
|
78 | # main panels | |
78 | self._mgr.AddPane(self.nb , wx.CENTER, "IPython Shells") |
|
79 | self._mgr.AddPane(self.nb , wx.CENTER, "IPython Shells") | |
79 | self.nb.AddPage(self.ipython_panel , "IPython0 Shell") |
|
80 | self.nb.AddPage(self.ipython_panel , "IPython0 Shell") | |
80 | if(sync_ok): |
|
81 | if(sync_ok): | |
81 | self.nb.AddPage(self.ipython_panel2, "IPython1 Synchroneous Shell") |
|
82 | self.nb.AddPage(self.ipython_panel2, "IPython1 Synchroneous Shell") | |
82 |
|
83 | |||
83 | self._mgr.AddPane(self.history_panel , wx.RIGHT, "IPython history") |
|
84 | self._mgr.AddPane(self.history_panel , wx.RIGHT, "IPython history") | |
84 |
|
85 | |||
85 | # now we specify some panel characteristics |
|
86 | # now we specify some panel characteristics | |
86 | self._mgr.GetPane(self.ipython_panel).CaptionVisible(True); |
|
87 | self._mgr.GetPane(self.ipython_panel).CaptionVisible(True); | |
87 | self._mgr.GetPane(self.history_panel).CaptionVisible(True); |
|
88 | self._mgr.GetPane(self.history_panel).CaptionVisible(True); | |
88 | self._mgr.GetPane(self.history_panel).MinSize((200,400)); |
|
89 | self._mgr.GetPane(self.history_panel).MinSize((200,400)); | |
89 |
|
90 | |||
90 | # tell the manager to "commit" all the changes just made |
|
91 | # tell the manager to "commit" all the changes just made | |
91 | self._mgr.Update() |
|
92 | self._mgr.Update() | |
92 |
|
93 | |||
93 | #global event handling |
|
94 | #global event handling | |
94 | self.Bind(wx.EVT_CLOSE, self.OnClose) |
|
95 | self.Bind(wx.EVT_CLOSE, self.OnClose) | |
95 | self.Bind(wx.EVT_MENU, self.OnClose,id=wx.ID_EXIT) |
|
96 | self.Bind(wx.EVT_MENU, self.OnClose,id=wx.ID_EXIT) | |
96 | self.Bind(wx.EVT_MENU, self.OnShowIPythonPanel,id=wx.ID_HIGHEST+1) |
|
97 | self.Bind(wx.EVT_MENU, self.OnShowIPythonPanel,id=wx.ID_HIGHEST+1) | |
97 | self.Bind(wx.EVT_MENU, self.OnShowHistoryPanel,id=wx.ID_HIGHEST+2) |
|
98 | self.Bind(wx.EVT_MENU, self.OnShowHistoryPanel,id=wx.ID_HIGHEST+2) | |
98 | self.Bind(wx.EVT_MENU, self.OnShowAbout, id=wx.ID_HIGHEST+3) |
|
99 | self.Bind(wx.EVT_MENU, self.OnShowAbout, id=wx.ID_HIGHEST+3) | |
99 | self.Bind(wx.EVT_MENU, self.OnShowAllPanel,id=wx.ID_HIGHEST+6) |
|
100 | self.Bind(wx.EVT_MENU, self.OnShowAllPanel,id=wx.ID_HIGHEST+6) | |
100 |
|
101 | |||
101 | warn_text = 'Hello from IPython and wxPython.\n' |
|
102 | warn_text = 'Hello from IPython and wxPython.\n' | |
102 | warn_text +='Please Note that this work is still EXPERIMENTAL\n' |
|
103 | warn_text +='Please Note that this work is still EXPERIMENTAL\n' | |
103 | warn_text +='It does NOT emulate currently all the IPython functions.\n' |
|
104 | warn_text +='It does NOT emulate currently all the IPython functions.\n' | |
104 | warn_text +="\nIf you use MATPLOTLIB with show() you'll need to deactivate the THREADING option.\n" |
|
105 | warn_text +="\nIf you use MATPLOTLIB with show() you'll need to deactivate the THREADING option.\n" | |
105 | if(not sync_ok): |
|
106 | if(not sync_ok): | |
106 | warn_text +="\n->No twisted package detected, IPython1 example deactivated." |
|
107 | warn_text +="\n->No twisted package detected, IPython1 example deactivated." | |
107 |
|
108 | |||
108 | dlg = wx.MessageDialog(self, |
|
109 | dlg = wx.MessageDialog(self, | |
109 | warn_text, |
|
110 | warn_text, | |
110 | 'Warning Box', |
|
111 | 'Warning Box', | |
111 | wx.OK | wx.ICON_INFORMATION |
|
112 | wx.OK | wx.ICON_INFORMATION | |
112 | ) |
|
113 | ) | |
113 | dlg.ShowModal() |
|
114 | dlg.ShowModal() | |
114 | dlg.Destroy() |
|
115 | dlg.Destroy() | |
115 |
|
116 | |||
116 | def optionSave(self, name, value): |
|
117 | def optionSave(self, name, value): | |
117 | ip = get() |
|
118 | ip = get() | |
118 | path = ip.IP.rc.ipythondir |
|
119 | path = ip.IP.rc.ipythondir | |
119 | opt = open(path + '/options.conf','w') |
|
120 | opt = open(path + '/options.conf','w') | |
120 |
|
121 | |||
121 | try: |
|
122 | try: | |
122 | options_ipython_panel = self.ipython_panel.getOptions() |
|
123 | options_ipython_panel = self.ipython_panel.getOptions() | |
123 | options_history_panel = self.history_panel.getOptions() |
|
124 | options_history_panel = self.history_panel.getOptions() | |
124 |
|
125 | |||
125 | for key in options_ipython_panel.keys(): |
|
126 | for key in options_ipython_panel.keys(): | |
126 | opt.write(key + '=' + options_ipython_panel[key]['value']+'\n') |
|
127 | opt.write(key + '=' + options_ipython_panel[key]['value']+'\n') | |
127 | for key in options_history_panel.keys(): |
|
128 | for key in options_history_panel.keys(): | |
128 | opt.write(key + '=' + options_history_panel[key]['value']+'\n') |
|
129 | opt.write(key + '=' + options_history_panel[key]['value']+'\n') | |
129 | finally: |
|
130 | finally: | |
130 | opt.close() |
|
131 | opt.close() | |
131 |
|
132 | |||
132 | def optionLoad(self): |
|
133 | def optionLoad(self): | |
133 | try: |
|
134 | try: | |
134 | ip = get() |
|
135 | ip = get() | |
135 | path = ip.IP.rc.ipythondir |
|
136 | path = ip.IP.rc.ipythondir | |
136 | opt = open(path + '/options.conf','r') |
|
137 | opt = open(path + '/options.conf','r') | |
137 | lines = opt.readlines() |
|
138 | lines = opt.readlines() | |
138 | opt.close() |
|
139 | opt.close() | |
139 |
|
140 | |||
140 | options_ipython_panel = self.ipython_panel.getOptions() |
|
141 | options_ipython_panel = self.ipython_panel.getOptions() | |
141 | options_history_panel = self.history_panel.getOptions() |
|
142 | options_history_panel = self.history_panel.getOptions() | |
142 |
|
143 | |||
143 | for line in lines: |
|
144 | for line in lines: | |
144 | key = line.split('=')[0] |
|
145 | key = line.split('=')[0] | |
145 | value = line.split('=')[1].replace('\n','').replace('\r','') |
|
146 | value = line.split('=')[1].replace('\n','').replace('\r','') | |
146 | if key in options_ipython_panel.keys(): |
|
147 | if key in options_ipython_panel.keys(): | |
147 | options_ipython_panel[key]['value'] = value |
|
148 | options_ipython_panel[key]['value'] = value | |
148 | elif key in options_history_panel.keys(): |
|
149 | elif key in options_history_panel.keys(): | |
149 | options_history_panel[key]['value'] = value |
|
150 | options_history_panel[key]['value'] = value | |
150 | else: |
|
151 | else: | |
151 | print >>sys.__stdout__,"Warning: key ",key,"not found in widget options. Check Options.conf" |
|
152 | print >>sys.__stdout__,"Warning: key ",key,"not found in widget options. Check Options.conf" | |
152 | self.ipython_panel.reloadOptions(options_ipython_panel) |
|
153 | self.ipython_panel.reloadOptions(options_ipython_panel) | |
153 | self.history_panel.reloadOptions(options_history_panel) |
|
154 | self.history_panel.reloadOptions(options_history_panel) | |
154 |
|
155 | |||
155 | except IOError: |
|
156 | except IOError: | |
156 | print >>sys.__stdout__,"Could not open Options.conf, defaulting to default values." |
|
157 | print >>sys.__stdout__,"Could not open Options.conf, defaulting to default values." | |
157 |
|
158 | |||
158 |
|
159 | |||
159 | def createMenu(self): |
|
160 | def createMenu(self): | |
160 | """local method used to create one menu bar""" |
|
161 | """local method used to create one menu bar""" | |
161 |
|
162 | |||
162 | mb = wx.MenuBar() |
|
163 | mb = wx.MenuBar() | |
163 |
|
164 | |||
164 | file_menu = wx.Menu() |
|
165 | file_menu = wx.Menu() | |
165 | file_menu.Append(wx.ID_EXIT, "Exit") |
|
166 | file_menu.Append(wx.ID_EXIT, "Exit") | |
166 |
|
167 | |||
167 | view_menu = wx.Menu() |
|
168 | view_menu = wx.Menu() | |
168 | view_menu.Append(wx.ID_HIGHEST+1, "Show IPython Panel") |
|
169 | view_menu.Append(wx.ID_HIGHEST+1, "Show IPython Panel") | |
169 | view_menu.Append(wx.ID_HIGHEST+2, "Show History Panel") |
|
170 | view_menu.Append(wx.ID_HIGHEST+2, "Show History Panel") | |
170 | view_menu.AppendSeparator() |
|
171 | view_menu.AppendSeparator() | |
171 | view_menu.Append(wx.ID_HIGHEST+6, "Show All") |
|
172 | view_menu.Append(wx.ID_HIGHEST+6, "Show All") | |
172 |
|
173 | |||
173 | about_menu = wx.Menu() |
|
174 | about_menu = wx.Menu() | |
174 | about_menu.Append(wx.ID_HIGHEST+3, "About") |
|
175 | about_menu.Append(wx.ID_HIGHEST+3, "About") | |
175 |
|
176 | |||
176 | mb.Append(file_menu, "File") |
|
177 | mb.Append(file_menu, "File") | |
177 | mb.Append(view_menu, "View") |
|
178 | mb.Append(view_menu, "View") | |
178 | mb.Append(about_menu, "About") |
|
179 | mb.Append(about_menu, "About") | |
179 | #mb.Append(options_menu, "Options") |
|
180 | #mb.Append(options_menu, "Options") | |
180 |
|
181 | |||
181 | self.SetMenuBar(mb) |
|
182 | self.SetMenuBar(mb) | |
182 |
|
183 | |||
183 | def createStatus(self): |
|
184 | def createStatus(self): | |
184 | statusbar = self.CreateStatusBar(2, wx.ST_SIZEGRIP) |
|
185 | statusbar = self.CreateStatusBar(2, wx.ST_SIZEGRIP) | |
185 | statusbar.SetStatusWidths([-2, -3]) |
|
186 | statusbar.SetStatusWidths([-2, -3]) | |
186 | statusbar.SetStatusText("Ready", 0) |
|
187 | statusbar.SetStatusText("Ready", 0) | |
187 | statusbar.SetStatusText("WxIPython "+str(__version_str__), 1) |
|
188 | statusbar.SetStatusText("WxIPython "+str(__version_str__), 1) | |
188 | return statusbar |
|
189 | return statusbar | |
189 |
|
190 | |||
190 | def updateStatus(self,text): |
|
191 | def updateStatus(self,text): | |
191 | states = {'IDLE':'Idle', |
|
192 | states = {'IDLE':'Idle', | |
192 | 'DO_EXECUTE_LINE':'Send command', |
|
193 | 'DO_EXECUTE_LINE':'Send command', | |
193 | 'WAIT_END_OF_EXECUTION':'Running command', |
|
194 | 'WAIT_END_OF_EXECUTION':'Running command', | |
194 | 'WAITING_USER_INPUT':'Waiting user input', |
|
195 | 'WAITING_USER_INPUT':'Waiting user input', | |
195 | 'SHOW_DOC':'Showing doc', |
|
196 | 'SHOW_DOC':'Showing doc', | |
196 | 'SHOW_PROMPT':'Showing prompt'} |
|
197 | 'SHOW_PROMPT':'Showing prompt'} | |
197 | self.statusbar.SetStatusText(states[text], 0) |
|
198 | self.statusbar.SetStatusText(states[text], 0) | |
198 |
|
199 | |||
199 | def OnClose(self, event): |
|
200 | def OnClose(self, event): | |
200 | """#event used to close program """ |
|
201 | """#event used to close program """ | |
201 | # deinitialize the frame manager |
|
202 | # deinitialize the frame manager | |
202 | self._mgr.UnInit() |
|
203 | self._mgr.UnInit() | |
203 | self.Destroy() |
|
204 | self.Destroy() | |
204 | event.Skip() |
|
205 | event.Skip() | |
205 |
|
206 | |||
206 | def OnExitDlg(self, event): |
|
207 | def OnExitDlg(self, event): | |
207 | dlg = wx.MessageDialog(self, 'Are you sure you want to quit WxIPython', |
|
208 | dlg = wx.MessageDialog(self, 'Are you sure you want to quit WxIPython', | |
208 | 'WxIPython exit', |
|
209 | 'WxIPython exit', | |
209 | wx.ICON_QUESTION | |
|
210 | wx.ICON_QUESTION | | |
210 | wx.YES_NO | wx.NO_DEFAULT |
|
211 | wx.YES_NO | wx.NO_DEFAULT | |
211 | ) |
|
212 | ) | |
212 | if dlg.ShowModal() == wx.ID_YES: |
|
213 | if dlg.ShowModal() == wx.ID_YES: | |
213 | dlg.Destroy() |
|
214 | dlg.Destroy() | |
214 | self._mgr.UnInit() |
|
215 | self._mgr.UnInit() | |
215 | self.Destroy() |
|
216 | self.Destroy() | |
216 | dlg.Destroy() |
|
217 | dlg.Destroy() | |
217 |
|
218 | |||
218 | #event to display IPython pannel |
|
219 | #event to display IPython pannel | |
219 | def OnShowIPythonPanel(self,event): |
|
220 | def OnShowIPythonPanel(self,event): | |
220 | """ #event to display Boxpannel """ |
|
221 | """ #event to display Boxpannel """ | |
221 | self._mgr.GetPane(self.ipython_panel).Show(True) |
|
222 | self._mgr.GetPane(self.ipython_panel).Show(True) | |
222 | self._mgr.Update() |
|
223 | self._mgr.Update() | |
223 | #event to display History pannel |
|
224 | #event to display History pannel | |
224 | def OnShowHistoryPanel(self,event): |
|
225 | def OnShowHistoryPanel(self,event): | |
225 | self._mgr.GetPane(self.history_panel).Show(True) |
|
226 | self._mgr.GetPane(self.history_panel).Show(True) | |
226 | self._mgr.Update() |
|
227 | self._mgr.Update() | |
227 |
|
228 | |||
228 | def OnShowAllPanel(self,event): |
|
229 | def OnShowAllPanel(self,event): | |
229 | """#event to display all Pannels""" |
|
230 | """#event to display all Pannels""" | |
230 | self._mgr.GetPane(self.ipython_panel).Show(True) |
|
231 | self._mgr.GetPane(self.ipython_panel).Show(True) | |
231 | self._mgr.GetPane(self.history_panel).Show(True) |
|
232 | self._mgr.GetPane(self.history_panel).Show(True) | |
232 | self._mgr.Update() |
|
233 | self._mgr.Update() | |
233 |
|
234 | |||
234 | def OnShowAbout(self, event): |
|
235 | def OnShowAbout(self, event): | |
235 | # First we create and fill the info object |
|
236 | # First we create and fill the info object | |
236 | info = wx.AboutDialogInfo() |
|
237 | info = wx.AboutDialogInfo() | |
237 | info.Name = "WxIPython" |
|
238 | info.Name = "WxIPython" | |
238 | info.Version = str(__version__) |
|
239 | info.Version = str(__version__) | |
239 | info.Copyright = "(C) 2007 Laurent Dufrechou" |
|
240 | info.Copyright = "(C) 2007 Laurent Dufrechou" | |
240 | info.Description = wordwrap( |
|
241 | info.Description = wordwrap( | |
241 | "A Gui that embbed a multithreaded IPython Shell", |
|
242 | "A Gui that embbed a multithreaded IPython Shell", | |
242 | 350, wx.ClientDC(self)) |
|
243 | 350, wx.ClientDC(self)) | |
243 | info.WebSite = ("http://ipython.scipy.org/", "IPython home page") |
|
244 | info.WebSite = ("http://ipython.scipy.org/", "IPython home page") | |
244 | info.Developers = [ "Laurent Dufrechou" ] |
|
245 | info.Developers = [ "Laurent Dufrechou" ] | |
245 | licenseText="BSD License.\nAll rights reserved. This program and the accompanying materials are made available under the terms of the BSD which accompanies this distribution, and is available at http://www.opensource.org/licenses/bsd-license.php" |
|
246 | licenseText="BSD License.\nAll rights reserved. This program and the accompanying materials are made available under the terms of the BSD which accompanies this distribution, and is available at http://www.opensource.org/licenses/bsd-license.php" | |
246 | info.License = wordwrap(licenseText, 500, wx.ClientDC(self)) |
|
247 | info.License = wordwrap(licenseText, 500, wx.ClientDC(self)) | |
247 |
|
248 | |||
248 | # Then we call wx.AboutBox giving it that info object |
|
249 | # Then we call wx.AboutBox giving it that info object | |
249 | wx.AboutBox(info) |
|
250 | wx.AboutBox(info) | |
250 |
|
251 | |||
251 | #----------------------------------------- |
|
252 | #----------------------------------------- | |
252 | #Creating our application |
|
253 | #Creating our application | |
253 | #----------------------------------------- |
|
254 | #----------------------------------------- | |
254 | class MyApp(wx.PySimpleApp): |
|
255 | class MyApp(wx.PySimpleApp): | |
255 | """Creating our application""" |
|
256 | """Creating our application""" | |
256 | def __init__(self, sync_ok=False): |
|
257 | def __init__(self, sync_ok=False): | |
257 | wx.PySimpleApp.__init__(self) |
|
258 | wx.PySimpleApp.__init__(self) | |
258 |
|
259 | |||
259 | self.frame = MyFrame(sync_ok=sync_ok) |
|
260 | self.frame = MyFrame(sync_ok=sync_ok) | |
260 | self.frame.Show() |
|
261 | self.frame.Show() | |
261 |
|
262 | |||
262 | #----------------------------------------- |
|
263 | #----------------------------------------- | |
263 | #Main loop |
|
264 | #Main loop | |
264 | #----------------------------------------- |
|
265 | #----------------------------------------- | |
265 | def main(): |
|
266 | def main(): | |
266 | app = MyApp(is_sync_frontend_ok) |
|
267 | app = MyApp(is_sync_frontend_ok) | |
267 | app.SetTopWindow(app.frame) |
|
268 | app.SetTopWindow(app.frame) | |
268 | app.MainLoop() |
|
269 | app.MainLoop() | |
269 |
|
270 | |||
270 | #if launched as main program run this |
|
271 | #if launched as main program run this | |
271 | if __name__ == '__main__': |
|
272 | if __name__ == '__main__': | |
272 | main() |
|
273 | main() |
General Comments 0
You need to be logged in to leave comments.
Login now