Rework profiles code a bit, initialize gecko profile
This commit is contained in:
@@ -3,7 +3,8 @@ from ConfigParser import ConfigParser
|
||||
from sugar.canvas.IconColor import IconColor
|
||||
|
||||
class Profile:
|
||||
def __init__(self):
|
||||
def __init__(self,):
|
||||
self._path = None
|
||||
self._nick_name = None
|
||||
|
||||
def _ensure_dirs(self):
|
||||
@@ -18,23 +19,20 @@ class Profile:
|
||||
|
||||
def set_color(self, color):
|
||||
self._color = color
|
||||
self.save()
|
||||
|
||||
def get_nick_name(self):
|
||||
return self._nick_name
|
||||
|
||||
def set_nick_name(self, nick_name):
|
||||
self._nick_name = nick_name
|
||||
self.save()
|
||||
|
||||
def get_path(self):
|
||||
return self._path
|
||||
|
||||
def read(self, profile_id):
|
||||
self._profile_id = profile_id
|
||||
def set_path(self, path):
|
||||
self._path = path
|
||||
|
||||
base_path = os.path.expanduser('~/.sugar')
|
||||
self._path = os.path.join(base_path, profile_id)
|
||||
def read(self):
|
||||
self._color = None
|
||||
self._ensure_dirs()
|
||||
|
||||
|
||||
+13
-7
@@ -44,15 +44,21 @@ def setup():
|
||||
registry = sugar.conf.get_activity_registry()
|
||||
registry.scan_directory(get_activities_dir())
|
||||
|
||||
profile = sugar.conf.get_profile()
|
||||
if os.environ.has_key('SUGAR_PROFILE'):
|
||||
profile.read(os.environ['SUGAR_PROFILE'])
|
||||
else:
|
||||
profile.read('default')
|
||||
read_profile()
|
||||
|
||||
def get_user_dir():
|
||||
def read_profile():
|
||||
profile = sugar.conf.get_profile()
|
||||
return profile.get_path()
|
||||
profile.set_path(get_profile_path())
|
||||
profile.read()
|
||||
|
||||
def get_profile_path():
|
||||
if os.environ.has_key('SUGAR_PROFILE'):
|
||||
profile_id = os.environ['SUGAR_PROFILE']
|
||||
else:
|
||||
profile_id = 'default'
|
||||
path = os.path.expanduser('~/.sugar')
|
||||
|
||||
return os.path.join(path, profile_id)
|
||||
|
||||
def get_nick_name():
|
||||
profile = sugar.conf.get_profile()
|
||||
|
||||
Reference in New Issue
Block a user