rename collect -> filter

This commit is contained in:
Jakob Ketterl 2020-03-24 22:16:11 +01:00
parent f30cf3fecd
commit 25b287344f
8 changed files with 13 additions and 13 deletions

View File

@ -199,7 +199,7 @@ class OpenWebRxReceiverClient(Client):
stack = PropertyStack()
stack.addLayer(0, self.sdr.getProps())
stack.addLayer(1, Config.get())
configProps = stack.collect(*OpenWebRxReceiverClient.config_keys)
configProps = stack.filter(*OpenWebRxReceiverClient.config_keys)
def sendConfig(key, value):
#config = dict((key, configProps[key]) for key in OpenWebRxReceiverClient.config_keys)
@ -257,7 +257,7 @@ class OpenWebRxReceiverClient(Client):
stack = PropertyStack()
stack.addLayer(0, self.sdr.getProps())
stack.addLayer(1, config)
protected = stack.collect(*keys)
protected = stack.filter(*keys)
for key, value in params.items():
protected[key] = value
@ -335,7 +335,7 @@ class MapConnection(Client):
super().__init__(conn)
pm = Config.get()
self.write_config(pm.collect("google_maps_api_key", "receiver_gps", "map_position_retention_time").__dict__())
self.write_config(pm.filter("google_maps_api_key", "receiver_gps", "map_position_retention_time").__dict__())
Map.getSharedInstance().addClient(self)

View File

@ -26,7 +26,7 @@ class DspManager(csdr.output):
self.props = PropertyStack()
# local demodulator properties not forwarded to the sdr
self.props.addLayer(0, PropertyLayer().collect(
self.props.addLayer(0, PropertyLayer().filter(
"output_rate",
"squelch_level",
"secondary_mod",
@ -37,7 +37,7 @@ class DspManager(csdr.output):
"secondary_offset_freq",
))
# properties that we inherit from the sdr
self.props.addLayer(1, self.sdrSource.getProps().collect(
self.props.addLayer(1, self.sdrSource.getProps().filter(
"audio_compression",
"fft_compression",
"digimodes_fft_size",
@ -84,7 +84,7 @@ class DspManager(csdr.output):
self.props.wireProperty("digital_voice_unvoiced_quality", self.dsp.set_unvoiced_quality),
self.props.wireProperty("dmr_filter", self.dsp.set_dmr_filter),
self.props.wireProperty("temporary_directory", self.dsp.set_temporary_directory),
self.props.collect("center_freq", "offset_freq").wire(set_dial_freq),
self.props.filter("center_freq", "offset_freq").wire(set_dial_freq),
]
self.dsp.set_offset_freq(0)

View File

@ -17,7 +17,7 @@ class SpectrumThread(csdr.output):
stack = PropertyStack()
stack.addLayer(0, self.sdrSource.props)
stack.addLayer(1, Config.get())
self.props = props = stack.collect(
self.props = props = stack.filter(
"samp_rate",
"fft_size",
"fft_fps",
@ -51,7 +51,7 @@ class SpectrumThread(csdr.output):
props.wireProperty("fft_fps", dsp.set_fft_fps),
props.wireProperty("fft_compression", dsp.set_fft_compression),
props.wireProperty("temporary_directory", dsp.set_temporary_directory),
props.collect("samp_rate", "fft_size", "fft_fps", "fft_voverlap_factor").wire(set_fft_averages),
props.filter("samp_rate", "fft_size", "fft_fps", "fft_voverlap_factor").wire(set_fft_averages),
]
set_fft_averages(None, None)

View File

@ -44,7 +44,7 @@ class PropertyManager(ABC):
def keys(self):
pass
def collect(self, *props):
def filter(self, *props):
return PropertyFilter(self, *props)
def wire(self, callback):

View File

@ -14,7 +14,7 @@ class SdrHuUpdater(threading.Thread):
super().__init__(daemon=True)
def update(self):
pm = Config.get().collect("server_hostname", "web_port", "sdrhu_key")
pm = Config.get().filter("server_hostname", "web_port", "sdrhu_key")
data = parse.urlencode({
"url": "http://{server_hostname}:{web_port}".format(**pm.__dict__()),
"apikey": pm["sdrhu_key"]

View File

@ -57,7 +57,7 @@ class ServiceHandler(object):
self.startupTimer = None
self.source.addClient(self)
props = self.source.getProps()
props.collect("center_freq", "samp_rate").wire(self.onFrequencyChange)
props.filter("center_freq", "samp_rate").wire(self.onFrequencyChange)
if self.source.isAvailable():
self.scheduleServiceStartup()
self.scheduler = None

View File

@ -210,7 +210,7 @@ class ServiceScheduler(object):
self.source.addClient(self)
props = self.source.getProps()
self.schedule = Schedule.parse(props)
props.collect("center_freq", "samp_rate").wire(self.onFrequencyChange)
props.filter("center_freq", "samp_rate").wire(self.onFrequencyChange)
self.scheduleSelection()
def shutdown(self):

View File

@ -38,7 +38,7 @@ class SdrSource(ABC):
# layer 0 reserved for profile properties
self.props.addLayer(1, props)
self.props.addLayer(2, Config.get())
self.rtlProps = self.props.collect(*self.getEventNames())
self.rtlProps = self.props.filter(*self.getEventNames())
self.profile_id = None
self.activateProfile()