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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by joko, Fri Aug 27 03:13:50 2004 UTC revision 1.3 by joko, Fri Aug 27 04:47:35 2004 UTC
# Line 2  Line 2 
2    
3  # $Id$  # $Id$
4  # $Log$  # $Log$
5    # 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  # Revision 1.2  2004/08/27 03:13:50  joko  # Revision 1.2  2004/08/27 03:13:50  joko
10  # added listbox for topics and button for update/sync  # added listbox for topics and button for update/sync
11  #  #
# Line 12  Line 16 
16  from wxPython.wx import *  from wxPython.wx import *
17  from wxPython.stc import *  from wxPython.stc import *
18    
19    import FraggleTopicDetailFrame
20    
21  def create(parent, config):  def create(parent, config):
22      return FraggleTopicFrame(parent, config)      return FraggleTopicFrame(parent, config)
23    
# Line 36  class FraggleTopicFrame(wxMDIChildFrame) Line 42  class FraggleTopicFrame(wxMDIChildFrame)
42          self.topicListBox = wxListBox(choices=[],          self.topicListBox = wxListBox(choices=[],
43                id=wxID_FRAGGLETOPICFRAMETOPICLISTBOX, name=u'topicListBox',                id=wxID_FRAGGLETOPICFRAMETOPICLISTBOX, name=u'topicListBox',
44                parent=self, pos=wxPoint(0, 0), size=wxSize(168, 168), style=0)                parent=self, pos=wxPoint(0, 0), size=wxSize(168, 168), style=0)
45            EVT_LISTBOX_DCLICK(self.topicListBox,
46                  wxID_FRAGGLETOPICFRAMETOPICLISTBOX,
47                  self.OnTopicListBoxListboxDclick)
48    
49      def __init__(self, parent, config):      def __init__(self, parent, config):
50            self.parent = parent
51          self.config = config          self.config = config
52          self._init_ctrls(parent)          self._init_ctrls(parent)
53            import __main__
54            self.engine = __main__.engine
55    
56      def OnUpdateButtonButton(self, event):      def OnUpdateButtonButton(self, event):
57          #event.Skip()          #event.Skip()
         import __main__  
         engine = __main__.engine  
58          # todo: make fraggleEngine read config on its own          # todo: make fraggleEngine read config on its own
59          engine.fraggleSync(self.config)          self.engine.fraggleSync(self.config)
60          topics = engine.getTopics()          topics = self.engine.getTopics()
61          i = 0          i = 0
62          for topic in topics:          for topic in topics:
63              self.topicListBox.Append(topic['name'], i)              self.topicListBox.Append(topic['name'], i)
64              i = i + 1              i = i + 1
65    
66        def OnTopicListBoxListboxDclick(self, event):
67            #event.Skip()
68            #print event
69            
70            # get "ClientData" of current selected entry from widget
71            sel = self.topicListBox.GetSelection()
72            seldata = self.topicListBox.GetClientData(sel)
73            
74            # determine if to activate an existing window or if to create a new one
75            win = self.parent.FindWindowByName(str(seldata))
76            if win:
77                win.Raise()
78                win.SetFocus()
79                return
80    
81            # resolve associated topic entry
82            topics = self.engine.getTopics()
83            title = topics[seldata]['name']
84    
85            frame = FraggleTopicDetailFrame.create(self.parent)
86            frame.SetName(str(seldata))
87            frame.SetTitle(title)
88            
89            # calculate new position (right beside the TopicFrame (us))
90            pos = self.GetPosition() + wxPoint(self.GetSize().GetWidth() + 5, 0)
91            frame.Move(pos)
92            self.parent.Fit()
93            
94            
95            

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

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