2 |
|
|
3 |
# $Id$ |
# $Id$ |
4 |
# $Log$ |
# $Log$ |
5 |
|
# Revision 1.9 2004/09/17 20:51:24 xabbu |
6 |
|
# + function initTreeList() will init a TreeList |
7 |
|
# + function loadContent(contentkey) moved from FraggleListFrame |
8 |
|
# |
9 |
# Revision 1.8 2004/09/17 09:46:30 xabbu |
# Revision 1.8 2004/09/17 09:46:30 xabbu |
10 |
# U function OnUpdateButtonButton items will be added in the correct order now |
# U function OnUpdateButtonButton items will be added in the correct order now |
11 |
# |
# |
46 |
return FraggleTopicFrame(parent) |
return FraggleTopicFrame(parent) |
47 |
|
|
48 |
[wxID_FRAGGLETOPICFRAME, wxID_FRAGGLETOPICFRAMETOPICLISTBOX, |
[wxID_FRAGGLETOPICFRAME, wxID_FRAGGLETOPICFRAMETOPICLISTBOX, |
49 |
wxID_FRAGGLETOPICFRAMEUPDATEBUTTON, |
wxID_FRAGGLETOPICFRAMETREECTRL1, wxID_FRAGGLETOPICFRAMEUPDATEBUTTON, |
50 |
] = map(lambda _init_ctrls: wxNewId(), range(3)) |
] = map(lambda _init_ctrls: wxNewId(), range(4)) |
51 |
|
|
52 |
class FraggleTopicFrame(wxMDIChildFrame): |
class FraggleTopicFrame(wxMDIChildFrame): |
53 |
def _init_ctrls(self, prnt): |
def _init_ctrls(self, prnt): |
54 |
# generated method, don't edit |
# generated method, don't edit |
55 |
wxMDIChildFrame.__init__(self, id=wxID_FRAGGLETOPICFRAME, name='', |
wxMDIChildFrame.__init__(self, id=wxID_FRAGGLETOPICFRAME, name='', |
56 |
parent=prnt, pos=wxPoint(494, 328), size=wxSize(169, 192), |
parent=prnt, pos=wxPoint(494, 328), size=wxSize(424, 219), |
57 |
style=wxSIMPLE_BORDER | wxDEFAULT_FRAME_STYLE, title='Topics') |
style=wxSIMPLE_BORDER | wxDEFAULT_FRAME_STYLE, title='Topics') |
58 |
self._init_utils() |
self.SetClientSize(wxSize(416, 192)) |
|
self.SetClientSize(wxSize(169, 192)) |
|
59 |
|
|
60 |
self.updateButton = wxButton(id=wxID_FRAGGLETOPICFRAMEUPDATEBUTTON, |
self.updateButton = wxButton(id=wxID_FRAGGLETOPICFRAMEUPDATEBUTTON, |
61 |
label=u'&Update', name=u'updateButton', parent=self, |
label=u'&Update', name=u'updateButton', parent=self, |
70 |
wxID_FRAGGLETOPICFRAMETOPICLISTBOX, |
wxID_FRAGGLETOPICFRAMETOPICLISTBOX, |
71 |
self.OnTopicListBoxListboxDclick) |
self.OnTopicListBoxListboxDclick) |
72 |
|
|
73 |
def _init_utils(self): |
self.treeCtrl1 = wxTreeCtrl(id=wxID_FRAGGLETOPICFRAMETREECTRL1, |
74 |
# generated method, don't edit |
name='treeCtrl1', parent=self, pos=wxPoint(176, 0), |
75 |
pass |
size=wxSize(160, 168), style=wxTR_HAS_BUTTONS) |
76 |
|
self.treeCtrl1.Enable(True) |
77 |
|
|
78 |
def __init__(self, parent): |
def __init__(self, parent): |
79 |
self.parent = parent |
self.parent = parent |
91 |
topics = self.engine.getTopics() |
topics = self.engine.getTopics() |
92 |
#print topics |
#print topics |
93 |
self.topicListBox.Clear() |
self.topicListBox.Clear() |
94 |
|
self.treeCtrl1.Clear() |
95 |
i = 0 |
i = 0 |
96 |
for topic in topics: |
for topic in topics: |
97 |
self.topicListBox.Append(topics[str(i)], i) |
self.topicListBox.Append(topics[str(i)], i) |
98 |
i = i + 1 |
i = i + 1 |
99 |
|
self.initTreeList() |
100 |
|
|
101 |
|
def initTreeList(self): |
102 |
|
topics = self.engine.getTopics() |
103 |
|
i = 0 |
104 |
|
self.treeItems = {} |
105 |
|
self.rootItem = self.treeCtrl1.AddRoot('Root') |
106 |
|
self.treeItems[topics[str(i)]] = {} |
107 |
|
for topic in topics: |
108 |
|
self.treeItems[topics[str(i)]] = self.treeCtrl1.AppendItem(self.rootItem, topics[str(i)]) |
109 |
|
self.load_content(topics[str(i)]) |
110 |
|
i = i + 1 |
111 |
|
|
112 |
|
|
113 |
|
def load_content(self,contentkey): |
114 |
|
self.payload = self.engine.listItems(contentkey) |
115 |
|
self.columns = self.payload['2'] |
116 |
|
topics = self.engine.getTopics() |
117 |
|
|
118 |
|
entries = self.payload['1'] |
119 |
|
itemid = 0 |
120 |
|
columnlist = self.columns |
121 |
|
for entry in entries: |
122 |
|
|
123 |
|
#print columnlist |
124 |
|
#columnlist.pop() |
125 |
|
if entries[entry]['1'] == '1': |
126 |
|
self.treeCtrl1.AppendItem(self.treeItems[contentkey],str(entries[entry]['2']+' - English')) |
127 |
|
elif entries[entry]['1'] == '2': |
128 |
|
self.treeCtrl1.AppendItem(self.treeItems[contentkey],str(entries[entry]['2']+' - Deutsch')) |
129 |
|
#print self.treeItems |
130 |
|
itemid += 1 |
131 |
|
|
132 |
def OnTopicListBoxListboxDclick(self, event): |
def OnTopicListBoxListboxDclick(self, event): |
133 |
#event.Skip() |
#event.Skip() |
134 |
#print event |
#print event |
161 |
|
|
162 |
frame.load_content(topics[str(seldata)]) |
frame.load_content(topics[str(seldata)]) |
163 |
|
|
|
|
|
164 |
|
|