Ejemplo n.º 1
0
def get_user_style(style):
    if style not in USER_PREFERENCES_MASK:
        raise ValueError, ("Argument style should be one of " +
                           common.list_to_english_or(
                               ('"{0}"'.format(i)
                                for i in USER_PREFERENCES_MASK.keys())))

    mask = registry.get('HKEY_CURRENT_USER\\Control Panel\\Desktop',
                        'UserPreferenceMask')
    if mask:
        mask = common.bitfield(mask)
        return bool(mask[USER_PREFERENCES_MASK[style]['bit']])
    else:
        return bool(USER_PREFERENCES_MASK[style]['default'])
Ejemplo n.º 2
0
def get_user_style(style):
    if style not in USER_PREFERENCES_MASK:
        raise ValueError, (
            "Argument style should be one of "+
            common.list_to_english_or((
                '"{0}"'.format(i) for i in
                USER_PREFERENCES_MASK.keys()
            ))
        )

    mask = registry.get(
        'HKEY_CURRENT_USER\\Control Panel\\Desktop', 'UserPreferenceMask'
    )
    if mask:
        mask = common.bitfield(mask)
        return bool(mask[ USER_PREFERENCES_MASK[style]['bit'] ])
    else:
        return bool(USER_PREFERENCES_MASK[style]['default'])
Ejemplo n.º 3
0
def set_user_style(style, state):
    if style not in USER_PREFERENCES_MASK:
        raise ValueError, ("Argument style should be one of " +
                           common.list_to_english_or(
                               ('"{0}"'.format(i)
                                for i in USER_PREFERENCES_MASK.keys())))

    mask = registry.get('HKEY_CURRENT_USER\\Control Panel\\Desktop',
                        'UserPreferenceMask')
    if mask:
        mask = common.bitfield(mask)
        mask[USER_PREFERENCES_MASK[style]['bit']] = int(state)
        registry_value = mask.registry_value()
        registry.set({
            'HKEY_CURRENT_USER\\Control Panel\\Desktop': {
                'UserPreferenceMask': registry_value
            }
        })
    else:
        return False
Ejemplo n.º 4
0
def set_user_style(style, state):
    if style not in USER_PREFERENCES_MASK:
        raise ValueError, (
            "Argument style should be one of "+
            common.list_to_english_or((
                '"{0}"'.format(i) for i in
                USER_PREFERENCES_MASK.keys()
            ))
        )

    mask = registry.get(
        'HKEY_CURRENT_USER\\Control Panel\\Desktop', 'UserPreferenceMask'
    )
    if mask:
        mask = common.bitfield(mask)
        mask[ USER_PREFERENCES_MASK[style]['bit'] ] = int(state)
        registry_value = mask.registry_value()
        registry.set({
            'HKEY_CURRENT_USER\\Control Panel\\Desktop': {
                'UserPreferenceMask': registry_value
            }
        })
    else:
        return False