/[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.15 - (show annotations)
Fri Aug 27 21:14:02 2004 UTC (19 years, 10 months ago) by xabbu
Branch: MAIN
Changes since 1.14: +10 -7 lines
File MIME type: text/x-python
TopicDetails can now be closed.
GUI change on Preferences Dialog in order to prepare multiple server profiles.
Small bugfixes to get the new topic windows working on posix platform.

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

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