2 |
|
|
3 |
# $Id$ |
# $Id$ |
4 |
# $Log$ |
# $Log$ |
5 |
|
# Revision 1.2 2004/08/27 03:13:50 joko |
6 |
|
# added listbox for topics and button for update/sync |
7 |
|
# |
8 |
# Revision 1.1 2004/08/26 17:23:30 joko |
# Revision 1.1 2004/08/26 17:23:30 joko |
9 |
# initial commit |
# initial commit |
10 |
# |
# |
11 |
|
|
12 |
from wxPython.wx import * |
from wxPython.wx import * |
13 |
|
from wxPython.stc import * |
14 |
|
|
15 |
def create(parent): |
def create(parent, config): |
16 |
return FraggleTopicFrame(parent) |
return FraggleTopicFrame(parent, config) |
17 |
|
|
18 |
[wxID_FRAGGLETOPICFRAME] = map(lambda _init_ctrls: wxNewId(), range(1)) |
[wxID_FRAGGLETOPICFRAME, wxID_FRAGGLETOPICFRAMETOPICLISTBOX, |
19 |
|
wxID_FRAGGLETOPICFRAMEUPDATEBUTTON, |
20 |
|
] = map(lambda _init_ctrls: wxNewId(), range(3)) |
21 |
|
|
22 |
class FraggleTopicFrame(wxMDIChildFrame): |
class FraggleTopicFrame(wxMDIChildFrame): |
23 |
def _init_ctrls(self, prnt): |
def _init_ctrls(self, prnt): |
24 |
# generated method, don't edit |
# generated method, don't edit |
25 |
wxMDIChildFrame.__init__(self, id=wxID_FRAGGLETOPICFRAME, name='', |
wxMDIChildFrame.__init__(self, id=wxID_FRAGGLETOPICFRAME, name='', |
26 |
parent=prnt, pos=wxPoint(352, 280), size=wxSize(138, 215), |
parent=prnt, pos=wxPoint(352, 280), size=wxSize(177, 219), |
27 |
style=wxSIMPLE_BORDER | wxDEFAULT_FRAME_STYLE, title='Topics') |
style=wxSIMPLE_BORDER | wxDEFAULT_FRAME_STYLE, title='Topics') |
28 |
self.SetClientSize(wxSize(130, 188)) |
self.SetClientSize(wxSize(169, 192)) |
29 |
|
|
30 |
|
self.updateButton = wxButton(id=wxID_FRAGGLETOPICFRAMEUPDATEBUTTON, |
31 |
|
label=u'&Update', name=u'updateButton', parent=self, |
32 |
|
pos=wxPoint(0, 168), size=wxSize(168, 23), style=0) |
33 |
|
EVT_BUTTON(self.updateButton, wxID_FRAGGLETOPICFRAMEUPDATEBUTTON, |
34 |
|
self.OnUpdateButtonButton) |
35 |
|
|
36 |
|
self.topicListBox = wxListBox(choices=[], |
37 |
|
id=wxID_FRAGGLETOPICFRAMETOPICLISTBOX, name=u'topicListBox', |
38 |
|
parent=self, pos=wxPoint(0, 0), size=wxSize(168, 168), style=0) |
39 |
|
|
40 |
def __init__(self, parent): |
def __init__(self, parent, config): |
41 |
|
self.config = config |
42 |
self._init_ctrls(parent) |
self._init_ctrls(parent) |
43 |
|
|
44 |
|
def OnUpdateButtonButton(self, event): |
45 |
|
#event.Skip() |
46 |
|
import __main__ |
47 |
|
engine = __main__.engine |
48 |
|
# todo: make fraggleEngine read config on its own |
49 |
|
engine.fraggleSync(self.config) |
50 |
|
topics = engine.getTopics() |
51 |
|
i = 0 |
52 |
|
for topic in topics: |
53 |
|
self.topicListBox.Append(topic['name'], i) |
54 |
|
i = i + 1 |