--- nfo/projects/netfraggle/bin/fraggleViewport.py 2004/08/25 17:43:12 1.3 +++ nfo/projects/netfraggle/bin/fraggleViewport.py 2004/08/26 15:21:13 1.9 @@ -1,10 +1,19 @@ #Boa:MDIParent:fraggleViewport -import wx +# $Id: fraggleViewport.py,v 1.9 2004/08/26 15:21:13 joko Exp $ +# $Log: fraggleViewport.py,v $ +# Revision 1.9 2004/08/26 15:21:13 joko +# renamed namespaces +# added key shortcuts to menu-items +# correct "showAbout" code +# + +import os from wxPython.wx import * import fraggleDialogPrefs import fraggleCtlPreferences +import FraggleAboutDialog def create(parent): return fraggleViewport(parent) @@ -14,21 +23,33 @@ [wxID_FRAGGLEVIEWPORTMENU1FPREFS, wxID_FRAGGLEVIEWPORTMENU1ITEMS1, ] = map(lambda _init_coll_menu1_Items: wxNewId(), range(2)) +[wxID_FRAGGLEVIEWPORTMENU2ABOUT, wxID_FRAGGLEVIEWPORTMENU2CONT, +] = map(lambda _init_coll_menu2_Items: wxNewId(), range(2)) + class fraggleViewport(wxMDIParentFrame): + def _init_coll_menu2_Items(self, parent): + # generated method, don't edit + + parent.Append(helpString='Contents', id=wxID_FRAGGLEVIEWPORTMENU2CONT, + item='Contents', kind=wxITEM_NORMAL) + parent.Append(helpString='About', id=wxID_FRAGGLEVIEWPORTMENU2ABOUT, + item='About', kind=wxITEM_NORMAL) + def _init_coll_menu1_Items(self, parent): # generated method, don't edit - parent.Append(wxID_FRAGGLEVIEWPORTMENU1FPREFS, '&Preferences', "", - wx.ITEM_NORMAL) - parent.Append(wxID_FRAGGLEVIEWPORTMENU1ITEMS1, '&Exit Netfraggle', "", - wx.ITEM_NORMAL) - EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU1FPREFS, self.OnMenu1items0Menu) - EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU1ITEMS1, self.OnMenu1items1Menu) + parent.Append(helpString='Configure Netfraggle', + id=wxID_FRAGGLEVIEWPORTMENU1FPREFS, item='Preferences', + kind=wxITEM_NORMAL) + parent.Append(helpString='Exit Netfraggle', + id=wxID_FRAGGLEVIEWPORTMENU1ITEMS1, item='Exit', + kind=wxITEM_NORMAL) def _init_coll_menuBar1_Menus(self, parent): # generated method, don't edit - parent.Append(menu=self.menu1, title='File') + parent.Append(menu=self.menu1, title='&File') + parent.Append(menu=self.menu2, title='&Help') def _init_utils(self): # generated method, don't edit @@ -36,24 +57,29 @@ self.menuBar1.SetAutoLayout(1) self.menu1 = wxMenu(title='') - self._init_coll_menu1_Items(self.menu1) + + self.menu2 = wxMenu(title='') self._init_coll_menuBar1_Menus(self.menuBar1) + self._init_coll_menu1_Items(self.menu1) + self._init_coll_menu2_Items(self.menu2) def _init_ctrls(self, prnt): # generated method, don't edit wxMDIParentFrame.__init__(self, id=wxID_FRAGGLEVIEWPORT, - name='fraggleViewport', parent=prnt, pos=wxPoint(277, 313), - size=wxSize(683, 307), + name='fraggleViewport', parent=prnt, pos=wxPoint(237, 287), + size=wxSize(485, 310), style=wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, - title='wxMDIParentFrame1') + title='NetFraggle') self._init_utils() - self.SetClientSize(wxSize(683, 284)) + self.SetClientSize(wxSize(477, 283)) self.SetMenuBar(self.menuBar1) def __init_preferences__(self): self.preferencesCtl = fraggleCtlPreferences.create(self) self.dialogPrefs = fraggleDialogPrefs.create(self) + self.dialogPrefs.loadConfig() + self.dialogPrefs.updateConfig() def __init__(self, parent): self._init_ctrls(parent) @@ -64,9 +90,24 @@ try: self.dialogPrefs.ShowModal() finally: - self.dialogPrefs.Destroy() + pass event.Skip() def OnMenu1items1Menu(self, event): self.Destroy() event.Skip() + + + def OnMenu2items0Menu(self, event): + try: + self.dialogPrefs.ShowModal() + finally: + pass + event.Skip() + + def OnMenu2items1Menu(self, event): + """Show about screen""" + dlg = FraggleAboutDialog.create(self) + dlg.ShowModal() + dlg.Destroy() +