Skip to content

Commit

Permalink
bugfixes (#16)
Browse files Browse the repository at this point in the history
* display new windows per-callsign

* structure fields in grid

* check for network connectivity before sending packets

* variable reference fix

* logging

* add minimum time intervals to connections

* fix username setting

* test on macos

* job name

* use `psycopg2-binary`

* update README.md

* minimize windows on close
  • Loading branch information
zacharyburnett authored Oct 7, 2020
1 parent 7b20cdf commit 3a2636a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
14 changes: 14 additions & 0 deletions client/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ def __init__(self, callsigns: [str] = None, log_filename: PathLike = None, outpu
if self.output_filename is None:
self.output_filename = Path('~') / 'Desktop'

self.__windows['main'].protocol("WM_DELETE_WINDOW", self.close)

main_window.mainloop()

@property
Expand Down Expand Up @@ -548,10 +550,17 @@ def retrieve_packets(self):
separator = Separator(window, orient=tkinter.VERTICAL)
separator.grid(row=0, column=3, rowspan=window.grid_size()[1] + 2, sticky='ns', padx=10)

window.protocol("WM_DELETE_WINDOW", window.iconify)

self.__windows[callsign] = window

window = self.__windows[callsign]

if window.state() == 'iconic':
window.deiconify()
if window.focus_get() is None:
window.focus_force()

set_child_states(window)

packet_track = self.packet_tracks[callsign]
Expand Down Expand Up @@ -596,6 +605,11 @@ def replace_text(element: tkinter.Entry, value: str):
element.delete(start_index, tkinter.END)
element.insert(start_index, value)

def close(self):
if self.active:
self.toggle()
self.__windows['main'].destroy()


def set_child_states(frame: tkinter.Frame, state: str = None, types: [type] = None):
if state is None:
Expand Down
2 changes: 1 addition & 1 deletion client/retrieve.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def retrieve_packets(connections: [APRSPacketConnection], packet_tracks: [APRSTr

if callsign not in packet_tracks:
packet_tracks[callsign] = APRSTrack(callsign, [parsed_packet])
logger.debug(f'started tracking {callsign:8}')
logger.debug(f'started tracking callsign {callsign:8}')
else:
packet_track = packet_tracks[callsign]
if parsed_packet not in packet_track:
Expand Down
3 changes: 1 addition & 2 deletions packetraven/connections.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from abc import ABC, abstractmethod
from datetime import datetime, timedelta
import logging
from os import PathLike
from pathlib import Path
import re
Expand Down Expand Up @@ -247,7 +246,7 @@ def packets(self) -> [APRSPacket]:
packets = [APRSPacket.from_raw_aprs(packet_candidate, source=self.location)
for packet_candidate in response['entries']]
else:
logging.warning(f'query failure "{response["code"]}: {response["description"]}"')
LOGGER.warning(f'query failure "{response["code"]}: {response["description"]}"')
packets = []

self.__last_access_time = datetime.now()
Expand Down
2 changes: 1 addition & 1 deletion packetraven/tracks.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def time_to_ground(self) -> timedelta:
if current_ascent_rate < 0:
# TODO implement landing location as the intersection of the predicted descent track with a local DEM
# TODO implement a time to impact calc based off of standard atmo
return self.packets[-1].coordinates[2] / current_ascent_rate
return timedelta(seconds=self.packets[-1].coordinates[2] / current_ascent_rate)
else:
return timedelta(seconds=-1)

Expand Down

0 comments on commit 3a2636a

Please sign in to comment.