Skip to content

Commit 1d66a6f

Browse files
Git4me2daywahender
andauthored
replace generic planet identifiers (, ) with meaningful planet names in both the object list and the details/navigation screen (#390)
Co-authored-by: wahender <wahender@blueclam.local>
1 parent 900a743 commit 1d66a6f

2 files changed

Lines changed: 21 additions & 3 deletions

File tree

python/PiFinder/composite_object.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,12 @@ def __hash__(self):
9797
def from_dict(cls, d):
9898
return cls(**d)
9999

100+
# Planets use their common name; all other catalogs use the standard format.
100101
@property
101102
def display_name(self):
102103
"""
103104
Returns the display name for this object
104105
"""
106+
if self.catalog_code == "PL" and self.names:
107+
return self.names[0]
105108
return f"{self.catalog_code} {self.sequence}"

python/PiFinder/ui/object_list.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -358,10 +358,24 @@ def create_name_text(self, obj: CompositeObject) -> str:
358358
result = ", ".join(dedups)
359359
return result
360360

361+
# Use 3-letter abbreviations for planets instead of PL1, PL2, etc.
362+
# Falls back to full name if planet is not in the dictionary.
361363
def create_shortname_text(self, obj: CompositeObject) -> str:
362-
name = f"{obj.catalog_code}{obj.sequence}"
363-
return name
364-
# return f"{name: <7}"
364+
if obj.catalog_code == "PL" and obj.names:
365+
planet_abbrevs = {
366+
"Mercury": "MER",
367+
"Venus": "VEN",
368+
"Moon": "MON",
369+
"Mars": "MAR",
370+
"Jupiter": "JUP",
371+
"Saturn": "SAT",
372+
"Uranus": "URA",
373+
"Neptune": "NEP",
374+
"Pluto": "PLU",
375+
}
376+
return planet_abbrevs.get(obj.names[0], obj.names[0])
377+
return f"{obj.catalog_code}{obj.sequence}"
378+
365379

366380
def create_locate_text(self, obj: CompositeObject) -> str:
367381
az, alt = aim_degrees(
@@ -372,6 +386,7 @@ def create_locate_text(self, obj: CompositeObject) -> str:
372386
distance = f"{az_txt} {alt_txt}"
373387
else:
374388
distance = "--- ---"
389+
# distance = obj.names[0] if obj.names else "--- ---"
375390

376391
return distance
377392

0 commit comments

Comments
 (0)