| 2 |
|
|
| 3 |
# $Id$ |
# $Id$ |
| 4 |
# $Log$ |
# $Log$ |
| 5 |
|
# 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 |
|
# 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 |
|
# Revision 1.5 2004/08/30 13:06:16 joko |
| 14 |
|
# U now gets config via self.engine |
| 15 |
|
# |
| 16 |
|
# 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 |
# Revision 1.3 2004/08/27 04:47:35 joko |
# Revision 1.3 2004/08/27 04:47:35 joko |
| 22 |
# instance of FraggleEngine now available in self.engine |
# instance of FraggleEngine now available in self.engine |
| 23 |
# added event handler "OnTopicListBoxListboxDclick" and logic to open "FraggleTopicDetailFrame"s |
# added event handler "OnTopicListBoxListboxDclick" and logic to open "FraggleTopicDetailFrame"s |
| 32 |
from wxPython.wx import * |
from wxPython.wx import * |
| 33 |
from wxPython.stc import * |
from wxPython.stc import * |
| 34 |
|
|
| 35 |
import FraggleTopicDetailFrame |
import FraggleItemFrame |
| 36 |
|
import FraggleListFrame |
| 37 |
|
|
| 38 |
def create(parent, config): |
def create(parent): |
| 39 |
return FraggleTopicFrame(parent, config) |
return FraggleTopicFrame(parent) |
| 40 |
|
|
| 41 |
[wxID_FRAGGLETOPICFRAME, wxID_FRAGGLETOPICFRAMETOPICLISTBOX, |
[wxID_FRAGGLETOPICFRAME, wxID_FRAGGLETOPICFRAMETOPICLISTBOX, |
| 42 |
wxID_FRAGGLETOPICFRAMEUPDATEBUTTON, |
wxID_FRAGGLETOPICFRAMEUPDATEBUTTON, |
| 46 |
def _init_ctrls(self, prnt): |
def _init_ctrls(self, prnt): |
| 47 |
# generated method, don't edit |
# generated method, don't edit |
| 48 |
wxMDIChildFrame.__init__(self, id=wxID_FRAGGLETOPICFRAME, name='', |
wxMDIChildFrame.__init__(self, id=wxID_FRAGGLETOPICFRAME, name='', |
| 49 |
parent=prnt, pos=wxPoint(352, 280), size=wxSize(177, 219), |
parent=prnt, pos=wxPoint(494, 328), size=wxSize(169, 192), |
| 50 |
style=wxSIMPLE_BORDER | wxDEFAULT_FRAME_STYLE, title='Topics') |
style=wxSIMPLE_BORDER | wxDEFAULT_FRAME_STYLE, title='Topics') |
| 51 |
|
self._init_utils() |
| 52 |
self.SetClientSize(wxSize(169, 192)) |
self.SetClientSize(wxSize(169, 192)) |
| 53 |
|
|
| 54 |
self.updateButton = wxButton(id=wxID_FRAGGLETOPICFRAMEUPDATEBUTTON, |
self.updateButton = wxButton(id=wxID_FRAGGLETOPICFRAMEUPDATEBUTTON, |
| 64 |
wxID_FRAGGLETOPICFRAMETOPICLISTBOX, |
wxID_FRAGGLETOPICFRAMETOPICLISTBOX, |
| 65 |
self.OnTopicListBoxListboxDclick) |
self.OnTopicListBoxListboxDclick) |
| 66 |
|
|
| 67 |
def __init__(self, parent, config): |
def _init_utils(self): |
| 68 |
|
# generated method, don't edit |
| 69 |
|
pass |
| 70 |
|
|
| 71 |
|
def __init__(self, parent): |
| 72 |
self.parent = parent |
self.parent = parent |
| 73 |
self.config = config |
|
| 74 |
|
# render widgets |
| 75 |
self._init_ctrls(parent) |
self._init_ctrls(parent) |
| 76 |
|
|
| 77 |
|
# get engine-instance (singleton) |
| 78 |
import __main__ |
import __main__ |
| 79 |
self.engine = __main__.engine |
self.engine = __main__.engine |
| 80 |
|
|
| 81 |
def OnUpdateButtonButton(self, event): |
def OnUpdateButtonButton(self, event): |
| 82 |
#event.Skip() |
#event.Skip() |
| 83 |
# todo: make fraggleEngine read config on its own |
self.engine.syncTopics() |
|
self.engine.fraggleSync(self.config) |
|
| 84 |
topics = self.engine.getTopics() |
topics = self.engine.getTopics() |
| 85 |
|
#print topics |
| 86 |
|
self.topicListBox.Clear() |
| 87 |
i = 0 |
i = 0 |
| 88 |
for topic in topics: |
for topic in topics: |
| 89 |
self.topicListBox.Append(topic['name'], i) |
self.topicListBox.Append(topics[topic], i) |
| 90 |
i = i + 1 |
i = i + 1 |
| 91 |
|
|
| 92 |
def OnTopicListBoxListboxDclick(self, event): |
def OnTopicListBoxListboxDclick(self, event): |
| 106 |
|
|
| 107 |
# resolve associated topic entry |
# resolve associated topic entry |
| 108 |
topics = self.engine.getTopics() |
topics = self.engine.getTopics() |
| 109 |
title = topics[seldata]['name'] |
title = topics[str(seldata)] |
| 110 |
|
#print title |
| 111 |
|
|
| 112 |
frame = FraggleTopicDetailFrame.create(self.parent) |
frame = FraggleListFrame.create(self.parent) |
| 113 |
frame.SetName(str(seldata)) |
frame.SetName(str(seldata)) |
| 114 |
frame.SetTitle(title) |
frame.SetTitle(title) |
| 115 |
|
|
| 118 |
frame.Move(pos) |
frame.Move(pos) |
| 119 |
self.parent.Fit() |
self.parent.Fit() |
| 120 |
|
|
| 121 |
|
frame.load_content() |
| 122 |
|
|
| 123 |
|
|