Edit keystrokes works from the menu bar, you can add more sessions from application menu

This commit is contained in:
Manuel Cortez 2015-03-04 17:52:27 -06:00
parent 4d1e03fb64
commit 3f1b00af8f
4 changed files with 22 additions and 4 deletions

View File

@ -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()

View File

@ -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):

View File

@ -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:])

View File

@ -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"))