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