Rework profiles code a bit, initialize gecko profile
This commit is contained in:
parent
ba3d5fce8c
commit
6b232d97d8
@ -1,3 +1,5 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
import gtk
|
import gtk
|
||||||
import geckoembed
|
import geckoembed
|
||||||
|
|
||||||
@ -8,11 +10,15 @@ from sugar.p2p.model.RemoteModel import RemoteModel
|
|||||||
|
|
||||||
from NotificationBar import NotificationBar
|
from NotificationBar import NotificationBar
|
||||||
from NavigationToolbar import NavigationToolbar
|
from NavigationToolbar import NavigationToolbar
|
||||||
|
from sugar import env
|
||||||
|
|
||||||
class BrowserActivity(Activity):
|
class BrowserActivity(Activity):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
Activity.__init__(self)
|
Activity.__init__(self)
|
||||||
|
|
||||||
|
path = os.path.join(env.get_profile_path(), 'gecko')
|
||||||
|
geckoembed.set_profile_path(path)
|
||||||
|
|
||||||
self._share_service = None
|
self._share_service = None
|
||||||
self._model_service = None
|
self._model_service = None
|
||||||
self._notif_service = None
|
self._notif_service = None
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
AC_INIT([Sugar],[0.22],[],[sugar])
|
AC_INIT([Sugar],[0.24],[],[sugar])
|
||||||
|
|
||||||
AC_PREREQ([2.59])
|
AC_PREREQ([2.59])
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ class ShellOwner(object):
|
|||||||
server portion of the Owner, paired with the client portion in Buddy.py."""
|
server portion of the Owner, paired with the client portion in Buddy.py."""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._nick = env.get_nick_name()
|
self._nick = env.get_nick_name()
|
||||||
user_dir = env.get_user_dir()
|
user_dir = env.get_profile_path()
|
||||||
|
|
||||||
self._icon = None
|
self._icon = None
|
||||||
for fname in os.listdir(user_dir):
|
for fname in os.listdir(user_dir):
|
||||||
|
@ -94,6 +94,7 @@ class Shell(gobject.GObject):
|
|||||||
self.set_zoom_level(Shell.ZOOM_MESH)
|
self.set_zoom_level(Shell.ZOOM_MESH)
|
||||||
|
|
||||||
def __first_time_dialog_destroy_cb(self, dialog):
|
def __first_time_dialog_destroy_cb(self, dialog):
|
||||||
|
conf.get_profile().save()
|
||||||
self.start()
|
self.start()
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
|
@ -3,7 +3,8 @@ from ConfigParser import ConfigParser
|
|||||||
from sugar.canvas.IconColor import IconColor
|
from sugar.canvas.IconColor import IconColor
|
||||||
|
|
||||||
class Profile:
|
class Profile:
|
||||||
def __init__(self):
|
def __init__(self,):
|
||||||
|
self._path = None
|
||||||
self._nick_name = None
|
self._nick_name = None
|
||||||
|
|
||||||
def _ensure_dirs(self):
|
def _ensure_dirs(self):
|
||||||
@ -18,23 +19,20 @@ class Profile:
|
|||||||
|
|
||||||
def set_color(self, color):
|
def set_color(self, color):
|
||||||
self._color = color
|
self._color = color
|
||||||
self.save()
|
|
||||||
|
|
||||||
def get_nick_name(self):
|
def get_nick_name(self):
|
||||||
return self._nick_name
|
return self._nick_name
|
||||||
|
|
||||||
def set_nick_name(self, nick_name):
|
def set_nick_name(self, nick_name):
|
||||||
self._nick_name = nick_name
|
self._nick_name = nick_name
|
||||||
self.save()
|
|
||||||
|
|
||||||
def get_path(self):
|
def get_path(self):
|
||||||
return self._path
|
return self._path
|
||||||
|
|
||||||
def read(self, profile_id):
|
def set_path(self, path):
|
||||||
self._profile_id = profile_id
|
self._path = path
|
||||||
|
|
||||||
base_path = os.path.expanduser('~/.sugar')
|
def read(self):
|
||||||
self._path = os.path.join(base_path, profile_id)
|
|
||||||
self._color = None
|
self._color = None
|
||||||
self._ensure_dirs()
|
self._ensure_dirs()
|
||||||
|
|
||||||
|
20
sugar/env.py
20
sugar/env.py
@ -44,15 +44,21 @@ def setup():
|
|||||||
registry = sugar.conf.get_activity_registry()
|
registry = sugar.conf.get_activity_registry()
|
||||||
registry.scan_directory(get_activities_dir())
|
registry.scan_directory(get_activities_dir())
|
||||||
|
|
||||||
profile = sugar.conf.get_profile()
|
read_profile()
|
||||||
if os.environ.has_key('SUGAR_PROFILE'):
|
|
||||||
profile.read(os.environ['SUGAR_PROFILE'])
|
|
||||||
else:
|
|
||||||
profile.read('default')
|
|
||||||
|
|
||||||
def get_user_dir():
|
def read_profile():
|
||||||
profile = sugar.conf.get_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():
|
def get_nick_name():
|
||||||
profile = sugar.conf.get_profile()
|
profile = sugar.conf.get_profile()
|
||||||
|
Loading…
Reference in New Issue
Block a user