From 3147d8d14e65846654db8d1fcdbec5bbb1eb7941 Mon Sep 17 00:00:00 2001 From: ingvar1995 Date: Thu, 25 Feb 2016 12:35:42 +0300 Subject: [PATCH] profile creation updated --- src/main.py | 7 ++++--- src/profile.py | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main.py b/src/main.py index 2fea8cd..44c5754 100644 --- a/src/main.py +++ b/src/main.py @@ -53,10 +53,11 @@ def main(): return elif _login.t == 1: # create new profile # TODO: test - name = _login.name if _login.name else 'Toxygen User' + name = _login.name if _login.name else 'toxygen_user' tox = tox_factory() - tox.self_set_name(name) - Profile.save_profile(tox.get_savedata()) + tox.self_set_name('Toxygen User') + tox.self_set_status('Toxing on Toxygen') + Profile.save_profile(tox.get_savedata(), name) else: # load existing profile path, name = _login.get_data() if _login.default: diff --git a/src/profile.py b/src/profile.py index adb6fba..3af4824 100644 --- a/src/profile.py +++ b/src/profile.py @@ -36,9 +36,9 @@ class Profile(object): raise IOError('Save file not found. Path: {}'.format(Profile._path)) @staticmethod - def save_profile(data): - if not hasattr(Profile, '_path'): - Profile._path = Settings.get_default_path() + def save_profile(data, name=None): + if name is not None: + Profile._path = Settings.get_default_path() + name + '.tox' with open(Profile._path, 'wb') as fl: fl.write(data) print 'Data saved to: {}'.format(Profile._path)