/[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.6 - (hide annotations)
Tue Aug 31 02:25:34 2004 UTC (20 years, 2 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 joko 1.1 #Boa:MDIChild:FraggleTopicFrame
2    
3 joko 1.6 # $Id: FraggleTopicFrame.py,v 1.5 2004/08/30 13:06:16 joko Exp $
4 joko 1.2 # $Log: FraggleTopicFrame.py,v $
5 joko 1.6 # Revision 1.5 2004/08/30 13:06:16 joko
6     # U now gets config via self.engine
7     #
8 joko 1.5 # 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 xabbu 1.4 # 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 joko 1.3 # Revision 1.2 2004/08/27 03:13:50 joko
18     # added listbox for topics and button for update/sync
19     #
20 joko 1.2 # Revision 1.1 2004/08/26 17:23:30 joko
21     # initial commit
22     #
23 joko 1.1
24     from wxPython.wx import *
25 joko 1.2 from wxPython.stc import *
26 joko 1.1
27 joko 1.6 import FraggleItemFrame
28     import FraggleListFrame
29 joko 1.3
30 joko 1.5 def create(parent):
31     return FraggleTopicFrame(parent)
32 joko 1.1
33 joko 1.2 [wxID_FRAGGLETOPICFRAME, wxID_FRAGGLETOPICFRAMETOPICLISTBOX,
34     wxID_FRAGGLETOPICFRAMEUPDATEBUTTON,
35     ] = map(lambda _init_ctrls: wxNewId(), range(3))
36 joko 1.1
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 xabbu 1.4 parent=prnt, pos=wxPoint(494, 328), size=wxSize(169, 192),
42 joko 1.1 style=wxSIMPLE_BORDER | wxDEFAULT_FRAME_STYLE, title='Topics')
43 xabbu 1.4 self._init_utils()
44 joko 1.2 self.SetClientSize(wxSize(169, 192))
45 joko 1.1
46 joko 1.2 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 joko 1.3 EVT_LISTBOX_DCLICK(self.topicListBox,
56     wxID_FRAGGLETOPICFRAMETOPICLISTBOX,
57     self.OnTopicListBoxListboxDclick)
58 xabbu 1.4
59     def _init_utils(self):
60     # generated method, don't edit
61     pass
62 joko 1.2
63 joko 1.5 def __init__(self, parent):
64 joko 1.3 self.parent = parent
65 joko 1.5
66     # render widgets
67 joko 1.1 self._init_ctrls(parent)
68 joko 1.5
69     # get engine-instance (singleton)
70 joko 1.3 import __main__
71     self.engine = __main__.engine
72 joko 1.2
73     def OnUpdateButtonButton(self, event):
74     #event.Skip()
75 joko 1.5 self.engine.fraggleSync()
76 joko 1.3 topics = self.engine.getTopics()
77 joko 1.6 self.topicListBox.Clear()
78 joko 1.2 i = 0
79     for topic in topics:
80     self.topicListBox.Append(topic['name'], i)
81     i = i + 1
82 joko 1.3
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 joko 1.6 result = topics[seldata]['result']
102 joko 1.3
103 joko 1.6 if result == 'item':
104     frame = FraggleItemFrame.create(self.parent)
105     elif result == 'list':
106     frame = FraggleListFrame.create(self.parent)
107 joko 1.3 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 joko 1.5 frame.load_content()
116 joko 1.3
117    

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