Skip to content

Commit

Permalink
More tests for overlay hiding
Browse files Browse the repository at this point in the history
  • Loading branch information
Silarn committed Mar 24, 2024
1 parent 39f793f commit 4fdd818
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions src/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,15 @@ def __init__(self):
self.db_mismatch: bool = False

# Plugin state
self.odyssey = False
self.odyssey: bool = False
self.game_version = semantic_version.Version('0.0.0')
self.commander: Commander | None = None
self.system: System | None = None
self.system_status: SystemStatus | None = None
self.system_was_scanned = False
self.system_was_mapped = False
self.analysis_mode = True
self.system_was_scanned: bool = False
self.system_was_mapped: bool = False
self.analysis_mode: bool = True
self.in_flight: bool = False
self.bodies: dict[str, PlanetData | StarData] = {}
self.non_bodies: dict[str, NonBodyData] = {}
self.body_values: dict[str, BodyValueData] = {}
Expand Down Expand Up @@ -739,9 +740,24 @@ def process_data_event(entry: Mapping[str, Any]) -> None:

def dashboard_entry(cmdr: str, is_beta: bool, entry: dict[str, any]) -> str:
status = StatusFlags(entry['Flags'])
update = False

if this.analysis_mode != (StatusFlags.IS_ANALYSIS_MODE in status):
this.analysis_mode = (StatusFlags.IS_ANALYSIS_MODE in status)
update = True

in_flight = False
if StatusFlags.IN_SHIP in status:
if (StatusFlags.DOCKED in status) or (StatusFlags.LANDED in status):
in_flight = False
else:
in_flight = True

if in_flight != this.in_flight:
this.in_flight = in_flight
update = True

if update:
update_display()

return ''
Expand Down Expand Up @@ -980,7 +996,7 @@ def format_body(body_name: str) -> str:
this.formatter.format_credits(int(total_value * .125)))

if this.use_overlay.get() and this.overlay.available():
if this.analysis_mode:
if this.analysis_mode and this.in_flight:
if this.label['text']:
overlay_text = this.label['text'] + "\n \n" + this.total_label['text']
this.overlay.display("pioneer_text", overlay_text,
Expand Down

0 comments on commit 4fdd818

Please sign in to comment.