/[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.8 - (hide annotations)
Fri Sep 17 09:46:30 2004 UTC (19 years, 9 months ago) by xabbu
Branch: MAIN
Changes since 1.7: +9 -4 lines
File MIME type: text/x-python
U function OnUpdateButtonButton items will be added in the correct order now

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

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