From 4f162157204de2631b1064bbd7c9dcf7ee91f928 Mon Sep 17 00:00:00 2001 From: Jonathan Harris Date: Sat, 9 Jan 2016 13:23:26 +0000 Subject: [PATCH] Perform basic update before invoking plugins. Update display and fixup commodities. --- EDMarketConnector.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/EDMarketConnector.py b/EDMarketConnector.py index b11bf69f..4c077920 100755 --- a/EDMarketConnector.py +++ b/EDMarketConnector.py @@ -289,8 +289,6 @@ class AppWindow: with open('%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).encode('utf-8')) - plug.notify_newdata(data) - self.cmdr['text'] = data.get('commander') and data.get('commander').get('name') or '' self.system['text'] = data.get('lastSystem') and data.get('lastSystem').get('name') or '' self.station['text'] = data.get('commander') and data.get('commander').get('docked') and data.get('lastStarport') and data.get('lastStarport').get('name') or (EDDB.system(self.system['text']) and self.STATION_UNDOCKED or '') @@ -298,7 +296,12 @@ class AppWindow: self.edit_menu.entryconfigure(_('Copy'), state=tk.NORMAL) self.view_menu.entryconfigure(_('Status'), state=tk.NORMAL) + if data['lastStarport'].get('commodities'): + # Fixup anomalies in the commodity data + self.session.fixup(data['lastStarport']['commodities']) + # stuff we can do when not docked + plug.notify_newdata(data) if config.getint('output') & config.OUT_SHIP_EDS: loadout.export(data) if config.getint('output') & config.OUT_SHIP_CORIOLIS: @@ -355,9 +358,6 @@ class AppWindow: else: if data['lastStarport'].get('commodities'): - # Fixup anomalies in the commodity data - self.session.fixup(data['lastStarport']['commodities']) - if config.getint('output') & config.OUT_CSV: bpc.export(data, True) if config.getint('output') & config.OUT_TD: @@ -447,10 +447,11 @@ class AppWindow: if self.system['text'] != system: self.system['text'] = system - plug.notify_system_changed(timestamp, system) - self.system['image'] = '' self.station['text'] = EDDB.system(system) and self.STATION_UNDOCKED or '' + + plug.notify_system_changed(timestamp, system) + if config.getint('output') & config.OUT_LOG_FILE: flightlog.writelog(timestamp, system) if config.getint('output') & config.OUT_LOG_EDSM: