示例#1
0
 def on_delete_event(self, *args):
     import bauble.task as task
     if task.running():
         msg = _('Would you like the cancel the current tasks?')
         if not utils.yes_no_dialog(msg):
             # stop other handlers for being invoked for this event
             return True
         task.kill()
     return False
示例#2
0
 def on_delete_event(self, *args):
     import bauble.task as task
     if task.running():
         msg = _('Would you like the cancel the current tasks?')
         if not utils.yes_no_dialog(msg):
             # stop other handlers for being invoked for this event
             return True
         task.kill()
     return False
示例#3
0
        gui.save_state()
    prefs.save()


def quit():
    """
    Stop all tasks and quit Bauble.
    """
    import gtk
    import bauble.utils as utils
    try:
        import bauble.task as task
    except Exception, e:
        logger.error('bauble.quit(): %s' % utils.utf8(e))
    else:
        task.kill()
    try:
        save_state()
        gtk.main_quit()
    except RuntimeError, e:
        # in case main_quit is called before main, e.g. before
        # bauble.main() is called
        sys.exit(1)


last_handler = None


def command_handler(cmd, arg):
    """
    Call a command handler.
    prefs.save()


def quit():
    """
    Stop all tasks and quit Bauble.
    """
    import gtk
    import bauble.utils as utils
    from bauble.utils.log import error
    try:
        import bauble.task as task
    except Exception, e:
        error('bauble.quit(): %s' % utils.utf8(e))
    else:
        task.kill()
    try:
        save_state()
        gtk.main_quit()
    except RuntimeError, e:
        # in case main_quit is called before main, e.g. before
        # bauble.main() is called
        sys.exit(1)


last_handler = None

def command_handler(cmd, arg):
    """
    Call a command handler.