Fix the bug where leaving the program open makes us always fail due to being logged out.

Also, some major refactoring to make the gui code cleaner.
This commit is contained in:
Anna Rose Wiggins 2016-01-28 11:52:09 -05:00
parent 4fdd7ba705
commit 0c2626ee5b
4 changed files with 191 additions and 134 deletions

18
actions.py Normal file
View file

@ -0,0 +1,18 @@
"""
This module mostly serves as a shim between the elite_api library and the rest of our program.
"""
from elite_api import companion
from elite_api.inara import InaraSession
def do_logins(settings):
inara_session = InaraSession(settings.get('inara', 'username'), settings.get('inara', 'password'))
companion.login(settings.get('ed_companion', 'username'), settings.get('ed_companion', 'password'))
return inara_session
def update_inara(inara_session):
data = companion.get_data()
inara_session.update_credits(data['commander']['credits'])
inara_session.update_location(data['lastSystem']['name'])