1 |
xabbu |
1.8 |
#Boa:MDIParent:fraggleViewport |
2 |
xabbu |
1.1 |
|
3 |
joko |
1.13 |
# $Id: fraggleViewport.py,v 1.12 2004/08/27 00:05:22 joko Exp $ |
4 |
joko |
1.10 |
# $Log: fraggleViewport.py,v $ |
5 |
joko |
1.13 |
# Revision 1.12 2004/08/27 00:05:22 joko |
6 |
|
|
# fix for icon-path and wxTaskBarIcon-events |
7 |
|
|
# |
8 |
joko |
1.12 |
# Revision 1.11 2004/08/26 23:10:12 xabbu |
9 |
|
|
# xmlrpc class added |
10 |
|
|
# |
11 |
xabbu |
1.11 |
# Revision 1.10 2004/08/26 18:19:27 joko |
12 |
|
|
# now using FraggleTopicFrame |
13 |
|
|
# |
14 |
joko |
1.10 |
# Revision 1.9 2004/08/26 15:21:13 joko |
15 |
|
|
# renamed namespaces |
16 |
|
|
# added key shortcuts to menu-items |
17 |
|
|
# correct "showAbout" code |
18 |
|
|
# |
19 |
joko |
1.9 |
|
20 |
joko |
1.5 |
import os |
21 |
xabbu |
1.1 |
from wxPython.wx import * |
22 |
xabbu |
1.11 |
from wxPython.stc import * |
23 |
xabbu |
1.1 |
|
24 |
joko |
1.12 |
from fraggleConstants import * |
25 |
xabbu |
1.1 |
import fraggleDialogPrefs |
26 |
xabbu |
1.2 |
import fraggleCtlPreferences |
27 |
joko |
1.9 |
import FraggleAboutDialog |
28 |
joko |
1.10 |
import FraggleTopicFrame |
29 |
xabbu |
1.11 |
import FraggleXMLRPC |
30 |
xabbu |
1.1 |
|
31 |
|
|
def create(parent): |
32 |
xabbu |
1.8 |
return fraggleViewport(parent) |
33 |
xabbu |
1.1 |
|
34 |
joko |
1.12 |
[wxID_FRAGGLEVIEWPORT] = map(lambda _init_ctrls: wxNewId(), range(1)) |
35 |
xabbu |
1.1 |
|
36 |
xabbu |
1.2 |
[wxID_FRAGGLEVIEWPORTMENU1FPREFS, wxID_FRAGGLEVIEWPORTMENU1ITEMS1, |
37 |
xabbu |
1.1 |
] = map(lambda _init_coll_menu1_Items: wxNewId(), range(2)) |
38 |
|
|
|
39 |
joko |
1.9 |
[wxID_FRAGGLEVIEWPORTMENU2ABOUT, wxID_FRAGGLEVIEWPORTMENU2CONT, |
40 |
|
|
] = map(lambda _init_coll_menu2_Items: wxNewId(), range(2)) |
41 |
joko |
1.7 |
|
42 |
xabbu |
1.11 |
[wxID_FRAGGLEVIEWPORTMENU2ABOUT, wxID_FRAGGLEVIEWPORTMENU2CONT, |
43 |
|
|
] = map(lambda _init_coll_menu2_Items: wxNewId(), range(2)) |
44 |
|
|
|
45 |
joko |
1.13 |
[wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSEXIT, |
46 |
|
|
wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSRESTORE, |
47 |
|
|
wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSSYNC, |
48 |
|
|
] = map(lambda _init_coll_FraggleTaskBarMenu_Items: wxNewId(), range(3)) |
49 |
|
|
|
50 |
xabbu |
1.2 |
class fraggleViewport(wxMDIParentFrame): |
51 |
joko |
1.13 |
def _init_coll_FraggleTaskBarMenu_Items(self, parent): |
52 |
|
|
# generated method, don't edit |
53 |
|
|
|
54 |
|
|
restore = parent.Append(helpString='Restore', |
55 |
|
|
id=wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSRESTORE, |
56 |
|
|
item='Restore', kind=wxITEM_NORMAL) |
57 |
|
|
parent.Append(helpString='Sync enabled', |
58 |
|
|
id=wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSSYNC, |
59 |
|
|
item='Sync enabled', kind=wxITEM_CHECK) |
60 |
|
|
parent.Append(helpString='Exit', |
61 |
|
|
id=wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSEXIT, item='Exit', |
62 |
|
|
kind=wxITEM_NORMAL) |
63 |
|
|
#EVT_MENU_OPEN(restore, |
64 |
|
|
# self.OnFraggleTaskBarMenuItemsrestoreMenu) |
65 |
|
|
#EVT_MENU_OPEN(restore, wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSRESTORE, |
66 |
|
|
# self.OnFraggleTaskBarMenuItemsrestoreMenu) |
67 |
|
|
#EVT_MENU(self, wxID_FRAGGLEVIEWPORTFRAGGLETASKBARMENUITEMSEXIT, |
68 |
|
|
# self.OnFraggleTaskBarMenuItemsexitMenu) |
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 |
joko |
1.9 |
|
101 |
joko |
1.7 |
self.menu2 = wxMenu(title='') |
102 |
|
|
|
103 |
joko |
1.13 |
self.FraggleTaskBarMenu = wxMenu(title=u'NetFraggle') |
104 |
|
|
|
105 |
xabbu |
1.1 |
self._init_coll_menuBar1_Menus(self.menuBar1) |
106 |
joko |
1.12 |
self._init_coll_menu1_Items(self.menu1) |
107 |
|
|
self._init_coll_menu2_Items(self.menu2) |
108 |
joko |
1.13 |
self._init_coll_FraggleTaskBarMenu_Items(self.FraggleTaskBarMenu) |
109 |
xabbu |
1.1 |
|
110 |
|
|
def _init_ctrls(self, prnt): |
111 |
|
|
# generated method, don't edit |
112 |
xabbu |
1.2 |
wxMDIParentFrame.__init__(self, id=wxID_FRAGGLEVIEWPORT, |
113 |
joko |
1.12 |
name='fraggleViewport', parent=prnt, pos=wxPoint(338, 296), |
114 |
|
|
size=wxSize(435, 296), |
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 |
joko |
1.12 |
self.SetClientSize(wxSize(427, 269)) |
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.10 |
self.topicFrame.Move(wxPoint(10, 10)) |
131 |
|
|
|
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 |
|
|
#EVT_BUTTON(self.updateButton, wxID_FRAGGLETOPICFRAMEUPDATEBUTTON, |
152 |
|
|
# self.OnUpdateButtonButton) |
153 |
|
|
|
154 |
xabbu |
1.1 |
def __init__(self, parent): |
155 |
|
|
self._init_ctrls(parent) |
156 |
xabbu |
1.2 |
self.__init_preferences__() |
157 |
xabbu |
1.11 |
self.__init_taskbar_icon__() |
158 |
|
|
self.__init_xmlrpc__() |
159 |
xabbu |
1.8 |
|
160 |
|
|
def OnMenu1items0Menu(self, event): |
161 |
xabbu |
1.1 |
try: |
162 |
|
|
self.dialogPrefs.ShowModal() |
163 |
|
|
finally: |
164 |
xabbu |
1.11 |
self.dialogPrefs.Hide() |
165 |
xabbu |
1.8 |
event.Skip() |
166 |
|
|
|
167 |
|
|
def OnMenu1items1Menu(self, event): |
168 |
joko |
1.7 |
self.Destroy() |
169 |
xabbu |
1.8 |
event.Skip() |
170 |
xabbu |
1.1 |
|
171 |
joko |
1.7 |
|
172 |
|
|
def OnMenu2items0Menu(self, event): |
173 |
xabbu |
1.8 |
try: |
174 |
|
|
self.dialogPrefs.ShowModal() |
175 |
|
|
finally: |
176 |
|
|
pass |
177 |
|
|
event.Skip() |
178 |
joko |
1.7 |
|
179 |
|
|
def OnMenu2items1Menu(self, event): |
180 |
joko |
1.9 |
"""Show about screen""" |
181 |
|
|
dlg = FraggleAboutDialog.create(self) |
182 |
|
|
dlg.ShowModal() |
183 |
|
|
dlg.Destroy() |
184 |
joko |
1.4 |
|
185 |
xabbu |
1.11 |
def OnTaskBarLeftDClick(self, event): |
186 |
joko |
1.12 |
#event.Skip() |
187 |
|
|
#self.SetFocus() |
188 |
joko |
1.13 |
if self.IsIconized(): |
189 |
|
|
self.Restore() |
190 |
|
|
else: |
191 |
|
|
self.Iconize() |
192 |
xabbu |
1.11 |
|
193 |
|
|
def OnTaskBarRightClick(self, event): |
194 |
joko |
1.13 |
#event.Skip() |
195 |
|
|
self.tbicon.PopupMenu(self.FraggleTaskBarMenu) |
196 |
|
|
|
197 |
|
|
def OnTaskBarAppRestore(self, event): |
198 |
|
|
self.Restore() |
199 |
|
|
#event.Skip() |
200 |
xabbu |
1.11 |
|
201 |
joko |
1.13 |
def OnTaskBarAppExit(self, event): |
202 |
|
|
#event.Skip() |
203 |
|
|
#self.Destroy() |
204 |
|
|
self.Close(True) |
205 |
|
|
|