Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
for s in conf_client.all_dirs('/apps/compiz/general')
if s.split('/')[-1][:6] == 'screen']
# Check that the screen is one of the ones supported by compiz
if screen not in screens:
screen = screens[0]
# Get the number of faces on this screen
number_of_faces = (
conf_client.get_int('/apps/compiz/general/%s/options/hsize' % screen) *
conf_client.get_int('/apps/compiz/general/%s/options/vsize' % screen))
# Get the current list of wallpapers on this screen
wallpapers = conf_client.get_list(
'/apps/compiz/plugins/wallpaper/%s/options/bg_image' % screen,
gconf.VALUE_STRING)
# If list of wallpapers is too short, populate it to the correct length
if len(wallpapers) < number_of_faces:
wallpapers.extend([filename] * (number_of_faces - len(wallpapers)))
prefix = '/apps/compiz/plugins/wallpaper/%s/options/' % screen
settings = {
'bg_color1' : (gconf.VALUE_STRING, '#000000ff'),
'bg_color2' : (gconf.VALUE_STRING, '#000000ff'),
'bg_fill_type': (gconf.VALUE_INT, 0),
'bg_image_pos': (gconf.VALUE_INT, 0),
}
for key, value in settings.items():
ext_list = conf_client.get_list(prefix + key, value[0])
ext_list.extend([value[1]] * (number_of_faces - len(ext_list)))
conf_client.set_list(prefix + key, value[0], ext_list)
def wobbly_checkbutton_toggled_cb(self, widget, data = None):
client = gconf.client_get_default()
if widget.get_active():
self.set_active("wobbly", True)
value = client.get(data)
if value.type == gconf.VALUE_INT:
client.set_int(data, 1)
client.set_string("/apps/compiz/plugins/wobbly/screen0/options/map_window_match","Splash | DropdownMenu | PopupMenu | Tooltip | Notification | Combo | Dnd | Unknown")
elif value.type == gconf.VALUE_BOOL:
client.set_bool(data, True)
elif value.type == gconf.VALUE_STRING:
client.set_string(data, "Toolbar | Menu | Utility | Dialog | Normal | Unknown")
else:
self.set_active("wobbly", False)
value = client.get(data)
if value.type == gconf.VALUE_INT:
client.set_int(data, 0)
elif value.type == gconf.VALUE_BOOL:
client.set_bool(data, False)
elif value.type == gconf.VALUE_STRING:
client.set_string(data, "")
try:
history.remove(name)
except ValueError:
pass
while len(history) > 7:
history.pop()
if name:
history.insert( 0, name )
combo = entry.parent
model = combo.get_model()
model.clear()
for h in history:
model.append([h])
if len(history):
combo.set_active(0)
self.gconf.set_list("%s/%s" % (self.STATE_ROOT, history_id), gconf.VALUE_STRING, history )
def _writeSetting(self, name, gconfType, value):
base = '/apps/gedit-2/plugins/gotofile/'
if gconfType == gconf.VALUE_STRING:
self._gconf.set_string(base + name, value)
elif gconfType == gconf.VALUE_INT:
self._gconf.set_int(base + name, value)
elif gconfType == gconf.VALUE_BOOL:
self._gconf.set_bool(base + name, value)
else:
raise "Not supported"
def get_schema_value(self):
value = self.__client.get_default_from_schema(self.__key)
if value:
if value.type == gconf.VALUE_BOOL:
return value.get_bool()
elif value.type == gconf.VALUE_STRING:
return value.get_string()
elif value.type == gconf.VALUE_INT:
return value.get_int()
elif value.type == gconf.VALUE_FLOAT:
return value.get_float()
else:
raise Exception("No schema value for %s" % self.__key)
"""
import gconf, gobject, gtk
class Spec (object):
def __init__ (self, name, gconf_type, py_type, default):
self.__gconf_type = gconf_type
self.__py_type = py_type
self.__default = default
self.__name = name
gconf_type = property (lambda self: self.__gconf_type)
py_type = property (lambda self: self.__py_type)
default = property (lambda self: self.__default)
name = property (lambda self: self.__name)
Spec.STRING = Spec ("string", gconf.VALUE_STRING, str, '')
Spec.FLOAT = Spec ("float", gconf.VALUE_FLOAT, float, 0.0)
Spec.INT = Spec ("int", gconf.VALUE_INT, int, 0)
Spec.BOOL = Spec ("bool", gconf.VALUE_BOOL, bool, True)
def data_file_chooser (button, key, use_directory = False, use_uri = True, default = None, client = None):
"""
Returns a gaw.Data.
use_directory - boolean variable setting if it's we're using files or directories.
use_uri - boolean variable setting if we're using URI's or normal filenames.
Associates a gaw.Data to a gtk.FileChooserButton.
"""
if not use_directory and not use_uri:
getter = button.get_filename
# Get the number of faces on this screen
number_of_faces = (
conf_client.get_int('/apps/compiz/general/%s/options/hsize' % screen) *
conf_client.get_int('/apps/compiz/general/%s/options/vsize' % screen))
# Get the current list of wallpapers on this screen
wallpapers = conf_client.get_list(
'/apps/compiz/plugins/wallpaper/%s/options/bg_image' % screen,
gconf.VALUE_STRING)
# If list of wallpapers is too short, populate it to the correct length
if len(wallpapers) < number_of_faces:
wallpapers.extend([filename] * (number_of_faces - len(wallpapers)))
prefix = '/apps/compiz/plugins/wallpaper/%s/options/' % screen
settings = {
'bg_color1' : (gconf.VALUE_STRING, '#000000ff'),
'bg_color2' : (gconf.VALUE_STRING, '#000000ff'),
'bg_fill_type': (gconf.VALUE_INT, 0),
'bg_image_pos': (gconf.VALUE_INT, 0),
}
for key, value in settings.items():
ext_list = conf_client.get_list(prefix + key, value[0])
ext_list.extend([value[1]] * (number_of_faces - len(ext_list)))
conf_client.set_list(prefix + key, value[0], ext_list)
# Correct face if invalid
if face >= number_of_faces or face < 0:
face = 0
# Set wallpaper
wallpapers[face] = filename
conf_client.set_list(
if row[0] == entrytext:
it = self.store.get_iter(row.path)
self.store.remove(it)
self.store.prepend([entrytext])
if len(self.store) > self._maxEntries:
it = self.store.get_iter(self.store[-1].path)
self.store.remove(it)
if doStore:
entries = []
for e in self.store:
encodedName = urllib.quote(e[0])
entries.append(encodedName)
self.gclient.set_list(self.confKey, gconf.VALUE_STRING, entries)