gnome-games r8275 - trunk/gnome-sudoku/src/lib/gtk_goodies



Author: thomashpa
Date: Fri Nov  7 15:16:03 2008
New Revision: 8275
URL: http://svn.gnome.org/viewvc/gnome-games?rev=8275&view=rev

Log:
replace tabs with spaces to correct indentation. Patch by Zhang Sen. Fixes bug 559434

Modified:
   trunk/gnome-sudoku/src/lib/gtk_goodies/gconf_wrapper.py

Modified: trunk/gnome-sudoku/src/lib/gtk_goodies/gconf_wrapper.py
==============================================================================
--- trunk/gnome-sudoku/src/lib/gtk_goodies/gconf_wrapper.py	(original)
+++ trunk/gnome-sudoku/src/lib/gtk_goodies/gconf_wrapper.py	Fri Nov  7 15:16:03 2008
@@ -14,131 +14,131 @@
 
 class GConf:
     def __init__ (self, appname, allowed={}):
-	self._domain = '/apps/%s/' % appname
-	self._allowed = allowed
-	self._gconf_client = gconf.client_get_default ()
+        self._domain = '/apps/%s/' % appname
+        self._allowed = allowed
+        self._gconf_client = gconf.client_get_default ()
 
     def __getitem__ (self, attr):
-	return self.get_value (attr)
+        return self.get_value (attr)
 
     def __setitem__ (self, key, val):
-	allowed = self._allowed
-	if allowed.has_key (key):
-	    if not key in allowed[key]:
-		good = ', '.join (allowed[key])
-		raise GConfError, '%s must be one of: (%s)' % (key, good)
-	self.set_value (key, val)
+        allowed = self._allowed
+        if allowed.has_key (key):
+            if not key in allowed[key]:
+                good = ', '.join (allowed[key])
+            raise GConfError, '%s must be one of: (%s)' % (key, good)
+        self.set_value (key, val)
 
     def _get_type (self, key):
-	KeyType = type (key)
-	if KeyType == StringType:
-	    return 'string'
-	elif KeyType == IntType:
-	    return 'int'
-	elif KeyType == FloatType:
-	    return 'float'
-	elif KeyType == BooleanType:
-	    return 'bool'
-	else:
-	    raise GConfError, 'unsupported type: %s' % str (KeyType)
+        KeyType = type (key)
+        if KeyType == StringType:
+            return 'string'
+        elif KeyType == IntType:
+            return 'int'
+        elif KeyType == FloatType:
+            return 'float'
+        elif KeyType == BooleanType:
+            return 'bool'
+        else:
+            raise GConfError, 'unsupported type: %s' % str (KeyType)
 
     # Public functions
 
     def set_allowed (self, allowed):
-	self._allowed = allowed
+        self._allowed = allowed
 
     def set_domain (self, domain):
-	self._domain = domain
+        self._domain = domain
 
     def get_domain (self):
-	return self._domain
+        return self._domain
    
     def get_gconf_client (self):
-	return self._gconf_client
+        return self._gconf_client
 
     def get_value (self, key):
         '''returns the value of key `key' ''' #'
-	if '/' in key:
-	    raise GConfError, 'key must not contain /'
+        if '/' in key:
+            raise GConfError, 'key must not contain /'
 
-	value = self._gconf_client.get (self._domain + key)
-	ValueType = value.type
-	if ValueType == VALUE_BOOL:
-	    return value.get_bool ()
-	elif ValueType == VALUE_INT:
-	    return value.get_int ()
-	elif ValueType == VALUE_STRING:
-	    return value.get_string ()
-	elif ValueType == VALUE_FLOAT:
-	    return value.get_float ()
+        value = self._gconf_client.get (self._domain + key)
+        ValueType = value.type
+        if ValueType == VALUE_BOOL:
+            return value.get_bool ()
+        elif ValueType == VALUE_INT:
+            return value.get_int ()
+        elif ValueType == VALUE_STRING:
+            return value.get_string ()
+        elif ValueType == VALUE_FLOAT:
+            return value.get_float ()
    
     def set_value (self, key, value):
         '''sets the value of key `key' to `value' '''
         value_type = self._get_type (value)
 
-	if '/' in key:
-	    raise GConfError, 'key must not contain /'
+        if '/' in key:
+            raise GConfError, 'key must not contain /'
 
-	func = getattr (self._gconf_client, 'set_' + value_type)
-	apply (func, (self._domain + key, value))
+        func = getattr (self._gconf_client, 'set_' + value_type)
+        apply (func, (self._domain + key, value))
 
     def get_string (self, key):
-	if '/' in key:
-	    raise GConfError, 'key must not contain /'
+        if '/' in key:
+            raise GConfError, 'key must not contain /'
 
-	return self._gconf_client.get_string (self._domain + key)
+        return self._gconf_client.get_string (self._domain + key)
    
     def set_string (self, key, value):
-	if type (value) != StringType:
-	    raise GConfError, 'value must be a string'
-	if '/' in key:
-	    raise GConfError, 'key must not contain /'
+        if type (value) != StringType:
+            raise GConfError, 'value must be a string'
+        if '/' in key:
+            raise GConfError, 'key must not contain /'
 
-	self._gconf_client.set_string (self._domain + key, value)
+        self._gconf_client.set_string (self._domain + key, value)
 
     def get_bool (self, key):
-	if '/' in key:
-	    raise GConfError, 'key must not contain /'
+        if '/' in key:
+            raise GConfError, 'key must not contain /'
 
-	return self._gconf_client.get_bool (self._domain + key)
+        return self._gconf_client.get_bool (self._domain + key)
    
     def set_bool (self, key, value):
-	if type (value) != IntType and \
-	   (key != 0 or key != 1):
-	    raise GConfError, 'value must be a boolean'
-	if '/' in key:
-	    raise GConfError, 'key must not contain /'
+        if type (value) != IntType and \
+           (key != 0 or key != 1):
+            raise GConfError, 'value must be a boolean'
+        if '/' in key:
+            raise GConfError, 'key must not contain /'
 
-	self._gconf_client.set_bool (self._domain + key, value)
+        self._gconf_client.set_bool (self._domain + key, value)
 
     def get_int (self, key):
-	if '/' in key:
-	    raise GConfError, 'key must not contain /'
+        if '/' in key:
+            raise GConfError, 'key must not contain /'
 
-	return self._gconf_client.get_int (self._domain + key)
+        return self._gconf_client.get_int (self._domain + key)
    
     def set_int (self, key, value):
-	if type (value) != IntType:
-	    raise GConfError, 'value must be an int'
-	if '/' in key:
-	    raise GConfError, 'key must not contain /'
+        if type (value) != IntType:
+            raise GConfError, 'value must be an int'
+        if '/' in key:
+            raise GConfError, 'key must not contain /'
 
-	self._gconf_client.set_int (self._domain + key, value)
+        self._gconf_client.set_int (self._domain + key, value)
 
     def get_float (self, key):
-	if '/' in key:
-	    raise GConfError, 'key must not contain /'
+        if '/' in key:
+            raise GConfError, 'key must not contain /'
 
-	return self._gconf_client.get_float (self._domain + key)
+        return self._gconf_client.get_float (self._domain + key)
    
     def set_float (self, key, value):
-	if type (value) != FloatType:
-	    raise GConfError, 'value must be an float'
+        if type (value) != FloatType:
+            raise GConfError, 'value must be an float'
 
-	if '/' in key:
-	    raise GConfError, 'key must not contain /'
+        if '/' in key:
+            raise GConfError, 'key must not contain /'
 
-	self._gconf_client.set_float (self._domain + key, value)
+        self._gconf_client.set_float (self._domain + key, value)
 
 class GConfWrapper:
     """Provide some general purpose convenience functions for keeping



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]