/[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.5 - (hide annotations)
Mon Aug 30 13:06:16 2004 UTC (20 years, 2 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 joko 1.1 #Boa:MDIChild:FraggleTopicFrame
2    
3 joko 1.5 # $Id: FraggleTopicFrame.py,v 1.4 2004/08/27 21:14:02 xabbu Exp $
4 joko 1.2 # $Log: FraggleTopicFrame.py,v $
5 joko 1.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 xabbu 1.4 # 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 joko 1.3 # Revision 1.2 2004/08/27 03:13:50 joko
15     # added listbox for topics and button for update/sync
16     #
17 joko 1.2 # Revision 1.1 2004/08/26 17:23:30 joko
18     # initial commit
19     #
20 joko 1.1
21     from wxPython.wx import *
22 joko 1.2 from wxPython.stc import *
23 joko 1.1
24 joko 1.3 import FraggleTopicDetailFrame
25    
26 joko 1.5 def create(parent):
27     return FraggleTopicFrame(parent)
28 joko 1.1
29 joko 1.2 [wxID_FRAGGLETOPICFRAME, wxID_FRAGGLETOPICFRAMETOPICLISTBOX,
30     wxID_FRAGGLETOPICFRAMEUPDATEBUTTON,
31     ] = map(lambda _init_ctrls: wxNewId(), range(3))
32 joko 1.1
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 xabbu 1.4 parent=prnt, pos=wxPoint(494, 328), size=wxSize(169, 192),
38 joko 1.1 style=wxSIMPLE_BORDER | wxDEFAULT_FRAME_STYLE, title='Topics')
39 xabbu 1.4 self._init_utils()
40 joko 1.2 self.SetClientSize(wxSize(169, 192))
41 joko 1.1
42 joko 1.2 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 joko 1.3 EVT_LISTBOX_DCLICK(self.topicListBox,
52     wxID_FRAGGLETOPICFRAMETOPICLISTBOX,
53     self.OnTopicListBoxListboxDclick)
54 xabbu 1.4
55     def _init_utils(self):
56     # generated method, don't edit
57     pass
58 joko 1.2
59 joko 1.5 def __init__(self, parent):
60 joko 1.3 self.parent = parent
61 joko 1.5
62     # render widgets
63 joko 1.1 self._init_ctrls(parent)
64 joko 1.5
65     # get engine-instance (singleton)
66 joko 1.3 import __main__
67     self.engine = __main__.engine
68 joko 1.2
69     def OnUpdateButtonButton(self, event):
70     #event.Skip()
71 joko 1.5 self.engine.fraggleSync()
72 joko 1.3 topics = self.engine.getTopics()
73 joko 1.2 i = 0
74     for topic in topics:
75     self.topicListBox.Append(topic['name'], i)
76     i = i + 1
77 joko 1.3
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 joko 1.5 frame.load_content()
107 joko 1.3
108    

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