--- nfo/projects/netfraggle/bin/FraggleTopicDetailFrame.py 2004/08/27 21:14:01 1.2 +++ nfo/projects/netfraggle/bin/FraggleTopicDetailFrame.py 2004/08/30 13:04:51 1.3 @@ -1,21 +1,24 @@ #Boa:MDIChild:FraggleTopicDetailFrame from wxPython.wx import * +from wxPython.stc import * +#import FraggleXMLRPC def create(parent): return FraggleTopicDetailFrame(parent) [wxID_FRAGGLETOPICDETAILFRAME, wxID_FRAGGLETOPICDETAILFRAMEBUTTONCLOSE, - wxID_FRAGGLETOPICDETAILFRAMEPANEL1, -] = map(lambda _init_ctrls: wxNewId(), range(3)) + 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(356, 362), size=wxSize(389, 211), + parent=prnt, pos=wxPoint(356, 362), size=wxSize(397, 238), style=wxDEFAULT_FRAME_STYLE, title='Topic details') - self._init_utils() self.SetClientSize(wxSize(389, 211)) self.panel1 = wxPanel(id=wxID_FRAGGLETOPICDETAILFRAMEPANEL1, @@ -29,13 +32,52 @@ EVT_BUTTON(self.buttonClose, wxID_FRAGGLETOPICDETAILFRAMEBUTTONCLOSE, self.OnButtoncloseButton) - def _init_utils(self): - # generated method, don't edit - pass + 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() + +