'Connect and display the given server'

def __display_server(self, server):

    logger.debug('Selected    server:    {}'.format(server))
    self.screen.display_popup('Connect    to    {}:{}'.format(server['name'], server['port']), duration=1)
    if (server['password'] is None):
        clear_password = self.password.get_password(server['name'])
        if ((clear_password is None) or (self.get_servers_list()[self.screen.active_server]['status'] == 'PROTECTED')):
            clear_password = self.screen.display_popup('Password    needed    for    {}:    '.format(server['name']), is_input=True)
        if (clear_password is not None):
            self.set_in_selected('password', self.password.sha256_hash(clear_password))
    logger.info('Connect    Glances    client    to    the    {}    server'.format(server['key']))
    args_server = self.args
    args_server.client = server['ip']
    args_server.port = server['port']
    args_server.username = server['username']
    args_server.password = server['password']
    client = GlancesClient(config=self.config, args=args_server, return_to_browser=True)
    if (not client.login()):
        self.screen.display_popup("Sorry,    cannot    connect    to    '{}'\nSee    '{}'    for    more    details".format(server['name'], LOG_FILENAME))
        self.set_in_selected('status', 'OFFLINE')
    else:
        connection_type = client.serve_forever()
        try:
            logger.debug('Disconnect    Glances    client    from    the    {}    server'.format(server['key']))
        except IndexError:
            pass
        else:
            if (connection_type == 'snmp'):
                self.set_in_selected('status', 'SNMP')
            else:
                self.set_in_selected('status', 'ONLINE')
    self.screen.active_server = None
