def __init__(self, remotes, error_buffer, encoding=None, compress_level=None, fine_quality_level=None, subsample_level=None):
        """compress_level: 0-9 [9 is highest compression]
        fine_quality_level: 0-100 [100 is best quality]
        subsample_level: 0-3 [0 is best quality]

        Lots of references for this, but
        https://github.com/TurboVNC/turbovnc/blob/master/doc/performance.txt
        is decent.
        """

        load_pygame()
        import libvncdriver

        if encoding is None:
            encoding = os.environ.get('LIBVNC_ENCODING', 'tight')
        if compress_level is None:
            compress_level = int(os.environ.get('LIBVNC_COMPRESS_LEVEL', '0'))
        if fine_quality_level is None:
            fine_quality_level = int(os.environ.get('LIBVNC_FINE_QUALITY_LEVEL', '100'))
        if subsample_level is None:
            subsample_level = int(os.environ.get('LIBVNC_SUBSAMPLE_LEVEL', '0'))

        if not hasattr(libvncdriver, 'VNCSession'):
            raise error.Error('''
 *=================================================*
|| libvncdriver is not installed                   ||
|| Try installing with "pip install libvncdriver"  ||
|| or use the go or python driver by setting       ||
|| UNIVERSE_VNCDRIVER=go                                ||
|| UNIVERSE_VNCDRIVER=py                                ||
 *=================================================*''')
        logger.info("Using libvncdriver's %s encoding" % encoding)
        self.driver = libvncdriver.VNCSession(
            remotes=remotes,
            error_buffer=error_buffer,
            encoding=encoding,
            compress_level=compress_level,
            fine_quality_level=fine_quality_level,
            subsample_level=subsample_level,
        )
        self.screen = None
        self.render_called_once = False
        if PYGAME_INSTALLED:
            pygame.init()
def __init__ ( self , remotes , error_buffer , encoding = None , compress_level = None , fine_quality_level = None , subsample_level = None ) : load_pygame ( ) import libvncdriver if encoding is None : encoding = os . environ . get ( 'LIBVNC_ENCODING' , 'tight' ) if compress_level is None : compress_level = int ( os . environ . get ( 'LIBVNC_COMPRESS_LEVEL' , '0' ) ) if fine_quality_level is None : fine_quality_level = int ( os . environ . get ( 'LIBVNC_FINE_QUALITY_LEVEL' , '100' ) ) if subsample_level is None : subsample_level = int ( os . environ . get ( 'LIBVNC_SUBSAMPLE_LEVEL' , '0' ) ) if not hasattr ( libvncdriver , 'VNCSession' ) : raise error . Error ( '''
 *=================================================*
|| libvncdriver is not installed                   ||
|| Try installing with "pip install libvncdriver"  ||
|| or use the go or python driver by setting       ||
|| UNIVERSE_VNCDRIVER=go                                ||
|| UNIVERSE_VNCDRIVER=py                                ||
 *=================================================*''' ) logger . info ( "Using libvncdriver's %s encoding" % encoding ) self . driver = libvncdriver . VNCSession ( remotes = remotes , error_buffer = error_buffer , encoding = encoding , compress_level = compress_level , fine_quality_level = fine_quality_level , subsample_level = subsample_level , ) self . screen = None self . render_called_once = False if PYGAME_INSTALLED : pygame . init ( )
compress_level: 0-9 [9 is highest compression]
        fine_quality_level: 0-100 [100 is best quality]
        subsample_level: 0-3 [0 is best quality]

        Lots of references for this, but
        https://github.com/TurboVNC/turbovnc/blob/master/doc/performance.txt
        is decent.