Final touches to frequency filters
This commit is contained in:
33
main.py
33
main.py
@@ -37,6 +37,7 @@ class MyApp(QMainWindow, Ui_MainWindow):
|
||||
bands = ELF, SLF, ULF, VLF, LF, MF, HF, VHF, UHF, SHF, EHF
|
||||
active_color = "#39eaff"
|
||||
inactive_color = "#9f9f9f"
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.setupUi(self)
|
||||
@@ -49,7 +50,7 @@ class MyApp(QMainWindow, Ui_MainWindow):
|
||||
self.undefined_freq = False
|
||||
self.undefined_band = False
|
||||
self.signal_names = []
|
||||
self.frequency_filters = (
|
||||
self.frequency_filters_btns = (
|
||||
self.elf_filter_btn,
|
||||
self.slf_filter_btn,
|
||||
self.ulf_filter_btn,
|
||||
@@ -67,10 +68,9 @@ class MyApp(QMainWindow, Ui_MainWindow):
|
||||
self.lower_freq_confidence.value()
|
||||
)
|
||||
)
|
||||
self.apply_reset_freq_filter_btn.set_texts("Apply frequency filters",
|
||||
"Remove frequency filters")
|
||||
self.apply_reset_freq_filter_btn.set_texts("Apply", "Remove")
|
||||
self.apply_reset_freq_filter_btn.set_slave_filters(
|
||||
*self.frequency_filters,
|
||||
*self.frequency_filters_btns,
|
||||
self.lower_freq_spinbox,
|
||||
self.upper_freq_spinbox,
|
||||
self.lower_freq_filter_unit,
|
||||
@@ -79,6 +79,7 @@ class MyApp(QMainWindow, Ui_MainWindow):
|
||||
self.upper_freq_confidence,
|
||||
)
|
||||
self.apply_reset_freq_filter_btn.clicked.connect(self.display_signals)
|
||||
self.reset_frequency_filters_btn.clicked.connect(self.reset_frequency_filters)
|
||||
UrlColors = namedtuple("UrlColors", ["inactive", "active", "clicked"])
|
||||
self.url_button.colors = UrlColors("#9f9f9f", "#4c75ff", "#942ccc")
|
||||
self.category_labels = [self.cat_mil,
|
||||
@@ -133,6 +134,20 @@ class MyApp(QMainWindow, Ui_MainWindow):
|
||||
BandLabel(self.ehf_left, self.ehf, self.ehf_right),
|
||||
]
|
||||
|
||||
def reset_frequency_filters(self):
|
||||
if self.apply_reset_freq_filter_btn.isChecked():
|
||||
self.apply_reset_freq_filter_btn.setChecked(False)
|
||||
self.apply_reset_freq_filter_btn.clicked.emit()
|
||||
for f in self.frequency_filters_btns:
|
||||
if f.isChecked():
|
||||
f.setChecked(False)
|
||||
self.lower_freq_spinbox.setValue(0)
|
||||
self.upper_freq_spinbox.setValue(0)
|
||||
self.lower_freq_filter_unit.setCurrentText("MHz")
|
||||
self.upper_freq_filter_unit.setCurrentText("MHz")
|
||||
self.lower_freq_confidence.setValue(5)
|
||||
self.upper_freq_confidence.setValue(5)
|
||||
|
||||
def set_initial_size(self):
|
||||
"""
|
||||
Function to handle high resolution screens. The function sets bigger sizes
|
||||
@@ -243,13 +258,13 @@ class MyApp(QMainWindow, Ui_MainWindow):
|
||||
|
||||
band_filter_ok = False
|
||||
any_checked = False
|
||||
for btn, band_limits in zip(self.frequency_filters, self.bands):
|
||||
for btn, band_limits in zip(self.frequency_filters_btns, self.bands):
|
||||
if btn.isChecked():
|
||||
any_checked = True
|
||||
if signal_freqs[0] >= band_limits.lower \
|
||||
and signal_freqs[0] < band_limits.upper \
|
||||
or signal_freqs[1] >= band_limits.lower \
|
||||
and signal_freqs[1] < band_limits.upper:
|
||||
if (signal_freqs[0] >= band_limits.lower \
|
||||
and signal_freqs[0] < band_limits.upper) \
|
||||
or (signal_freqs[1] >= band_limits.lower \
|
||||
and signal_freqs[1] < band_limits.upper):
|
||||
band_filter_ok = True
|
||||
lower_freq_filter = self.lower_freq_spinbox.value()
|
||||
upper_freq_filter = self.upper_freq_spinbox.value()
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>ARTEMIS2</string>
|
||||
<string>ARTEMIS3</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QWidget {
|
||||
@@ -2330,6 +2330,14 @@ QPushButton:checked {
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="currentText">
|
||||
<string>MHz</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>MHz</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Hz</string>
|
||||
@@ -2340,11 +2348,6 @@ QPushButton:checked {
|
||||
<string>kHz</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>MHz</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>GHz</string>
|
||||
@@ -2586,6 +2589,9 @@ QPushButton:checked {
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="currentText">
|
||||
<string>MHz</string>
|
||||
</property>
|
||||
<property name="maxCount">
|
||||
<number>4</number>
|
||||
</property>
|
||||
@@ -2595,6 +2601,11 @@ QPushButton:checked {
|
||||
<property name="modelColumn">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>MHz</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Hz</string>
|
||||
@@ -2605,11 +2616,6 @@ QPushButton:checked {
|
||||
<string>kHz</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>MHz</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>GHz</string>
|
||||
@@ -2636,13 +2642,27 @@ QPushButton:checked {
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Applay frequency filters</string>
|
||||
<string>Applay</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="reset_frequency_filters_btn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Reset</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_4">
|
||||
@@ -2695,7 +2715,7 @@ border: 1px solid gray;
|
||||
border-radius: 5px;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Remove all filters</string>
|
||||
<string>Reset all filters</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
Reference in New Issue
Block a user