Changes

Jump to navigation Jump to search
no edit summary
Line 1: Line 1:  
{{Almanac}}
 
{{Almanac}}
 +
 +
'''Note:'''
 +
 +
sugar.profile is largely depreciated. We are now using gconf for accessing most profile information.
 +
    
The profile package can be used to get access to user specific details such as his/her nick_name, XO colors, public key, etc. Much of these details are accessed by first creating a Profile object. However, there are several shortcut helper functions that provide access to some user details directly.  
 
The profile package can be used to get access to user specific details such as his/her nick_name, XO colors, public key, etc. Much of these details are accessed by first creating a Profile object. However, there are several shortcut helper functions that provide access to some user details directly.  
Line 6: Line 11:     
=== How do I get the user's nick name? ===
 
=== How do I get the user's nick name? ===
 +
 +
<pre>
 +
import gconf
 +
 +
client = gconf.client_get_default()
 +
username = client.get_string("/desktop/suagr/user/nick")
 +
</pre>
 +
 +
 +
The following code is depreciated:
 
<pre>
 
<pre>
 
from sugar import profile  
 
from sugar import profile  
Line 18: Line 33:     
=== How do I get the XO colors set by the user? ===
 
=== How do I get the XO colors set by the user? ===
 +
 +
<pre>
 +
import gconf
 +
 +
client = gconf.client_get_default()
 +
color = client.get_string("/desktop/sugar/user/color")
 +
stroke,fill = color.split(",")
 +
</pre>
 +
 +
The following code is depreciated:
 
<pre>
 
<pre>
 
from sugar import profile  
 
from sugar import profile  

Navigation menu