| 1 |
joko |
1.1 |
#Boa:MDIChild:FraggleTopicDetailFrame |
| 2 |
|
|
|
| 3 |
|
|
from wxPython.wx import * |
| 4 |
joko |
1.3 |
from wxPython.stc import * |
| 5 |
|
|
#import FraggleXMLRPC |
| 6 |
joko |
1.1 |
|
| 7 |
|
|
def create(parent): |
| 8 |
|
|
return FraggleTopicDetailFrame(parent) |
| 9 |
|
|
|
| 10 |
xabbu |
1.2 |
[wxID_FRAGGLETOPICDETAILFRAME, wxID_FRAGGLETOPICDETAILFRAMEBUTTONCLOSE, |
| 11 |
joko |
1.3 |
wxID_FRAGGLETOPICDETAILFRAMEBUTTONREFRESH, |
| 12 |
|
|
wxID_FRAGGLETOPICDETAILFRAMEBUTTONUPDATE, |
| 13 |
|
|
wxID_FRAGGLETOPICDETAILFRAMECONTENT, wxID_FRAGGLETOPICDETAILFRAMEPANEL1, |
| 14 |
|
|
] = map(lambda _init_ctrls: wxNewId(), range(6)) |
| 15 |
joko |
1.1 |
|
| 16 |
|
|
class FraggleTopicDetailFrame(wxMDIChildFrame): |
| 17 |
|
|
def _init_ctrls(self, prnt): |
| 18 |
|
|
# generated method, don't edit |
| 19 |
|
|
wxMDIChildFrame.__init__(self, id=wxID_FRAGGLETOPICDETAILFRAME, name='', |
| 20 |
joko |
1.3 |
parent=prnt, pos=wxPoint(356, 362), size=wxSize(397, 238), |
| 21 |
joko |
1.1 |
style=wxDEFAULT_FRAME_STYLE, title='Topic details') |
| 22 |
xabbu |
1.2 |
self.SetClientSize(wxSize(389, 211)) |
| 23 |
|
|
|
| 24 |
|
|
self.panel1 = wxPanel(id=wxID_FRAGGLETOPICDETAILFRAMEPANEL1, |
| 25 |
|
|
name='panel1', parent=self, pos=wxPoint(0, 0), size=wxSize(389, |
| 26 |
|
|
211), style=wxTAB_TRAVERSAL) |
| 27 |
|
|
|
| 28 |
|
|
self.buttonClose = wxButton(id=wxID_FRAGGLETOPICDETAILFRAMEBUTTONCLOSE, |
| 29 |
|
|
label='X', name='buttonClose', parent=self.panel1, pos=wxPoint(8, |
| 30 |
|
|
8), size=wxSize(16, 16), style=0) |
| 31 |
|
|
self.buttonClose.SetAutoLayout(True) |
| 32 |
|
|
EVT_BUTTON(self.buttonClose, wxID_FRAGGLETOPICDETAILFRAMEBUTTONCLOSE, |
| 33 |
|
|
self.OnButtoncloseButton) |
| 34 |
|
|
|
| 35 |
joko |
1.3 |
self.content = wxStyledTextCtrl(id=wxID_FRAGGLETOPICDETAILFRAMECONTENT, |
| 36 |
|
|
name=u'content', parent=self.panel1, pos=wxPoint(88, 8), |
| 37 |
|
|
size=wxSize(296, 200), style=0) |
| 38 |
|
|
|
| 39 |
|
|
self.buttonUpdate = wxButton(id=wxID_FRAGGLETOPICDETAILFRAMEBUTTONUPDATE, |
| 40 |
|
|
label=u'&Update', name=u'buttonUpdate', parent=self.panel1, |
| 41 |
|
|
pos=wxPoint(8, 184), size=wxSize(75, 23), style=0) |
| 42 |
|
|
|
| 43 |
|
|
self.buttonRefresh = wxButton(id=wxID_FRAGGLETOPICDETAILFRAMEBUTTONREFRESH, |
| 44 |
|
|
label=u'&Refresh', name=u'buttonRefresh', parent=self.panel1, |
| 45 |
|
|
pos=wxPoint(8, 160), size=wxSize(75, 23), style=0) |
| 46 |
|
|
EVT_BUTTON(self.buttonRefresh, |
| 47 |
|
|
wxID_FRAGGLETOPICDETAILFRAMEBUTTONREFRESH, |
| 48 |
|
|
self.OnButtonRefreshButton) |
| 49 |
joko |
1.1 |
|
| 50 |
|
|
def __init__(self, parent): |
| 51 |
|
|
self._init_ctrls(parent) |
| 52 |
joko |
1.3 |
# get engine-instance (singleton) |
| 53 |
|
|
import __main__ |
| 54 |
|
|
self.engine = __main__.engine |
| 55 |
|
|
#self.load_content() |
| 56 |
xabbu |
1.2 |
|
| 57 |
|
|
def OnButtoncloseButton(self, event): |
| 58 |
|
|
self.Destroy() |
| 59 |
|
|
event.Skip() |
| 60 |
joko |
1.3 |
|
| 61 |
|
|
def load_content(self): |
| 62 |
|
|
#self.content.SetText(self.GetTitle()) |
| 63 |
|
|
#print self.engine.preferences.getConfig() |
| 64 |
|
|
topicid = int(self.GetName()) |
| 65 |
|
|
topicmeta = self.engine.getTopicById(topicid) |
| 66 |
|
|
#print topic |
| 67 |
|
|
#self.content.SetText(topic) |
| 68 |
|
|
if topicmeta['target']['type'] == 'XMLRPC': |
| 69 |
|
|
# TODO: make FraggleXMLRPC do all stuff |
| 70 |
|
|
# (call methods dynamically) |
| 71 |
|
|
from xmlrpclib import Server |
| 72 |
|
|
rpc = Server(topicmeta['target']['url']) |
| 73 |
|
|
#topicdata = rpc.getContent(topicmeta['target']['arguments']) |
| 74 |
|
|
topicdata = rpc.getContent('Home') |
| 75 |
|
|
#print topicdata |
| 76 |
|
|
self.content.SetText(repr(topicdata)) |
| 77 |
|
|
#transport = rpc.__get_transport() |
| 78 |
|
|
#self.content.SetText(str(transport.phpsessionid)) |
| 79 |
|
|
|
| 80 |
|
|
def OnButtonRefreshButton(self, event): |
| 81 |
|
|
event.Skip() |
| 82 |
|
|
|
| 83 |
|
|
|