1 |
joko |
1.1 |
#Boa:MDIChild:FraggleItemFrame |
2 |
|
|
|
3 |
|
|
from wxPython.wx import * |
4 |
|
|
from wxPython.stc import * |
5 |
|
|
|
6 |
|
|
def create(parent): |
7 |
|
|
return FraggleItemFrame(parent) |
8 |
|
|
|
9 |
|
|
[wxID_FRAGGLEITEMFRAME, wxID_FRAGGLEITEMFRAMEBUTTONCLOSE, |
10 |
|
|
wxID_FRAGGLEITEMFRAMEBUTTONREFRESH, |
11 |
|
|
wxID_FRAGGLEITEMFRAMEBUTTONUPDATE, |
12 |
|
|
wxID_FRAGGLEITEMFRAMEPANEL1, |
13 |
|
|
wxID_FRAGGLEITEMFRAMESTATICTEXTDESCRIPTION, |
14 |
|
|
wxID_FRAGGLEITEMFRAMESTATICTEXTKEYNAME, |
15 |
|
|
wxID_FRAGGLEITEMFRAMESTYLEDTEXTCONTENT, |
16 |
|
|
wxID_FRAGGLEITEMFRAMETEXTCTRLDESCRIPTION, |
17 |
|
|
wxID_FRAGGLEITEMFRAMETEXTCTRLKEYNAME, |
18 |
|
|
] = map(lambda _init_ctrls: wxNewId(), range(10)) |
19 |
|
|
|
20 |
|
|
class FraggleItemFrame(wxMDIChildFrame): |
21 |
|
|
def _init_ctrls(self, prnt): |
22 |
|
|
# generated method, don't edit |
23 |
|
|
wxMDIChildFrame.__init__(self, id=wxID_FRAGGLEITEMFRAME, name='', |
24 |
|
|
parent=prnt, pos=wxPoint(356, 362), size=wxSize(397, 238), |
25 |
|
|
style=wxDEFAULT_FRAME_STYLE, title='Topic details') |
26 |
|
|
self.SetClientSize(wxSize(389, 211)) |
27 |
|
|
|
28 |
|
|
self.panel1 = wxPanel(id=wxID_FRAGGLEITEMFRAMEPANEL1, |
29 |
|
|
name='panel1', parent=self, pos=wxPoint(0, 0), size=wxSize(389, |
30 |
|
|
211), style=wxTAB_TRAVERSAL) |
31 |
|
|
|
32 |
|
|
self.buttonClose = wxButton(id=wxID_FRAGGLEITEMFRAMEBUTTONCLOSE, |
33 |
|
|
label='X', name='buttonClose', parent=self.panel1, pos=wxPoint(8, |
34 |
|
|
8), size=wxSize(16, 16), style=0) |
35 |
|
|
self.buttonClose.SetAutoLayout(True) |
36 |
|
|
EVT_BUTTON(self.buttonClose, wxID_FRAGGLEITEMFRAMEBUTTONCLOSE, |
37 |
|
|
self.OnButtoncloseButton) |
38 |
|
|
|
39 |
|
|
self.styledTextContent = wxStyledTextCtrl(id=wxID_FRAGGLEITEMFRAMESTYLEDTEXTCONTENT, |
40 |
|
|
name=u'styledTextContent', parent=self.panel1, pos=wxPoint(88, |
41 |
|
|
56), size=wxSize(296, 152), style=0) |
42 |
|
|
|
43 |
|
|
self.buttonUpdate = wxButton(id=wxID_FRAGGLEITEMFRAMEBUTTONUPDATE, |
44 |
|
|
label=u'&Update', name=u'buttonUpdate', parent=self.panel1, |
45 |
|
|
pos=wxPoint(8, 184), size=wxSize(75, 23), style=0) |
46 |
|
|
|
47 |
|
|
self.buttonRefresh = wxButton(id=wxID_FRAGGLEITEMFRAMEBUTTONREFRESH, |
48 |
|
|
label=u'&Refresh', name=u'buttonRefresh', parent=self.panel1, |
49 |
|
|
pos=wxPoint(8, 160), size=wxSize(75, 23), style=0) |
50 |
|
|
EVT_BUTTON(self.buttonRefresh, |
51 |
|
|
wxID_FRAGGLEITEMFRAMEBUTTONREFRESH, |
52 |
|
|
self.OnButtonRefreshButton) |
53 |
|
|
|
54 |
|
|
self.staticTextDescription = wxStaticText(id=wxID_FRAGGLEITEMFRAMESTATICTEXTDESCRIPTION, |
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_FRAGGLEITEMFRAMETEXTCTRLDESCRIPTION, |
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_FRAGGLEITEMFRAMESTATICTEXTKEYNAME, |
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_FRAGGLEITEMFRAMETEXTCTRLKEYNAME, |
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): |
74 |
|
|
self._init_ctrls(parent) |
75 |
|
|
# get engine-instance (singleton) |
76 |
|
|
import __main__ |
77 |
|
|
self.engine = __main__.engine |
78 |
|
|
#self.load_content() |
79 |
|
|
|
80 |
|
|
def OnButtoncloseButton(self, event): |
81 |
|
|
self.Destroy() |
82 |
|
|
event.Skip() |
83 |
|
|
|
84 |
|
|
def load_content(self): |
85 |
|
|
topicid = int(self.GetName()) |
86 |
|
|
topicdata = self.engine.query_remote(topicid) |
87 |
|
|
|
88 |
|
|
if topicdata: |
89 |
|
|
self.styledTextContent.SetText(topicdata['content']) |
90 |
|
|
self.textCtrlKeyname.SetValue(topicdata['keyname']) |
91 |
|
|
self.textCtrlDescription.SetValue(topicdata['description']) |
92 |
|
|
|
93 |
|
|
def OnButtonRefreshButton(self, event): |
94 |
|
|
event.Skip() |
95 |
|
|
|
96 |
|
|
|