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