Ejemplo n.º 1
0
def create_or_link_account():
    agent = None
    account = sublime.ok_cancel_dialog(
        'You need a Floobits account!\n\n'
        'Click "Open browser" if you have one or click "cancel" and we\'ll make it for you.',
        'Open browser')
    if account:
        token = binascii.b2a_hex(uuid.uuid4().bytes).decode('utf-8')
        agent = RequestCredentialsConnection(token)
    elif not utils.get_persistent_data().get('disable_account_creation'):
        agent = CreateAccountConnection()

    if not agent:
        sublime.error_message(
            'A configuration error occured earlier. Please go to floobits.com and sign up to use this plugin.\n\nWe\'re really sorry. This should never happen.'
        )
        return

    try:
        Listener.reset()
        G.AGENT = agent
        agent.connect()
    except Exception as e:
        print(e)
        tb = traceback.format_exc()
        print(tb)
Ejemplo n.º 2
0
        def run_agent(owner, workspace, host, port, secure):
            global on_room_info_waterfall
            if G.AGENT:
                msg.debug('Stopping agent.')
                G.AGENT.stop()
                G.AGENT = None

            on_room_info_waterfall.add(update_recent_workspaces,
                                       {'url': workspace_url})

            try:
                msg.debug("agent_conn_kwargs: %s" % str(agent_conn_kwargs))
                G.AGENT = AgentConnection(
                    owner=owner,
                    workspace=workspace,
                    host=host,
                    port=port,
                    secure=secure,
                    on_room_info=on_room_info_waterfall.call,
                    **agent_conn_kwargs)
                on_room_info_waterfall = utils.Waterfall()
                Listener.reset()
                G.AGENT.connect()
            except Exception as e:
                print(e)
                tb = traceback.format_exc()
                print(tb)
Ejemplo n.º 3
0
        def run_agent(owner, workspace, host, port, secure):
            global on_room_info_waterfall
            if G.AGENT:
                msg.debug('Stopping agent.')
                G.AGENT.stop()
                G.AGENT = None

            on_room_info_waterfall.add(update_recent_workspaces, {'url': workspace_url})

            try:
                G.AGENT = AgentConnection(owner=owner, workspace=workspace, host=host, port=port, secure=secure, on_room_info=on_room_info_waterfall.call)
                on_room_info_waterfall = utils.Waterfall()
                Listener.reset()
                G.AGENT.connect()
            except Exception as e:
                print(e)
                tb = traceback.format_exc()
                print(tb)
Ejemplo n.º 4
0
def create_or_link_account():
    agent = None
    account = sublime.ok_cancel_dialog('You need a Floobits account!\n\n'
                                       'Click "Open browser" if you have one or click "cancel" and we\'ll make it for you.',
                                       'Open browser')
    if account:
        token = binascii.b2a_hex(uuid.uuid4().bytes).decode('utf-8')
        agent = RequestCredentialsConnection(token)
    elif not utils.get_persistent_data().get('disable_account_creation'):
        agent = CreateAccountConnection()

    if not agent:
        sublime.error_message('A configuration error occured earlier. Please go to floobits.com and sign up to use this plugin.\n\nWe\'re really sorry. This should never happen.')
        return

    try:
        Listener.reset()
        G.AGENT = agent
        agent.connect()
    except Exception as e:
        print(e)
        tb = traceback.format_exc()
        print(tb)