Example #1
0
    def undo(self):
        self._model.undo()
        self._nick_alert.hide()
        self._color_alert.hide()

        # Undo gender or age changes
        save_gender(self._saved_gender)
        save_age(self._saved_age)
Example #2
0
    def undo(self):
        self._model.undo()
        self._nick_alert.hide()
        self._color_alert.hide()

        # Undo gender or age changes
        save_gender(self._saved_gender)
        save_age(self._saved_age)
Example #3
0
def create_profile(user_profile):
    settings = Gio.Settings('org.sugarlabs.user')

    if user_profile.nickname in [None, '']:
        nick = settings.get_string('nick')
        if nick is not None:
            logging.debug('recovering old nickname %s' % (nick))
            user_profile.nickname = nick
    settings.set_string('nick', user_profile.nickname)

    colors = user_profile.colors
    if colors is None:
        colors = XoColor()
    settings.set_string('color', colors.to_string())

    genderpicker.save_gender(user_profile.gender)

    agepicker.save_age(user_profile.age)

    # DEPRECATED
    from gi.repository import GConf
    client = GConf.Client.get_default()

    client.set_string('/desktop/sugar/user/nick', user_profile.nickname)

    client.set_string('/desktop/sugar/user/color', colors.to_string())

    client.suggest_sync()

    if profile.get_pubkey() and profile.get_profile().privkey_hash:
        logging.info('Valid key pair found, skipping generation.')
        return

    # Generate keypair
    keypath = os.path.join(env.get_profile_path(), 'owner.key')
    if os.path.exists(keypath):
        os.rename(keypath, keypath + '.broken')
        logging.warning('Existing private key %s moved to %s.broken', keypath,
                        keypath)

    if os.path.exists(keypath + '.pub'):
        os.rename(keypath + '.pub', keypath + '.pub.broken')
        logging.warning('Existing public key %s.pub moved to %s.pub.broken',
                        keypath, keypath)

    logging.debug("Generating user keypair")

    cmd = "ssh-keygen -q -t dsa -f %s -C '' -N ''" % (keypath, )
    (s, o) = commands.getstatusoutput(cmd)
    if s != 0:
        logging.error('Could not generate key pair: %d %s', s, o)

    logging.debug("User keypair generated")
Example #4
0
def create_profile(user_profile):
    settings = Gio.Settings('org.sugarlabs.user')

    if user_profile.nickname in [None, '']:
        nick = settings.get_string('nick')
        if nick is not None:
            logging.debug('recovering old nickname %s' % (nick))
            user_profile.nickname = nick
    settings.set_string('nick', user_profile.nickname)

    colors = user_profile.colors
    if colors is None:
        colors = XoColor()
    settings.set_string('color', colors.to_string())

    genderpicker.save_gender(user_profile.gender)

    agepicker.save_age(user_profile.age)

    # DEPRECATED
    from gi.repository import GConf
    client = GConf.Client.get_default()

    client.set_string('/desktop/sugar/user/nick', user_profile.nickname)

    client.set_string('/desktop/sugar/user/color', colors.to_string())

    client.suggest_sync()

    if profile.get_pubkey() and profile.get_profile().privkey_hash:
        logging.info('Valid key pair found, skipping generation.')
        return

    # Generate keypair
    keypath = os.path.join(env.get_profile_path(), 'owner.key')
    if os.path.exists(keypath):
        os.rename(keypath, keypath + '.broken')
        logging.warning('Existing private key %s moved to %s.broken',
                        keypath, keypath)

    if os.path.exists(keypath + '.pub'):
        os.rename(keypath + '.pub', keypath + '.pub.broken')
        logging.warning('Existing public key %s.pub moved to %s.pub.broken',
                        keypath, keypath)

    logging.debug("Generating user keypair")

    cmd = "ssh-keygen -q -t dsa -f %s -C '' -N ''" % (keypath, )
    (s, o) = commands.getstatusoutput(cmd)
    if s != 0:
        logging.error('Could not generate key pair: %d %s', s, o)

    logging.debug("User keypair generated")
Example #5
0
 def __age_changed_cb(self, event, age):
     save_age(age)
Example #6
0
 def __age_changed_cb(self, event, age):
     save_age(age)
Example #7
0
 def __age_changed_cb(event, age):
     save_age(age)