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