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 |
15 |
|
# xmlrpc class added |
16 |
|
# |
17 |
# Revision 1.10 2004/08/26 18:19:27 joko |
# Revision 1.10 2004/08/26 18:19:27 joko |
18 |
# now using FraggleTopicFrame |
# now using FraggleTopicFrame |
19 |
# |
# |
25 |
|
|
26 |
import os |
import os |
27 |
from wxPython.wx import * |
from wxPython.wx import * |
28 |
|
from wxPython.stc import * |
29 |
|
|
30 |
|
from fraggleConstants import * |
31 |
import fraggleDialogPrefs |
import fraggleDialogPrefs |
32 |
import fraggleCtlPreferences |
import fraggleCtlPreferences |
33 |
import FraggleAboutDialog |
import FraggleAboutDialog |
34 |
import FraggleTopicFrame |
import FraggleTopicFrame |
35 |
|
import FraggleXMLRPC |
36 |
|
|
37 |
def create(parent): |
def create(parent): |
38 |
return fraggleViewport(parent) |
return fraggleViewport(parent) |
45 |
[wxID_FRAGGLEVIEWPORTMENU2ABOUT, wxID_FRAGGLEVIEWPORTMENU2CONT, |
[wxID_FRAGGLEVIEWPORTMENU2ABOUT, wxID_FRAGGLEVIEWPORTMENU2CONT, |
46 |
] = map(lambda _init_coll_menu2_Items: wxNewId(), range(2)) |
] = map(lambda _init_coll_menu2_Items: wxNewId(), range(2)) |
47 |
|
|
48 |
|
[wxID_FRAGGLEVIEWPORTMENU2ABOUT, wxID_FRAGGLEVIEWPORTMENU2CONT, |
49 |
|
] = 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 |
|
|
100 |
|
|
101 |
self.menu2 = wxMenu(title='') |
self.menu2 = wxMenu(title='') |
102 |
|
|
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) |
self._init_coll_menu1_Items(self.menu1) |
107 |
self._init_coll_menu2_Items(self.menu2) |
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(237, 287), |
name='fraggleViewport', parent=prnt, pos=wxPoint(338, 296), |
114 |
size=wxSize(485, 310), |
size=wxSize(435, 296), |
115 |
style=wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, |
style=wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, |
116 |
title='NetFraggle') |
title='NetFraggle 0.0.1') |
117 |
self._init_utils() |
self._init_utils() |
118 |
self.SetClientSize(wxSize(477, 283)) |
self.SetClientSize(wxSize(427, 269)) |
119 |
self.SetMenuBar(self.menuBar1) |
self.SetMenuBar(self.menuBar1) |
120 |
|
|
121 |
def __init_preferences__(self): |
def __init_preferences__(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): |
135 |
|
#self.xml_rpc = FraggleXMLRPC.create(self, self.preferencesCtl.configList) |
136 |
|
pass |
137 |
|
|
138 |
|
def __init_taskbar_icon__(self): |
139 |
|
if os.name == 'posix': |
140 |
|
pass |
141 |
|
elif os.name == 'nt': |
142 |
|
self.tbicon = wxTaskBarIcon() |
143 |
|
#icon = wxIcon('mixxx.ico', wxBITMAP_TYPE_ICO) |
144 |
|
icon = wxIcon(os.path.join(APPLOCATION, 'mixxx.ico'), wxBITMAP_TYPE_ICO) |
145 |
|
self.tbicon.SetIcon(icon, '') |
146 |
|
EVT_TASKBAR_LEFT_DCLICK(self.tbicon, self.OnTaskBarLeftDClick) |
147 |
|
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__() |
154 |
|
self.__init_taskbar_icon__() |
155 |
|
self.__init_xmlrpc__() |
156 |
|
|
|
|
|
157 |
def OnMenu1items0Menu(self, event): |
def OnMenu1items0Menu(self, event): |
158 |
try: |
try: |
159 |
self.dialogPrefs.ShowModal() |
self.dialogPrefs.ShowModal() |
160 |
finally: |
finally: |
161 |
pass |
self.dialogPrefs.Hide() |
162 |
event.Skip() |
event.Skip() |
163 |
|
|
164 |
def OnMenu1items1Menu(self, event): |
def OnMenu1items1Menu(self, event): |
179 |
dlg.ShowModal() |
dlg.ShowModal() |
180 |
dlg.Destroy() |
dlg.Destroy() |
181 |
|
|
182 |
|
def OnTaskBarLeftDClick(self, event): |
183 |
|
#event.Skip() |
184 |
|
#self.SetFocus() |
185 |
|
if self.IsIconized(): |
186 |
|
self.Restore() |
187 |
|
else: |
188 |
|
self.Iconize() |
189 |
|
|
190 |
|
def OnTaskBarRightClick(self, event): |
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 |
|
|