From 30edb542b16a544977cf22f2b1a669d4d618730c Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Mon, 17 Sep 2007 11:53:10 +0000 Subject: Cleanup the profile code and rename the Server section to Jabber. --- (limited to 'shell') diff --git a/shell/intro/intro.py b/shell/intro/intro.py index 90804dc..1ee386f 100644 --- a/shell/intro/intro.py +++ b/shell/intro/intro.py @@ -28,6 +28,7 @@ from sugar import env from sugar.graphics import style from sugar.graphics.button import CanvasButton from sugar.graphics.entry import CanvasEntry +from sugar.profile import get_profile import colorpicker @@ -233,27 +234,10 @@ class IntroWindow(gtk.Window): scaled = pixbuf.scale_simple(200, 200, gtk.gdk.INTERP_BILINEAR) pixbuf.save(icon_path, "jpeg", {"quality":"85"}) - cp = ConfigParser() - section = 'Buddy' - if not cp.has_section(section): - cp.add_section(section) - # encode nickname to ascii-safe characters - cp.set(section, 'NickName', name.encode("utf-8")) - cp.set(section, 'Color', color.to_string()) - - section = 'Server' - if not cp.has_section(section): - cp.add_section(section) - if env.is_emulator(): - cp.set(section, 'Server', 'olpc.collabora.co.uk') - else: - cp.set(section, 'Server', '') - cp.set(section, 'Registered', 'False') - - config_path = os.path.join(env.get_profile_path(), 'config') - f = open(config_path, 'w') - cp.write(f) - f.close() + profile = get_profile() + profile.name = name + profile.color = color + profile.save() # Generate keypair import commands diff --git a/shell/model/Owner.py b/shell/model/Owner.py index 87e49ca..0abc13a 100644 --- a/shell/model/Owner.py +++ b/shell/model/Owner.py @@ -46,7 +46,7 @@ class ShellOwner(gobject.GObject): def __init__(self): gobject.GObject.__init__(self) - self._nick = profile.get_nick_name() + self._nick = profile.get_name() self._icon = None self._icon_hash = "" diff --git a/shell/sugar-shell b/shell/sugar-shell index c2928c2..a054189 100755 --- a/shell/sugar-shell +++ b/shell/sugar-shell @@ -26,8 +26,8 @@ import gtk import gobject from sugar import logger -from sugar import profile from sugar import env +from sugar.profile import get_profile logger.cleanup() logger.start('shell') @@ -95,11 +95,10 @@ def main(): _setup_translations() # Do initial setup if needed - if not profile.is_valid(): + if not get_profile().is_valid(): win = intro.IntroWindow() win.show_all() gtk.main() - profile.update() if os.environ.has_key("SUGAR_TP_DEBUG"): # Allow the user time to start up telepathy connection managers diff --git a/shell/view/home/FriendsBox.py b/shell/view/home/FriendsBox.py index 9a9ca9b..b5519df 100644 --- a/shell/view/home/FriendsBox.py +++ b/shell/view/home/FriendsBox.py @@ -41,7 +41,7 @@ class FriendsBox(hippo.CanvasBox): self._owner_icon = CanvasIcon(icon_name='computer-xo', cache=True, xo_color=profile.get_color()) self._owner_icon.props.size = style.LARGE_ICON_SIZE - palette = Palette(profile.get_nick_name()) + palette = Palette(profile.get_name()) self._owner_icon.set_palette(palette) self._layout.add_center(self._owner_icon) diff --git a/shell/view/home/HomeBox.py b/shell/view/home/HomeBox.py index 82fa083..4cf688b 100644 --- a/shell/view/home/HomeBox.py +++ b/shell/view/home/HomeBox.py @@ -149,7 +149,7 @@ class HomeMyIcon(MyIcon): self._shell = shell def enable_palette(self): - palette = Palette(profile.get_nick_name()) + palette = Palette(profile.get_name()) reboot_menu_item = gtk.MenuItem(_('Reboot')) reboot_menu_item.connect('activate', self._reboot_activate_cb) -- cgit v0.9.1