avoid using tuples, they don't work in json (future config system)

This commit is contained in:
Jakob Ketterl 2021-02-08 15:34:55 +01:00
parent a083042002
commit 3a1e5ee73c
2 changed files with 16 additions and 5 deletions

View File

@ -318,8 +318,8 @@ fst4_enabled_intervals = [15, 30]
fst4w_enabled_intervals = [120, 300]
# Q65 allows many combinations of intervals and submodes. This setting determines which combinations will be decoded.
# Please use python tuples of (interval: int, mode: str) to specify the combinations. For example:
q65_enabled_combinations = [(30, "A"), (120, "E"), (60, "C")]
# Please use the mode letter followed by the decode interval in seconds to specify the combinations. For example:
q65_enabled_combinations = ["A30", "E120", "C60"]
# JS8 comes in different speeds: normal, slow, fast, turbo. This setting controls which ones are enabled.
js8_enabled_profiles = ["normal", "slow"]

View File

@ -171,7 +171,18 @@ class Q65Profile(WsjtProfile):
def getEnabledProfiles():
config = Config.get()
profiles = config["q65_enabled_combinations"] if "q65_enabled_combinations" in config else []
return [Q65Profile(i, Q65Mode[m]) for i, m in profiles if i in Fst4wProfile.availableIntervals]
def buildProfile(modestring):
mode = Q65Mode[modestring[0]]
interval = int(modestring[1:])
if interval not in Q65Profile.availableIntervals:
logger.warning("%i is not a valid Q65 interval; ignoring mode \"%s\"", interval, modestring)
return None
return Q65Profile(interval, mode)
mapped = [buildProfile(m) for m in profiles]
logger.debug(mapped)
return [p for p in mapped if p is not None]
class WsjtParser(Parser):