How to use the gconf.escape_key function in gconf

To help you get started, we’ve selected a few gconf examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github CMoH / gnome15 / src / plugins / sense / sense.py View on Github external
# which shows a message
        if len(enabled_sensors) == 0: 
            self.page.theme.set_variant("none")
        else:      
            self.page.theme.set_variant(None)
            def menu_selected():
                self.page.theme.set_variant(VARIANT_NAMES[self._menu.selected.sensor.sense_type])
                
            self._menu.on_selected = menu_selected
            self.page.add_child(self._menu)
            self.page.theme.svg_processor = self._process_svg 
            self.page.add_child(g15theme.MenuScrollbar("viewScrollbar", self._menu))       
            i = 0
            for s in enabled_sensors:                
                if s.sense_type in TYPE_NAMES:
                    sense_key = "%s/sensors/%s" % (self.gconf_key, gconf.escape_key(s.name, len(s.name)))
                    sense_label = g15gconf.get_string_or_default(self.gconf_client, "%s/label" % (sense_key), s.name)
                    menu_item = SensorMenuItem("menuitem-%d" % i, s, sense_label)
                    self.sensor_dict[s.name] = menu_item
                    self._menu.add_child(menu_item)
                    
                    # If this is the first child, change the theme variant
                    if self._menu.get_child_count() == 1: 
                        self.page.theme.set_variant(VARIANT_NAMES[menu_item.sensor.sense_type])
                    
                    i += 1
github CMoH / gnome15 / gnome15 / src / plugins / sense / sense.py View on Github external
# which shows a message
        if len(enabled_sensors) == 0: 
            self.page.theme.set_variant("none")
        else:      
            self.page.theme.set_variant(None)
            def menu_selected():
                self.page.theme.set_variant(VARIANT_NAMES[self._menu.selected.sensor.sense_type])
                
            self._menu.on_selected = menu_selected
            self.page.add_child(self._menu)
            self.page.theme.svg_processor = self._process_svg 
            self.page.add_child(g15theme.MenuScrollbar("viewScrollbar", self._menu))       
            i = 0
            for s in enabled_sensors:                
                if s.sense_type in TYPE_NAMES:
                    sense_key = "%s/sensors/%s" % (self.gconf_key, gconf.escape_key(s.name, len(s.name)))
                    sense_label = g15gconf.get_string_or_default(self.gconf_client, "%s/label" % (sense_key), s.name)
                    menu_item = SensorMenuItem("menuitem-%d" % i, s, sense_label)
                    self.sensor_dict[s.name] = menu_item
                    self._menu.add_child(menu_item)
                    
                    # If this is the first child, change the theme variant
                    if self._menu.get_child_count() == 1: 
                        self.page.theme.set_variant(VARIANT_NAMES[menu_item.sensor.sense_type])
                    
                    i += 1
github CMoH / gnome15 / src / plugins / sense / sense.py View on Github external
def reload_model(self):
        self.sensor_model.clear() 
        ss = get_sensor_sources()
        for source in ss:
            sa  = source.get_sensors()
            for sensor in sa:
                sense_key = "%s/sensors/%s" % (self._gconf_key, gconf.escape_key(sensor.name, len(sensor.name)))
                if sensor.sense_type in TYPE_NAMES:
                    self.sensor_model.append([ sensor.name, g15gconf.get_bool_or_default(self._gconf_client, "%s/enabled" % (sense_key), True),
                                              g15gconf.get_string_or_default(self._gconf_client, "%s/label" % (sense_key), sensor.name), TYPE_NAMES[sensor.sense_type] ])
            source.stop()
github CMoH / gnome15 / gnome15 / src / plugins / sense / sense.py View on Github external
def populate_page(self):
        self._menu = g15theme.Menu("menu")
        g15plugin.G15RefreshingPlugin.populate_page(self)
        
        enabled_sensors = []
        for c in self.sensor_sources:
            for s in c.get_sensors():                
                sense_key = "%s/sensors/%s" % (self.gconf_key, gconf.escape_key(s.name, len(s.name)))
                if g15gconf.get_bool_or_default(self.gconf_client, "%s/enabled" % (sense_key), True):
                    enabled_sensors.append(s)
                    
              
        # If there are no sensors enabled, display the 'none' variant
        # which shows a message
        if len(enabled_sensors) == 0: 
            self.page.theme.set_variant("none")
        else:      
            self.page.theme.set_variant(None)
            def menu_selected():
                self.page.theme.set_variant(VARIANT_NAMES[self._menu.selected.sensor.sense_type])
                
            self._menu.on_selected = menu_selected
            self.page.add_child(self._menu)
            self.page.theme.svg_processor = self._process_svg
github CMoH / gnome15 / gnome15 / src / plugins / sense / sense.py View on Github external
def reload_model(self):
        self.sensor_model.clear() 
        ss = get_sensor_sources()
        for source in ss:
            sa  = source.get_sensors()
            for sensor in sa:
                sense_key = "%s/sensors/%s" % (self._gconf_key, gconf.escape_key(sensor.name, len(sensor.name)))
                if sensor.sense_type in TYPE_NAMES:
                    self.sensor_model.append([ sensor.name, g15gconf.get_bool_or_default(self._gconf_client, "%s/enabled" % (sense_key), True),
                                              g15gconf.get_string_or_default(self._gconf_client, "%s/label" % (sense_key), sensor.name), TYPE_NAMES[sensor.sense_type] ])
            source.stop()
github CMoH / gnome15 / gnome15 / src / plugins / sense / sense.py View on Github external
def sensor_toggled(self, widget, row_index):
        row_index = int(row_index)
        now_active = not widget.get_active()
        self.sensor_model.set_value(self.sensor_model.get_iter(row_index), 1, now_active)
        sensor_name = self.sensor_model[row_index][0]
        self._gconf_client.set_bool("%s/sensors/%s/enabled" % (self._gconf_key, gconf.escape_key(sensor_name, len(sensor_name))), now_active)
github CMoH / gnome15 / src / plugins / sense / sense.py View on Github external
def populate_page(self):
        self._menu = g15theme.Menu("menu")
        g15plugin.G15RefreshingPlugin.populate_page(self)
        
        enabled_sensors = []
        for c in self.sensor_sources:
            for s in c.get_sensors():                
                sense_key = "%s/sensors/%s" % (self.gconf_key, gconf.escape_key(s.name, len(s.name)))
                if g15gconf.get_bool_or_default(self.gconf_client, "%s/enabled" % (sense_key), True):
                    enabled_sensors.append(s)
                    
              
        # If there are no sensors enabled, display the 'none' variant
        # which shows a message
        if len(enabled_sensors) == 0: 
            self.page.theme.set_variant("none")
        else:      
            self.page.theme.set_variant(None)
            def menu_selected():
                self.page.theme.set_variant(VARIANT_NAMES[self._menu.selected.sensor.sense_type])
                
            self._menu.on_selected = menu_selected
            self.page.add_child(self._menu)
            self.page.theme.svg_processor = self._process_svg
github thousandparsec / tpclient-pywx / requirements.py View on Github external
linux_location = os.path.join(os.path.dirname(os.path.join(os.path.abspath(__file__))), "tpclient-pywx")
		if not os.path.exists(linux_location):
			print "Hrm, unable to find tpclient-pywx are you running outside a tpclient-pywx tree?"
		else:
			#print location
			# Check the file is executable
			try:
				os.chmod(linux_location, stat.S_IRUSR|stat.S_IWUSR|stat.S_IXUSR|stat.S_IRGRP|stat.S_IXGRP|stat.S_IROTH|stat.S_IXOTH)
			except Exception, e:
				pass

			# Register the URL Handlers
			try:
				import gconf
				for prefix in ['tp', 'tps', 'tphttp', 'tphttps', 'tp+http', 'tp+https']:
					prefix = gconf.escape_key(prefix, len(prefix))
					gconf.client_get_default().set_string('/desktop/gnome/url-handlers/%s/command' % prefix, linux_location)
					gconf.client_get_default().set_bool('/desktop/gnome/url-handlers/%s/enabled' % prefix, True)
			except ImportError, e:
				print e

				reason = "It is recommended that under gnome you have the Python Gconf module installed so I can register URL handlers."
				if system == "debian-based":
					recommended.append(("python-gconf", reason))
				else:
					recommended.append(("Recent version of pyGTK", reason))

	print
	print "Checking locations:"
	print "---------------------------------------------------------------"
	import os
	try: