/[cvs]/nfo/projects/netfraggle/bin/FraggleListFrame.py
ViewVC logotype

Annotation of /nfo/projects/netfraggle/bin/FraggleListFrame.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (hide annotations)
Tue Sep 21 18:09:43 2004 UTC (19 years, 9 months ago) by xabbu
Branch: MAIN
CVS Tags: HEAD
Changes since 1.4: +8 -46 lines
File MIME type: text/x-python
U removed function load_content because modules are working now
U class FraggleListFrame becomes deprecated

1 joko 1.1 #Boa:MDIChild:FraggleListFrame
2    
3     from wxPython.wx import *
4     from wxPython.stc import *
5 joko 1.2 import FraggleItemFrame
6 joko 1.1
7     def create(parent):
8     return FraggleListFrame(parent)
9    
10     [wxID_FRAGGLELISTFRAME, wxID_FRAGGLELISTFRAMEBUTTONCLOSE,
11     wxID_FRAGGLELISTFRAMELISTVIEWMAIN, wxID_FRAGGLELISTFRAMEPANEL1,
12     ] = map(lambda _init_ctrls: wxNewId(), range(4))
13    
14     class FraggleListFrame(wxMDIChildFrame):
15     def _init_ctrls(self, prnt):
16     # generated method, don't edit
17     wxMDIChildFrame.__init__(self, id=wxID_FRAGGLELISTFRAME, name='',
18     parent=prnt, pos=wxPoint(356, 363), size=wxSize(397, 240),
19     style=wxDEFAULT_FRAME_STYLE, title='Topic details')
20     self.SetClientSize(wxSize(389, 213))
21    
22     self.panel1 = wxPanel(id=wxID_FRAGGLELISTFRAMEPANEL1, name='panel1',
23     parent=self, pos=wxPoint(0, 0), size=wxSize(389, 213),
24     style=wxTAB_TRAVERSAL)
25    
26     self.buttonClose = wxButton(id=wxID_FRAGGLELISTFRAMEBUTTONCLOSE,
27     label='X', name='buttonClose', parent=self.panel1, pos=wxPoint(8,
28     8), size=wxSize(16, 16), style=0)
29     self.buttonClose.SetAutoLayout(True)
30     EVT_BUTTON(self.buttonClose, wxID_FRAGGLELISTFRAMEBUTTONCLOSE,
31     self.OnButtoncloseButton)
32    
33     self.listViewMain = wxListView(id=wxID_FRAGGLELISTFRAMELISTVIEWMAIN,
34     name=u'listViewMain', parent=self.panel1, pos=wxPoint(8, 40),
35     size=wxSize(376, 168), style=wxLC_REPORT)
36 joko 1.2 EVT_LEFT_DCLICK(self.listViewMain, self.OnListViewMainLeftDclick)
37 joko 1.1
38     def __init__(self, parent):
39 joko 1.2 self.parent = parent
40 joko 1.1 self._init_ctrls(parent)
41     # get engine-instance (singleton)
42     import __main__
43     self.engine = __main__.engine
44     #self.load_content()
45    
46     def OnButtoncloseButton(self, event):
47     self.Destroy()
48     event.Skip()
49 xabbu 1.3
50 xabbu 1.4
51    
52    
53 xabbu 1.3 #def load_content(self):
54     # self.topicid = int(self.GetName())
55     # self.topicmeta = self.engine.getTopicById(self.topicid)
56     # self.payload = self.engine.query_remote(self.topicmeta)
57 joko 1.1
58 xabbu 1.3 # if self.payload:
59 joko 1.1
60     # 1. generate columns
61 xabbu 1.3 # row0 = self.payload[0]
62     # colid = 0
63     # for column in row0.keys():
64     # self.listViewMain.InsertColumn(
65     # col=colid,
66     # format=wxLIST_FORMAT_LEFT,
67     # heading=column,
68     # width=-1
69     # )
70     # colid += 1
71 joko 1.1
72     # 2. fill entries
73 xabbu 1.3 #itemid = 0
74     #for entry in self.payload:
75     # self.listViewMain.InsertStringItem(itemid, entry.keys()[0])
76     # colid = 0
77     # columnlist = entry.keys()
78     # columnlist.pop()
79     # for column in columnlist:
80     # self.listViewMain.SetStringItem(itemid, colid, entry[column])
81     # colid += 1
82 joko 1.2
83     # set custom data
84 xabbu 1.3 #self.listViewMain.SetItemData(itemid, itemid)
85 joko 1.2
86 xabbu 1.3 #itemid += 1
87 joko 1.2
88     def OnListViewMainLeftDclick(self, event):
89     #event.Skip()
90     list_selection = self.listViewMain.GetFocusedItem()
91     list_item = self.listViewMain.GetItem(list_selection)
92     #wxMessageBox(str(item.GetData()))
93     idx = list_item.GetData()
94 xabbu 1.5 entries = self.payload['1']
95    
96     item = entries[str(idx)]
97 joko 1.2
98     # create new MDI frame
99     frame = FraggleItemFrame.create(self.parent)
100     frame.SetName(str(idx))
101 xabbu 1.5 frame.SetTitle(str("Item No."+item['id']))
102 joko 1.2
103     # calculate new position (right lower offset of 15px to us)
104     pos = self.GetPosition() + wxPoint(25, 25)
105     frame.Move(pos)
106     self.parent.Fit()
107    
108     # patch topic metadata to point to an item instead of a list
109     # use keyname as query argument
110 xabbu 1.5 #topicmeta = self.topicmeta
111     #topicmeta['result'] = 'item'
112     #topicmeta['target']['arguments'] = item['keyname']
113     #frame.load_content(topicmeta)

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed