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
This commit is contained in:
parent
9fd444d937
commit
595a594b64
1 changed files with 224 additions and 23 deletions
|
|
@ -26,6 +26,7 @@ from param import Param
|
|||
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 @@ class MainWindow(wx.Frame, QuickApp):
|
|||
"""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 @@ class MainWindow(wx.Frame, QuickApp):
|
|||
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 @@ class MainWindow(wx.Frame, QuickApp):
|
|||
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 @@ class MainWindow(wx.Frame, QuickApp):
|
|||
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]
|
||||
|
|
|
|||
Loading…
Reference in a new issue