diff options
author | Marco Pesenti Gritti <marco@localhost.localdomain> | 2006-10-16 11:34:43 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <marco@localhost.localdomain> | 2006-10-16 11:34:43 (GMT) |
commit | bc0ee6d34c963de81f65d3319e99be0b1e13effc (patch) | |
tree | a0bc604b07fda04db0c8b5161b650a4e71a6de0d /shell/view | |
parent | a3be4492b2c910bd78ced7daf3208f69d0862005 (diff) |
Refactor startup. In progress, give me a couple hours.
For now start sugar with "sugar-emulator shell/sugar-shell"
Diffstat (limited to 'shell/view')
-rw-r--r-- | shell/view/ActivityHost.py | 3 | ||||
-rw-r--r-- | shell/view/FirstTimeDialog.py | 33 | ||||
-rw-r--r-- | shell/view/home/MyIcon.py | 3 |
3 files changed, 22 insertions, 17 deletions
diff --git a/shell/view/ActivityHost.py b/shell/view/ActivityHost.py index fe8bc19..4074de2 100644 --- a/shell/view/ActivityHost.py +++ b/shell/view/ActivityHost.py @@ -18,6 +18,7 @@ import gtk import dbus import conf +from sugar import profile from sugar.activity import Activity from sugar.presence import PresenceService from sugar.graphics.iconcolor import IconColor @@ -92,7 +93,7 @@ class ActivityHost: if activity != None: return IconColor(activity.get_color()) else: - return conf.get_profile().get_color() + return profile.get_color() def share(self): self._activity.share() diff --git a/shell/view/FirstTimeDialog.py b/shell/view/FirstTimeDialog.py index 5e878f9..463114a 100644 --- a/shell/view/FirstTimeDialog.py +++ b/shell/view/FirstTimeDialog.py @@ -14,11 +14,14 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -import gtk +import os +from ConfigParser import ConfigParser +import gtk from gettext import gettext as _ -import conf +from sugar.graphics.iconcolor import IconColor +from sugar import env class FirstTimeDialog(gtk.Dialog): def __init__(self): @@ -37,22 +40,24 @@ class FirstTimeDialog(gtk.Dialog): self._ok = gtk.Button(None, gtk.STOCK_OK) self._ok.set_sensitive(False) self.vbox.pack_start(self._ok) - self._ok.connect('clicked', self.__ok_button_clicked_cb) + self._ok.connect('clicked', self._ok_button_clicked_cb) self._ok.show() def _entry_changed_cb(self, entry): valid = (len(entry.get_text()) > 0) self._ok.set_sensitive(valid) - def __ok_button_clicked_cb(self, button): - profile = conf.get_profile() - profile.set_nick_name(self._entry.get_text()) - self.destroy() + def _ok_button_clicked_cb(self, button): + cp = ConfigParser() -def get_profile(): - profile = conf.get_profile() - if profile.get_nick_name() == None: - dialog = FirstTimeDialog() - dialog.connect('destroy', self.__first_time_dialog_destroy_cb) - dialog.show() - return profile + section = 'Buddy' + cp.add_section(section) + cp.set(section, 'NickName', self._entry.get_text()) + cp.set(section, 'Color', IconColor().to_string()) + + config_path = os.path.join(env.get_profile_path(), 'config') + fileobject = open(config_path, 'w') + cp.write(fileobject) + fileobject.close() + + self.destroy() diff --git a/shell/view/home/MyIcon.py b/shell/view/home/MyIcon.py index 8da1692..df59317 100644 --- a/shell/view/home/MyIcon.py +++ b/shell/view/home/MyIcon.py @@ -15,10 +15,9 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA from sugar.graphics.canvasicon import CanvasIcon -import conf +from sugar import profile class MyIcon(CanvasIcon): def __init__(self): - profile = conf.get_profile() CanvasIcon.__init__(self, icon_name='stock-buddy', color=profile.get_color()) |