diff options
Diffstat (limited to 'shell/view/FirstTimeDialog.py')
-rw-r--r-- | shell/view/FirstTimeDialog.py | 33 |
1 files changed, 19 insertions, 14 deletions
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() |