Add location filter screen
This commit is contained in:
61
main.py
61
main.py
@@ -288,7 +288,18 @@ class MyApp(QMainWindow, Ui_MainWindow):
|
|||||||
self.modulation_list])
|
self.modulation_list])
|
||||||
self.apply_remove_modulation_filter_btn.clicked.connect(self.display_signals)
|
self.apply_remove_modulation_filter_btn.clicked.connect(self.display_signals)
|
||||||
self.reset_modulation_filters_btn.clicked.connect(self.reset_modulation_filters)
|
self.reset_modulation_filters_btn.clicked.connect(self.reset_modulation_filters)
|
||||||
self.modulation_list.itemClicked.connect(self.remove_if_unselected)
|
self.modulation_list.itemClicked.connect(self.remove_if_unselected_modulation)
|
||||||
|
|
||||||
|
# Set location filter screen.
|
||||||
|
|
||||||
|
self.locations_list.addItems(Constants.LOCATIONS)
|
||||||
|
self.search_bar_location.textEdited.connect(self.show_matching_locations)
|
||||||
|
self.apply_remove_location_filter_btn.set_texts(Constants.APPLY, Constants.REMOVE)
|
||||||
|
self.apply_remove_location_filter_btn.set_slave_filters([self.search_bar_location,
|
||||||
|
self.locations_list])
|
||||||
|
self.apply_remove_location_filter_btn.clicked.connect(self.display_signals)
|
||||||
|
self.reset_location_filters_btn.clicked.connect(self.reset_location_filters)
|
||||||
|
self.locations_list.itemClicked.connect(self.remove_if_unselected_location)
|
||||||
|
|
||||||
# ##########################################################################################
|
# ##########################################################################################
|
||||||
|
|
||||||
@@ -326,15 +337,27 @@ class MyApp(QMainWindow, Ui_MainWindow):
|
|||||||
self.show()
|
self.show()
|
||||||
|
|
||||||
@pyqtSlot(QListWidgetItem)
|
@pyqtSlot(QListWidgetItem)
|
||||||
def remove_if_unselected(self, item):
|
def remove_if_unselected_modulation(self, item):
|
||||||
if not item.isSelected():
|
if not item.isSelected():
|
||||||
self.show_matching_modulations(self.search_bar_modulation.text())
|
self.show_matching_modulations(self.search_bar_modulation.text())
|
||||||
|
|
||||||
|
@pyqtSlot(QListWidgetItem)
|
||||||
|
def remove_if_unselected_location(self, item):
|
||||||
|
if not item.isSelected():
|
||||||
|
self.show_matching_locations(self.search_bar_location.text())
|
||||||
|
|
||||||
@pyqtSlot(str)
|
@pyqtSlot(str)
|
||||||
def show_matching_modulations(self, text):
|
def show_matching_modulations(self, text):
|
||||||
for index in range(self.modulation_list.count()):
|
self.show_matching_strings(self.modulation_list, text)
|
||||||
item = self.modulation_list.item(index)
|
|
||||||
if self.search_bar_modulation.text().upper() in item.text() or item.isSelected():
|
@pyqtSlot(str)
|
||||||
|
def show_matching_locations(self, text):
|
||||||
|
self.show_matching_strings(self.locations_list, text)
|
||||||
|
|
||||||
|
def show_matching_strings(self, list_elements, text):
|
||||||
|
for index in range(list_elements.count()):
|
||||||
|
item = list_elements.item(index)
|
||||||
|
if text.upper() in item.text() or item.isSelected():
|
||||||
item.setHidden(False)
|
item.setHidden(False)
|
||||||
else:
|
else:
|
||||||
item.setHidden(True)
|
item.setHidden(True)
|
||||||
@@ -558,7 +581,8 @@ class MyApp(QMainWindow, Ui_MainWindow):
|
|||||||
self.band_filters_ok(signal) ,
|
self.band_filters_ok(signal) ,
|
||||||
self.category_filters_ok(signal) ,
|
self.category_filters_ok(signal) ,
|
||||||
self.mode_filters_ok(signal) ,
|
self.mode_filters_ok(signal) ,
|
||||||
self.modulation_filters_ok(signal)]):
|
self.modulation_filters_ok(signal) ,
|
||||||
|
self.location_filters_ok(signal)]) :
|
||||||
self.result_list.item(index).setHidden(False)
|
self.result_list.item(index).setHidden(False)
|
||||||
available_signals += 1
|
available_signals += 1
|
||||||
else:
|
else:
|
||||||
@@ -627,6 +651,14 @@ class MyApp(QMainWindow, Ui_MainWindow):
|
|||||||
if self.modulation_list.item(i).isSelected():
|
if self.modulation_list.item(i).isSelected():
|
||||||
self.modulation_list.item(i).setSelected(False)
|
self.modulation_list.item(i).setSelected(False)
|
||||||
|
|
||||||
|
@pyqtSlot()
|
||||||
|
def reset_location_filters(self):
|
||||||
|
reset_apply_remove_btn(self.apply_remove_location_filter_btn)
|
||||||
|
self.search_bar_location.setText('')
|
||||||
|
for i in range(self.locations_list.count()):
|
||||||
|
if self.locations_list.item(i).isSelected():
|
||||||
|
self.locations_list.item(i).setSelected(False)
|
||||||
|
|
||||||
def frequency_filters_ok(self, signal_name):
|
def frequency_filters_ok(self, signal_name):
|
||||||
if not self.apply_remove_freq_filter_btn.isChecked():
|
if not self.apply_remove_freq_filter_btn.isChecked():
|
||||||
return True
|
return True
|
||||||
@@ -737,6 +769,15 @@ class MyApp(QMainWindow, Ui_MainWindow):
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def location_filters_ok(self, signal_name):
|
||||||
|
if not self.apply_remove_location_filter_btn.isChecked():
|
||||||
|
return True
|
||||||
|
signal_location = self.db.at[signal_name, "location"]
|
||||||
|
for item in self.locations_list.selectedItems():
|
||||||
|
if item.text() == signal_location:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def filters_ok(spinbox, filter_unit, confidence, sign = 1):
|
def filters_ok(spinbox, filter_unit, confidence, sign = 1):
|
||||||
band_filter = spinbox.value() * Constants.CONVERSION_FACTORS[filter_unit.currentText()]
|
band_filter = spinbox.value() * Constants.CONVERSION_FACTORS[filter_unit.currentText()]
|
||||||
@@ -845,9 +886,12 @@ class MyApp(QMainWindow, Ui_MainWindow):
|
|||||||
item = self.result_list.currentItem()
|
item = self.result_list.currentItem()
|
||||||
if item:
|
if item:
|
||||||
spectrogram_name = item.text()
|
spectrogram_name = item.text()
|
||||||
path_spectr = os.path.join(Constants.DATA_FOLDER, Constants.SPECTRA_FOLDER, spectrogram_name + ".png")
|
path_spectr = os.path.join(Constants.DATA_FOLDER,
|
||||||
|
Constants.SPECTRA_FOLDER,
|
||||||
|
spectrogram_name + ".png")
|
||||||
if not QFileInfo(path_spectr).exists():
|
if not QFileInfo(path_spectr).exists():
|
||||||
path_spectr = os.path.join(Constants.ICONS_FOLDER, "spectrumnotavailable.png")
|
path_spectr = os.path.join(Constants.ICONS_FOLDER,
|
||||||
|
"spectrumnotavailable.png")
|
||||||
else:
|
else:
|
||||||
path_spectr = default_pic
|
path_spectr = default_pic
|
||||||
self.spectrogram.setPixmap(QPixmap(path_spectr))
|
self.spectrogram.setPixmap(QPixmap(path_spectr))
|
||||||
@@ -886,6 +930,7 @@ class MyApp(QMainWindow, Ui_MainWindow):
|
|||||||
self.reset_cat_filters_btn.clicked.emit()
|
self.reset_cat_filters_btn.clicked.emit()
|
||||||
self.reset_mode_filters_btn.clicked.emit()
|
self.reset_mode_filters_btn.clicked.emit()
|
||||||
self.reset_modulation_filters_btn.clicked.emit()
|
self.reset_modulation_filters_btn.clicked.emit()
|
||||||
|
self.reset_location_filters_btn.clicked.emit()
|
||||||
|
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
def go_to_web_page_signal(self):
|
def go_to_web_page_signal(self):
|
||||||
|
|||||||
@@ -2716,7 +2716,24 @@ Inactive</string>
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0" colspan="2">
|
<item row="0" column="0" colspan="3">
|
||||||
|
<widget class="QPushButton" name="include_undef_freqs">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>12</pointsize>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Include undefined frequencies</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0" colspan="3">
|
||||||
<widget class="DoubleTextButton" name="apply_remove_freq_filter_btn">
|
<widget class="DoubleTextButton" name="apply_remove_freq_filter_btn">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
@@ -2736,7 +2753,7 @@ Inactive</string>
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0" colspan="2">
|
<item row="4" column="0" colspan="3">
|
||||||
<widget class="QPushButton" name="reset_frequency_filters_btn">
|
<widget class="QPushButton" name="reset_frequency_filters_btn">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
@@ -2750,23 +2767,6 @@ Inactive</string>
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0" colspan="3">
|
|
||||||
<widget class="QPushButton" name="include_undef_freqs">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<pointsize>12</pointsize>
|
|
||||||
<weight>75</weight>
|
|
||||||
<bold>true</bold>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Include undefined frequencies</string>
|
|
||||||
</property>
|
|
||||||
<property name="checkable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="tab_4">
|
<widget class="QWidget" name="tab_4">
|
||||||
@@ -3876,8 +3876,8 @@ Inactive</string>
|
|||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
<pointsize>12</pointsize>
|
<pointsize>12</pointsize>
|
||||||
<weight>75</weight>
|
<weight>50</weight>
|
||||||
<bold>true</bold>
|
<bold>false</bold>
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="editTriggers">
|
<property name="editTriggers">
|
||||||
@@ -3962,7 +3962,7 @@ Inactive</string>
|
|||||||
<widget class="QWidget" name="widget_10" native="true">
|
<widget class="QWidget" name="widget_10" native="true">
|
||||||
<layout class="QGridLayout" name="gridLayout_10">
|
<layout class="QGridLayout" name="gridLayout_10">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLineEdit" name="lineEdit"/>
|
<widget class="QLineEdit" name="search_bar_location"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QLabel" name="label_10">
|
<widget class="QLabel" name="label_10">
|
||||||
@@ -3990,7 +3990,16 @@ Inactive</string>
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0" colspan="2">
|
<item row="1" column="0" colspan="2">
|
||||||
<widget class="QListWidget" name="listWidget"/>
|
<widget class="QListWidget" name="locations_list">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>12</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="selectionMode">
|
||||||
|
<enum>QAbstractItemView::MultiSelection</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
@@ -4009,7 +4018,7 @@ Inactive</string>
|
|||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0" colspan="3">
|
<item row="1" column="0" colspan="3">
|
||||||
<widget class="QPushButton" name="pushButton">
|
<widget class="DoubleTextButton" name="apply_remove_location_filter_btn">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
<pointsize>12</pointsize>
|
<pointsize>12</pointsize>
|
||||||
@@ -4026,7 +4035,7 @@ Inactive</string>
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0" colspan="3">
|
<item row="2" column="0" colspan="3">
|
||||||
<widget class="QPushButton" name="pushButton_2">
|
<widget class="QPushButton" name="reset_location_filters_btn">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
<pointsize>12</pointsize>
|
<pointsize>12</pointsize>
|
||||||
@@ -4038,7 +4047,7 @@ Inactive</string>
|
|||||||
<string>Reset</string>
|
<string>Reset</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="checkable">
|
<property name="checkable">
|
||||||
<bool>true</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
38
utilities.py
38
utilities.py
@@ -44,7 +44,7 @@ class __Constants(object):
|
|||||||
BANDS = (__ELF, __SLF, __ULF, __VLF, __LF, __MF, __HF, __VHF, __UHF, __SHF, __EHF)
|
BANDS = (__ELF, __SLF, __ULF, __VLF, __LF, __MF, __HF, __VHF, __UHF, __SHF, __EHF)
|
||||||
ACTIVE_COLOR = "#39eaff"
|
ACTIVE_COLOR = "#39eaff"
|
||||||
INACTIVE_COLOR = "#9f9f9f"
|
INACTIVE_COLOR = "#9f9f9f"
|
||||||
CONVERSION_FACTORS = {"Hz":1, "kHz":1000, "MHz":1000000, "GHz":1000000000}
|
CONVERSION_FACTORS = {"Hz": 1, "kHz": 1000, "MHz": 1000000, "GHz": 1000000000}
|
||||||
MODES = {"FM": ["NFM", "WFM"],
|
MODES = {"FM": ["NFM", "WFM"],
|
||||||
"AM": [],
|
"AM": [],
|
||||||
"CW": [],
|
"CW": [],
|
||||||
@@ -57,7 +57,7 @@ class __Constants(object):
|
|||||||
APPLY = "Apply"
|
APPLY = "Apply"
|
||||||
REMOVE = "Remove"
|
REMOVE = "Remove"
|
||||||
UNKNOWN = "N/A"
|
UNKNOWN = "N/A"
|
||||||
MODULATIONS = ["8VSB",
|
MODULATIONS = ("8VSB",
|
||||||
"AFSK",
|
"AFSK",
|
||||||
"AM",
|
"AM",
|
||||||
"BFSK",
|
"BFSK",
|
||||||
@@ -81,7 +81,39 @@ class __Constants(object):
|
|||||||
"PPM",
|
"PPM",
|
||||||
"PSK",
|
"PSK",
|
||||||
"QAM",
|
"QAM",
|
||||||
"TDMA",]
|
"TDMA",)
|
||||||
|
|
||||||
|
LOCATIONS = (UNKNOWN,
|
||||||
|
"Australia",
|
||||||
|
"Canada",
|
||||||
|
"Central Europe",
|
||||||
|
"China",
|
||||||
|
"Cyprus",
|
||||||
|
"Eastern Europe",
|
||||||
|
"Europe",
|
||||||
|
"Europe, japan and Asia",
|
||||||
|
"Exmouth, Australia",
|
||||||
|
"Finland",
|
||||||
|
"France",
|
||||||
|
"Germany",
|
||||||
|
"Home Base Mobile , AL",
|
||||||
|
"Hungary",
|
||||||
|
"Iran",
|
||||||
|
"Israel",
|
||||||
|
"Japan",
|
||||||
|
"LaMour, North Dakota",
|
||||||
|
"Lualualei, Hawaii",
|
||||||
|
"North America",
|
||||||
|
"North Korea",
|
||||||
|
"Poland",
|
||||||
|
"Romania",
|
||||||
|
"Ruda, Sweden",
|
||||||
|
"UK",
|
||||||
|
"United Kingdom",
|
||||||
|
"United States",
|
||||||
|
"Varberg, Sweden",
|
||||||
|
"World Wide",
|
||||||
|
"Worldwide",)
|
||||||
|
|
||||||
Constants = __Constants()
|
Constants = __Constants()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user