1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-15 00:30:33 +03:00

Display Private Group in main window

Fixes #166
This commit is contained in:
Jonathan Harris 2016-12-07 00:55:26 +00:00
parent 4395386ffb
commit c3df78c2c1
2 changed files with 5 additions and 4 deletions

View File

@ -388,7 +388,6 @@ class AppWindow:
with open('dump/%s%s.%s.json' % (data['lastSystem']['name'], data['commander'].get('docked') and '.'+data['lastStarport']['name'] or '', strftime('%Y-%m-%dT%H.%M.%S', localtime())), 'wt') as h:
h.write(json.dumps(data, ensure_ascii=False, indent=2, sort_keys=True, separators=(',', ': ')).encode('utf-8'))
self.cmdr['text'] = data['commander']['name']
self.ship['text'] = companion.ship_map.get(data['ship']['name'].lower(), data['ship']['name'])
if not monitor.shiptype: # Started game in SRV or fighter
monitor.shipid = data['ship']['id']
@ -542,7 +541,7 @@ class AppWindow:
station_changed = monitor.station and self.station['text'] != monitor.station
# Update main window
self.cmdr['text'] = monitor.cmdr or ''
self.cmdr['text'] = monitor.cmdr and monitor.group and ' / '.join([monitor.cmdr, monitor.group]) or monitor.cmdr or ''
self.ship['text'] = monitor.shiptype and companion.ship_map.get(monitor.shiptype, monitor.shiptype) or ''
self.station['text'] = monitor.station or (EDDB.system(monitor.system) and self.STATION_UNDOCKED or '')
if system_changed or station_changed:
@ -742,7 +741,6 @@ class AppWindow:
try:
data = self.session.query()
self.cmdr['text'] = data.get('commander') and data.get('commander').get('name') or ''
self.status['text'] = ''
f = tkFileDialog.asksaveasfilename(parent = self.w,
defaultextension = platform=='darwin' and '.json' or '',

View File

@ -76,6 +76,7 @@ class EDLogs(FileSystemEventHandler):
self.version = None
self.is_beta = False
self.mode = None
self.group = None
self.cmdr = None
self.shipid = None
self.shiptype = None
@ -139,7 +140,7 @@ class EDLogs(FileSystemEventHandler):
if __debug__:
print 'Stopping monitoring'
self.currentdir = None
self.version = self.mode = self.cmdr = self.body = self.system = self.station = self.coordinates = None
self.version = self.mode = self.group = self.cmdr = self.body = self.system = self.station = self.coordinates = None
self.is_beta = False
if self.observed:
self.observed = None
@ -234,6 +235,7 @@ class EDLogs(FileSystemEventHandler):
elif entry['event'] == 'LoadGame':
self.cmdr = entry['Commander']
self.mode = entry.get('GameMode') # 'Open', 'Solo', 'Group', or None for CQC
self.group = entry.get('Group')
self.shiptype = 'Ship' in entry and entry['Ship'] not in ['TestBuggy', 'Empire_Fighter', 'Federation_Fighter', 'Independent_Fighter'] and entry['Ship'].lower() or None # None in CQC. TestBuggy or *_Fighter if game starts in SRV/fighter.
self.shipid = self.shiptype and entry.get('ShipID') or None # None in CQC
self.shippaint = None
@ -245,6 +247,7 @@ class EDLogs(FileSystemEventHandler):
self.credits = ( entry['Credits'], entry['Loan'] )
elif entry['event'] == 'NewCommander':
self.cmdr = entry['Name']
self.group = None
elif entry['event'] == 'ShipyardNew':
self.shipid = entry['NewShipID']
self.shiptype = entry['ShipType'].lower()