Allow table columns to be toggled on and off. #19

This commit is contained in:
Ian Renton
2025-10-12 17:17:26 +01:00
parent e3d342c5d6
commit bb2813c2a5
6 changed files with 306 additions and 57 deletions

View File

@@ -113,6 +113,7 @@ def infer_country_from_callsign(call):
# Infer a DXCC ID from a callsign
def infer_dxcc_id_from_callsign(call):
get_clublog_xml_data_for_callsign("M0TRT")
try:
# Start with the basic country-files.com-based decoder.
dxcc = CALL_INFO_BASIC.get_adif_id(call)
@@ -225,7 +226,8 @@ def get_qrz_data_for_callsign(call):
QRZ_CALLSIGN_DATA_CACHE.add(call, data, expire=604800) # 1 week in seconds
return data
except KeyError:
# QRZ had no info for the call, that's OK
# QRZ had no info for the call, that's OK. Cache a None so we don't try to look this up again
QRZ_CALLSIGN_DATA_CACHE.add(call, None, expire=604800) # 1 week in seconds
return None
else:
return None
@@ -243,7 +245,8 @@ def get_clublog_api_data_for_callsign(call):
CLUBLOG_CALLSIGN_DATA_CACHE.add(call, data, expire=604800) # 1 week in seconds
return data
except KeyError:
# Clublog had no info for the call, that's OK
# Clublog had no info for the call, that's OK. Cache a None so we don't try to look this up again
CLUBLOG_CALLSIGN_DATA_CACHE.add(call, None, expire=604800) # 1 week in seconds
return None
except APIKeyMissingError:
# User API key was wrong, warn
@@ -260,7 +263,8 @@ def get_clublog_xml_data_for_callsign(call):
data = LOOKUP_LIB_CLUBLOG_XML.lookup_callsign(callsign=call)
return data
except KeyError:
# Clublog had no info for the call, that's OK
# Clublog had no info for the call, that's OK. Cache a None so we don't try to look this up again
CLUBLOG_CALLSIGN_DATA_CACHE.add(call, None, expire=604800) # 1 week in seconds
return None
else:
return None
@@ -310,11 +314,21 @@ def infer_latlon_from_callsign_dxcc(call):
try:
data = CALL_INFO_BASIC.get_lat_long(call)
if data and "latitude" in data and "longitude" in data:
return [data["latitude"], data["longitude"]]
loc = [data["latitude"], data["longitude"]]
else:
return None
loc = None
except KeyError:
return None
loc = None
# Couldn't get anything from basic call info database, try Clublog data
if not loc:
data = get_clublog_xml_data_for_callsign(call)
if data and "Lat" in data and "Lon" in data:
loc = [data["Lat"], data["Lon"]]
if not loc:
data = get_clublog_api_data_for_callsign(call)
if data and "Lat" in data and "Lon" in data:
loc = [data["Lat"], data["Lon"]]
return loc
# Infer a grid locator from a callsign (using DXCC, probably very inaccurate)