Fix location_filters_ok function to check for multiple locations

This commit is contained in:
alessandro90
2019-06-07 23:37:28 +02:00
parent 8859495068
commit de05cf9872

View File

@@ -1391,15 +1391,20 @@ class Artemis(QMainWindow, Ui_MainWindow):
ok.append(item.text(0) == signal_mode) ok.append(item.text(0) == signal_mode)
return any(ok) return any(ok)
def get_field_entries(self, signal_name, field):
return [
x.strip() for x in self.db.at[
signal_name, field
].split(Constants.FIELD_SEPARATOR)
]
def modulation_filters_ok(self, signal_name): def modulation_filters_ok(self, signal_name):
"""Evalaute if the signal matches the modulation filters.""" """Evalaute if the signal matches the modulation filters."""
if not self.apply_remove_modulation_filter_btn.isChecked(): if not self.apply_remove_modulation_filter_btn.isChecked():
return True return True
signal_modulation = [ signal_modulation = self.get_field_entries(
x.strip() for x in self.db.at[ signal_name, Signal.MODULATION
signal_name, Signal.MODULATION )
].split(Constants.FIELD_SEPARATOR)
]
for item in self.modulation_list.selectedItems(): for item in self.modulation_list.selectedItems():
if item.text() in signal_modulation: if item.text() in signal_modulation:
return True return True
@@ -1409,9 +1414,11 @@ class Artemis(QMainWindow, Ui_MainWindow):
"""Evalaute if the signal matches the location filters.""" """Evalaute if the signal matches the location filters."""
if not self.apply_remove_location_filter_btn.isChecked(): if not self.apply_remove_location_filter_btn.isChecked():
return True return True
signal_location = self.db.at[signal_name, Signal.LOCATION] signal_locations = self.get_field_entries(
signal_name, Signal.LOCATION
)
for item in self.locations_list.selectedItems(): for item in self.locations_list.selectedItems():
if item.text() == signal_location: if item.text() in signal_locations:
return True return True
return False return False