/[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.4 by xabbu, Fri Aug 27 21:14:02 2004 UTC
# Line 2  Line 2 
2    
3  # $Id$  # $Id$
4  # $Log$  # $Log$
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    # 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  # Revision 1.2  2004/08/27 03:13:50  joko  # Revision 1.2  2004/08/27 03:13:50  joko
15  # added listbox for topics and button for update/sync  # added listbox for topics and button for update/sync
16  #  #
# Line 12  Line 21 
21  from wxPython.wx import *  from wxPython.wx import *
22  from wxPython.stc import *  from wxPython.stc import *
23    
24    import FraggleTopicDetailFrame
25    
26  def create(parent, config):  def create(parent, config):
27      return FraggleTopicFrame(parent, config)      return FraggleTopicFrame(parent, config)
28    
# Line 23  class FraggleTopicFrame(wxMDIChildFrame) Line 34  class FraggleTopicFrame(wxMDIChildFrame)
34      def _init_ctrls(self, prnt):      def _init_ctrls(self, prnt):
35          # generated method, don't edit          # generated method, don't edit
36          wxMDIChildFrame.__init__(self, id=wxID_FRAGGLETOPICFRAME, name='',          wxMDIChildFrame.__init__(self, id=wxID_FRAGGLETOPICFRAME, name='',
37                parent=prnt, pos=wxPoint(352, 280), size=wxSize(177, 219),                parent=prnt, pos=wxPoint(494, 328), size=wxSize(169, 192),
38                style=wxSIMPLE_BORDER | wxDEFAULT_FRAME_STYLE, title='Topics')                style=wxSIMPLE_BORDER | wxDEFAULT_FRAME_STYLE, title='Topics')
39            self._init_utils()
40          self.SetClientSize(wxSize(169, 192))          self.SetClientSize(wxSize(169, 192))
41    
42          self.updateButton = wxButton(id=wxID_FRAGGLETOPICFRAMEUPDATEBUTTON,          self.updateButton = wxButton(id=wxID_FRAGGLETOPICFRAMEUPDATEBUTTON,
# Line 36  class FraggleTopicFrame(wxMDIChildFrame) Line 48  class FraggleTopicFrame(wxMDIChildFrame)
48          self.topicListBox = wxListBox(choices=[],          self.topicListBox = wxListBox(choices=[],
49                id=wxID_FRAGGLETOPICFRAMETOPICLISTBOX, name=u'topicListBox',                id=wxID_FRAGGLETOPICFRAMETOPICLISTBOX, name=u'topicListBox',
50                parent=self, pos=wxPoint(0, 0), size=wxSize(168, 168), style=0)                parent=self, pos=wxPoint(0, 0), size=wxSize(168, 168), style=0)
51            EVT_LISTBOX_DCLICK(self.topicListBox,
52                  wxID_FRAGGLETOPICFRAMETOPICLISTBOX,
53                  self.OnTopicListBoxListboxDclick)
54    
55        def _init_utils(self):
56            # generated method, don't edit
57            pass
58    
59      def __init__(self, parent, config):      def __init__(self, parent, config):
60            self.parent = parent
61          self.config = config          self.config = config
62          self._init_ctrls(parent)          self._init_ctrls(parent)
63            import __main__
64            self.engine = __main__.engine
65    
66      def OnUpdateButtonButton(self, event):      def OnUpdateButtonButton(self, event):
67          #event.Skip()          #event.Skip()
         import __main__  
         engine = __main__.engine  
68          # todo: make fraggleEngine read config on its own          # todo: make fraggleEngine read config on its own
69          engine.fraggleSync(self.config)          self.engine.fraggleSync(self.config)
70          topics = engine.getTopics()          topics = self.engine.getTopics()
71          i = 0          i = 0
72          for topic in topics:          for topic in topics:
73              self.topicListBox.Append(topic['name'], i)              self.topicListBox.Append(topic['name'], i)
74              i = i + 1              i = i + 1
75    
76        def OnTopicListBoxListboxDclick(self, event):
77            #event.Skip()
78            #print event
79            
80            # get "ClientData" of current selected entry from widget
81            sel = self.topicListBox.GetSelection()
82            seldata = self.topicListBox.GetClientData(sel)
83            
84            # determine if to activate an existing window or if to create a new one
85            win = self.parent.FindWindowByName(str(seldata))
86            if win:
87                win.Raise()
88                win.SetFocus()
89                return
90    
91            # resolve associated topic entry
92            topics = self.engine.getTopics()
93            title = topics[seldata]['name']
94    
95            frame = FraggleTopicDetailFrame.create(self.parent)
96            frame.SetName(str(seldata))
97            frame.SetTitle(title)
98            
99            # calculate new position (right beside the TopicFrame (us))
100            pos = self.GetPosition() + wxPoint(self.GetSize().GetWidth() + 5, 0)
101            frame.Move(pos)
102            self.parent.Fit()
103            
104            
105            

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

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