11 |
wxID_FRAGGLETOPICDETAILFRAMEBUTTONREFRESH, |
wxID_FRAGGLETOPICDETAILFRAMEBUTTONREFRESH, |
12 |
wxID_FRAGGLETOPICDETAILFRAMEBUTTONUPDATE, |
wxID_FRAGGLETOPICDETAILFRAMEBUTTONUPDATE, |
13 |
wxID_FRAGGLETOPICDETAILFRAMECONTENT, wxID_FRAGGLETOPICDETAILFRAMEPANEL1, |
wxID_FRAGGLETOPICDETAILFRAMECONTENT, wxID_FRAGGLETOPICDETAILFRAMEPANEL1, |
14 |
] = map(lambda _init_ctrls: wxNewId(), range(6)) |
wxID_FRAGGLETOPICDETAILFRAMESTATICTEXTDESCRIPTION, |
15 |
|
wxID_FRAGGLETOPICDETAILFRAMESTATICTEXTKEYNAME, |
16 |
|
wxID_FRAGGLETOPICDETAILFRAMETEXTCTRLDESCRIPTION, |
17 |
|
wxID_FRAGGLETOPICDETAILFRAMETEXTCTRLKEYNAME, |
18 |
|
] = map(lambda _init_ctrls: wxNewId(), range(10)) |
19 |
|
|
20 |
class FraggleTopicDetailFrame(wxMDIChildFrame): |
class FraggleTopicDetailFrame(wxMDIChildFrame): |
21 |
def _init_ctrls(self, prnt): |
def _init_ctrls(self, prnt): |
37 |
self.OnButtoncloseButton) |
self.OnButtoncloseButton) |
38 |
|
|
39 |
self.content = wxStyledTextCtrl(id=wxID_FRAGGLETOPICDETAILFRAMECONTENT, |
self.content = wxStyledTextCtrl(id=wxID_FRAGGLETOPICDETAILFRAMECONTENT, |
40 |
name=u'content', parent=self.panel1, pos=wxPoint(88, 8), |
name=u'content', parent=self.panel1, pos=wxPoint(88, 56), |
41 |
size=wxSize(296, 200), style=0) |
size=wxSize(296, 152), style=0) |
42 |
|
|
43 |
self.buttonUpdate = wxButton(id=wxID_FRAGGLETOPICDETAILFRAMEBUTTONUPDATE, |
self.buttonUpdate = wxButton(id=wxID_FRAGGLETOPICDETAILFRAMEBUTTONUPDATE, |
44 |
label=u'&Update', name=u'buttonUpdate', parent=self.panel1, |
label=u'&Update', name=u'buttonUpdate', parent=self.panel1, |
51 |
wxID_FRAGGLETOPICDETAILFRAMEBUTTONREFRESH, |
wxID_FRAGGLETOPICDETAILFRAMEBUTTONREFRESH, |
52 |
self.OnButtonRefreshButton) |
self.OnButtonRefreshButton) |
53 |
|
|
54 |
|
self.staticTextDescription = wxStaticText(id=wxID_FRAGGLETOPICDETAILFRAMESTATICTEXTDESCRIPTION, |
55 |
|
label=u'Description:', name=u'staticTextDescription', |
56 |
|
parent=self.panel1, pos=wxPoint(88, 32), size=wxSize(56, 13), |
57 |
|
style=0) |
58 |
|
|
59 |
|
self.textCtrlDescription = wxTextCtrl(id=wxID_FRAGGLETOPICDETAILFRAMETEXTCTRLDESCRIPTION, |
60 |
|
name=u'textCtrlDescription', parent=self.panel1, pos=wxPoint(152, |
61 |
|
32), size=wxSize(100, 21), style=0, value=u'') |
62 |
|
self.textCtrlDescription.SetToolTipString(u'') |
63 |
|
|
64 |
|
self.staticTextKeyname = wxStaticText(id=wxID_FRAGGLETOPICDETAILFRAMESTATICTEXTKEYNAME, |
65 |
|
label=u'Name:', name=u'staticTextKeyname', parent=self.panel1, |
66 |
|
pos=wxPoint(88, 8), size=wxSize(31, 13), style=0) |
67 |
|
|
68 |
|
self.textCtrlKeyname = wxTextCtrl(id=wxID_FRAGGLETOPICDETAILFRAMETEXTCTRLKEYNAME, |
69 |
|
name=u'textCtrlKeyname', parent=self.panel1, pos=wxPoint(152, 8), |
70 |
|
size=wxSize(100, 21), style=0, value=u'') |
71 |
|
self.textCtrlKeyname.SetToolTipString(u'') |
72 |
|
|
73 |
def __init__(self, parent): |
def __init__(self, parent): |
74 |
self._init_ctrls(parent) |
self._init_ctrls(parent) |
75 |
# get engine-instance (singleton) |
# get engine-instance (singleton) |
86 |
#print self.engine.preferences.getConfig() |
#print self.engine.preferences.getConfig() |
87 |
topicid = int(self.GetName()) |
topicid = int(self.GetName()) |
88 |
topicmeta = self.engine.getTopicById(topicid) |
topicmeta = self.engine.getTopicById(topicid) |
|
#print topic |
|
|
#self.content.SetText(topic) |
|
89 |
if topicmeta['target']['type'] == 'XMLRPC': |
if topicmeta['target']['type'] == 'XMLRPC': |
90 |
# TODO: make FraggleXMLRPC do all stuff |
# TODO: make FraggleXMLRPC do all stuff |
91 |
# (call methods dynamically) |
# (call methods dynamically) |
92 |
from xmlrpclib import Server |
from xmlrpclib import Server, Error |
93 |
rpc = Server(topicmeta['target']['url']) |
rpc = Server(topicmeta['target']['url']) |
94 |
#topicdata = rpc.getContent(topicmeta['target']['arguments']) |
topicdata = {} |
95 |
topicdata = rpc.getContent('Home') |
try: |
96 |
#print topicdata |
#topicdata = rpc.getContent('Home') |
97 |
self.content.SetText(repr(topicdata)) |
topicdata = rpc.getContent(tuple(topicmeta['target']['arguments'])) |
98 |
#transport = rpc.__get_transport() |
#print topicdata |
99 |
#self.content.SetText(str(transport.phpsessionid)) |
except Error, v: |
100 |
|
print "ERROR", v |
101 |
|
if topicdata: |
102 |
|
self.content.SetText(topicdata['content']) |
103 |
|
self.textCtrlKeyname.SetValue(topicdata['keyname']) |
104 |
|
self.textCtrlDescription.SetValue(topicdata['description']) |
105 |
|
|
106 |
def OnButtonRefreshButton(self, event): |
def OnButtonRefreshButton(self, event): |
107 |
event.Skip() |
event.Skip() |