/[cvs]/nfo/projects/netfraggle/bin/fraggleViewport.py
ViewVC logotype

Contents of /nfo/projects/netfraggle/bin/fraggleViewport.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.18 - (show annotations)
Sat Sep 4 20:26:01 2004 UTC (19 years, 10 months ago) by xabbu
Branch: MAIN
Changes since 1.17: +30 -7 lines
File MIME type: text/x-python
+Added a button to the Preferences tab for showing the Modules Dialog.
 Todo: When the module dialog is shown, it is still being blocked by the    preferences dialog. I am not sure why but will have to look into it further.

+Added modules directory

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

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed