Пример #1
0
    def PrevSession(self):
        """Moves to the previous session in the list of active sessions."""

        sessions.SetSession(sessions.GetSessionIndex() - 1)
        output.AnnounceSession()
        if hasattr(sessions.current_session, 'announce_session_mute'):
            sessions.current_session.announce_session_mute(True)
Пример #2
0
 def NewSession(self):
     """Allows you to create a new session."""
     dlg = modal_dialog(core.gui.SessionManager.NewSessionDialog,
                        parent=application.main_frame)
     kind = dlg.sessions.GetStringSelection()
     name = dlg.name.GetValue()
     if not name:
         output.speak(_("Please enter a name for this session."))
         return self.NewSession()
     try:
         new = sessions.SpawnSession(kind=kind, name=name)
     except:
         output.speak(_("Unable to spawn new %s session.") % kind, True)
         application.main_frame.Show(False)
         return
     sessions.SetSession(new)
     output.AnnounceSession()
     application.main_frame.Show(False)
Пример #3
0
def RemoveSession(session, end=False, delete=False):
    """Remove session from global sessions list.  Accepts a session object."""
    global sessions
    logging.info("Removing session %s from global list." % session.name)
    index = GetSessionIndex(session)
    index = index - 1
    if not end:
        SetSession(index)
    try:
        sessions.remove(session)
        config.main['sessions']['sessions'].remove(session_descriptor(session))
        config.main.write()
    except:
        pass
    try:
        call_threaded(session.shutdown, end=end, delete=delete)
    except:
        logging.exception("Error deactivating session...")
    dispatcher.send(sender=session, signal=signals.session_destroyed)
    output.AnnounceSession()
Пример #4
0
 def RenameSession(self):
     """Renames the active session."""
     dlg = wx.TextEntryDialog(
         parent=None,
         caption=_("Rename %s session") % sessions.current_session.name,
         message=_("Please enter a new name for session %s:") %
         sessions.current_session.name)
     dlg.Raise()
     if dlg.ShowModal() != wx.ID_OK:
         return output.speak(_("Canceled."), True)
     name = dlg.GetValue()
     output.speak(
         _("Renaming session %s to %s, please wait.") %
         (sessions.current_session.name, name), True)
     try:
         sessions.rename_session(sessions.current_session, name)
     except sessions.RenameError as e:
         return output.speak(
             _("There was an error renaming %s to %s: %s") %
             (sessions.current_session, name, e.args[0]))
     output.speak(_("Renaming session complete."))
     output.AnnounceSession(interrupt=False)
Пример #5
0
def setup():
    global current_session
    logging.debug("Initializing sessions subsystem.")
    RegisterDefaultSessions()
    #Give the session a chance to say anything.
    output.AnnounceSession(interrupt=False)
Пример #6
0
 def CurrentSession(self):
     """Announces the currently active session."""
     output.AnnounceSession()