2 |
|
|
3 |
# $Id$ |
# $Id$ |
4 |
# $Log$ |
# $Log$ |
5 |
|
# Revision 1.14 2004/08/27 04:39:06 joko |
6 |
|
# cleanup |
7 |
|
# |
8 |
|
# Revision 1.13 2004/08/27 03:25:44 joko |
9 |
|
# added FraggleTaskBarMenu |
10 |
|
# |
11 |
|
# Revision 1.12 2004/08/27 00:05:22 joko |
12 |
|
# fix for icon-path and wxTaskBarIcon-events |
13 |
|
# |
14 |
# Revision 1.11 2004/08/26 23:10:12 xabbu |
# Revision 1.11 2004/08/26 23:10:12 xabbu |
15 |
# xmlrpc class added |
# xmlrpc class added |
16 |
# |
# |
27 |
from wxPython.wx import * |
from wxPython.wx import * |
28 |
from wxPython.stc import * |
from wxPython.stc import * |
29 |
|
|
30 |
|
from fraggleConstants import * |
31 |
import fraggleDialogPrefs |
import fraggleDialogPrefs |
32 |
import fraggleCtlPreferences |
import fraggleCtlPreferences |
33 |
import FraggleAboutDialog |
import FraggleAboutDialog |
37 |
def create(parent): |
def create(parent): |
38 |
return fraggleViewport(parent) |
return fraggleViewport(parent) |
39 |
|
|
40 |
[wxID_FRAGGLEVIEWPORT, wxID_FRAGGLEVIEWPORTBUTTONSYNC, |
[wxID_FRAGGLEVIEWPORT] = map(lambda _init_ctrls: wxNewId(), range(1)) |
|
wxID_FRAGGLEVIEWPORTSTYLEDTEXTCTRL1, |
|
|
] = map(lambda _init_ctrls: wxNewId(), range(3)) |
|
41 |
|
|
42 |
[wxID_FRAGGLEVIEWPORTMENU1FPREFS, wxID_FRAGGLEVIEWPORTMENU1ITEMS1, |
[wxID_FRAGGLEVIEWPORTMENU1FPREFS, wxID_FRAGGLEVIEWPORTMENU1ITEMS1, |
43 |
] = map(lambda _init_coll_menu1_Items: wxNewId(), range(2)) |
] = map(lambda _init_coll_menu1_Items: wxNewId(), range(2)) |
48 |
[wxID_FRAGGLEVIEWPORTMENU2ABOUT, wxID_FRAGGLEVIEWPORTMENU2CONT, |
[wxID_FRAGGLEVIEWPORTMENU2ABOUT, wxID_FRAGGLEVIEWPORTMENU2CONT, |
49 |
] = map(lambda _init_coll_menu2_Items: wxNewId(), range(2)) |
] = map(lambda _init_coll_menu2_Items: wxNewId(), range(2)) |
50 |
|
|
51 |
|
[wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSEXIT, |
52 |
|
wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSRESTORE, |
53 |
|
wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSSYNC, |
54 |
|
] = map(lambda _init_coll_FraggleTaskBarMenu_Items: wxNewId(), range(3)) |
55 |
|
|
56 |
class fraggleViewport(wxMDIParentFrame): |
class fraggleViewport(wxMDIParentFrame): |
57 |
|
def _init_coll_FraggleTaskBarMenu_Items(self, parent): |
58 |
|
# generated method, don't edit |
59 |
|
|
60 |
|
parent.Append(helpString='Restore', |
61 |
|
id=wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSRESTORE, |
62 |
|
item='Restore', kind=wxITEM_NORMAL) |
63 |
|
parent.Append(helpString='Sync enabled', |
64 |
|
id=wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSSYNC, |
65 |
|
item='Sync enabled', kind=wxITEM_CHECK) |
66 |
|
parent.Append(helpString='Exit', |
67 |
|
id=wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSEXIT, item='Exit', |
68 |
|
kind=wxITEM_NORMAL) |
69 |
|
|
70 |
def _init_coll_menu2_Items(self, parent): |
def _init_coll_menu2_Items(self, parent): |
71 |
# generated method, don't edit |
# generated method, don't edit |
72 |
|
|
97 |
self.menuBar1.SetAutoLayout(1) |
self.menuBar1.SetAutoLayout(1) |
98 |
|
|
99 |
self.menu1 = wxMenu(title='') |
self.menu1 = wxMenu(title='') |
|
self._init_coll_menu1_Items(self.menu1) |
|
100 |
|
|
101 |
self.menu2 = wxMenu(title='') |
self.menu2 = wxMenu(title='') |
102 |
self._init_coll_menu2_Items(self.menu2) |
|
103 |
|
self.FraggleTaskBarMenu = wxMenu(title=u'NetFraggle') |
104 |
|
|
105 |
self._init_coll_menuBar1_Menus(self.menuBar1) |
self._init_coll_menuBar1_Menus(self.menuBar1) |
106 |
|
self._init_coll_menu1_Items(self.menu1) |
107 |
|
self._init_coll_menu2_Items(self.menu2) |
108 |
|
self._init_coll_FraggleTaskBarMenu_Items(self.FraggleTaskBarMenu) |
109 |
|
|
110 |
def _init_ctrls(self, prnt): |
def _init_ctrls(self, prnt): |
111 |
# generated method, don't edit |
# generated method, don't edit |
112 |
wxMDIParentFrame.__init__(self, id=wxID_FRAGGLEVIEWPORT, |
wxMDIParentFrame.__init__(self, id=wxID_FRAGGLEVIEWPORT, |
113 |
name='fraggleViewport', parent=prnt, pos=wxPoint(525, 292), |
name='fraggleViewport', parent=prnt, pos=wxPoint(338, 296), |
114 |
size=wxSize(341, 296), |
size=wxSize(435, 296), |
115 |
style=wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, |
style=wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, |
116 |
title='NetFraggle 0.0.1') |
title='NetFraggle 0.0.1') |
117 |
self._init_utils() |
self._init_utils() |
118 |
self.SetClientSize(wxSize(341, 273)) |
self.SetClientSize(wxSize(427, 269)) |
119 |
self.SetMenuBar(self.menuBar1) |
self.SetMenuBar(self.menuBar1) |
120 |
|
|
|
self.buttonsync = wxButton(id=wxID_FRAGGLEVIEWPORTBUTTONSYNC, |
|
|
label='Sync', name='buttonsync', parent=self, pos=wxPoint(104, |
|
|
240), size=wxSize(136, 24), style=0) |
|
|
EVT_BUTTON(self.buttonsync, wxID_FRAGGLEVIEWPORTBUTTONSYNC, |
|
|
self.OnButtonsyncButton) |
|
|
|
|
|
self.styledTextCtrl1 = wxStyledTextCtrl(id=wxID_FRAGGLEVIEWPORTSTYLEDTEXTCTRL1, |
|
|
name='styledTextCtrl1', parent=self, pos=wxPoint(8, 16), |
|
|
size=wxSize(328, 216), style=0) |
|
|
|
|
121 |
def __init_preferences__(self): |
def __init_preferences__(self): |
122 |
self.preferencesCtl = fraggleCtlPreferences.create(self) |
self.preferencesCtl = fraggleCtlPreferences.create(self) |
123 |
self.dialogPrefs = fraggleDialogPrefs.create(self) |
self.dialogPrefs = fraggleDialogPrefs.create(self) |
125 |
self.dialogPrefs.updateConfig() |
self.dialogPrefs.updateConfig() |
126 |
|
|
127 |
# new as of 2004-08-26: TopicFrame |
# new as of 2004-08-26: TopicFrame |
128 |
self.topicFrame = FraggleTopicFrame.create(self) |
# new as of 2004-08-27: pass configList to TopicFrame |
129 |
self.topicFrame.Move(wxPoint(10, 10)) |
self.topicFrame = FraggleTopicFrame.create(self, self.preferencesCtl.configList) |
130 |
|
self.topicFrame.Move(wxPoint(5, 5)) |
131 |
|
|
132 |
#frame.Show() |
#frame.Show() |
133 |
#frame.Destroy() |
#frame.Destroy() |
134 |
def __init_xmlrpc__(self): |
def __init_xmlrpc__(self): |
135 |
self.xml_rpc = FraggleXMLRPC.create(self, self.preferencesCtl.configList) |
#self.xml_rpc = FraggleXMLRPC.create(self, self.preferencesCtl.configList) |
136 |
|
pass |
137 |
|
|
138 |
def __init_taskbar_icon__(self): |
def __init_taskbar_icon__(self): |
139 |
if os.name == 'posix': |
if os.name == 'posix': |
140 |
pass |
pass |
141 |
elif os.name == 'nt': |
elif os.name == 'nt': |
142 |
self.tbicon = wxTaskBarIcon() |
self.tbicon = wxTaskBarIcon() |
143 |
icon = wxIcon('mixxx.ico', wxBITMAP_TYPE_ICO) |
#icon = wxIcon('mixxx.ico', wxBITMAP_TYPE_ICO) |
144 |
|
icon = wxIcon(os.path.join(APPLOCATION, 'mixxx.ico'), wxBITMAP_TYPE_ICO) |
145 |
self.tbicon.SetIcon(icon, '') |
self.tbicon.SetIcon(icon, '') |
146 |
wxEVT_TASKBAR_LEFT_DCLICK(self.tbicon, self.OnTaskBarLeftDClick) |
EVT_TASKBAR_LEFT_DCLICK(self.tbicon, self.OnTaskBarLeftDClick) |
147 |
wxEVT_TASKBAR_RIGHT_UP(self.tbicon, self.OnTaskBarRightClick) |
EVT_TASKBAR_RIGHT_UP(self.tbicon, self.OnTaskBarRightClick) |
148 |
|
EVT_MENU(self.tbicon, wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSRESTORE, self.OnTaskBarAppRestore) |
149 |
|
EVT_MENU(self.tbicon, wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSEXIT, self.OnTaskBarAppExit) |
150 |
|
|
151 |
def __init__(self, parent): |
def __init__(self, parent): |
152 |
self._init_ctrls(parent) |
self._init_ctrls(parent) |
153 |
self.__init_preferences__() |
self.__init_preferences__() |
180 |
dlg.Destroy() |
dlg.Destroy() |
181 |
|
|
182 |
def OnTaskBarLeftDClick(self, event): |
def OnTaskBarLeftDClick(self, event): |
183 |
event.Skip() |
#event.Skip() |
184 |
|
#self.SetFocus() |
185 |
|
if self.IsIconized(): |
186 |
|
self.Restore() |
187 |
|
else: |
188 |
|
self.Iconize() |
189 |
|
|
190 |
def OnTaskBarRightClick(self, event): |
def OnTaskBarRightClick(self, event): |
|
event.Skip() |
|
|
|
|
|
def OnButtonsyncButton(self, event): |
|
|
fragglexml = self.xml_rpc.FraggleSync() |
|
|
print fragglexml |
|
|
import codecs |
|
|
(UTF8_encode, UTF8_decode, |
|
|
UTF8_streamreader, UTF8_streamwriter) = codecs.lookup('UTF-8') |
|
|
text = UTF8_decode(repr(fragglexml))[0] |
|
|
text = fragglexml.data |
|
|
self.styledTextCtrl1.AddText(text) |
|
|
event.Skip() |
|
191 |
|
#event.Skip() |
192 |
|
self.tbicon.PopupMenu(self.FraggleTaskBarMenu) |
193 |
|
|
194 |
|
def OnTaskBarAppRestore(self, event): |
195 |
|
self.Restore() |
196 |
|
#event.Skip() |
197 |
|
|
198 |
|
def OnTaskBarAppExit(self, event): |
199 |
|
#event.Skip() |
200 |
|
#self.Destroy() |
201 |
|
self.Close(True) |
202 |
|
|