1 |
xabbu |
1.8 |
#Boa:MDIParent:fraggleViewport |
2 |
xabbu |
1.1 |
|
3 |
xabbu |
1.21 |
# $Id: fraggleViewport.py,v 1.20 2004/09/05 10:09:26 xabbu Exp $ |
4 |
joko |
1.10 |
# $Log: fraggleViewport.py,v $ |
5 |
xabbu |
1.21 |
# Revision 1.20 2004/09/05 10:09:26 xabbu |
6 |
|
|
# + Bug that menues where displayed incorrectly on nt like os resolved. |
7 |
|
|
# + Removed OS dependend menu creation in faggleMain -> moved to fraggleViewPort |
8 |
|
|
# + Modules configuration dialog can be displayed by selecting Files->Modules now |
9 |
|
|
# |
10 |
xabbu |
1.20 |
# Revision 1.19 2004/09/05 00:21:10 xabbu |
11 |
|
|
# +Fixed File Menu Modules item on Posix system. Gotta do testing on Windows with it. |
12 |
|
|
# |
13 |
xabbu |
1.19 |
# Revision 1.18 2004/09/04 20:26:01 xabbu |
14 |
|
|
# +Added a button to the Preferences tab for showing the Modules Dialog. |
15 |
|
|
# Todo: When the module dialog is shown, it is still being blocked by the preferences dialog. I am not sure why but will have to look into it further. |
16 |
|
|
# |
17 |
|
|
# +Added modules directory |
18 |
|
|
# |
19 |
xabbu |
1.18 |
# Revision 1.17 2004/09/01 21:43:30 xabbu |
20 |
|
|
# +Moved funtion getDefaultDir from FraggleCtlPreferences to FraggleEngine for more convenience |
21 |
|
|
# +FraggleCtlModules class creation for handling content modules |
22 |
|
|
# |
23 |
xabbu |
1.17 |
# Revision 1.16 2004/08/30 13:06:40 joko |
24 |
|
|
# U now gets preferences via self.engine |
25 |
|
|
# |
26 |
joko |
1.16 |
# Revision 1.15 2004/08/27 21:14:02 xabbu |
27 |
|
|
# TopicDetails can now be closed. |
28 |
|
|
# GUI change on Preferences Dialog in order to prepare multiple server profiles. |
29 |
|
|
# Small bugfixes to get the new topic windows working on posix platform. |
30 |
|
|
# |
31 |
xabbu |
1.15 |
# Revision 1.14 2004/08/27 04:39:06 joko |
32 |
|
|
# cleanup |
33 |
|
|
# |
34 |
joko |
1.14 |
# Revision 1.13 2004/08/27 03:25:44 joko |
35 |
|
|
# added FraggleTaskBarMenu |
36 |
|
|
# |
37 |
joko |
1.13 |
# Revision 1.12 2004/08/27 00:05:22 joko |
38 |
|
|
# fix for icon-path and wxTaskBarIcon-events |
39 |
|
|
# |
40 |
joko |
1.12 |
# Revision 1.11 2004/08/26 23:10:12 xabbu |
41 |
|
|
# xmlrpc class added |
42 |
|
|
# |
43 |
xabbu |
1.11 |
# Revision 1.10 2004/08/26 18:19:27 joko |
44 |
|
|
# now using FraggleTopicFrame |
45 |
|
|
# |
46 |
joko |
1.10 |
# Revision 1.9 2004/08/26 15:21:13 joko |
47 |
|
|
# renamed namespaces |
48 |
|
|
# added key shortcuts to menu-items |
49 |
|
|
# correct "showAbout" code |
50 |
|
|
# |
51 |
joko |
1.9 |
|
52 |
joko |
1.5 |
import os |
53 |
xabbu |
1.1 |
from wxPython.wx import * |
54 |
xabbu |
1.11 |
from wxPython.stc import * |
55 |
xabbu |
1.1 |
|
56 |
joko |
1.12 |
from fraggleConstants import * |
57 |
xabbu |
1.1 |
import fraggleDialogPrefs |
58 |
xabbu |
1.18 |
import FraggleDialogModules |
59 |
joko |
1.9 |
import FraggleAboutDialog |
60 |
joko |
1.10 |
import FraggleTopicFrame |
61 |
xabbu |
1.11 |
import FraggleXMLRPC |
62 |
xabbu |
1.1 |
|
63 |
|
|
def create(parent): |
64 |
xabbu |
1.8 |
return fraggleViewport(parent) |
65 |
xabbu |
1.1 |
|
66 |
joko |
1.12 |
[wxID_FRAGGLEVIEWPORT] = map(lambda _init_ctrls: wxNewId(), range(1)) |
67 |
xabbu |
1.1 |
|
68 |
xabbu |
1.18 |
[wxID_FRAGGLEVIEWPORTMENU1FMODULES, wxID_FRAGGLEVIEWPORTMENU1FPREFS, |
69 |
|
|
wxID_FRAGGLEVIEWPORTMENU1ITEMS1, |
70 |
|
|
] = map(lambda _init_coll_menu1_Items: wxNewId(), range(3)) |
71 |
xabbu |
1.1 |
|
72 |
joko |
1.9 |
[wxID_FRAGGLEVIEWPORTMENU2ABOUT, wxID_FRAGGLEVIEWPORTMENU2CONT, |
73 |
|
|
] = map(lambda _init_coll_menu2_Items: wxNewId(), range(2)) |
74 |
joko |
1.7 |
|
75 |
xabbu |
1.11 |
[wxID_FRAGGLEVIEWPORTMENU2ABOUT, wxID_FRAGGLEVIEWPORTMENU2CONT, |
76 |
|
|
] = map(lambda _init_coll_menu2_Items: wxNewId(), range(2)) |
77 |
|
|
|
78 |
joko |
1.13 |
[wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSEXIT, |
79 |
|
|
wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSRESTORE, |
80 |
|
|
wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSSYNC, |
81 |
|
|
] = map(lambda _init_coll_FraggleTaskBarMenu_Items: wxNewId(), range(3)) |
82 |
|
|
|
83 |
xabbu |
1.2 |
class fraggleViewport(wxMDIParentFrame): |
84 |
joko |
1.13 |
def _init_coll_FraggleTaskBarMenu_Items(self, parent): |
85 |
|
|
# generated method, don't edit |
86 |
|
|
|
87 |
joko |
1.14 |
parent.Append(helpString='Restore', |
88 |
joko |
1.13 |
id=wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSRESTORE, |
89 |
|
|
item='Restore', kind=wxITEM_NORMAL) |
90 |
|
|
parent.Append(helpString='Sync enabled', |
91 |
|
|
id=wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSSYNC, |
92 |
|
|
item='Sync enabled', kind=wxITEM_CHECK) |
93 |
|
|
parent.Append(helpString='Exit', |
94 |
|
|
id=wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSEXIT, item='Exit', |
95 |
|
|
kind=wxITEM_NORMAL) |
96 |
|
|
|
97 |
joko |
1.9 |
def _init_coll_menu2_Items(self, parent): |
98 |
|
|
# generated method, don't edit |
99 |
|
|
|
100 |
|
|
parent.Append(helpString='Contents', id=wxID_FRAGGLEVIEWPORTMENU2CONT, |
101 |
|
|
item='Contents', kind=wxITEM_NORMAL) |
102 |
|
|
parent.Append(helpString='About', id=wxID_FRAGGLEVIEWPORTMENU2ABOUT, |
103 |
|
|
item='About', kind=wxITEM_NORMAL) |
104 |
|
|
|
105 |
xabbu |
1.1 |
def _init_coll_menu1_Items(self, parent): |
106 |
|
|
# generated method, don't edit |
107 |
joko |
1.9 |
|
108 |
xabbu |
1.18 |
parent.Append(helpString='Configure Modules', |
109 |
|
|
id=wxID_FRAGGLEVIEWPORTMENU1FMODULES, item='Modules', |
110 |
|
|
kind=wxITEM_NORMAL) |
111 |
xabbu |
1.6 |
parent.Append(helpString='Configure Netfraggle', |
112 |
|
|
id=wxID_FRAGGLEVIEWPORTMENU1FPREFS, item='Preferences', |
113 |
|
|
kind=wxITEM_NORMAL) |
114 |
|
|
parent.Append(helpString='Exit Netfraggle', |
115 |
|
|
id=wxID_FRAGGLEVIEWPORTMENU1ITEMS1, item='Exit', |
116 |
|
|
kind=wxITEM_NORMAL) |
117 |
xabbu |
1.18 |
EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU1FMODULES, |
118 |
|
|
self.OnMenu1FmodulesMenu) |
119 |
|
|
EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU1FPREFS, self.OnMenu1FprefsMenu) |
120 |
|
|
EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU1ITEMS1, self.OnMenu1Items1Menu) |
121 |
xabbu |
1.1 |
|
122 |
|
|
def _init_coll_menuBar1_Menus(self, parent): |
123 |
|
|
# generated method, don't edit |
124 |
|
|
|
125 |
xabbu |
1.8 |
parent.Append(menu=self.menu1, title='&File') |
126 |
joko |
1.9 |
parent.Append(menu=self.menu2, title='&Help') |
127 |
xabbu |
1.1 |
|
128 |
|
|
def _init_utils(self): |
129 |
|
|
# generated method, don't edit |
130 |
|
|
self.menuBar1 = wxMenuBar() |
131 |
xabbu |
1.20 |
self.menuBar1.SetAutoLayout(0) |
132 |
xabbu |
1.1 |
|
133 |
|
|
self.menu1 = wxMenu(title='') |
134 |
joko |
1.9 |
|
135 |
joko |
1.7 |
self.menu2 = wxMenu(title='') |
136 |
|
|
|
137 |
joko |
1.13 |
self.FraggleTaskBarMenu = wxMenu(title=u'NetFraggle') |
138 |
|
|
|
139 |
xabbu |
1.1 |
self._init_coll_menuBar1_Menus(self.menuBar1) |
140 |
xabbu |
1.20 |
self._init_coll_menu1_Items(self.menu1) |
141 |
|
|
self._init_coll_menu2_Items(self.menu2) |
142 |
|
|
self._init_coll_FraggleTaskBarMenu_Items(self.FraggleTaskBarMenu) |
143 |
xabbu |
1.1 |
|
144 |
|
|
def _init_ctrls(self, prnt): |
145 |
|
|
# generated method, don't edit |
146 |
xabbu |
1.2 |
wxMDIParentFrame.__init__(self, id=wxID_FRAGGLEVIEWPORT, |
147 |
xabbu |
1.15 |
name='fraggleViewport', parent=prnt, pos=wxPoint(335, 382), |
148 |
xabbu |
1.20 |
size=wxSize(435, 250), |
149 |
xabbu |
1.1 |
style=wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, |
150 |
xabbu |
1.11 |
title='NetFraggle 0.0.1') |
151 |
xabbu |
1.1 |
self._init_utils() |
152 |
xabbu |
1.19 |
self.SetClientSize(wxSize(427, 223)) |
153 |
xabbu |
1.1 |
self.SetMenuBar(self.menuBar1) |
154 |
|
|
|
155 |
xabbu |
1.17 |
def __init_modules__(self): |
156 |
|
|
self.modulesCtl = self.engine.modules |
157 |
xabbu |
1.21 |
self.modulesCtl.SetViewport(self) |
158 |
xabbu |
1.17 |
self.dialogModules = FraggleDialogModules.create(self) |
159 |
|
|
|
160 |
xabbu |
1.2 |
def __init_preferences__(self): |
161 |
joko |
1.16 |
self.preferencesCtl = self.engine.preferences |
162 |
xabbu |
1.2 |
self.dialogPrefs = fraggleDialogPrefs.create(self) |
163 |
xabbu |
1.6 |
self.dialogPrefs.loadConfig() |
164 |
|
|
self.dialogPrefs.updateConfig() |
165 |
joko |
1.10 |
|
166 |
|
|
# new as of 2004-08-26: TopicFrame |
167 |
joko |
1.13 |
# new as of 2004-08-27: pass configList to TopicFrame |
168 |
joko |
1.16 |
self.topicFrame = FraggleTopicFrame.create(self) |
169 |
joko |
1.14 |
self.topicFrame.Move(wxPoint(5, 5)) |
170 |
joko |
1.10 |
|
171 |
|
|
#frame.Show() |
172 |
|
|
#frame.Destroy() |
173 |
xabbu |
1.11 |
def __init_xmlrpc__(self): |
174 |
joko |
1.13 |
#self.xml_rpc = FraggleXMLRPC.create(self, self.preferencesCtl.configList) |
175 |
|
|
pass |
176 |
xabbu |
1.2 |
|
177 |
xabbu |
1.11 |
def __init_taskbar_icon__(self): |
178 |
|
|
if os.name == 'posix': |
179 |
|
|
pass |
180 |
|
|
elif os.name == 'nt': |
181 |
|
|
self.tbicon = wxTaskBarIcon() |
182 |
joko |
1.12 |
#icon = wxIcon('mixxx.ico', wxBITMAP_TYPE_ICO) |
183 |
|
|
icon = wxIcon(os.path.join(APPLOCATION, 'mixxx.ico'), wxBITMAP_TYPE_ICO) |
184 |
xabbu |
1.11 |
self.tbicon.SetIcon(icon, '') |
185 |
joko |
1.12 |
EVT_TASKBAR_LEFT_DCLICK(self.tbicon, self.OnTaskBarLeftDClick) |
186 |
|
|
EVT_TASKBAR_RIGHT_UP(self.tbicon, self.OnTaskBarRightClick) |
187 |
joko |
1.13 |
EVT_MENU(self.tbicon, wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSRESTORE, self.OnTaskBarAppRestore) |
188 |
|
|
EVT_MENU(self.tbicon, wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSEXIT, self.OnTaskBarAppExit) |
189 |
joko |
1.12 |
|
190 |
xabbu |
1.1 |
def __init__(self, parent): |
191 |
joko |
1.16 |
import __main__ |
192 |
|
|
self.engine = __main__.engine |
193 |
xabbu |
1.1 |
self._init_ctrls(parent) |
194 |
xabbu |
1.18 |
self.__init_modules__() |
195 |
xabbu |
1.2 |
self.__init_preferences__() |
196 |
xabbu |
1.11 |
self.__init_taskbar_icon__() |
197 |
|
|
self.__init_xmlrpc__() |
198 |
xabbu |
1.8 |
|
199 |
|
|
def OnMenu1items0Menu(self, event): |
200 |
xabbu |
1.1 |
try: |
201 |
|
|
self.dialogPrefs.ShowModal() |
202 |
|
|
finally: |
203 |
xabbu |
1.11 |
self.dialogPrefs.Hide() |
204 |
xabbu |
1.8 |
event.Skip() |
205 |
|
|
|
206 |
|
|
def OnMenu1items1Menu(self, event): |
207 |
joko |
1.7 |
self.Destroy() |
208 |
xabbu |
1.8 |
event.Skip() |
209 |
xabbu |
1.1 |
|
210 |
joko |
1.7 |
|
211 |
xabbu |
1.20 |
#def OnMenu2items0Menu(self, event): |
212 |
|
|
# try: |
213 |
|
|
# self.dialogPrefs.ShowModal() |
214 |
|
|
# finally: |
215 |
|
|
# pass |
216 |
|
|
# event.Skip() |
217 |
joko |
1.7 |
|
218 |
|
|
def OnMenu2items1Menu(self, event): |
219 |
joko |
1.9 |
"""Show about screen""" |
220 |
|
|
dlg = FraggleAboutDialog.create(self) |
221 |
|
|
dlg.ShowModal() |
222 |
|
|
dlg.Destroy() |
223 |
joko |
1.4 |
|
224 |
xabbu |
1.11 |
def OnTaskBarLeftDClick(self, event): |
225 |
joko |
1.12 |
#event.Skip() |
226 |
|
|
#self.SetFocus() |
227 |
joko |
1.13 |
if self.IsIconized(): |
228 |
|
|
self.Restore() |
229 |
|
|
else: |
230 |
|
|
self.Iconize() |
231 |
xabbu |
1.11 |
|
232 |
|
|
def OnTaskBarRightClick(self, event): |
233 |
joko |
1.13 |
#event.Skip() |
234 |
|
|
self.tbicon.PopupMenu(self.FraggleTaskBarMenu) |
235 |
|
|
|
236 |
|
|
def OnTaskBarAppRestore(self, event): |
237 |
|
|
self.Restore() |
238 |
|
|
#event.Skip() |
239 |
xabbu |
1.11 |
|
240 |
joko |
1.13 |
def OnTaskBarAppExit(self, event): |
241 |
|
|
#event.Skip() |
242 |
|
|
#self.Destroy() |
243 |
|
|
self.Close(True) |
244 |
xabbu |
1.18 |
|
245 |
|
|
def OnMenu1FmodulesMenu(self, event): |
246 |
xabbu |
1.19 |
self.dialogModules.Show() |
247 |
xabbu |
1.18 |
event.Skip() |
248 |
|
|
|
249 |
|
|
def OnMenu1FprefsMenu(self, event): |
250 |
xabbu |
1.20 |
try: |
251 |
|
|
self.dialogPrefs.ShowModal() |
252 |
|
|
finally: |
253 |
|
|
pass |
254 |
xabbu |
1.18 |
event.Skip() |
255 |
|
|
|
256 |
|
|
def OnMenu1Items1Menu(self, event): |
257 |
xabbu |
1.20 |
self.Destroy() |
258 |
xabbu |
1.18 |
event.Skip() |
259 |
joko |
1.13 |
|