Simple profile support. First time dialog (ugly and only nick atm).
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
from sugar.conf.ActivityRegistry import ActivityRegistry
|
||||
from sugar.conf.Profile import Profile
|
||||
|
||||
__registry = ActivityRegistry()
|
||||
__profile = Profile()
|
||||
|
||||
def get_activity_registry():
|
||||
return __registry
|
||||
|
||||
def get_profile():
|
||||
return __profile
|
||||
|
||||
+10
-9
@@ -44,18 +44,19 @@ def setup():
|
||||
registry = sugar.conf.get_activity_registry()
|
||||
registry.scan_directory(get_activities_dir())
|
||||
|
||||
def get_user_dir():
|
||||
if os.environ.has_key('SUGAR_NICK_NAME'):
|
||||
nick = get_nick_name()
|
||||
return os.path.expanduser('~/.sugar-%s/' % nick)
|
||||
profile = sugar.conf.get_profile()
|
||||
if os.environ.has_key('SUGAR_PROFILE'):
|
||||
profile.read(os.environ['SUGAR_PROFILE'])
|
||||
else:
|
||||
return os.path.expanduser('~/.sugar')
|
||||
profile.read('default')
|
||||
|
||||
def get_user_dir():
|
||||
profile = sugar.conf.get_profile()
|
||||
return profile.get_path()
|
||||
|
||||
def get_nick_name():
|
||||
if os.environ.has_key('SUGAR_NICK_NAME'):
|
||||
return os.environ['SUGAR_NICK_NAME']
|
||||
else:
|
||||
return pwd.getpwuid(os.getuid())[0]
|
||||
profile = sugar.conf.get_profile()
|
||||
return profile.get_nick_name()
|
||||
|
||||
def get_data_dir():
|
||||
return sugar_data_dir
|
||||
|
||||
Reference in New Issue
Block a user