Fix some path bugs. Reload the profile when first time dialog wrote it.

master
Marco Pesenti Gritti 18 years ago
parent b481373db0
commit 637a08154e

@ -37,6 +37,7 @@ name = profile.get_nick_name()
if not name or not len(name):
dialog = FirstTimeDialog()
dialog.run()
profile.update()
model = ShellModel()
shell = Shell(model)

@ -31,9 +31,15 @@ from sugar import env
from sugar import setup
if sourcedir:
if os.environ.has_key('PYTHONPATH'):
old_path = os.environ['PYTHONPATH']
os.environ['PYTHONPATH'] = sourcedir + ':' + old_path
else:
os.environ['PYTHONPATH'] = sourcedir
bin_path = sourcedir
bin_path += ';' + os.path.join(sourcedir, 'shell')
bin_path += ';' + os.path.join(sourcedir, 'services/presence')
bin_path += ':' + os.path.join(sourcedir, 'shell')
bin_path += ':' + os.path.join(sourcedir, 'services/presence')
if os.environ.has_key('PATH'):
old_path = os.environ['PATH']

@ -20,24 +20,36 @@ from ConfigParser import ConfigParser
from sugar import env
from sugar.graphics.iconcolor import IconColor
def get_nick_name():
return _nick_name
class _Profile(object):
def __init__(self):
self.name = None
self.color = None
self._load()
def get_color():
return _color
def update(self):
self._load()
def _load(self):
cp = ConfigParser()
config_path = os.path.join(env.get_profile_path(), 'config')
parsed = cp.read([config_path])
if cp.has_option('Buddy', 'NickName'):
self.name = cp.get('Buddy', 'NickName')
cp = ConfigParser()
config_path = os.path.join(env.get_profile_path(), 'config')
parsed = cp.read([config_path])
if cp.has_option('Buddy', 'Color'):
self.color = IconColor(cp.get('Buddy', 'Color'))
if cp.has_option('Buddy', 'NickName'):
_nick_name = cp.get('Buddy', 'NickName')
else:
_nick_name = None
del cp
def get_nick_name():
return _profile.name
def get_color():
return _profile.color
if cp.has_option('Buddy', 'Color'):
_color = IconColor(cp.get('Buddy', 'Color'))
else:
_color = None
def update():
print 'Update'
_profile.update()
del cp
_profile = _Profile()

Loading…
Cancel
Save