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):
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.setupUi(self)
|
||||
@@ -425,7 +426,6 @@ class Artemis(QMainWindow, Ui_MainWindow):
|
||||
|
||||
# Set modulation filter screen.
|
||||
|
||||
self.modulation_list.addItems(Constants.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_slave_filters(
|
||||
@@ -440,7 +440,6 @@ class Artemis(QMainWindow, Ui_MainWindow):
|
||||
|
||||
# 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(
|
||||
@@ -817,7 +816,7 @@ class Artemis(QMainWindow, Ui_MainWindow):
|
||||
@pyqtSlot()
|
||||
def download_db(self):
|
||||
if not self.download_window.isVisible():
|
||||
self.download_window.download_thread.start()
|
||||
self.download_window.start_download()
|
||||
self.download_window.show()
|
||||
|
||||
@pyqtSlot()
|
||||
@@ -912,6 +911,30 @@ class Artemis(QMainWindow, Ui_MainWindow):
|
||||
self.result_list.clear()
|
||||
self.result_list.addItems(self.signal_names)
|
||||
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()
|
||||
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"
|
||||
EXTRACTING_MSG = "Extracting..."
|
||||
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
|
||||
)
|
||||
|
||||
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,
|
||||
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,
|
||||
connection=self.close)
|
||||
|
||||
self.download_thread = DownloadThread()
|
||||
self.download_thread.finished.connect(self.wait_close)
|
||||
self.download_thread.progress.connect(self.__display_progress)
|
||||
self.cancel_btn.clicked.connect(self.terminate_process)
|
||||
self.__download_thread = DownloadThread()
|
||||
self.__download_thread.finished.connect(self.__wait_close)
|
||||
self.__download_thread.progress.connect(self.__display_progress)
|
||||
self.cancel_btn.clicked.connect(self.__terminate_process)
|
||||
|
||||
def start_download(self):
|
||||
self.__download_thread.start()
|
||||
|
||||
def __downlaod_format_str(self, n, speed):
|
||||
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')
|
||||
|
||||
@pyqtSlot()
|
||||
def terminate_process(self):
|
||||
if self.download_thread.isRunning():
|
||||
self.download_thread.terminate()
|
||||
self.download_thread.wait()
|
||||
def __terminate_process(self):
|
||||
if self.__download_thread.isRunning():
|
||||
self.__download_thread.terminate()
|
||||
self.__download_thread.wait()
|
||||
self.close()
|
||||
|
||||
@pyqtSlot()
|
||||
def wait_close(self):
|
||||
if self.download_thread.status is ThreadStatus.OK:
|
||||
def __wait_close(self):
|
||||
if self.__download_thread.status is ThreadStatus.OK:
|
||||
self.complete.emit()
|
||||
self.close()
|
||||
elif self.download_thread.status is ThreadStatus.NO_CONNECTION_ERR:
|
||||
self.no_internet_msg.show()
|
||||
elif self.download_thread.status is ThreadStatus.BAD_DOWNLOAD_ERR:
|
||||
self.bad_db_download_msg.show()
|
||||
elif self.__download_thread.status is ThreadStatus.NO_CONNECTION_ERR:
|
||||
self.__no_internet_msg.show()
|
||||
elif self.__download_thread.status is ThreadStatus.BAD_DOWNLOAD_ERR:
|
||||
self.__bad_db_download_msg.show()
|
||||
else:
|
||||
self.close()
|
||||
|
||||
def reject(self):
|
||||
if self.download_thread.isRunning():
|
||||
self.download_thread.terminate()
|
||||
self.download_thread.wait()
|
||||
if self.__download_thread.isRunning():
|
||||
self.__download_thread.terminate()
|
||||
self.__download_thread.wait()
|
||||
super().reject()
|
||||
|
||||
@@ -74,10 +74,9 @@ class MultiColorSwitchableLabel(_BaseSwitchableLabel):
|
||||
def switch_on(self):
|
||||
if 5 <= self.level <= 9:
|
||||
super().switch_on()
|
||||
self.setStyleSheet(f"color: {self.LEVEL_COLORS[self.level]}"
|
||||
# f"""background-color: {self.LEVEL_COLORS[self.level]};
|
||||
# color: #000000;
|
||||
# """
|
||||
self.setStyleSheet(
|
||||
f"""color: {self.LEVEL_COLORS[self.level]};
|
||||
text-decoration: underline;"""
|
||||
)
|
||||
|
||||
def switch_off(self):
|
||||
|
||||
@@ -143,10 +143,13 @@ class ForecastData(_BaseWeatherData):
|
||||
]
|
||||
|
||||
def _parse_data(self):
|
||||
self.forecast = self.forecast.splitlines()
|
||||
# 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(
|
||||
'(G\d)', lambda obj: '', self.probabilities
|
||||
'\(G\d\)', lambda obj: '', self.probabilities
|
||||
)
|
||||
self.probabilities = self.probabilities.splitlines()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user