/[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.5 - (show annotations)
Mon Aug 30 13:06:16 2004 UTC (19 years, 10 months ago) by joko
Branch: MAIN
Changes since 1.4: +15 -7 lines
File MIME type: text/x-python
U now gets config via self.engine

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

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