47 |
self.Destroy() |
self.Destroy() |
48 |
event.Skip() |
event.Skip() |
49 |
|
|
|
def load_content(self,contentkey): |
|
|
self.payload = self.engine.listItems(contentkey) |
|
|
self.columns = self.payload['2'] |
|
|
if self.payload: |
|
|
load3 = self.columns |
|
|
colid = 0 |
|
|
for i in load3: |
|
|
self.listViewMain.InsertColumn( |
|
|
col=colid, |
|
|
format=wxLIST_FORMAT_LEFT, |
|
|
heading=load3[i], |
|
|
width=-1 |
|
|
) |
|
|
colid += 1 |
|
|
#print self.payload |
|
50 |
|
|
|
entries = self.payload['1'] |
|
|
|
|
|
itemid = 0 |
|
|
|
|
|
columnlist = self.columns |
|
|
|
|
|
for entry in entries: |
|
|
colid = 0 |
|
|
#print columnlist |
|
|
#columnlist.pop() |
|
|
for column in columnlist: |
|
|
if column == '1' and entries[entry][column] == '1': |
|
|
self.listViewMain.InsertStringItem(itemid, 'English') |
|
|
elif column == '1' and entries[entry][column] == '2': |
|
|
self.listViewMain.InsertStringItem(itemid, 'Deutsch') |
|
|
#print entries[entry][column] |
|
|
#print "column: "+column |
|
|
if column != '1': |
|
|
self.listViewMain.SetStringItem(itemid, colid, entries[entry][column]) |
|
|
print "colid: "+str(colid) |
|
|
colid += 1 |
|
|
|
|
|
#set custom data |
|
|
self.listViewMain.SetItemData(itemid, itemid) |
|
|
itemid += 1 |
|
51 |
|
|
52 |
|
|
53 |
#def load_content(self): |
#def load_content(self): |
91 |
list_item = self.listViewMain.GetItem(list_selection) |
list_item = self.listViewMain.GetItem(list_selection) |
92 |
#wxMessageBox(str(item.GetData())) |
#wxMessageBox(str(item.GetData())) |
93 |
idx = list_item.GetData() |
idx = list_item.GetData() |
94 |
item = self.payload[idx] |
entries = self.payload['1'] |
95 |
|
|
96 |
|
item = entries[str(idx)] |
97 |
|
|
98 |
# create new MDI frame |
# create new MDI frame |
99 |
frame = FraggleItemFrame.create(self.parent) |
frame = FraggleItemFrame.create(self.parent) |
100 |
frame.SetName(str(idx)) |
frame.SetName(str(idx)) |
101 |
frame.SetTitle(item['keyname']) |
frame.SetTitle(str("Item No."+item['id'])) |
102 |
|
|
103 |
# calculate new position (right lower offset of 15px to us) |
# calculate new position (right lower offset of 15px to us) |
104 |
pos = self.GetPosition() + wxPoint(25, 25) |
pos = self.GetPosition() + wxPoint(25, 25) |
107 |
|
|
108 |
# patch topic metadata to point to an item instead of a list |
# patch topic metadata to point to an item instead of a list |
109 |
# use keyname as query argument |
# use keyname as query argument |
110 |
topicmeta = self.topicmeta |
#topicmeta = self.topicmeta |
111 |
topicmeta['result'] = 'item' |
#topicmeta['result'] = 'item' |
112 |
topicmeta['target']['arguments'] = item['keyname'] |
#topicmeta['target']['arguments'] = item['keyname'] |
113 |
frame.load_content(topicmeta) |
#frame.load_content(topicmeta) |