diff --git a/default_config.json b/default_config.json index fbaae5f5..6cadfcb0 100644 --- a/default_config.json +++ b/default_config.json @@ -1,13 +1,6 @@ { "display_brightness": 255, "keypad_brightness": "0", - "last_location": { - "lat": 34.0, - "lon": -118.0, - "altitude": 51.0, - "gps_lock": false, - "timezone": "America/Los_Angeles" - }, "camera_exp": 400000, "camera_gain": 20, "menu_anim_speed": 0.1, diff --git a/pifinder_post_update.sh b/pifinder_post_update.sh old mode 100644 new mode 100755 index e87db3ed..05d38654 --- a/pifinder_post_update.sh +++ b/pifinder_post_update.sh @@ -1,26 +1,26 @@ git submodule update --init --recursive -sudo pip install -r /home/pifinder/PiFinder/python/requirements.txt +# sudo pip install -r ./python/ments.txt # Set up migrations folder if it does not exist -if ! [ -d "/home/pifinder/PiFinder_data/migrations" ] +if ! [ -d "~/PiFinder_data/migrations" ] then - mkdir /home/pifinder/PiFinder_data/migrations + mkdir ~/PiFinder_data/migrations fi # v1.x.x # everying prior to selecitve migrations -if ! [ -f "/home/pifinder/PiFinder_data/migrations/v1.x.x" ] +if ! [ -f "~/PiFinder_data/migrations/v1.x.x" ] then - source /home/pifinder/PiFinder/migration_source/v1.x.x.sh - touch /home/pifinder/PiFinder_data/migrations/v1.x.x + source ./migration_source/v1.x.x.sh + touch ~/PiFinder_data/migrations/v1.x.x fi # v2.1.0 # Switch to Cedar -if ! [ -f "/home/pifinder/PiFinder_data/migrations/v2.1.0" ] +if ! [ -f "~/PiFinder_data/migrations/v2.1.0" ] then - source /home/pifinder/PiFinder/migration_source/v2.1.0.sh - touch /home/pifinder/PiFinder_data/migrations/v2.1.0 + source ./migration_source/v2.1.0.sh + touch ~/PiFinder_data/migrations/v2.1.0 fi # DONE diff --git a/python/PiFinder/calc_utils.py b/python/PiFinder/calc_utils.py index 65d211d1..c085b2ce 100755 --- a/python/PiFinder/calc_utils.py +++ b/python/PiFinder/calc_utils.py @@ -142,14 +142,14 @@ def aim_degrees(shared_state, mount_type, screen_direction, target): solution = shared_state.solution() location = shared_state.location() dt = shared_state.datetime() - if location and dt and solution: + if location.lock and dt and solution: if mount_type == "Alt/Az": if solution["Alt"]: # We have position and time/date! sf_utils.set_location( - location["lat"], - location["lon"], - location["altitude"], + location.lat, + location.lon, + location.altitude, ) target_alt, target_az = sf_utils.radec_to_altaz( target.ra, @@ -180,8 +180,8 @@ def calc_object_altitude(shared_state, obj) -> Optional[float]: dt = shared_state.datetime() if location and dt and solution: aa = FastAltAz( - location["lat"], - location["lon"], + location.lat, + location.lon, dt, ) alt, _ = aa.radec_to_altaz( @@ -412,6 +412,8 @@ def calc_planets(self, dt): 'altaz': (1.667930045300066, 228.61434416619613)}, } """ + if not self.observer_loc: + return {} t = self.ts.from_datetime(dt) observer = self.observer_loc.at(t) planet_dict = {} diff --git a/python/PiFinder/catalogs.py b/python/PiFinder/catalogs.py index dff8384d..b2cbf442 100644 --- a/python/PiFinder/catalogs.py +++ b/python/PiFinder/catalogs.py @@ -182,8 +182,8 @@ def calc_fast_aa(self, shared_state): dt = shared_state.datetime() if location and dt and solution: self.fast_aa = calc_utils.FastAltAz( - location["lat"], - location["lon"], + location.lat, + location.lon, dt, ) else: @@ -643,8 +643,9 @@ def init_planets(self, dt): planet_dict = sf_utils.calc_planets(dt) sequence = 0 for name in sf_utils.planet_names: - if name.lower() != "sun": - self.add_planet(sequence, name, planet_dict[name]) + planet_data = planet_dict.get(name, None) + if name.lower() != "sun" and planet_data: + self.add_planet(sequence, name, planet_data) sequence += 1 with self.virtual_id_lock: new_low = self.assign_virtual_object_ids(self, self.virtual_id_low) diff --git a/python/PiFinder/config.py b/python/PiFinder/config.py index a561692b..34f93c54 100644 --- a/python/PiFinder/config.py +++ b/python/PiFinder/config.py @@ -24,6 +24,7 @@ def __init__(self): self._config_dict = {} else: with open(self.config_file_path, "r") as config_file: + print("Loading config from", self.config_file_path) self._config_dict = json.load(config_file) # open default default_config diff --git a/python/PiFinder/gps_fake.py b/python/PiFinder/gps_fake.py index f2786e32..04f7eac9 100644 --- a/python/PiFinder/gps_fake.py +++ b/python/PiFinder/gps_fake.py @@ -23,7 +23,7 @@ def gps_monitor(gps_queue, console_queue, log_queue): time.sleep(0.5) fix = ( "fix", - {"lat": 34.22, "lon": -118.22, "altitude": 22}, + {"lat": 34.22, "lon": -118.22, "altitude": 22, "source": "fakeGPS"}, ) gps_queue.put(fix) tm = ("time", datetime.datetime.now()) diff --git a/python/PiFinder/gps_pi.py b/python/PiFinder/gps_pi.py index 741b4c7d..4ef42541 100644 --- a/python/PiFinder/gps_pi.py +++ b/python/PiFinder/gps_pi.py @@ -111,6 +111,23 @@ async def gps_main(gps_queue, console_queue, log_queue): client, gps_queue, console_queue, gps_locked ), ) + logger.debug("last reading is %s", result) + if result.get("lat") and result.get("lon") and result.get("altHAE"): + if gps_locked is False: + gps_locked = True + console_queue.put("GPS: Locked") + logger.debug("GPS locked") + msg = ( + "fix", + { + "lat": result.get("lat"), + "lon": result.get("lon"), + "altitude": result.get("altHAE"), + "source": "GPS", + }, + ) + logger.debug("GPS fix: %s", msg) + gps_queue.put(msg) logger.debug("GPS sleeping now for 7s") await asyncio.sleep(7) diff --git a/python/PiFinder/integrator.py b/python/PiFinder/integrator.py index e5c34bbd..de48385c 100644 --- a/python/PiFinder/integrator.py +++ b/python/PiFinder/integrator.py @@ -103,9 +103,9 @@ def integrator(shared_state, solver_queue, console_queue, log_queue, is_debug=Fa if location and dt: # We have position and time/date! calc_utils.sf_utils.set_location( - location["lat"], - location["lon"], - location["altitude"], + location.lat, + location.lon, + location.altitude, ) alt, az = calc_utils.sf_utils.radec_to_altaz( solved["RA"], diff --git a/python/PiFinder/main.py b/python/PiFinder/main.py index 33ab0980..1aa1c0cf 100644 --- a/python/PiFinder/main.py +++ b/python/PiFinder/main.py @@ -44,7 +44,7 @@ from PiFinder.ui.console import UIConsole from PiFinder.ui.menu_manager import MenuManager -from PiFinder.state import SharedStateObj, UIState +from PiFinder.state import SharedStateObj, UIState, Location from PiFinder.image_util import subtract_background @@ -347,18 +347,18 @@ def main( # Load last location, set lock to false tz_finder = TimezoneFinder() - initial_location = cfg.get_option("last_location") - initial_location["timezone"] = tz_finder.timezone_at( - lat=initial_location["lat"], lng=initial_location["lon"] - ) - initial_location["gps_lock"] = False - initial_location["last_gps_lock"] = None - shared_state.set_location(initial_location) - sf_utils.set_location( - initial_location["lat"], - initial_location["lon"], - initial_location["altitude"], - ) + # initial_location = cfg.get_option("last_location") + # initial_location["timezone"] = tz_finder.timezone_at( + # lat=initial_location["lat"], lng=initial_location["lon"] + # ) + # initial_location["gps_lock"] = False + # initial_location["last_gps_lock"] = None + # shared_state.set_location(initial_location) + # sf_utils.set_location( + # initial_location["lat"], + # initial_location["lon"], + # initial_location["altitude"], + # ) console.write(" Camera") console.update() @@ -479,23 +479,23 @@ def main( if gps_msg == "fix": # logger.debug("GPS fix msg: %s", gps_content) if gps_content["lat"] + gps_content["lon"] != 0: - location = shared_state.location() - location["lat"] = gps_content["lat"] - location["lon"] = gps_content["lon"] - location["altitude"] = gps_content["altitude"] - location["last_gps_lock"] = ( + location: Location = shared_state.location() + location.lat = gps_content["lat"] + location.lon = gps_content["lon"] + location.altitude = gps_content["altitude"] + location.last_gps_lock = ( datetime.datetime.now().time().isoformat()[:8] ) - if location["gps_lock"] is False: + if not location.lock: # Write to config if we just got a lock - location["timezone"] = tz_finder.timezone_at( - lat=location["lat"], lng=location["lon"] + location.timezone = tz_finder.timezone_at( + lat=location.lat, lng=location.lon ) cfg.set_option("last_location", location) console.write( - f'GPS: Location {location["lat"]} {location["lon"]} {location["altitude"]}' + f'GPS: Location {location.lat} {location.lon} {location.altitude}' ) - location["gps_lock"] = True + location.lock = True shared_state.set_location(location) if gps_msg == "time": diff --git a/python/PiFinder/obslog.py b/python/PiFinder/obslog.py index 7cd76228..d117efb8 100644 --- a/python/PiFinder/obslog.py +++ b/python/PiFinder/obslog.py @@ -57,9 +57,9 @@ def session_uuid(self): self.db.create_obs_session( local_time.timestamp(), - location["lat"], - location["lon"], - location["timezone"], + location.lat, + location.lon, + location.timezone, self.__session_uuid, ) diff --git a/python/PiFinder/server.py b/python/PiFinder/server.py index 32654746..e53f431f 100644 --- a/python/PiFinder/server.py +++ b/python/PiFinder/server.py @@ -638,6 +638,7 @@ def gps_lock(lat: float = 50, lon: float = 3, altitude: float = 10): "lat": lat, "lon": lon, "altitude": altitude, + "source": "WEB", }, ) self.gps_queue.put(msg) @@ -679,11 +680,11 @@ def update_gps(self): logging.debug( "self shared state is %s and location is %s", self.shared_state, location ) - if location["gps_lock"] is True: + if location.lock is True: self.gps_locked = True - self.lat = location["lat"] - self.lon = location["lon"] - self.altitude = location["altitude"] + self.lat = location.lat + self.lon = location.lon + self.altitude = location.altitude else: self.gps_locked = False self.lat = None diff --git a/python/PiFinder/state.py b/python/PiFinder/state.py index 343aa951..88e2438c 100644 --- a/python/PiFinder/state.py +++ b/python/PiFinder/state.py @@ -13,6 +13,9 @@ import logging from typing import List from PiFinder.composite_object import CompositeObject +from typing import Optional +from dataclasses import dataclass, asdict +import json logger = logging.getLogger("SharedState") @@ -117,7 +120,7 @@ def __repr__(self): 'Dec_target': 15.347716050003328, 'T_extract': 75.79255499877036, 'Alt': None, 'Az': None, 'solve_source': 'CAM', 'constellation': 'Psc'}, imu={'moving': False, 'move_start': 1695297928.69749, 'move_end': 1695297928.764207, 'pos': [171.39798541261814, 202.7646132036331, 358.2794741322842], 'start_pos': [171.4009455613444, 202.76321535004726, 358.2587208386012], 'status': 3}, - location={'lat': 59.05139745, 'lon': 7.987654, 'altitude': 151.4, 'gps_lock': False, 'timezone': 'Europe/Stockholm', 'last_gps_lock': None}, + location={'lat': 59.05139745, 'lon': 7.987654, 'altitude': 151.4, 'source': 'GPS', gps_lock': False, 'timezone': 'Europe/Stockholm', 'last_gps_lock': None}, datetime=None, screen=, solve_pixel=[305.6970520019531, 351.9438781738281] @@ -125,6 +128,44 @@ def __repr__(self): """ +@dataclass +class Location: + """ + the location of the observer, lat/lon/altitude and the source of the data. + """ + lat: float = 0.0 + lon: float = 0.0 + altitude: float = 0.0 + source: str = "None" + lock: bool = False + timezone: Optional[str] = None + last_gps_lock: Optional[str] = None + + def __str__(self): + return f"Location(lat={self.lat:.6f}, " \ + f"lon={self.lon:.6f}, alt={self.altitude:.1f}m, " \ + f"source={self.source}, alt={self.altitude:.1f}m, " \ + f"Lock: {'Yes' if self.lock else 'No'})" + + def to_dict(self): + """Convert the Location object to a dictionary.""" + return asdict(self) + + def to_json(self): + """Convert the Location object to a JSON string.""" + return json.dumps(self.to_dict()) + + @classmethod + def from_dict(cls, data): + """Create a Location object from a dictionary.""" + return cls(**data) + + @classmethod + def from_json(cls, json_str): + """Create a Location object from a JSON string.""" + data = json.loads(json_str) + return cls.from_dict(data) + class SharedStateObj: def __init__(self): self.__power_state = 1 @@ -139,7 +180,7 @@ def __init__(self): self.__solution = None self.__sats = None self.__imu = None - self.__location = None + self.__location: Location = Location() self.__datetime = None self.__datetime_time = None self.__screen = None @@ -233,7 +274,7 @@ def local_datetime(self): return self.datetime() dt = self.datetime() - return dt.astimezone(pytz.timezone(self.__location["timezone"])) + return dt.astimezone(pytz.timezone(self.__location.timezone)) def set_datetime(self, dt): if dt.tzname() is None: diff --git a/python/PiFinder/ui/base.py b/python/PiFinder/ui/base.py index eba4d191..097d8aa3 100644 --- a/python/PiFinder/ui/base.py +++ b/python/PiFinder/ui/base.py @@ -194,7 +194,7 @@ def screen_update(self, title_bar=True, button_hints=True) -> None: moving = True if imu and imu["pos"] and imu["moving"] else False # GPS status - if self.shared_state.location()["gps_lock"]: + if self.shared_state.location().lock: self._gps_brightness = 0 else: gps_anim = int(128 * (time.time() - self.last_update_time)) + 1 diff --git a/python/PiFinder/ui/console.py b/python/PiFinder/ui/console.py index 5f95766b..36a057f9 100644 --- a/python/PiFinder/ui/console.py +++ b/python/PiFinder/ui/console.py @@ -126,7 +126,7 @@ def screen_update(self, title_bar=True, button_hints=True): moving = True if imu and imu["pos"] and imu["moving"] else False # GPS status - if self.shared_state.location()["gps_lock"]: + if self.shared_state.location().lock: self._gps_brightness = 0 else: gps_anim = int(128 * (time.time() - self.last_update_time)) + 1 diff --git a/python/PiFinder/ui/gpsstatus.py b/python/PiFinder/ui/gpsstatus.py new file mode 100644 index 00000000..27bd1b9b --- /dev/null +++ b/python/PiFinder/ui/gpsstatus.py @@ -0,0 +1,164 @@ +#!/usr/bin/python +# -*- coding:utf-8 -*- +""" +This module contains all the UI Module classes + +""" + +import time +from PiFinder import state_utils +from PiFinder.ui.base import UIModule + + +class UIGPSStatus(UIModule): + """ + UI for seeing GPS status + """ + + __title__ = "GPS" + + def __init__(self, *args, **kwargs) -> None: + super().__init__(*args, **kwargs) + + def update(self, force=False): + state_utils.sleep_for_framerate(self.shared_state) + self.clear_screen() + draw_pos = self.display_class.titlebar_height + 2 + location = self.shared_state.location() + sats = self.shared_state.sats() + if sats is None: + sats = (0, 0) + self.draw.text( + (0, draw_pos), + f"Sats seen: {sats[0]}", + font=self.fonts.base.font, + fill=self.colors.get(128), + ) + draw_pos += 10 + + self.draw.text( + (0, draw_pos), + f"Sats used: {sats[1]}", + font=self.fonts.base.font, + fill=self.colors.get(128), + ) + draw_pos += 10 + + self.draw.text( + (10, draw_pos), + f"Lock: {location.lock}", + font=self.fonts.bold.font, + fill=self.colors.get(192), + ) + draw_pos += 16 + + if location.lock: + self.draw.text( + (0, draw_pos), + f"Source: {location.source}", + font=self.fonts.base.font, + fill=self.colors.get(128), + ) + draw_pos += 10 + + # self.draw.text( + # (10, draw_pos), + # f"{self._release_version}", + # font=self.fonts.bold.font, + # fill=self.colors.get(192), + # ) + # + # if self._wifi_mode != "Client": + # self.draw.text( + # (10, 90), + # "WiFi must be", + # font=self.fonts.large.font, + # fill=self.colors.get(255), + # ) + # self.draw.text( + # (10, 105), + # "client mode", + # font=self.fonts.large.font, + # fill=self.colors.get(255), + # ) + # return self.screen_update() + # + # if self._release_version == "-.-.-": + # self.draw.text( + # (10, 90), + # "Checking for", + # font=self.fonts.large.font, + # fill=self.colors.get(255), + # ) + # self.draw.text( + # (10, 105), + # f"updates{'.' * int(self._elipsis_count / 10)}", + # font=self.fonts.large.font, + # fill=self.colors.get(255), + # ) + # self._elipsis_count += 1 + # if self._elipsis_count > 39: + # self._elipsis_count = 0 + # return self.screen_update() + # + # if self._release_version.strip() == self._software_version.strip(): + # self.draw.text( + # (10, 90), + # "No Update", + # font=self.fonts.large.font, + # fill=self.colors.get(255), + # ) + # self.draw.text( + # (10, 105), + # "needed", + # font=self.fonts.large.font, + # fill=self.colors.get(255), + # ) + # return self.screen_update() + # + # # If we are here, go for update! + # self._go_for_update = True + # self.draw.text( + # (10, 90), + # "Update Now", + # font=self.fonts.large.font, + # fill=self.colors.get(255), + # ) + # self.draw.text( + # (10, 105), + # "Cancel", + # font=self.fonts.large.font, + # fill=self.colors.get(255), + # ) + # if self._option_select == "Update": + # ind_pos = 90 + # else: + # ind_pos = 105 + # self.draw.text( + # (0, ind_pos), + # self._RIGHT_ARROW, + # font=self.fonts.large.font, + # fill=self.colors.get(255), + # ) + + return self.screen_update() + + # def toggle_option(self): + # if not self._go_for_update: + # return + # if self._option_select == "Update": + # self._option_select = "Cancel" + # else: + # self._option_select = "Update" + # + # def key_up(self): + # self.toggle_option() + # + # def key_down(self): + # self.toggle_option() + # + # def key_right(self): + # if self._option_select == "Cancel": + # self.remove_from_stack() + # else: + # self.update_software() diff --git a/python/PiFinder/ui/menu_structure.py b/python/PiFinder/ui/menu_structure.py index 162dfafe..fa941252 100644 --- a/python/PiFinder/ui/menu_structure.py +++ b/python/PiFinder/ui/menu_structure.py @@ -3,6 +3,7 @@ from PiFinder.ui.status import UIStatus from PiFinder.ui.console import UIConsole from PiFinder.ui.software import UISoftware +from PiFinder.ui.gpsstatus import UIGPSStatus from PiFinder.ui.chart import UIChart from PiFinder.ui.align import UIAlign from PiFinder.ui.textentry import UITextEntry @@ -17,196 +18,372 @@ "start_index": 2, "items": [ { - "name": "Camera", - "class": UIPreview, - }, - { - "name": "Align", - "class": UIAlign, - "stateful": True, - "preload": True, - }, - { - "name": "Chart", - "class": UIChart, - "stateful": True, - "preload": True, - }, - { - "name": "Objects", + "name": "Setup", "class": UITextMenu, "select": "single", "items": [ { - "name": "All Filtered", - "class": UIObjectList, - "objects": "catalogs.filtered", + "name": "Focus", + "class": UIPreview, + }, + { + "name": "Align", + "class": UIAlign, + "stateful": True, + "preload": True, }, { - "name": "By Catalog", + "name": "GPS", "class": UITextMenu, "select": "single", "items": [ { - "name": "Planets", - "class": UIObjectList, - "objects": "catalog", - "value": "PL", - }, - { - "name": "Comets", - "class": UIObjectList, - "objects": "catalog", - "value": "CM", - }, - { - "name": "NGC", - "class": UIObjectList, - "objects": "catalog", - "value": "NGC", + "name": "Status", + "class": UIGPSStatus, + "config_option": "location.latitude", }, { - "name": "Messier", - "class": UIObjectList, - "objects": "catalog", - "value": "M", - }, - { - "name": "DSO...", - "class": UITextMenu, - "select": "single", - "items": [ - { - "name": "Abell Pn", - "class": UIObjectList, - "objects": "catalog", - "value": "Abl", - }, - { - "name": "Arp Galaxies", - "class": UIObjectList, - "objects": "catalog", - "value": "Arp", - }, - { - "name": "Barnard", - "class": UIObjectList, - "objects": "catalog", - "value": "B", - }, - { - "name": "Caldwell", - "class": UIObjectList, - "objects": "catalog", - "value": "C", - }, - { - "name": "Collinder", - "class": UIObjectList, - "objects": "catalog", - "value": "Col", - }, - { - "name": "E.G. Globs", - "class": UIObjectList, - "objects": "catalog", - "value": "EGC", - }, - { - "name": "Herschel 400", - "class": UIObjectList, - "objects": "catalog", - "value": "H", - }, - { - "name": "IC", - "class": UIObjectList, - "objects": "catalog", - "value": "IC", - }, - { - "name": "Messier", - "class": UIObjectList, - "objects": "catalog", - "value": "M", - }, - { - "name": "NGC", - "class": UIObjectList, - "objects": "catalog", - "value": "NGC", - }, - { - "name": "Sharpless", - "class": UIObjectList, - "objects": "catalog", - "value": "Sh2", - }, - { - "name": "TAAS 200", - "class": UIObjectList, - "objects": "catalog", - "value": "Ta2", - }, - ], + "name": "Save location", + "class": UITextEntry, + "config_option": "location.longitude", }, { - "name": "Stars...", - "class": UITextMenu, - "select": "single", - "items": [ - { - "name": "Bright Named", - "class": UIObjectList, - "objects": "catalog", - "value": "Str", - }, - { - "name": "SAC Doubles", - "class": UIObjectList, - "objects": "catalog", - "value": "SaM", - }, - { - "name": "SAC Asterisms", - "class": UIObjectList, - "objects": "catalog", - "value": "SaA", - }, - { - "name": "SAC Red Stars", - "class": UIObjectList, - "objects": "catalog", - "value": "SaR", - }, - { - "name": "RASC Doubles", - "class": UIObjectList, - "objects": "catalog", - "value": "RDS", - }, - { - "name": "TLK 90 Variables", - "class": UIObjectList, - "objects": "catalog", - "value": "TLK", - }, - ], + "name": "Set location", + "class": UITextEntry, + "config_option": "location.altitude", }, ], }, - { - "name": "Recent", - "class": UIObjectList, - "objects": "recent", - "label": "recent", - }, - { - "name": "Name Search", - "class": UITextEntry, - }, ], }, + { + "name": "Align", + "class": UIAlign, + "stateful": True, + "preload": True, + }, + { + "name": "Chart", + "class": UIChart, + "stateful": True, + "preload": True, + }, + { + "name": "Objects", + "class": UITextMenu, + "select": "single", + "items": [ + { + "name": "All Filtered", + "class": UIObjectList, + "objects": "catalogs.filtered", + }, + { + "name": "By Catalog", + "class": UITextMenu, + "select": "single", + "items": [ + { + "name": "Planets", + "class": UIObjectList, + "objects": "catalog", + "value": "PL", + }, + { + "name": "NGC", + "class": UIObjectList, + "objects": "catalog", + "value": "NGC", + }, + { + "name": "Messier", + "class": UIObjectList, + "objects": "catalog", + "value": "M", + }, + { + "name": "DSO...", + "class": UITextMenu, + "select": "single", + "items": [ + { + "name": "Abell Pn", + "class": UIObjectList, + "objects": "catalog", + "value": "Abl", + }, + { + "name": "Arp Galaxies", + "class": UIObjectList, + "objects": "catalog", + "value": "Arp", + }, + { + "name": "Barnard", + "class": UIObjectList, + "objects": "catalog", + "value": "B", + }, + { + "name": "Caldwell", + "class": UIObjectList, + "objects": "catalog", + "value": "C", + }, + { + "name": "Collinder", + "class": UIObjectList, + "objects": "catalog", + "value": "Col", + }, + { + "name": "E.G. Globs", + "class": UIObjectList, + "objects": "catalog", + "value": "EGC", + }, + { + "name": "Herschel 400", + "class": UIObjectList, + "objects": "catalog", + "value": "H", + }, + { + "name": "IC", + "class": UIObjectList, + "objects": "catalog", + "value": "IC", + }, + { + "name": "Messier", + "class": UIObjectList, + "objects": "catalog", + "value": "M", + }, + { + "name": "NGC", + "class": UIObjectList, + "objects": "catalog", + "value": "NGC", + }, + { + "name": "Sharpless", + "class": UIObjectList, + "objects": "catalog", + "value": "Sh2", + }, + { + "name": "TAAS 200", + "class": UIObjectList, + "objects": "catalog", + "value": "Ta2", + }, + ], + }, + { + "name": "Stars...", + "class": UITextMenu, + "select": "single", + "items": [ + { + "name": "Bright Named", + "class": UIObjectList, + "objects": "catalog", + "value": "Str", + }, + { + "name": "SAC Doubles", + "class": UIObjectList, + "objects": "catalog", + "value": "SaM", + }, + { + "name": "SAC Asterisms", + "class": UIObjectList, + "objects": "catalog", + "value": "SaA", + }, + { + "name": "SAC Red Stars", + "class": UIObjectList, + "objects": "catalog", + "value": "SaR", + }, + { + "name": "RASC Doubles", + "class": UIObjectList, + "objects": "catalog", + "value": "RDS", + }, + { + "name": "TLK 90 Variables", + "class": UIObjectList, + "objects": "catalog", + "value": "TLK", + }, + ], + }, + ], + }, + { + "name": "By Catalog", + "class": UITextMenu, + "select": "single", + "items": [ + { + "name": "Planets", + "class": UIObjectList, + "objects": "catalog", + "value": "PL", + }, + { + "name": "Comets", + "class": UIObjectList, + "objects": "catalog", + "value": "CM", + }, + { + "name": "NGC", + "class": UIObjectList, + "objects": "catalog", + "value": "NGC", + }, + { + "name": "Messier", + "class": UIObjectList, + "objects": "catalog", + "value": "M", + }, + { + "name": "DSO...", + "class": UITextMenu, + "select": "single", + "items": [ + { + "name": "Abell Pn", + "class": UIObjectList, + "objects": "catalog", + "value": "Abl", + }, + { + "name": "Arp Galaxies", + "class": UIObjectList, + "objects": "catalog", + "value": "Arp", + }, + { + "name": "Barnard", + "class": UIObjectList, + "objects": "catalog", + "value": "B", + }, + { + "name": "Caldwell", + "class": UIObjectList, + "objects": "catalog", + "value": "C", + }, + { + "name": "Collinder", + "class": UIObjectList, + "objects": "catalog", + "value": "Col", + }, + { + "name": "E.G. Globs", + "class": UIObjectList, + "objects": "catalog", + "value": "EGC", + }, + { + "name": "Herschel 400", + "class": UIObjectList, + "objects": "catalog", + "value": "H", + }, + { + "name": "IC", + "class": UIObjectList, + "objects": "catalog", + "value": "IC", + }, + { + "name": "Messier", + "class": UIObjectList, + "objects": "catalog", + "value": "M", + }, + { + "name": "NGC", + "class": UIObjectList, + "objects": "catalog", + "value": "NGC", + }, + { + "name": "Sharpless", + "class": UIObjectList, + "objects": "catalog", + "value": "Sh2", + }, + { + "name": "TAAS 200", + "class": UIObjectList, + "objects": "catalog", + "value": "Ta2", + }, + ], + }, + { + "name": "Stars...", + "class": UITextMenu, + "select": "single", + "items": [ + { + "name": "Bright Named", + "class": UIObjectList, + "objects": "catalog", + "value": "Str", + }, + { + "name": "SAC Doubles", + "class": UIObjectList, + "objects": "catalog", + "value": "SaM", + }, + { + "name": "SAC Asterisms", + "class": UIObjectList, + "objects": "catalog", + "value": "SaA", + }, + { + "name": "SAC Red Stars", + "class": UIObjectList, + "objects": "catalog", + "value": "SaR", + }, + { + "name": "RASC Doubles", + "class": UIObjectList, + "objects": "catalog", + "value": "RDS", + }, + { + "name": "TLK 90 Variables", + "class": UIObjectList, + "objects": "catalog", + "value": "TLK", + }, + ], + }, + ], + }, + { + "name": "Name Search", + "class": UITextEntry, + }, + ], + }, { "name": "Filter", "class": UITextMenu, diff --git a/python/PiFinder/ui/status.py b/python/PiFinder/ui/status.py index 5b808036..79b840be 100644 --- a/python/PiFinder/ui/status.py +++ b/python/PiFinder/ui/status.py @@ -270,11 +270,11 @@ def update_status_dict(self): sats = self.shared_state.sats() self.status_dict["GPS"] = [ f"GPS {sats[0]}/{sats[1]}" if sats else "GPS 0/0", - f"{location['lat']:.2f}/{location['lon']:.2f}", + f"{location.lat:.2f}/{location.lon:.2f}", ] - self.status_dict["GPS ALT"] = f"{location['altitude']:.1f}m" - last_lock = location["last_gps_lock"] + self.status_dict["GPS ALT"] = f"{location.altitude:.1f}m" + last_lock = location.last_gps_lock self.status_dict["GPS LST"] = last_lock if last_lock else "--" dt = self.shared_state.datetime() diff --git a/shell.nix b/shell.nix deleted file mode 100644 index d54e3242..00000000 --- a/shell.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ pkgs ? import {} }: - -pkgs.mkShell { - packages = with pkgs; [ - (python39.withPackages (ps: [ ps.pip ])) - pre-commit - ]; -}