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