2 |
|
|
3 |
# $Id$ |
# $Id$ |
4 |
# $Log$ |
# $Log$ |
5 |
|
# Revision 1.11 2004/08/26 23:10:12 xabbu |
6 |
|
# xmlrpc class added |
7 |
|
# |
8 |
# Revision 1.10 2004/08/26 18:19:27 joko |
# Revision 1.10 2004/08/26 18:19:27 joko |
9 |
# now using FraggleTopicFrame |
# now using FraggleTopicFrame |
10 |
# |
# |
16 |
|
|
17 |
import os |
import os |
18 |
from wxPython.wx import * |
from wxPython.wx import * |
19 |
|
from wxPython.stc import * |
20 |
|
|
21 |
import fraggleDialogPrefs |
import fraggleDialogPrefs |
22 |
import fraggleCtlPreferences |
import fraggleCtlPreferences |
23 |
import FraggleAboutDialog |
import FraggleAboutDialog |
24 |
import FraggleTopicFrame |
import FraggleTopicFrame |
25 |
|
import FraggleXMLRPC |
26 |
|
|
27 |
def create(parent): |
def create(parent): |
28 |
return fraggleViewport(parent) |
return fraggleViewport(parent) |
29 |
|
|
30 |
[wxID_FRAGGLEVIEWPORT] = map(lambda _init_ctrls: wxNewId(), range(1)) |
[wxID_FRAGGLEVIEWPORT, wxID_FRAGGLEVIEWPORTBUTTONSYNC, |
31 |
|
wxID_FRAGGLEVIEWPORTSTYLEDTEXTCTRL1, |
32 |
|
] = map(lambda _init_ctrls: wxNewId(), range(3)) |
33 |
|
|
34 |
[wxID_FRAGGLEVIEWPORTMENU1FPREFS, wxID_FRAGGLEVIEWPORTMENU1ITEMS1, |
[wxID_FRAGGLEVIEWPORTMENU1FPREFS, wxID_FRAGGLEVIEWPORTMENU1ITEMS1, |
35 |
] = map(lambda _init_coll_menu1_Items: wxNewId(), range(2)) |
] = map(lambda _init_coll_menu1_Items: wxNewId(), range(2)) |
37 |
[wxID_FRAGGLEVIEWPORTMENU2ABOUT, wxID_FRAGGLEVIEWPORTMENU2CONT, |
[wxID_FRAGGLEVIEWPORTMENU2ABOUT, wxID_FRAGGLEVIEWPORTMENU2CONT, |
38 |
] = map(lambda _init_coll_menu2_Items: wxNewId(), range(2)) |
] = map(lambda _init_coll_menu2_Items: wxNewId(), range(2)) |
39 |
|
|
40 |
|
[wxID_FRAGGLEVIEWPORTMENU2ABOUT, wxID_FRAGGLEVIEWPORTMENU2CONT, |
41 |
|
] = map(lambda _init_coll_menu2_Items: wxNewId(), range(2)) |
42 |
|
|
43 |
class fraggleViewport(wxMDIParentFrame): |
class fraggleViewport(wxMDIParentFrame): |
44 |
def _init_coll_menu2_Items(self, parent): |
def _init_coll_menu2_Items(self, parent): |
45 |
# generated method, don't edit |
# generated method, don't edit |
71 |
self.menuBar1.SetAutoLayout(1) |
self.menuBar1.SetAutoLayout(1) |
72 |
|
|
73 |
self.menu1 = wxMenu(title='') |
self.menu1 = wxMenu(title='') |
74 |
|
self._init_coll_menu1_Items(self.menu1) |
75 |
|
|
76 |
self.menu2 = wxMenu(title='') |
self.menu2 = wxMenu(title='') |
77 |
|
self._init_coll_menu2_Items(self.menu2) |
78 |
|
|
79 |
self._init_coll_menuBar1_Menus(self.menuBar1) |
self._init_coll_menuBar1_Menus(self.menuBar1) |
|
self._init_coll_menu1_Items(self.menu1) |
|
|
self._init_coll_menu2_Items(self.menu2) |
|
80 |
|
|
81 |
def _init_ctrls(self, prnt): |
def _init_ctrls(self, prnt): |
82 |
# generated method, don't edit |
# generated method, don't edit |
83 |
wxMDIParentFrame.__init__(self, id=wxID_FRAGGLEVIEWPORT, |
wxMDIParentFrame.__init__(self, id=wxID_FRAGGLEVIEWPORT, |
84 |
name='fraggleViewport', parent=prnt, pos=wxPoint(237, 287), |
name='fraggleViewport', parent=prnt, pos=wxPoint(525, 292), |
85 |
size=wxSize(485, 310), |
size=wxSize(341, 296), |
86 |
style=wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, |
style=wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, |
87 |
title='NetFraggle') |
title='NetFraggle 0.0.1') |
88 |
self._init_utils() |
self._init_utils() |
89 |
self.SetClientSize(wxSize(477, 283)) |
self.SetClientSize(wxSize(341, 273)) |
90 |
self.SetMenuBar(self.menuBar1) |
self.SetMenuBar(self.menuBar1) |
91 |
|
|
92 |
|
self.buttonsync = wxButton(id=wxID_FRAGGLEVIEWPORTBUTTONSYNC, |
93 |
|
label='Sync', name='buttonsync', parent=self, pos=wxPoint(104, |
94 |
|
240), size=wxSize(136, 24), style=0) |
95 |
|
EVT_BUTTON(self.buttonsync, wxID_FRAGGLEVIEWPORTBUTTONSYNC, |
96 |
|
self.OnButtonsyncButton) |
97 |
|
|
98 |
|
self.styledTextCtrl1 = wxStyledTextCtrl(id=wxID_FRAGGLEVIEWPORTSTYLEDTEXTCTRL1, |
99 |
|
name='styledTextCtrl1', parent=self, pos=wxPoint(8, 16), |
100 |
|
size=wxSize(328, 216), style=0) |
101 |
|
|
102 |
def __init_preferences__(self): |
def __init_preferences__(self): |
103 |
self.preferencesCtl = fraggleCtlPreferences.create(self) |
self.preferencesCtl = fraggleCtlPreferences.create(self) |
104 |
self.dialogPrefs = fraggleDialogPrefs.create(self) |
self.dialogPrefs = fraggleDialogPrefs.create(self) |
111 |
|
|
112 |
#frame.Show() |
#frame.Show() |
113 |
#frame.Destroy() |
#frame.Destroy() |
114 |
|
def __init_xmlrpc__(self): |
115 |
|
self.xml_rpc = FraggleXMLRPC.create(self, self.preferencesCtl.configList) |
116 |
|
|
117 |
|
def __init_taskbar_icon__(self): |
118 |
|
if os.name == 'posix': |
119 |
|
pass |
120 |
|
elif os.name == 'nt': |
121 |
|
self.tbicon = wxTaskBarIcon() |
122 |
|
icon = wxIcon('mixxx.ico', wxBITMAP_TYPE_ICO) |
123 |
|
self.tbicon.SetIcon(icon, '') |
124 |
|
wxEVT_TASKBAR_LEFT_DCLICK(self.tbicon, self.OnTaskBarLeftDClick) |
125 |
|
wxEVT_TASKBAR_RIGHT_UP(self.tbicon, self.OnTaskBarRightClick) |
126 |
|
|
127 |
def __init__(self, parent): |
def __init__(self, parent): |
128 |
self._init_ctrls(parent) |
self._init_ctrls(parent) |
129 |
self.__init_preferences__() |
self.__init_preferences__() |
130 |
|
self.__init_taskbar_icon__() |
131 |
|
self.__init_xmlrpc__() |
132 |
|
|
|
|
|
133 |
def OnMenu1items0Menu(self, event): |
def OnMenu1items0Menu(self, event): |
134 |
try: |
try: |
135 |
self.dialogPrefs.ShowModal() |
self.dialogPrefs.ShowModal() |
136 |
finally: |
finally: |
137 |
pass |
self.dialogPrefs.Hide() |
138 |
event.Skip() |
event.Skip() |
139 |
|
|
140 |
def OnMenu1items1Menu(self, event): |
def OnMenu1items1Menu(self, event): |
155 |
dlg.ShowModal() |
dlg.ShowModal() |
156 |
dlg.Destroy() |
dlg.Destroy() |
157 |
|
|
158 |
|
def OnTaskBarLeftDClick(self, event): |
159 |
|
event.Skip() |
160 |
|
|
161 |
|
def OnTaskBarRightClick(self, event): |
162 |
|
event.Skip() |
163 |
|
|
164 |
|
def OnButtonsyncButton(self, event): |
165 |
|
fragglexml = self.xml_rpc.FraggleSync() |
166 |
|
print fragglexml |
167 |
|
import codecs |
168 |
|
(UTF8_encode, UTF8_decode, |
169 |
|
UTF8_streamreader, UTF8_streamwriter) = codecs.lookup('UTF-8') |
170 |
|
text = UTF8_decode(repr(fragglexml))[0] |
171 |
|
text = fragglexml.data |
172 |
|
self.styledTextCtrl1.AddText(text) |
173 |
|
event.Skip() |