| 1 |
xabbu |
1.1 |
#Boa:MDIChild:xmlpage |
| 2 |
|
|
|
| 3 |
|
|
from wxPython.wx import * |
| 4 |
|
|
from wxPython.stc import * |
| 5 |
|
|
|
| 6 |
|
|
def create(parent): |
| 7 |
|
|
return xmlpage(parent) |
| 8 |
|
|
|
| 9 |
|
|
[wxID_XMLPAGE, wxID_XMLPAGEBUTTONCLOSE, wxID_XMLPAGEBUTTONREFRESH, |
| 10 |
|
|
wxID_XMLPAGEBUTTONUPDATE, wxID_XMLPAGEPANEL1, |
| 11 |
|
|
wxID_XMLPAGESTATICTEXTDESCRIPTION, wxID_XMLPAGESTATICTEXTKEYNAME, |
| 12 |
|
|
wxID_XMLPAGESTYLEDTEXTCONTENT, wxID_XMLPAGETEXTCTRLDESCRIPTION, |
| 13 |
|
|
wxID_XMLPAGETEXTCTRLKEYNAME, |
| 14 |
|
|
] = map(lambda _init_ctrls: wxNewId(), range(10)) |
| 15 |
|
|
|
| 16 |
|
|
class xmlpage(wxMDIChildFrame): |
| 17 |
|
|
def _init_ctrls(self, parent): |
| 18 |
|
|
# generated method, don't edit |
| 19 |
|
|
wxMDIChildFrame.__init__(self, id=wxID_XMLPAGE, name='xmlpage', |
| 20 |
|
|
parent=parent, pos=wxPoint(356, 362), size=wxSize(597, 407), |
| 21 |
|
|
style=wxDEFAULT_FRAME_STYLE, title='Topic details') |
| 22 |
|
|
self.SetClientSize(wxSize(589, 380)) |
| 23 |
|
|
|
| 24 |
|
|
self.panel1 = wxPanel(id=wxID_XMLPAGEPANEL1, name='panel1', parent=self, |
| 25 |
|
|
pos=wxPoint(0, 0), size=wxSize(589, 380), style=wxTAB_TRAVERSAL) |
| 26 |
|
|
|
| 27 |
|
|
self.buttonClose = wxButton(id=wxID_XMLPAGEBUTTONCLOSE, label='X', |
| 28 |
|
|
name='buttonClose', parent=self.panel1, pos=wxPoint(8, 8), |
| 29 |
|
|
size=wxSize(16, 16), style=0) |
| 30 |
|
|
self.buttonClose.SetAutoLayout(True) |
| 31 |
|
|
EVT_BUTTON(self.buttonClose, wxID_XMLPAGEBUTTONCLOSE, |
| 32 |
|
|
self.OnButtoncloseButton) |
| 33 |
|
|
|
| 34 |
|
|
self.styledTextContent = wxStyledTextCtrl(id=wxID_XMLPAGESTYLEDTEXTCONTENT, |
| 35 |
|
|
name=u'styledTextContent', parent=self.panel1, pos=wxPoint(88, |
| 36 |
|
|
56), size=wxSize(488, 312), style=0) |
| 37 |
|
|
|
| 38 |
|
|
self.buttonUpdate = wxButton(id=wxID_XMLPAGEBUTTONUPDATE, |
| 39 |
|
|
label=u'&Update', name=u'buttonUpdate', parent=self.panel1, |
| 40 |
|
|
pos=wxPoint(8, 184), size=wxSize(75, 23), style=0) |
| 41 |
|
|
|
| 42 |
|
|
self.buttonRefresh = wxButton(id=wxID_XMLPAGEBUTTONREFRESH, |
| 43 |
|
|
label=u'&Refresh', name=u'buttonRefresh', parent=self.panel1, |
| 44 |
|
|
pos=wxPoint(8, 160), size=wxSize(75, 23), style=0) |
| 45 |
|
|
EVT_BUTTON(self.buttonRefresh, wxID_XMLPAGEBUTTONREFRESH, |
| 46 |
|
|
self.OnButtonRefreshButton) |
| 47 |
|
|
|
| 48 |
|
|
self.staticTextDescription = wxStaticText(id=wxID_XMLPAGESTATICTEXTDESCRIPTION, |
| 49 |
|
|
label=u'Description:', name=u'staticTextDescription', |
| 50 |
|
|
parent=self.panel1, pos=wxPoint(88, 32), size=wxSize(56, 13), |
| 51 |
|
|
style=0) |
| 52 |
|
|
|
| 53 |
|
|
self.textCtrlDescription = wxTextCtrl(id=wxID_XMLPAGETEXTCTRLDESCRIPTION, |
| 54 |
|
|
name=u'textCtrlDescription', parent=self.panel1, pos=wxPoint(152, |
| 55 |
|
|
32), size=wxSize(100, 21), style=0, value=u'') |
| 56 |
|
|
self.textCtrlDescription.SetToolTipString(u'') |
| 57 |
|
|
|
| 58 |
|
|
self.staticTextKeyname = wxStaticText(id=wxID_XMLPAGESTATICTEXTKEYNAME, |
| 59 |
|
|
label=u'Name:', name=u'staticTextKeyname', parent=self.panel1, |
| 60 |
|
|
pos=wxPoint(88, 8), size=wxSize(31, 13), style=0) |
| 61 |
|
|
|
| 62 |
|
|
self.textCtrlKeyname = wxTextCtrl(id=wxID_XMLPAGETEXTCTRLKEYNAME, |
| 63 |
|
|
name=u'textCtrlKeyname', parent=self.panel1, pos=wxPoint(152, 8), |
| 64 |
|
|
size=wxSize(100, 21), style=0, value=u'') |
| 65 |
|
|
self.textCtrlKeyname.SetToolTipString(u'') |
| 66 |
|
|
|
| 67 |
|
|
def __init__(self, parent): |
| 68 |
|
|
self._init_ctrls(parent) |
| 69 |
|
|
# get engine-instance (singleton) |
| 70 |
|
|
import __main__ |
| 71 |
|
|
self.engine = __main__.engine |
| 72 |
|
|
#self.load_content() |
| 73 |
|
|
|
| 74 |
|
|
def OnButtoncloseButton(self, event): |
| 75 |
|
|
self.Destroy() |
| 76 |
|
|
event.Skip() |
| 77 |
|
|
|
| 78 |
|
|
def load_content(self, contentkey): |
| 79 |
|
|
#load payload with contentkey |
| 80 |
|
|
self.payload = self.engine.getContent(contentkey) |
| 81 |
|
|
for key in self.payload['2']: |
| 82 |
|
|
if self.payload['2'][key] == 'content': |
| 83 |
|
|
stringdata = self.payload['1']['0'][key] |
| 84 |
|
|
#print stringdata |
| 85 |
|
|
self.styledTextContent.AddText(stringdata.encode('latin1')) |
| 86 |
|
|
print self.payload |
| 87 |
|
|
|
| 88 |
|
|
|
| 89 |
|
|
def OnButtonRefreshButton(self, event): |
| 90 |
|
|
event.Skip() |
| 91 |
|
|
|
| 92 |
|
|
|