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