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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (hide annotations)
Fri Aug 27 21:14:02 2004 UTC (20 years, 2 months ago) by xabbu
Branch: MAIN
Changes since 1.3: +11 -2 lines
File MIME type: text/x-python
TopicDetails can now be closed.
GUI change on Preferences Dialog in order to prepare multiple server profiles.
Small bugfixes to get the new topic windows working on posix platform.

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

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