profile creation updated

This commit is contained in:
ingvar1995 2016-02-25 12:35:42 +03:00
parent 47954afc4c
commit 3147d8d14e
2 changed files with 7 additions and 6 deletions

View file

@ -53,10 +53,11 @@ def main():
return return
elif _login.t == 1: # create new profile elif _login.t == 1: # create new profile
# TODO: test # TODO: test
name = _login.name if _login.name else 'Toxygen User' name = _login.name if _login.name else 'toxygen_user'
tox = tox_factory() tox = tox_factory()
tox.self_set_name(name) tox.self_set_name('Toxygen User')
Profile.save_profile(tox.get_savedata()) tox.self_set_status('Toxing on Toxygen')
Profile.save_profile(tox.get_savedata(), name)
else: # load existing profile else: # load existing profile
path, name = _login.get_data() path, name = _login.get_data()
if _login.default: if _login.default:

View file

@ -36,9 +36,9 @@ class Profile(object):
raise IOError('Save file not found. Path: {}'.format(Profile._path)) raise IOError('Save file not found. Path: {}'.format(Profile._path))
@staticmethod @staticmethod
def save_profile(data): def save_profile(data, name=None):
if not hasattr(Profile, '_path'): if name is not None:
Profile._path = Settings.get_default_path() Profile._path = Settings.get_default_path() + name + '.tox'
with open(Profile._path, 'wb') as fl: with open(Profile._path, 'wb') as fl:
fl.write(data) fl.write(data)
print 'Data saved to: {}'.format(Profile._path) print 'Data saved to: {}'.format(Profile._path)