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

Contents of /nfo/projects/netfraggle/bin/FraggleTopicFrame.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (show annotations)
Tue Aug 31 02:25:34 2004 UTC (19 years, 10 months ago) by joko
Branch: MAIN
Changes since 1.5: +12 -3 lines
File MIME type: text/x-python
U removed FraggleTopicDetailFrame in favor of FraggleItemFrame and FraggleListFrame
U now clearing topicListBox before updating it

1 #Boa:MDIChild:FraggleTopicFrame
2
3 # $Id: FraggleTopicFrame.py,v 1.5 2004/08/30 13:06:16 joko Exp $
4 # $Log: FraggleTopicFrame.py,v $
5 # Revision 1.5 2004/08/30 13:06:16 joko
6 # U now gets config via self.engine
7 #
8 # Revision 1.4 2004/08/27 21:14:02 xabbu
9 # TopicDetails can now be closed.
10 # GUI change on Preferences Dialog in order to prepare multiple server profiles.
11 # Small bugfixes to get the new topic windows working on posix platform.
12 #
13 # Revision 1.3 2004/08/27 04:47:35 joko
14 # instance of FraggleEngine now available in self.engine
15 # added event handler "OnTopicListBoxListboxDclick" and logic to open "FraggleTopicDetailFrame"s
16 #
17 # Revision 1.2 2004/08/27 03:13:50 joko
18 # added listbox for topics and button for update/sync
19 #
20 # Revision 1.1 2004/08/26 17:23:30 joko
21 # initial commit
22 #
23
24 from wxPython.wx import *
25 from wxPython.stc import *
26
27 import FraggleItemFrame
28 import FraggleListFrame
29
30 def create(parent):
31 return FraggleTopicFrame(parent)
32
33 [wxID_FRAGGLETOPICFRAME, wxID_FRAGGLETOPICFRAMETOPICLISTBOX,
34 wxID_FRAGGLETOPICFRAMEUPDATEBUTTON,
35 ] = map(lambda _init_ctrls: wxNewId(), range(3))
36
37 class FraggleTopicFrame(wxMDIChildFrame):
38 def _init_ctrls(self, prnt):
39 # generated method, don't edit
40 wxMDIChildFrame.__init__(self, id=wxID_FRAGGLETOPICFRAME, name='',
41 parent=prnt, pos=wxPoint(494, 328), size=wxSize(169, 192),
42 style=wxSIMPLE_BORDER | wxDEFAULT_FRAME_STYLE, title='Topics')
43 self._init_utils()
44 self.SetClientSize(wxSize(169, 192))
45
46 self.updateButton = wxButton(id=wxID_FRAGGLETOPICFRAMEUPDATEBUTTON,
47 label=u'&Update', name=u'updateButton', parent=self,
48 pos=wxPoint(0, 168), size=wxSize(168, 23), style=0)
49 EVT_BUTTON(self.updateButton, wxID_FRAGGLETOPICFRAMEUPDATEBUTTON,
50 self.OnUpdateButtonButton)
51
52 self.topicListBox = wxListBox(choices=[],
53 id=wxID_FRAGGLETOPICFRAMETOPICLISTBOX, name=u'topicListBox',
54 parent=self, pos=wxPoint(0, 0), size=wxSize(168, 168), style=0)
55 EVT_LISTBOX_DCLICK(self.topicListBox,
56 wxID_FRAGGLETOPICFRAMETOPICLISTBOX,
57 self.OnTopicListBoxListboxDclick)
58
59 def _init_utils(self):
60 # generated method, don't edit
61 pass
62
63 def __init__(self, parent):
64 self.parent = parent
65
66 # render widgets
67 self._init_ctrls(parent)
68
69 # get engine-instance (singleton)
70 import __main__
71 self.engine = __main__.engine
72
73 def OnUpdateButtonButton(self, event):
74 #event.Skip()
75 self.engine.fraggleSync()
76 topics = self.engine.getTopics()
77 self.topicListBox.Clear()
78 i = 0
79 for topic in topics:
80 self.topicListBox.Append(topic['name'], i)
81 i = i + 1
82
83 def OnTopicListBoxListboxDclick(self, event):
84 #event.Skip()
85 #print event
86
87 # get "ClientData" of current selected entry from widget
88 sel = self.topicListBox.GetSelection()
89 seldata = self.topicListBox.GetClientData(sel)
90
91 # determine if to activate an existing window or if to create a new one
92 win = self.parent.FindWindowByName(str(seldata))
93 if win:
94 win.Raise()
95 win.SetFocus()
96 return
97
98 # resolve associated topic entry
99 topics = self.engine.getTopics()
100 title = topics[seldata]['name']
101 result = topics[seldata]['result']
102
103 if result == 'item':
104 frame = FraggleItemFrame.create(self.parent)
105 elif result == 'list':
106 frame = FraggleListFrame.create(self.parent)
107 frame.SetName(str(seldata))
108 frame.SetTitle(title)
109
110 # calculate new position (right beside the TopicFrame (us))
111 pos = self.GetPosition() + wxPoint(self.GetSize().GetWidth() + 5, 0)
112 frame.Move(pos)
113 self.parent.Fit()
114
115 frame.load_content()
116
117

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