--- nfo/projects/netfraggle/bin/FraggleTopicDetailFrame.py 2004/08/27 04:47:48 1.1 +++ nfo/projects/netfraggle/bin/FraggleTopicDetailFrame.py 2004/08/30 13:04:51 1.3 @@ -1,19 +1,83 @@ #Boa:MDIChild:FraggleTopicDetailFrame from wxPython.wx import * +from wxPython.stc import * +#import FraggleXMLRPC def create(parent): return FraggleTopicDetailFrame(parent) -[wxID_FRAGGLETOPICDETAILFRAME] = map(lambda _init_ctrls: wxNewId(), range(1)) +[wxID_FRAGGLETOPICDETAILFRAME, wxID_FRAGGLETOPICDETAILFRAMEBUTTONCLOSE, + wxID_FRAGGLETOPICDETAILFRAMEBUTTONREFRESH, + wxID_FRAGGLETOPICDETAILFRAMEBUTTONUPDATE, + wxID_FRAGGLETOPICDETAILFRAMECONTENT, wxID_FRAGGLETOPICDETAILFRAMEPANEL1, +] = map(lambda _init_ctrls: wxNewId(), range(6)) class FraggleTopicDetailFrame(wxMDIChildFrame): def _init_ctrls(self, prnt): # generated method, don't edit wxMDIChildFrame.__init__(self, id=wxID_FRAGGLETOPICDETAILFRAME, name='', - parent=prnt, pos=wxPoint(384, 266), size=wxSize(350, 231), + parent=prnt, pos=wxPoint(356, 362), size=wxSize(397, 238), style=wxDEFAULT_FRAME_STYLE, title='Topic details') - self.SetClientSize(wxSize(342, 204)) + self.SetClientSize(wxSize(389, 211)) + + self.panel1 = wxPanel(id=wxID_FRAGGLETOPICDETAILFRAMEPANEL1, + name='panel1', parent=self, pos=wxPoint(0, 0), size=wxSize(389, + 211), style=wxTAB_TRAVERSAL) + + self.buttonClose = wxButton(id=wxID_FRAGGLETOPICDETAILFRAMEBUTTONCLOSE, + label='X', name='buttonClose', parent=self.panel1, pos=wxPoint(8, + 8), size=wxSize(16, 16), style=0) + self.buttonClose.SetAutoLayout(True) + EVT_BUTTON(self.buttonClose, wxID_FRAGGLETOPICDETAILFRAMEBUTTONCLOSE, + self.OnButtoncloseButton) + + self.content = wxStyledTextCtrl(id=wxID_FRAGGLETOPICDETAILFRAMECONTENT, + name=u'content', parent=self.panel1, pos=wxPoint(88, 8), + size=wxSize(296, 200), style=0) + + self.buttonUpdate = wxButton(id=wxID_FRAGGLETOPICDETAILFRAMEBUTTONUPDATE, + label=u'&Update', name=u'buttonUpdate', parent=self.panel1, + pos=wxPoint(8, 184), size=wxSize(75, 23), style=0) + + self.buttonRefresh = wxButton(id=wxID_FRAGGLETOPICDETAILFRAMEBUTTONREFRESH, + label=u'&Refresh', name=u'buttonRefresh', parent=self.panel1, + pos=wxPoint(8, 160), size=wxSize(75, 23), style=0) + EVT_BUTTON(self.buttonRefresh, + wxID_FRAGGLETOPICDETAILFRAMEBUTTONREFRESH, + self.OnButtonRefreshButton) def __init__(self, parent): self._init_ctrls(parent) + # get engine-instance (singleton) + import __main__ + self.engine = __main__.engine + #self.load_content() + + def OnButtoncloseButton(self, event): + self.Destroy() + event.Skip() + + def load_content(self): + #self.content.SetText(self.GetTitle()) + #print self.engine.preferences.getConfig() + topicid = int(self.GetName()) + topicmeta = self.engine.getTopicById(topicid) + #print topic + #self.content.SetText(topic) + if topicmeta['target']['type'] == 'XMLRPC': + # TODO: make FraggleXMLRPC do all stuff + # (call methods dynamically) + from xmlrpclib import Server + rpc = Server(topicmeta['target']['url']) + #topicdata = rpc.getContent(topicmeta['target']['arguments']) + topicdata = rpc.getContent('Home') + #print topicdata + self.content.SetText(repr(topicdata)) + #transport = rpc.__get_transport() + #self.content.SetText(str(transport.phpsessionid)) + + def OnButtonRefreshButton(self, event): + event.Skip() + +