Modulations and locations lists are now detected at startup.
Also improve styles of some widgets. Also fix a bug in forecast screen.
This commit is contained in:
29
artemis.py
29
artemis.py
@@ -51,6 +51,7 @@ Ui_MainWindow, _ = uic.loadUiType(qt_creator_file)
|
|||||||
|
|
||||||
|
|
||||||
class Artemis(QMainWindow, Ui_MainWindow):
|
class Artemis(QMainWindow, Ui_MainWindow):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
@@ -425,7 +426,6 @@ class Artemis(QMainWindow, Ui_MainWindow):
|
|||||||
|
|
||||||
# Set modulation filter screen.
|
# Set modulation filter screen.
|
||||||
|
|
||||||
self.modulation_list.addItems(Constants.MODULATIONS)
|
|
||||||
self.search_bar_modulation.textEdited.connect(self.show_matching_modulations)
|
self.search_bar_modulation.textEdited.connect(self.show_matching_modulations)
|
||||||
self.apply_remove_modulation_filter_btn.set_texts(Constants.APPLY, Constants.REMOVE)
|
self.apply_remove_modulation_filter_btn.set_texts(Constants.APPLY, Constants.REMOVE)
|
||||||
self.apply_remove_modulation_filter_btn.set_slave_filters(
|
self.apply_remove_modulation_filter_btn.set_slave_filters(
|
||||||
@@ -440,7 +440,6 @@ class Artemis(QMainWindow, Ui_MainWindow):
|
|||||||
|
|
||||||
# Set location filter screen.
|
# Set location filter screen.
|
||||||
|
|
||||||
self.locations_list.addItems(Constants.LOCATIONS)
|
|
||||||
self.search_bar_location.textEdited.connect(self.show_matching_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_texts(Constants.APPLY, Constants.REMOVE)
|
||||||
self.apply_remove_location_filter_btn.set_slave_filters(
|
self.apply_remove_location_filter_btn.set_slave_filters(
|
||||||
@@ -817,7 +816,7 @@ class Artemis(QMainWindow, Ui_MainWindow):
|
|||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
def download_db(self):
|
def download_db(self):
|
||||||
if not self.download_window.isVisible():
|
if not self.download_window.isVisible():
|
||||||
self.download_window.download_thread.start()
|
self.download_window.start_download()
|
||||||
self.download_window.show()
|
self.download_window.show()
|
||||||
|
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
@@ -912,6 +911,30 @@ class Artemis(QMainWindow, Ui_MainWindow):
|
|||||||
self.result_list.clear()
|
self.result_list.clear()
|
||||||
self.result_list.addItems(self.signal_names)
|
self.result_list.addItems(self.signal_names)
|
||||||
self.result_list.setCurrentItem(None)
|
self.result_list.setCurrentItem(None)
|
||||||
|
self.modulation_list.addItems(self.collect_modulations())
|
||||||
|
self.locations_list.addItems(self.collect_locations())
|
||||||
|
|
||||||
|
def collect_locations(self):
|
||||||
|
all_locs = self.db[Signal.LOCATION]
|
||||||
|
all_locs = list(
|
||||||
|
set(
|
||||||
|
all_locs[all_locs != Constants.UNKNOWN]
|
||||||
|
)
|
||||||
|
)
|
||||||
|
all_locs.sort()
|
||||||
|
all_locs.insert(0, Constants.UNKNOWN)
|
||||||
|
return all_locs
|
||||||
|
|
||||||
|
def collect_modulations(self):
|
||||||
|
modulations = self.db[Signal.MODULATION]
|
||||||
|
modulations = list(
|
||||||
|
set(
|
||||||
|
modulations[modulations != Constants.UNKNOWN]
|
||||||
|
)
|
||||||
|
)
|
||||||
|
modulations.sort()
|
||||||
|
modulations.insert(0, Constants.UNKNOWN)
|
||||||
|
return modulations
|
||||||
|
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
def set_min_value_upper_limit(self, lower_combo_box,
|
def set_min_value_upper_limit(self, lower_combo_box,
|
||||||
|
|||||||
1013
artemis.ui
1013
artemis.ui
File diff suppressed because it is too large
Load Diff
56
constants.py
56
constants.py
@@ -154,59 +154,3 @@ class Constants:
|
|||||||
UNKNOWN = "N/A"
|
UNKNOWN = "N/A"
|
||||||
EXTRACTING_MSG = "Extracting..."
|
EXTRACTING_MSG = "Extracting..."
|
||||||
EXTRACTING_CODE = -1
|
EXTRACTING_CODE = -1
|
||||||
MODULATIONS = ("8VSB",
|
|
||||||
"AFSK",
|
|
||||||
"AM",
|
|
||||||
"BFSK",
|
|
||||||
"C4FM",
|
|
||||||
"CDMA",
|
|
||||||
"COFDM",
|
|
||||||
"CW",
|
|
||||||
"FFSK",
|
|
||||||
"FM",
|
|
||||||
"FMCW",
|
|
||||||
"FMOP",
|
|
||||||
"FSK",
|
|
||||||
"GFSK",
|
|
||||||
"GMSK",
|
|
||||||
"IFK",
|
|
||||||
"MFSK",
|
|
||||||
"MSK",
|
|
||||||
"OFDM",
|
|
||||||
"OOK",
|
|
||||||
"PAM",
|
|
||||||
"PPM",
|
|
||||||
"PSK",
|
|
||||||
"QAM",
|
|
||||||
"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",)
|
|
||||||
|
|||||||
@@ -23,18 +23,21 @@ class DownloadWindow(QWidget, Ui_Download_window):
|
|||||||
# Qt.WindowStaysOnTopHint
|
# Qt.WindowStaysOnTopHint
|
||||||
)
|
)
|
||||||
|
|
||||||
self.no_internet_msg = pop_up(self, title=Messages.NO_CONNECTION,
|
self.__no_internet_msg = pop_up(self, title=Messages.NO_CONNECTION,
|
||||||
text=Messages.NO_CONNECTION_MSG,
|
text=Messages.NO_CONNECTION_MSG,
|
||||||
connection=self.close)
|
connection=self.close)
|
||||||
|
|
||||||
self.bad_db_download_msg = pop_up(self, title=Messages.BAD_DOWNLOAD,
|
self.__bad_db_download_msg = pop_up(self, title=Messages.BAD_DOWNLOAD,
|
||||||
text=Messages.BAD_DOWNLOAD_MSG,
|
text=Messages.BAD_DOWNLOAD_MSG,
|
||||||
connection=self.close)
|
connection=self.close)
|
||||||
|
|
||||||
self.download_thread = DownloadThread()
|
self.__download_thread = DownloadThread()
|
||||||
self.download_thread.finished.connect(self.wait_close)
|
self.__download_thread.finished.connect(self.__wait_close)
|
||||||
self.download_thread.progress.connect(self.__display_progress)
|
self.__download_thread.progress.connect(self.__display_progress)
|
||||||
self.cancel_btn.clicked.connect(self.terminate_process)
|
self.cancel_btn.clicked.connect(self.__terminate_process)
|
||||||
|
|
||||||
|
def start_download(self):
|
||||||
|
self.__download_thread.start()
|
||||||
|
|
||||||
def __downlaod_format_str(self, n, speed):
|
def __downlaod_format_str(self, n, speed):
|
||||||
return f"Downloaded MB: {n}\nSpeed: {speed} MB/s"
|
return f"Downloaded MB: {n}\nSpeed: {speed} MB/s"
|
||||||
@@ -51,26 +54,26 @@ class DownloadWindow(QWidget, Ui_Download_window):
|
|||||||
self.status_lbl.setText(Constants.EXTRACTING_MSG + '\n')
|
self.status_lbl.setText(Constants.EXTRACTING_MSG + '\n')
|
||||||
|
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
def terminate_process(self):
|
def __terminate_process(self):
|
||||||
if self.download_thread.isRunning():
|
if self.__download_thread.isRunning():
|
||||||
self.download_thread.terminate()
|
self.__download_thread.terminate()
|
||||||
self.download_thread.wait()
|
self.__download_thread.wait()
|
||||||
self.close()
|
self.close()
|
||||||
|
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
def wait_close(self):
|
def __wait_close(self):
|
||||||
if self.download_thread.status is ThreadStatus.OK:
|
if self.__download_thread.status is ThreadStatus.OK:
|
||||||
self.complete.emit()
|
self.complete.emit()
|
||||||
self.close()
|
self.close()
|
||||||
elif self.download_thread.status is ThreadStatus.NO_CONNECTION_ERR:
|
elif self.__download_thread.status is ThreadStatus.NO_CONNECTION_ERR:
|
||||||
self.no_internet_msg.show()
|
self.__no_internet_msg.show()
|
||||||
elif self.download_thread.status is ThreadStatus.BAD_DOWNLOAD_ERR:
|
elif self.__download_thread.status is ThreadStatus.BAD_DOWNLOAD_ERR:
|
||||||
self.bad_db_download_msg.show()
|
self.__bad_db_download_msg.show()
|
||||||
else:
|
else:
|
||||||
self.close()
|
self.close()
|
||||||
|
|
||||||
def reject(self):
|
def reject(self):
|
||||||
if self.download_thread.isRunning():
|
if self.__download_thread.isRunning():
|
||||||
self.download_thread.terminate()
|
self.__download_thread.terminate()
|
||||||
self.download_thread.wait()
|
self.__download_thread.wait()
|
||||||
super().reject()
|
super().reject()
|
||||||
|
|||||||
@@ -74,10 +74,9 @@ class MultiColorSwitchableLabel(_BaseSwitchableLabel):
|
|||||||
def switch_on(self):
|
def switch_on(self):
|
||||||
if 5 <= self.level <= 9:
|
if 5 <= self.level <= 9:
|
||||||
super().switch_on()
|
super().switch_on()
|
||||||
self.setStyleSheet(f"color: {self.LEVEL_COLORS[self.level]}"
|
self.setStyleSheet(
|
||||||
# f"""background-color: {self.LEVEL_COLORS[self.level]};
|
f"""color: {self.LEVEL_COLORS[self.level]};
|
||||||
# color: #000000;
|
text-decoration: underline;"""
|
||||||
# """
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def switch_off(self):
|
def switch_off(self):
|
||||||
|
|||||||
@@ -143,10 +143,13 @@ class ForecastData(_BaseWeatherData):
|
|||||||
]
|
]
|
||||||
|
|
||||||
def _parse_data(self):
|
def _parse_data(self):
|
||||||
self.forecast = self.forecast.splitlines()
|
|
||||||
# Remove possible '(G\d)' from the kp_index table
|
# Remove possible '(G\d)' from the kp_index table
|
||||||
|
self.forecast = re.sub(
|
||||||
|
'\(G\d\)', lambda obj: '', self.forecast
|
||||||
|
)
|
||||||
|
self.forecast = self.forecast.splitlines()
|
||||||
self.probabilities = re.sub(
|
self.probabilities = re.sub(
|
||||||
'(G\d)', lambda obj: '', self.probabilities
|
'\(G\d\)', lambda obj: '', self.probabilities
|
||||||
)
|
)
|
||||||
self.probabilities = self.probabilities.splitlines()
|
self.probabilities = self.probabilities.splitlines()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user