Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _set_config_str(self, key, string):
""" Save a value to a gconf key. """
key = self._gconf_key_base + key
value = gconf.Value(gconf.VALUE_STRING)
value.set_string(string)
gconf.client_get_default().set(key, value)
def gconf_set_str(key, value):
v = gconf.Value(gconf.VALUE_STRING)
v.set_string(value)
gconf.client_get_default().set(key, v)
def gconf_set_bool(key, value):
v = gconf.Value(gconf.VALUE_BOOL)
v.set_bool(value)
gconf.client_get_default().set(key, v)
def __init__(self, *args, **kwargs):
self.getter = getattr(gconf.Value, 'get_%s' % self.gconf_type.value_nick)
self.setter = getattr(gconf.Value, 'set_%s' % self.gconf_type.value_nick)
super(SimpleOption, self).__init__(*args, **kwargs)
def __set__(self, instance, value):
gconf_value = gconf.Value(self.gconf_type)
self.setter(gconf_value, value)
super(SimpleOption, self).__set__(instance, gconf_value)
def __set__(self, instance, value):
gconf_value = gconf.Value(self.gconf_type)
self.setter(gconf_value, value)
super(SimpleOption, self).__set__(instance, gconf_value)
def __set__(self, instance, value):
assert hasattr(value, '__iter__'), 'value of ListOption must be iterable'
gvalues = [gconf.Value(self.list_type) for i in range(len(value))]
for g, v in map(None, gvalues, value):
getattr(g, 'set_%s' % self.list_type.value_nick)(v)
gconf_value = gconf.Value(self.gconf_type)
gconf_value.set_list_type(self.list_type)
self.setter(gconf_value, gvalues)
Option.__set__(self, instance, gconf_value)