--- nfo/projects/netfraggle/bin/fraggleViewport.py 2004/08/25 13:53:48 1.1 +++ nfo/projects/netfraggle/bin/fraggleViewport.py 2004/08/26 15:21:13 1.9 @@ -1,36 +1,55 @@ -#Boa:MDIParent:wxMDIParentFrame1 +#Boa:MDIParent:fraggleViewport +# $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 wxMDIParentFrame1(parent) + return fraggleViewport(parent) -[wxID_WXMDIPARENTFRAME1] = map(lambda _init_ctrls: wxNewId(), range(1)) +[wxID_FRAGGLEVIEWPORT] = map(lambda _init_ctrls: wxNewId(), range(1)) -[wxID_WXMDIPARENTFRAME1MENU1FPREFS, wxID_WXMDIPARENTFRAME1MENU1ITEMS1, +[wxID_FRAGGLEVIEWPORTMENU1FPREFS, wxID_FRAGGLEVIEWPORTMENU1ITEMS1, ] = map(lambda _init_coll_menu1_Items: wxNewId(), range(2)) -class wxMDIParentFrame1(wxMDIParentFrame): +[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(helpString='Configure Netfraggle', - id=wxID_WXMDIPARENTFRAME1MENU1FPREFS, item='Preferences', + id=wxID_FRAGGLEVIEWPORTMENU1FPREFS, item='Preferences', kind=wxITEM_NORMAL) parent.Append(helpString='Exit Netfraggle', - id=wxID_WXMDIPARENTFRAME1MENU1ITEMS1, item='Exit', + id=wxID_FRAGGLEVIEWPORTMENU1ITEMS1, item='Exit', kind=wxITEM_NORMAL) - EVT_MENU(self, wxID_WXMDIPARENTFRAME1MENU1FPREFS, - self.OnMenu1items0Menu) - EVT_MENU(self, wxID_WXMDIPARENTFRAME1MENU1ITEMS1, - self.OnMenu1items1Menu) 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 @@ -38,32 +57,57 @@ 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_WXMDIPARENTFRAME1, name='', - parent=prnt, pos=wxPoint(277, 313), size=wxSize(683, 330), + wxMDIParentFrame.__init__(self, id=wxID_FRAGGLEVIEWPORT, + 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, 307)) + 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) - + self.__init_preferences__() + def OnMenu1items0Menu(self, event): - self.dialogPrefs = fraggleDialogPrefs.wxDialog1(self) 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() +