--- nfo/projects/netfraggle/bin/FraggleTopicDetailFrame.py 2004/08/30 13:04:51 1.3 +++ nfo/projects/netfraggle/bin/FraggleTopicDetailFrame.py 2004/08/30 16:51:22 1.4 @@ -11,7 +11,11 @@ wxID_FRAGGLETOPICDETAILFRAMEBUTTONREFRESH, wxID_FRAGGLETOPICDETAILFRAMEBUTTONUPDATE, wxID_FRAGGLETOPICDETAILFRAMECONTENT, wxID_FRAGGLETOPICDETAILFRAMEPANEL1, -] = map(lambda _init_ctrls: wxNewId(), range(6)) + wxID_FRAGGLETOPICDETAILFRAMESTATICTEXTDESCRIPTION, + wxID_FRAGGLETOPICDETAILFRAMESTATICTEXTKEYNAME, + wxID_FRAGGLETOPICDETAILFRAMETEXTCTRLDESCRIPTION, + wxID_FRAGGLETOPICDETAILFRAMETEXTCTRLKEYNAME, +] = map(lambda _init_ctrls: wxNewId(), range(10)) class FraggleTopicDetailFrame(wxMDIChildFrame): def _init_ctrls(self, prnt): @@ -33,8 +37,8 @@ self.OnButtoncloseButton) self.content = wxStyledTextCtrl(id=wxID_FRAGGLETOPICDETAILFRAMECONTENT, - name=u'content', parent=self.panel1, pos=wxPoint(88, 8), - size=wxSize(296, 200), style=0) + name=u'content', parent=self.panel1, pos=wxPoint(88, 56), + size=wxSize(296, 152), style=0) self.buttonUpdate = wxButton(id=wxID_FRAGGLETOPICDETAILFRAMEBUTTONUPDATE, label=u'&Update', name=u'buttonUpdate', parent=self.panel1, @@ -47,6 +51,25 @@ wxID_FRAGGLETOPICDETAILFRAMEBUTTONREFRESH, self.OnButtonRefreshButton) + self.staticTextDescription = wxStaticText(id=wxID_FRAGGLETOPICDETAILFRAMESTATICTEXTDESCRIPTION, + label=u'Description:', name=u'staticTextDescription', + parent=self.panel1, pos=wxPoint(88, 32), size=wxSize(56, 13), + style=0) + + self.textCtrlDescription = wxTextCtrl(id=wxID_FRAGGLETOPICDETAILFRAMETEXTCTRLDESCRIPTION, + name=u'textCtrlDescription', parent=self.panel1, pos=wxPoint(152, + 32), size=wxSize(100, 21), style=0, value=u'') + self.textCtrlDescription.SetToolTipString(u'') + + self.staticTextKeyname = wxStaticText(id=wxID_FRAGGLETOPICDETAILFRAMESTATICTEXTKEYNAME, + label=u'Name:', name=u'staticTextKeyname', parent=self.panel1, + pos=wxPoint(88, 8), size=wxSize(31, 13), style=0) + + self.textCtrlKeyname = wxTextCtrl(id=wxID_FRAGGLETOPICDETAILFRAMETEXTCTRLKEYNAME, + name=u'textCtrlKeyname', parent=self.panel1, pos=wxPoint(152, 8), + size=wxSize(100, 21), style=0, value=u'') + self.textCtrlKeyname.SetToolTipString(u'') + def __init__(self, parent): self._init_ctrls(parent) # get engine-instance (singleton) @@ -63,19 +86,22 @@ #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 + from xmlrpclib import Server, Error 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)) + topicdata = {} + try: + #topicdata = rpc.getContent('Home') + topicdata = rpc.getContent(tuple(topicmeta['target']['arguments'])) + #print topicdata + except Error, v: + print "ERROR", v + if topicdata: + self.content.SetText(topicdata['content']) + self.textCtrlKeyname.SetValue(topicdata['keyname']) + self.textCtrlDescription.SetValue(topicdata['description']) def OnButtonRefreshButton(self, event): event.Skip()