1 |
#Boa:MDIChild:FraggleTopicFrame |
2 |
|
3 |
# $Id: FraggleTopicFrame.py,v 1.1 2004/08/26 17:23:30 joko Exp $ |
4 |
# $Log: FraggleTopicFrame.py,v $ |
5 |
# Revision 1.1 2004/08/26 17:23:30 joko |
6 |
# initial commit |
7 |
# |
8 |
|
9 |
from wxPython.wx import * |
10 |
from wxPython.stc import * |
11 |
|
12 |
def create(parent, config): |
13 |
return FraggleTopicFrame(parent, config) |
14 |
|
15 |
[wxID_FRAGGLETOPICFRAME, wxID_FRAGGLETOPICFRAMETOPICLISTBOX, |
16 |
wxID_FRAGGLETOPICFRAMEUPDATEBUTTON, |
17 |
] = map(lambda _init_ctrls: wxNewId(), range(3)) |
18 |
|
19 |
class FraggleTopicFrame(wxMDIChildFrame): |
20 |
def _init_ctrls(self, prnt): |
21 |
# generated method, don't edit |
22 |
wxMDIChildFrame.__init__(self, id=wxID_FRAGGLETOPICFRAME, name='', |
23 |
parent=prnt, pos=wxPoint(352, 280), size=wxSize(177, 219), |
24 |
style=wxSIMPLE_BORDER | wxDEFAULT_FRAME_STYLE, title='Topics') |
25 |
self.SetClientSize(wxSize(169, 192)) |
26 |
|
27 |
self.updateButton = wxButton(id=wxID_FRAGGLETOPICFRAMEUPDATEBUTTON, |
28 |
label=u'&Update', name=u'updateButton', parent=self, |
29 |
pos=wxPoint(0, 168), size=wxSize(168, 23), style=0) |
30 |
EVT_BUTTON(self.updateButton, wxID_FRAGGLETOPICFRAMEUPDATEBUTTON, |
31 |
self.OnUpdateButtonButton) |
32 |
|
33 |
self.topicListBox = wxListBox(choices=[], |
34 |
id=wxID_FRAGGLETOPICFRAMETOPICLISTBOX, name=u'topicListBox', |
35 |
parent=self, pos=wxPoint(0, 0), size=wxSize(168, 168), style=0) |
36 |
|
37 |
def __init__(self, parent, config): |
38 |
self.config = config |
39 |
self._init_ctrls(parent) |
40 |
|
41 |
def OnUpdateButtonButton(self, event): |
42 |
#event.Skip() |
43 |
import __main__ |
44 |
engine = __main__.engine |
45 |
# todo: make fraggleEngine read config on its own |
46 |
engine.fraggleSync(self.config) |
47 |
topics = engine.getTopics() |
48 |
i = 0 |
49 |
for topic in topics: |
50 |
self.topicListBox.Append(topic['name'], i) |
51 |
i = i + 1 |