--- nfo/projects/netfraggle/bin/FraggleTopicFrame.py 2004/08/26 17:23:30 1.1 +++ nfo/projects/netfraggle/bin/FraggleTopicFrame.py 2004/08/27 03:13:50 1.2 @@ -1,25 +1,54 @@ #Boa:MDIChild:FraggleTopicFrame -# $Id: FraggleTopicFrame.py,v 1.1 2004/08/26 17:23:30 joko Exp $ +# $Id: FraggleTopicFrame.py,v 1.2 2004/08/27 03:13:50 joko Exp $ # $Log: FraggleTopicFrame.py,v $ +# Revision 1.2 2004/08/27 03:13:50 joko +# added listbox for topics and button for update/sync +# # Revision 1.1 2004/08/26 17:23:30 joko # initial commit # from wxPython.wx import * +from wxPython.stc import * -def create(parent): - return FraggleTopicFrame(parent) +def create(parent, config): + return FraggleTopicFrame(parent, config) -[wxID_FRAGGLETOPICFRAME] = map(lambda _init_ctrls: wxNewId(), range(1)) +[wxID_FRAGGLETOPICFRAME, wxID_FRAGGLETOPICFRAMETOPICLISTBOX, + wxID_FRAGGLETOPICFRAMEUPDATEBUTTON, +] = map(lambda _init_ctrls: wxNewId(), range(3)) class FraggleTopicFrame(wxMDIChildFrame): def _init_ctrls(self, prnt): # generated method, don't edit wxMDIChildFrame.__init__(self, id=wxID_FRAGGLETOPICFRAME, name='', - parent=prnt, pos=wxPoint(352, 280), size=wxSize(138, 215), + parent=prnt, pos=wxPoint(352, 280), size=wxSize(177, 219), style=wxSIMPLE_BORDER | wxDEFAULT_FRAME_STYLE, title='Topics') - self.SetClientSize(wxSize(130, 188)) + self.SetClientSize(wxSize(169, 192)) + + self.updateButton = wxButton(id=wxID_FRAGGLETOPICFRAMEUPDATEBUTTON, + label=u'&Update', name=u'updateButton', parent=self, + pos=wxPoint(0, 168), size=wxSize(168, 23), style=0) + EVT_BUTTON(self.updateButton, wxID_FRAGGLETOPICFRAMEUPDATEBUTTON, + self.OnUpdateButtonButton) + + self.topicListBox = wxListBox(choices=[], + id=wxID_FRAGGLETOPICFRAMETOPICLISTBOX, name=u'topicListBox', + parent=self, pos=wxPoint(0, 0), size=wxSize(168, 168), style=0) - def __init__(self, parent): + def __init__(self, parent, config): + self.config = config self._init_ctrls(parent) + + def OnUpdateButtonButton(self, event): + #event.Skip() + import __main__ + engine = __main__.engine + # todo: make fraggleEngine read config on its own + engine.fraggleSync(self.config) + topics = engine.getTopics() + i = 0 + for topic in topics: + self.topicListBox.Append(topic['name'], i) + i = i + 1