Mercurial > libervia-backend
diff frontends/wix/main_window.py @ 68:9b842086d915
multiple profiles update
- Wix: new profile managed, it appear at launch in place of the contact list, and disappear once the profile is choosen
- SàT: default profile is now saved, first one is choosed is no default profile
- Bridge: new delete profile method
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 25 Feb 2010 17:09:18 +1100 |
parents | 0e50dd3a234a |
children | 8f2ed279784b |
line wrap: on
line diff
--- a/frontends/wix/main_window.py Thu Feb 04 01:06:36 2010 +1100 +++ b/frontends/wix/main_window.py Thu Feb 25 17:09:18 2010 +1100 @@ -26,6 +26,7 @@ from form import Form from gateways import GatewaysManager from profile import Profile +from profile_manager import ProfileManager import gobject import os.path import pdb @@ -219,17 +220,24 @@ """main app window""" def __init__(self): - wx.Frame.__init__(self,None, title="SAT Wix", size=(300,500)) + wx.Frame.__init__(self,None, title="SàT Wix", size=(300,500)) self.CM = QuickContactManagement() #FIXME: not the best place - - + #sizer + self.sizer = wx.BoxSizer(wx.VERTICAL) + self.SetSizer(self.sizer) + #Frame elements self.contactList = ContactList(self, self.CM) self.contactList.registerActivatedCB(self.onContactActivated) + self.contactList.Hide() + self.sizer.Add(self.contactList, 1, flag=wx.EXPAND) + self.chat_wins=ChatList(self) self.CreateStatusBar() self.createMenus() + for i in range(self.menuBar.GetMenuCount()): + self.menuBar.EnableTop(i, False) #ToolBar self.tools=self.CreateToolBar() @@ -254,10 +262,26 @@ self.Bind(wx.EVT_CLOSE, self.onClose, self) QuickApp.__init__(self) - self.plug_profile() + #self.plug_profile() #gof: + + #profile panel + self.profile_pan = ProfileManager(self) + #self.profile_pan.Hide() #gof: + self.sizer.Add(self.profile_pan, 1, flag=wx.EXPAND) self.Show() + def plug_profile(self, profile_key='@DEFAULT@'): + """Hide profile panel then plug profile""" + self.profile_pan.Hide() + self.contactList.Show() + self.sizer.Layout() + for i in range(self.menuBar.GetMenuCount()): + self.menuBar.EnableTop(i, True) + super(MainWindow, self).plug_profile(profile_key) + if not self.bridge.isConnected(profile_key): + self.bridge.connect(profile_key) + def createMenus(self): info("Creating menus") connectMenu = wx.Menu() @@ -273,11 +297,11 @@ contactMenu.Append(idSHOW_PROFILE, "&Show profile", " Show contact's profile") communicationMenu = wx.Menu() communicationMenu.Append(idFIND_GATEWAYS, "&Find Gateways"," Find gateways to legacy IM") - menuBar = wx.MenuBar() - menuBar.Append(connectMenu,"&General") - menuBar.Append(contactMenu,"&Contacts") - menuBar.Append(communicationMenu,"&Communication") - self.SetMenuBar(menuBar) + self.menuBar = wx.MenuBar() + self.menuBar.Append(connectMenu,"&General") + self.menuBar.Append(contactMenu,"&Contacts") + self.menuBar.Append(communicationMenu,"&Communication") + self.SetMenuBar(self.menuBar) #events wx.EVT_MENU(self, idCONNECT, self.onConnectRequest) @@ -448,10 +472,10 @@ self.chat_wins[jid.short].Show() def onConnectRequest(self, e): - self.bridge.connect() + self.bridge.connect(self.profile) def onDisconnectRequest(self, e): - self.bridge.disconnect() + self.bridge.disconnect(self.profile) def __updateStatus(self): show = filter(lambda x:x[1] == self.statusBox.GetValue(), const_STATUS)[0][0]