/[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.16 - (show annotations)
Mon Aug 30 13:06:40 2004 UTC (19 years, 10 months ago) by joko
Branch: MAIN
Changes since 1.15: +10 -4 lines
File MIME type: text/x-python
U now gets preferences via self.engine

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

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