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