| 1 |
#Boa:MDIChild:FraggleTopicDetailFrame |
#Boa:MDIChild:FraggleTopicDetailFrame |
| 2 |
|
|
| 3 |
from wxPython.wx import * |
from wxPython.wx import * |
| 4 |
|
from wxPython.stc import * |
| 5 |
|
#import FraggleXMLRPC |
| 6 |
|
|
| 7 |
def create(parent): |
def create(parent): |
| 8 |
return FraggleTopicDetailFrame(parent) |
return FraggleTopicDetailFrame(parent) |
| 9 |
|
|
| 10 |
[wxID_FRAGGLETOPICDETAILFRAME, wxID_FRAGGLETOPICDETAILFRAMEBUTTONCLOSE, |
[wxID_FRAGGLETOPICDETAILFRAME, wxID_FRAGGLETOPICDETAILFRAMEBUTTONCLOSE, |
| 11 |
wxID_FRAGGLETOPICDETAILFRAMEPANEL1, |
wxID_FRAGGLETOPICDETAILFRAMEBUTTONREFRESH, |
| 12 |
] = map(lambda _init_ctrls: wxNewId(), range(3)) |
wxID_FRAGGLETOPICDETAILFRAMEBUTTONUPDATE, |
| 13 |
|
wxID_FRAGGLETOPICDETAILFRAMECONTENT, wxID_FRAGGLETOPICDETAILFRAMEPANEL1, |
| 14 |
|
] = map(lambda _init_ctrls: wxNewId(), range(6)) |
| 15 |
|
|
| 16 |
class FraggleTopicDetailFrame(wxMDIChildFrame): |
class FraggleTopicDetailFrame(wxMDIChildFrame): |
| 17 |
def _init_ctrls(self, prnt): |
def _init_ctrls(self, prnt): |
| 18 |
# generated method, don't edit |
# generated method, don't edit |
| 19 |
wxMDIChildFrame.__init__(self, id=wxID_FRAGGLETOPICDETAILFRAME, name='', |
wxMDIChildFrame.__init__(self, id=wxID_FRAGGLETOPICDETAILFRAME, name='', |
| 20 |
parent=prnt, pos=wxPoint(356, 362), size=wxSize(389, 211), |
parent=prnt, pos=wxPoint(356, 362), size=wxSize(397, 238), |
| 21 |
style=wxDEFAULT_FRAME_STYLE, title='Topic details') |
style=wxDEFAULT_FRAME_STYLE, title='Topic details') |
|
self._init_utils() |
|
| 22 |
self.SetClientSize(wxSize(389, 211)) |
self.SetClientSize(wxSize(389, 211)) |
| 23 |
|
|
| 24 |
self.panel1 = wxPanel(id=wxID_FRAGGLETOPICDETAILFRAMEPANEL1, |
self.panel1 = wxPanel(id=wxID_FRAGGLETOPICDETAILFRAMEPANEL1, |
| 32 |
EVT_BUTTON(self.buttonClose, wxID_FRAGGLETOPICDETAILFRAMEBUTTONCLOSE, |
EVT_BUTTON(self.buttonClose, wxID_FRAGGLETOPICDETAILFRAMEBUTTONCLOSE, |
| 33 |
self.OnButtoncloseButton) |
self.OnButtoncloseButton) |
| 34 |
|
|
| 35 |
def _init_utils(self): |
self.content = wxStyledTextCtrl(id=wxID_FRAGGLETOPICDETAILFRAMECONTENT, |
| 36 |
# generated method, don't edit |
name=u'content', parent=self.panel1, pos=wxPoint(88, 8), |
| 37 |
pass |
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 |
|
|
| 50 |
def __init__(self, parent): |
def __init__(self, parent): |
| 51 |
self._init_ctrls(parent) |
self._init_ctrls(parent) |
| 52 |
|
# get engine-instance (singleton) |
| 53 |
|
import __main__ |
| 54 |
|
self.engine = __main__.engine |
| 55 |
|
#self.load_content() |
| 56 |
|
|
| 57 |
def OnButtoncloseButton(self, event): |
def OnButtoncloseButton(self, event): |
| 58 |
self.Destroy() |
self.Destroy() |
| 59 |
event.Skip() |
event.Skip() |
| 60 |
|
|
| 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 |
|
|