diff --git a/src/controller/mainController.py b/src/controller/mainController.py index 9eb24533..c1ac215f 100644 --- a/src/controller/mainController.py +++ b/src/controller/mainController.py @@ -2,7 +2,8 @@ import application from wxUI import (view, dialogs, commonMessageDialogs) from twitter import utils -from sessionmanager import manager +from sessionmanager import manager, sessionManager + from update import updater import buffersController import messages @@ -146,7 +147,8 @@ class Controller(object): widgetUtils.connect_event(self.view, widgetUtils.MENU, self.check_for_updates, self.view.check_for_updates) widgetUtils.connect_event(self.view, widgetUtils.MENU, self.about, menuitem=self.view.about) widgetUtils.connect_event(self.view, widgetUtils.MENU, self.visit_website, menuitem=self.view.visit_website) - + widgetUtils.connect_event(self.view, widgetUtils.MENU, self.edit_keystrokes, menuitem=self.view.keystroke_editor) + widgetUtils.connect_event(self.view, widgetUtils.MENU, self.manage_accounts, self.view.manage_accounts) widgetUtils.connect_event(self.view.nb, widgetUtils.NOTEBOOK_PAGE_CHANGED, self.buffer_changed) def __init__(self): @@ -1052,5 +1054,16 @@ class Controller(object): def visit_website(self, *args, **kwargs): webbrowser.open(application.url) + def manage_accounts(self, *args, **kwargs): + sm = sessionManager.sessionManagerController() + sm.fill_list() + sm.show() + for i in sm.new_sessions: + call_threaded(self.add_account, i) + + def add_account(self, i): + self.create_buffers(session_.sessions[i]) + self.start_buffers(session_.sessions[i]) + def __del__(self): config.app.write() \ No newline at end of file diff --git a/src/sessionmanager/manager.py b/src/sessionmanager/manager.py index af6c60b9..0fd9b5d8 100644 --- a/src/sessionmanager/manager.py +++ b/src/sessionmanager/manager.py @@ -10,7 +10,8 @@ import session_exceptions manager = None def setup(): global manager - manager = sessionManager() + if not manager: + manager = sessionManager() class sessionManager(object): # def __init__(self): diff --git a/src/sessionmanager/sessionManager.py b/src/sessionmanager/sessionManager.py index 1fef1eae..784ae58c 100644 --- a/src/sessionmanager/sessionManager.py +++ b/src/sessionmanager/sessionManager.py @@ -17,6 +17,8 @@ class sessionManagerController(object): super(sessionManagerController, self).__init__() log.debug("Setting up the session manager.") manager.setup() + self.view = view.sessionManagerWindow(self) + self.new_sessions = {} def fill_list(self): sessionsList = [] @@ -36,18 +38,19 @@ class sessionManagerController(object): if hasattr(self, "view"): self.view.fill_list(sessionsList) def show(self): - self.view = view.sessionManagerWindow(self) if self.view.ShowModal() == wx.ID_CANCEL: self.view.Destroy() def do_ok(self): log.debug("Starting sessions...") for i in self.sessions: + if session.sessions.has_key(i) == True: continue s = session.Session(i) s.get_configuration() if i not in config.app["sessions"]["ignored_sessions"]: s.login() session.sessions[i] = s + self.new_sessions[i] = s def manage_new_account(self): location = (str(time.time())[-6:]) diff --git a/src/wxUI/view.py b/src/wxUI/view.py index 0bf89fd7..e5e3163d 100644 --- a/src/wxUI/view.py +++ b/src/wxUI/view.py @@ -12,6 +12,7 @@ class mainFrame(wx.Frame): # Application menu app = wx.Menu() + self.manage_accounts = app.Append(wx.NewId(), _(u"Manage accounts")) self.updateProfile = app.Append(wx.NewId(), _(u"&Update profile")) self.updateProfile.Enable(False) self.show_hide = app.Append(wx.NewId(), _(u"&Hide window"))