Skip to content

Commit 945e01b

Browse files
committed
Add indication if no EDSM data was found
1 parent 32af67c commit 945e01b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

load.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ def __init__(self):
6262
self.values_label: tk.Label | None = None
6363
self.total_label: tk.Label | None = None
6464
self.edsm_button: tk.Label | None = None
65+
self.edsm_failed: tk.Label | None = None
6566

6667
# Plugin state data
6768
self.bodies: dict[str, BodyData] = {}
@@ -128,6 +129,7 @@ def plugin_app(parent: tk.Frame) -> tk.Frame:
128129
this.edsm_button = tk.Label(this.frame, text='Fetch EDSM Data', fg='white', cursor='hand2')
129130
this.edsm_button.grid(row=3, columnspan=2, sticky=tk.EW)
130131
this.edsm_button.bind('<Button-1>', lambda e: edsm_fetch())
132+
this.edsm_failed = tk.Label(this.frame, text='No EDSM Data Found')
131133
update = version_check()
132134
if update != '':
133135
text = 'Version {} is now available'.format(update)
@@ -278,6 +280,9 @@ def edsm_data(event: tk.Event) -> None:
278280
if this.edsm_bodies is None:
279281
return
280282

283+
if len(this.edsm_bodies.get('bodies', [])) == 0:
284+
this.edsm_failed.grid(row=3, columnspan=2, sticky=tk.EW)
285+
281286
for body in this.edsm_bodies.get('bodies', []):
282287
body_short_name = get_body_name(body['name'])
283288
if body['type'] == 'Star':
@@ -831,6 +836,7 @@ def update_display() -> None:
831836
this.edsm_button.grid_remove()
832837
else:
833838
this.edsm_button.grid()
839+
this.edsm_failed.grid_remove()
834840

835841
bio_bodies = dict(sorted(dict(filter(lambda fitem: fitem[1].get_bio_signals() > 0 or len(fitem[1].get_flora()) > 0, this.bodies.items())).items(),
836842
key=lambda item: item[1].get_id()))

0 commit comments

Comments
 (0)