--- nfo/projects/netfraggle/bin/fraggleViewport.py 2004/08/25 23:46:05 1.8 +++ nfo/projects/netfraggle/bin/fraggleViewport.py 2004/08/27 00:05:22 1.12 @@ -1,11 +1,32 @@ #Boa:MDIParent:fraggleViewport +# $Id: fraggleViewport.py,v 1.12 2004/08/27 00:05:22 joko Exp $ +# $Log: fraggleViewport.py,v $ +# Revision 1.12 2004/08/27 00:05:22 joko +# fix for icon-path and wxTaskBarIcon-events +# +# Revision 1.11 2004/08/26 23:10:12 xabbu +# xmlrpc class added +# +# Revision 1.10 2004/08/26 18:19:27 joko +# now using FraggleTopicFrame +# +# 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 * +from wxPython.stc import * +from fraggleConstants import * import fraggleDialogPrefs import fraggleCtlPreferences -import fraggleDialogs +import FraggleAboutDialog +import FraggleTopicFrame +import FraggleXMLRPC def create(parent): return fraggleViewport(parent) @@ -15,13 +36,24 @@ [wxID_FRAGGLEVIEWPORTMENU1FPREFS, wxID_FRAGGLEVIEWPORTMENU1ITEMS1, ] = map(lambda _init_coll_menu1_Items: wxNewId(), range(2)) -[wxID_FRAGGLEVIEWPORTMENU2CONT, wxID_FRAGGLEVIEWPORTMENU2ABOUT, -] = map(lambda _init_coll_menu1_Items: wxNewId(), range(2)) +[wxID_FRAGGLEVIEWPORTMENU2ABOUT, wxID_FRAGGLEVIEWPORTMENU2CONT, +] = map(lambda _init_coll_menu2_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(helpString='Configure Netfraggle', id=wxID_FRAGGLEVIEWPORTMENU1FPREFS, item='Preferences', kind=wxITEM_NORMAL) @@ -29,27 +61,11 @@ id=wxID_FRAGGLEVIEWPORTMENU1ITEMS1, item='Exit', kind=wxITEM_NORMAL) - EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU1FPREFS, self.OnMenu1items0Menu) - EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU1ITEMS1, self.OnMenu1items1Menu) - - 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) - - EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU2CONT, self.OnMenu2items0Menu) - EVT_MENU(self, wxID_FRAGGLEVIEWPORTMENU2ABOUT, self.OnMenu2items1Menu) - def _init_coll_menuBar1_Menus(self, parent): # generated method, don't edit parent.Append(menu=self.menu1, title='&File') - parent.Append(menu=self.menu2, title='&help') + parent.Append(menu=self.menu2, title='&Help') def _init_utils(self): # generated method, don't edit @@ -57,21 +73,22 @@ self.menuBar1.SetAutoLayout(1) self.menu1 = wxMenu(title='') - self._init_coll_menu1_Items(self.menu1) + self.menu2 = wxMenu(title='') - self._init_coll_menu2_Items(self.menu2) 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(338, 296), + size=wxSize(435, 296), style=wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, - title='wxMDIParentFrame1') + title='NetFraggle 0.0.1') self._init_utils() - self.SetClientSize(wxSize(683, 284)) + self.SetClientSize(wxSize(427, 269)) self.SetMenuBar(self.menuBar1) def __init_preferences__(self): @@ -79,17 +96,41 @@ self.dialogPrefs = fraggleDialogPrefs.create(self) self.dialogPrefs.loadConfig() self.dialogPrefs.updateConfig() + + # new as of 2004-08-26: TopicFrame + self.topicFrame = FraggleTopicFrame.create(self) + self.topicFrame.Move(wxPoint(10, 10)) + + #frame.Show() + #frame.Destroy() + def __init_xmlrpc__(self): + self.xml_rpc = FraggleXMLRPC.create(self, self.preferencesCtl.configList) + def __init_taskbar_icon__(self): + if os.name == 'posix': + pass + elif os.name == 'nt': + self.tbicon = wxTaskBarIcon() + #icon = wxIcon('mixxx.ico', wxBITMAP_TYPE_ICO) + icon = wxIcon(os.path.join(APPLOCATION, 'mixxx.ico'), wxBITMAP_TYPE_ICO) + self.tbicon.SetIcon(icon, '') + EVT_TASKBAR_LEFT_DCLICK(self.tbicon, self.OnTaskBarLeftDClick) + EVT_TASKBAR_RIGHT_UP(self.tbicon, self.OnTaskBarRightClick) + + #EVT_BUTTON(self.updateButton, wxID_FRAGGLETOPICFRAMEUPDATEBUTTON, + # self.OnUpdateButtonButton) + def __init__(self, parent): self._init_ctrls(parent) self.__init_preferences__() + self.__init_taskbar_icon__() + self.__init_xmlrpc__() - def OnMenu1items0Menu(self, event): try: self.dialogPrefs.ShowModal() finally: - pass + self.dialogPrefs.Hide() event.Skip() def OnMenu1items1Menu(self, event): @@ -105,7 +146,22 @@ event.Skip() def OnMenu2items1Menu(self, event): - #self.Destroy() + """Show about screen""" + dlg = FraggleAboutDialog.create(self) + dlg.ShowModal() + dlg.Destroy() + + def OnTaskBarLeftDClick(self, event): #event.Skip() - fraggleDialogs.AboutDialog() + #self.SetFocus() + self.Restore() + + def OnTaskBarRightClick(self, event): + event.Skip() + def OnButtonsyncButton(self, event): + fragglexml = self.xml_rpc.FraggleSync() + print fragglexml + #text = fragglexml.data + self.styledTextCtrl1.AddText(fragglexml) + event.Skip()