mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-17 17:42:20 +03:00
Ensure ship type/name is only clickable when we have the data for it.
This is keyed off monitor.state['Modules'] because that's what monitor.py EDLogs.ship() uses.
This commit is contained in:
parent
a9c4c191e9
commit
74656f45c9
@ -831,6 +831,13 @@ class AppWindow(object):
|
||||
monitor.state['ShipID'] = data['ship']['id']
|
||||
monitor.state['ShipType'] = data['ship']['name'].lower()
|
||||
|
||||
if not monitor.state['Modules']:
|
||||
self.ship.configure(state=tk.DISABLED)
|
||||
|
||||
# We might have disabled this in the conditional above.
|
||||
if monitor.state['Modules']:
|
||||
self.ship.configure(state=True)
|
||||
|
||||
if data['commander'].get('credits') is not None:
|
||||
monitor.state['Credits'] = data['commander']['credits']
|
||||
monitor.state['Loan'] = data['commander'].get('debt', 0)
|
||||
@ -938,7 +945,14 @@ class AppWindow(object):
|
||||
if not ship_text:
|
||||
ship_text = ''
|
||||
|
||||
self.ship.configure(text=ship_text, url=self.shipyard_url)
|
||||
# Ensure the ship type/name text is clickable, if it should be.
|
||||
if monitor.state['Modules']:
|
||||
ship_state = True
|
||||
|
||||
else:
|
||||
ship_state = tk.DISABLED
|
||||
|
||||
self.ship.configure(text=ship_text, url=self.shipyard_url, state=ship_state)
|
||||
|
||||
else:
|
||||
self.cmdr['text'] = ''
|
||||
|
Loading…
x
Reference in New Issue
Block a user