diff --git a/EDMarketConnector.py b/EDMarketConnector.py index db176767..e81cdf16 100755 --- a/EDMarketConnector.py +++ b/EDMarketConnector.py @@ -85,7 +85,7 @@ class HyperlinkLabel(ttk.Label): class AppWindow: - STATION_UNDOCKED = '-' # "Station" name to display when not docked + STATION_UNDOCKED = '×' # "Station" name to display when not docked = U+00D7 def __init__(self, master): @@ -319,11 +319,9 @@ class AppWindow: else: # Finally - the data looks sane and we're docked at a station + (station_id, has_shipyard, has_outfitting) = EDDB.station(self.system['text'], self.station['text']) - station = EDDB.station(self.system['text'], self.station['text']) - has_shipyard = station and station[1] - - if (config.getint('output') & config.OUT_EDDN) and not data['lastStarport'].get('commodities') and not data['lastStarport'].get('modules') and not has_shipyard: + if (config.getint('output') & config.OUT_EDDN) and not data['lastStarport'].get('commodities') and not has_outfitting and not has_shipyard: self.status['text'] = _("Station doesn't have anything!") elif not data['lastStarport'].get('commodities'): @@ -345,7 +343,9 @@ class AppWindow: self.status['text'] = _('Sending data to EDDN...') self.w.update_idletasks() eddn.export_commodities(data) - eddn.export_outfitting(data) + if has_outfitting: + # Only send if eddb says that the station provides outfitting + eddn.export_outfitting(data) if has_shipyard: # Only send if eddb says that the station has a shipyard - # https://github.com/Marginal/EDMarketConnector/issues/16 @@ -413,9 +413,9 @@ class AppWindow: def station_url(self, text): if text: - station = EDDB.station(self.system['text'], self.station['text']) - if station: - return 'http://eddb.io/station/%d' % station[0] + (station_id, has_shipyard, has_outfitting) = EDDB.station(self.system['text'], self.station['text']) + if station_id: + return 'http://eddb.io/station/%d' % station_id system_id = EDDB.system(self.system['text']) if system_id: diff --git a/eddb.py b/eddb.py index 57128352..9e818672 100755 --- a/eddb.py +++ b/eddb.py @@ -19,9 +19,9 @@ class EDDB: def system(self, system_name): return self.system_ids.get(system_name, 0) # return 0 on failure (0 is not a valid id) - # (system_name, station_name) -> (station_id, has_shipyard) or None + # (system_name, station_name) -> (station_id, has_shipyard, has_outfitting) def station(self, system_name, station_name): - return self.station_ids.get((self.system_ids.get(system_name), station_name)) + return self.station_ids.get((self.system_ids.get(system_name), station_name), (0,False,False)) def respath(self): if getattr(sys, 'frozen', False): @@ -54,6 +54,6 @@ if __name__ == "__main__": cPickle.dump(system_ids, open('systems.p', 'wb'), protocol = cPickle.HIGHEST_PROTOCOL) # station_id by (system_id, station_name) - station_ids = dict([((x['system_id'], str(x['name'])), (x['id'],bool(x['has_shipyard']))) for x in stations]) + station_ids = dict([((x['system_id'], str(x['name'])), (x['id'], bool(x['has_shipyard']), bool(x['has_outfitting']))) for x in stations]) cPickle.dump(station_ids, open('stations.p', 'wb'), protocol = cPickle.HIGHEST_PROTOCOL) diff --git a/stations.p b/stations.p index 215ceb85..b0b48b50 100644 Binary files a/stations.p and b/stations.p differ