46 |
def OnButtoncloseButton(self, event): |
def OnButtoncloseButton(self, event): |
47 |
self.Destroy() |
self.Destroy() |
48 |
event.Skip() |
event.Skip() |
49 |
|
|
50 |
def load_content(self): |
def load_content(self,contentkey): |
51 |
self.topicid = int(self.GetName()) |
self.payload = self.engine.listItems(contentkey) |
52 |
self.topicmeta = self.engine.getTopicById(self.topicid) |
self.columns = self.payload['2'] |
53 |
self.payload = self.engine.query_remote(self.topicmeta) |
if self.payload: |
54 |
|
load3 = self.columns |
55 |
if self.payload: |
colid = 0 |
56 |
|
for i in load3: |
57 |
|
self.listViewMain.InsertColumn( |
58 |
|
col=colid, |
59 |
|
format=wxLIST_FORMAT_LEFT, |
60 |
|
heading=load3[i], |
61 |
|
width=-1 |
62 |
|
) |
63 |
|
colid += 1 |
64 |
|
#print self.payload |
65 |
|
|
66 |
|
entries = self.payload['1'] |
67 |
|
|
|
# 1. generate columns |
|
|
row0 = self.payload[0] |
|
|
colid = 0 |
|
|
for column in row0.keys(): |
|
|
self.listViewMain.InsertColumn( |
|
|
col=colid, |
|
|
format=wxLIST_FORMAT_LEFT, |
|
|
heading=column, |
|
|
width=-1 |
|
|
) |
|
|
colid += 1 |
|
|
|
|
|
# 2. fill entries |
|
68 |
itemid = 0 |
itemid = 0 |
69 |
for entry in self.payload: |
|
70 |
self.listViewMain.InsertStringItem(itemid, entry.keys()[0]) |
columnlist = self.columns |
71 |
|
|
72 |
|
for entry in entries: |
73 |
colid = 0 |
colid = 0 |
74 |
columnlist = entry.keys() |
#print columnlist |
75 |
columnlist.pop() |
#columnlist.pop() |
76 |
for column in columnlist: |
for column in columnlist: |
77 |
self.listViewMain.SetStringItem(itemid, colid, entry[column]) |
if column == '1' and entries[entry][column] == '1': |
78 |
|
self.listViewMain.InsertStringItem(itemid, 'English') |
79 |
|
elif column == '1' and entries[entry][column] == '2': |
80 |
|
self.listViewMain.InsertStringItem(itemid, 'Deutsch') |
81 |
|
#print entries[entry][column] |
82 |
|
#print "column: "+column |
83 |
|
if column != '1': |
84 |
|
self.listViewMain.SetStringItem(itemid, colid, entries[entry][column]) |
85 |
|
print "colid: "+str(colid) |
86 |
colid += 1 |
colid += 1 |
87 |
|
|
88 |
|
#set custom data |
89 |
|
self.listViewMain.SetItemData(itemid, itemid) |
90 |
|
itemid += 1 |
91 |
|
|
92 |
|
|
93 |
|
#def load_content(self): |
94 |
|
# self.topicid = int(self.GetName()) |
95 |
|
# self.topicmeta = self.engine.getTopicById(self.topicid) |
96 |
|
# self.payload = self.engine.query_remote(self.topicmeta) |
97 |
|
|
98 |
|
# if self.payload: |
99 |
|
|
100 |
|
# 1. generate columns |
101 |
|
# row0 = self.payload[0] |
102 |
|
# colid = 0 |
103 |
|
# for column in row0.keys(): |
104 |
|
# self.listViewMain.InsertColumn( |
105 |
|
# col=colid, |
106 |
|
# format=wxLIST_FORMAT_LEFT, |
107 |
|
# heading=column, |
108 |
|
# width=-1 |
109 |
|
# ) |
110 |
|
# colid += 1 |
111 |
|
|
112 |
|
# 2. fill entries |
113 |
|
#itemid = 0 |
114 |
|
#for entry in self.payload: |
115 |
|
# self.listViewMain.InsertStringItem(itemid, entry.keys()[0]) |
116 |
|
# colid = 0 |
117 |
|
# columnlist = entry.keys() |
118 |
|
# columnlist.pop() |
119 |
|
# for column in columnlist: |
120 |
|
# self.listViewMain.SetStringItem(itemid, colid, entry[column]) |
121 |
|
# colid += 1 |
122 |
|
|
123 |
# set custom data |
# set custom data |
124 |
self.listViewMain.SetItemData(itemid, itemid) |
#self.listViewMain.SetItemData(itemid, itemid) |
125 |
|
|
126 |
itemid += 1 |
#itemid += 1 |
127 |
|
|
128 |
def OnListViewMainLeftDclick(self, event): |
def OnListViewMainLeftDclick(self, event): |
129 |
#event.Skip() |
#event.Skip() |