mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-12 23:37:14 +03:00
parent
a0e5bcd5c6
commit
04f68b535f
@ -465,7 +465,7 @@ class EDLogs(FileSystemEventHandler):
|
|||||||
if k in self.state['Rank']:
|
if k in self.state['Rank']:
|
||||||
self.state['Rank'][k] = (self.state['Rank'][k][0], min(v, 100)) # perhaps not taken promotion mission yet
|
self.state['Rank'][k] = (self.state['Rank'][k][0], min(v, 100)) # perhaps not taken promotion mission yet
|
||||||
elif entry['event'] in ['Reputation', 'Statistics']:
|
elif entry['event'] in ['Reputation', 'Statistics']:
|
||||||
payload = dict(entry)
|
payload = OrderedDict(entry)
|
||||||
payload.pop('event')
|
payload.pop('event')
|
||||||
payload.pop('timestamp')
|
payload.pop('timestamp')
|
||||||
self.state[entry['event']] = payload
|
self.state[entry['event']] = payload
|
||||||
|
15
stats.py
15
stats.py
@ -12,6 +12,7 @@ import myNotebook as nb
|
|||||||
|
|
||||||
import companion
|
import companion
|
||||||
from companion import ship_map
|
from companion import ship_map
|
||||||
|
from l10n import Locale
|
||||||
from monitor import monitor
|
from monitor import monitor
|
||||||
import prefs
|
import prefs
|
||||||
|
|
||||||
@ -159,10 +160,13 @@ def ships(data):
|
|||||||
|
|
||||||
if not data['commander'].get('docked'):
|
if not data['commander'].get('docked'):
|
||||||
# Set current system, not last docked
|
# Set current system, not last docked
|
||||||
return ([ (str(ships[0]['id']), ship_map.get(ships[0]['name'].lower(), ships[0]['name']), ships[0].get('shipName', ''), data['lastSystem']['name'], '', str(ships[0]['value']['total'])) ] +
|
return ([ (str(ships[0]['id']), ship_map.get(ships[0]['name'].lower(), ships[0]['name']), ships[0].get('shipName', ''), data['lastSystem']['name'], '', credits(ships[0]['value']['total'])) ] +
|
||||||
[ (str(ship['id']), ship_map.get(ship['name'].lower(), ship['name']), ship.get('shipName', ''), ship['starsystem']['name'], ship['station']['name'], str(ship['value']['total'])) for ship in ships[1:] if ship])
|
[ (str(ship['id']), ship_map.get(ship['name'].lower(), ship['name']), ship.get('shipName', ''), ship['starsystem']['name'], ship['station']['name'], credits(ship['value']['total'])) for ship in ships[1:] if ship])
|
||||||
|
|
||||||
return [ (str(ship['id']), ship_map.get(ship['name'].lower(), ship['name']), ship.get('shipName', ''), ship['starsystem']['name'], ship['station']['name'], str(ship['value']['total'])) for ship in ships if ship]
|
return [ (str(ship['id']), ship_map.get(ship['name'].lower(), ship['name']), ship.get('shipName', ''), ship['starsystem']['name'], ship['station']['name'], credits(ship['value']['total'])) for ship in ships if ship]
|
||||||
|
|
||||||
|
def credits(value):
|
||||||
|
return Locale.stringFromNumber(value, 0) + ' Cr'
|
||||||
|
|
||||||
def export_ships(data, filename):
|
def export_ships(data, filename):
|
||||||
h = csv.writer(open(filename, 'wb'))
|
h = csv.writer(open(filename, 'wb'))
|
||||||
@ -175,7 +179,6 @@ class StatsDialog():
|
|||||||
|
|
||||||
def __init__(self, app):
|
def __init__(self, app):
|
||||||
self.parent = app.w
|
self.parent = app.w
|
||||||
self.session = app.session
|
|
||||||
self.status = app.status
|
self.status = app.status
|
||||||
self.verify = app.verify
|
self.verify = app.verify
|
||||||
self.showstats()
|
self.showstats()
|
||||||
@ -188,7 +191,7 @@ class StatsDialog():
|
|||||||
self.parent.update_idletasks()
|
self.parent.update_idletasks()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
data = self.session.profile()
|
data = companion.session.profile()
|
||||||
except companion.VerificationRequired:
|
except companion.VerificationRequired:
|
||||||
return prefs.AuthenticationDialog(self.parent, partial(self.verify, self.showstats))
|
return prefs.AuthenticationDialog(self.parent, partial(self.verify, self.showstats))
|
||||||
except companion.ServerError as e:
|
except companion.ServerError as e:
|
||||||
@ -242,7 +245,7 @@ class StatsResults(tk.Toplevel):
|
|||||||
|
|
||||||
page = self.addpage(notebook)
|
page = self.addpage(notebook)
|
||||||
for thing in stats[1:3]:
|
for thing in stats[1:3]:
|
||||||
self.addpagerow(page, [thing[0], thing[1] + ' CR']) # assumes things two and three are money
|
self.addpagerow(page, [thing[0], credits(int(thing[1]))]) # assumes things two and three are money
|
||||||
for thing in stats[3:]:
|
for thing in stats[3:]:
|
||||||
self.addpagerow(page, thing)
|
self.addpagerow(page, thing)
|
||||||
ttk.Frame(page).grid(pady=5) # bottom spacer
|
ttk.Frame(page).grid(pady=5) # bottom spacer
|
||||||
|
Loading…
x
Reference in New Issue
Block a user