diff --git a/artemis.py b/artemis.py index 5ffda16..3ce3b70 100644 --- a/artemis.py +++ b/artemis.py @@ -27,7 +27,7 @@ from audio_player import AudioPlayer from space_weather_data import SpaceWeatherData from double_text_button import DoubleTextButton from download_window import DownloadWindow -from switchable_label import SwitchableLabel, SwitchableLabelsIterable +from switchable_label import SwitchableLabelsIterable from constants import (Constants, Ftype, GfdType, @@ -376,7 +376,8 @@ class Artemis(QMainWindow, Ui_MainWindow): # Space weather self.info_now_btn.clicked.connect(lambda : webbrowser.open(Constants.FORECAST_INFO)) - self.update_now_btn.clicked.connect(self.start_update_space_weather) + self.update_now_bar.clicked.connect(self.start_update_space_weather) + self.update_now_bar.set_idle() self.space_weather_data = SpaceWeatherData() self.space_weather_data.update_complete.connect(self.update_space_weather) self.switchable_r_labels = SwitchableLabelsIterable(self.r0_now_lbl, @@ -464,12 +465,12 @@ class Artemis(QMainWindow, Ui_MainWindow): @pyqtSlot() def start_update_space_weather(self): if not self.space_weather_data.is_updating: - self.update_now_bar.setMaximum(self.update_now_bar.minimum()) + self.update_now_bar.set_updating() self.space_weather_data.update() @pyqtSlot(bool) def update_space_weather(self, status_ok): - self.update_now_bar.setMaximum(self.update_now_bar.minimum() + 1) + self.update_now_bar.set_idle() if status_ok: xray_long = float(self.space_weather_data.xray[-1][7]) format_text = lambda letter, power : letter + f"{xray_long * 10**power:.1f}" diff --git a/artemis.ui b/artemis.ui index e94f866..d633fe0 100644 --- a/artemis.ui +++ b/artemis.ui @@ -199,8 +199,46 @@ Main - - + + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 90 + 20 + + + + + + + + + 11 + + + + border: 0px; +/*border-radius: 8px;*/ + + + Qt::ScrollBarAsNeeded + + + Qt::ScrollBarAsNeeded + + + true + + + + @@ -233,297 +271,391 @@ p, li { white-space: pre-wrap; } - - - - - - - - - - 0 - 0 - - - - - 12 - - - - N/A - - - - - - - - 0 - 0 - - - - - 12 - - - - N/A - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 12 - 75 - true - - - - Mode - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 12 - - - - N/A - - - - - - - - 0 - 0 - - - - - 12 - - - - N/A - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 12 - 75 - true - - - - Frequency - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 12 - - - - N/A - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 12 - 75 - true - - - - Modulation - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 12 - 75 - true - - - - Location - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 12 - - - - N/A - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 12 - 75 - true - - - - Bandwidth - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 12 - 75 - true - - - - ACF - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - + + + + + 0 + 0 + + + + + 12 + 75 + true + + + + Description + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 90 + 20 + + + + + + + + + + + + + 0 + 0 + + + + + + + + 0 + 0 + + + + + 12 + + + + N/A + + + + + + + + 0 + 0 + + + + + 12 + + + + N/A + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 12 + 75 + true + + + + Mode + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 12 + + + + N/A + + + + + + + + 0 + 0 + + + + + 12 + + + + N/A + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 12 + 75 + true + + + + Frequency + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 12 + + + + N/A + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 12 + 75 + true + + + + Modulation + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 12 + 75 + true + + + + Location + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 12 + + + + N/A + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 12 + 75 + true + + + + Bandwidth + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 12 + 75 + true + + + + ACF + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + 0 + 0 + + + + + + + false + + + + 0 + 0 + + + + + 12 + 75 + true + true + + + + <html><head/><body><p><span style=" color:#000000;">Go to the signal's wiki.</span></p></body></html> + + + + + + Signal's wiki + + + true + + + + + + + - + @@ -1032,99 +1164,25 @@ p, li { white-space: pre-wrap; } - - - - - 0 - 0 - - - - - - - false - - - - 0 - 0 - - - - - 12 - 75 - true - true - - - - <html><head/><body><p><span style=" color:#000000;">Go to the signal's wiki.</span></p></body></html> - - - - - - Signal's wiki - - - true - - - - - - - - - - - 0 - 0 - + + + + Qt::Vertical - - - 12 - 75 - true - + + QSizePolicy::MinimumExpanding - - Description + + + 20 + 20 + - - Qt::AlignCenter - - + - - - - - 11 - - - - border: 0px; -/*border-radius: 8px;*/ - - - Qt::ScrollBarAsNeeded - - - Qt::ScrollBarAsNeeded - - - true - - - - + <html><head/><body><p><span style=" color:#000000;">Frequency bands</span></p></body></html> @@ -3516,20 +3574,20 @@ Inactive Mode - - + + Qt::Horizontal - 171 + 170 20 - + @@ -3563,50 +3621,6 @@ Inactive - - - - Qt::Horizontal - - - - 170 - 20 - - - - - - - - - 12 - 75 - true - - - - Apply - - - true - - - - - - - - 12 - 75 - true - - - - Reset - - - @@ -3624,6 +3638,66 @@ Inactive + + + + + 12 + 75 + true + + + + Apply + + + true + + + + + + + + 12 + 75 + true + + + + Reset + + + + + + + Qt::Horizontal + + + + 171 + 20 + + + + + + + + Qt::Vertical + + + QSizePolicy::Minimum + + + + 20 + 20 + + + + @@ -6568,34 +6642,37 @@ background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0,stop:0 #283048 ,sto - - - - 0 - 0 - - - - Update - - - - - + 0 0 + + + 8 + 75 + true + + + + + 1 -1 + + Qt::AlignCenter + - false + true + + + %p% @@ -6936,6 +7013,11 @@ QSlider::handle:horizontal { QLabel
switchable_label.h
+ + ClickableProgressBar + QProgressBar +
clickable_progress_bar.h
+
diff --git a/clickable_progress_bar.py b/clickable_progress_bar.py new file mode 100644 index 0000000..0cbf2fc --- /dev/null +++ b/clickable_progress_bar.py @@ -0,0 +1,31 @@ +from PyQt5.QtWidgets import QProgressBar +from PyQt5.QtCore import Qt, pyqtSignal +from constants import Constants + +class ClickableProgressBar(QProgressBar): + + clicked = pyqtSignal() + + def __init__(self, parent = None): + self.__text = '' + super().__init__(parent) + + def __set_text(self, text): + self.__text = text + + def text(self): + return self.__text + + def set_idle(self): + self.__set_text(Constants.CLICK_TO_UPDATE_STR) + self.setMaximum(self.minimum() + 1) + + def set_updating(self): + self.__set_text(Constants.UPDATING_STR) + self.setMaximum(self.minimum()) + + def mousePressEvent(self, event): + if event.button() == Qt.LeftButton: + self.clicked.emit() + else: + super().mousePressEvent(event) diff --git a/constants.py b/constants.py index b7c5cae..d52c367 100644 --- a/constants.py +++ b/constants.py @@ -91,65 +91,67 @@ class Colors(object): YELLOW_LIGHT = "#ffff33" class Constants(object): - ACF_DOCS = "https://aresvalley.com/documentation/" - FORECAST_XRAY = "https://services.swpc.noaa.gov/text/goes-xray-flux-primary.txt" - FORECAST_PROT = "https://services.swpc.noaa.gov/text/goes-particle-flux-primary.txt" - FORECAST_AK_IND = "https://services.swpc.noaa.gov/text/wwv.txt" - FORECAST_SGAS = "https://services.swpc.noaa.gov/text/sgas.txt" - FORECAST_G = "https://services.swpc.noaa.gov/text/3-day-forecast.txt" - FORECAST_INFO = "https://www.swpc.noaa.gov/sites/default/files/images/NOAAscales.pdf" - FORECAST_IMG_0 = "http://www.mmmonvhf.de/eme/eme.png" - FORECAST_IMG_1 = "http://www.mmmonvhf.de/ms/ms.png" - FORECAST_IMG_2 = "http://www.mmmonvhf.de/es/es.png" - FORECAST_IMG_3 = "http://www.mmmonvhf.de/solar/solar.png" - FORECAST_IMG_4 = "http://amunters.home.xs4all.nl/eskipstatusNA.gif" - FORECAST_IMG_5 = "http://amunters.home.xs4all.nl/aurorastatus.gif" - FORECAST_IMG_6 = "http://amunters.home.xs4all.nl/eskipstatus.gif" - FORECAST_IMG_7 = "http://amunters.home.xs4all.nl/eskip50status.gif" - FORECAST_IMG_8 = "http://amunters.home.xs4all.nl/eskip70status.gif" - SEARCH_LABEL_IMG = "search_icon.png" - VOLUME_LABEL_IMG = "volume.png" - DATA_FOLDER = "Data" - SPECTRA_FOLDER = "Spectra" - SPECTRA_EXT = ".png" - AUDIO_FOLDER = "Audio" - ACTIVE = "active" - INACTIVE = "inactive" - NOT_AVAILABLE = "spectrumnotavailable.png" - NOT_SELECTED = "nosignalselected.png" - __Band = namedtuple("Band", ["lower", "upper"]) - __ELF = __Band(0, 30) # Formally it is (3, 30) Hz. - __SLF = __Band(30, 300) - __ULF = __Band(300, 3000) - __VLF = __Band(3000, 30000) - __LF = __Band(30 * 10**3, 300 * 10**3) - __MF = __Band(300 * 10 ** 3, 3000 * 10**3) - __HF = __Band(3 * 10**6, 30 * 10**6) - __VHF = __Band(30 * 10**6, 300 * 10**6) - __UHF = __Band(300 * 10**6, 3000 * 10**6) - __SHF = __Band(3 * 10**9, 30 * 10**9) - __EHF = __Band(30 * 10**9, 300 * 10**9) - BANDS = (__ELF, __SLF, __ULF, __VLF, __LF, __MF, __HF, __VHF, __UHF, __SHF, __EHF) - MAX_DIGITS = 3 - RANGE_SEPARATOR = ' ÷ ' - GFD_SITE = "http://qrg.globaltuners.com/" - CONVERSION_FACTORS = {"Hz" : 1, - "kHz": 1000, - "MHz": 1000000, - "GHz": 1000000000} - MODES = {"FM": ("NFM", "WFM"), - "AM": (), - "CW": (), - "SK": ("FSK", "PSK", "MSK"), - "SB": ("LSB", "USB", "DSB"), - "Chirp Spread Spectrum": (), - "FHSS-TDM": (), - "RAW": (), - "SC-FDMA": (),} - APPLY = "Apply" - REMOVE = "Remove" - UNKNOWN = "N/A" - MODULATIONS = ("8VSB", + CLICK_TO_UPDATE_STR = "Click to update" + UPDATING_STR = "Updating..." + ACF_DOCS = "https://aresvalley.com/documentation/" + FORECAST_XRAY = "https://services.swpc.noaa.gov/text/goes-xray-flux-primary.txt" + FORECAST_PROT = "https://services.swpc.noaa.gov/text/goes-particle-flux-primary.txt" + FORECAST_AK_IND = "https://services.swpc.noaa.gov/text/wwv.txt" + FORECAST_SGAS = "https://services.swpc.noaa.gov/text/sgas.txt" + FORECAST_G = "https://services.swpc.noaa.gov/text/3-day-forecast.txt" + FORECAST_INFO = "https://www.swpc.noaa.gov/sites/default/files/images/NOAAscales.pdf" + FORECAST_IMG_0 = "http://www.mmmonvhf.de/eme/eme.png" + FORECAST_IMG_1 = "http://www.mmmonvhf.de/ms/ms.png" + FORECAST_IMG_2 = "http://www.mmmonvhf.de/es/es.png" + FORECAST_IMG_3 = "http://www.mmmonvhf.de/solar/solar.png" + FORECAST_IMG_4 = "http://amunters.home.xs4all.nl/eskipstatusNA.gif" + FORECAST_IMG_5 = "http://amunters.home.xs4all.nl/aurorastatus.gif" + FORECAST_IMG_6 = "http://amunters.home.xs4all.nl/eskipstatus.gif" + FORECAST_IMG_7 = "http://amunters.home.xs4all.nl/eskip50status.gif" + FORECAST_IMG_8 = "http://amunters.home.xs4all.nl/eskip70status.gif" + SEARCH_LABEL_IMG = "search_icon.png" + VOLUME_LABEL_IMG = "volume.png" + DATA_FOLDER = "Data" + SPECTRA_FOLDER = "Spectra" + SPECTRA_EXT = ".png" + AUDIO_FOLDER = "Audio" + ACTIVE = "active" + INACTIVE = "inactive" + NOT_AVAILABLE = "spectrumnotavailable.png" + NOT_SELECTED = "nosignalselected.png" + __Band = namedtuple("Band", ["lower", "upper"]) + __ELF = __Band(0, 30) # Formally it is (3, 30) Hz. + __SLF = __Band(30, 300) + __ULF = __Band(300, 3000) + __VLF = __Band(3000, 30000) + __LF = __Band(30 * 10**3, 300 * 10**3) + __MF = __Band(300 * 10 ** 3, 3000 * 10**3) + __HF = __Band(3 * 10**6, 30 * 10**6) + __VHF = __Band(30 * 10**6, 300 * 10**6) + __UHF = __Band(300 * 10**6, 3000 * 10**6) + __SHF = __Band(3 * 10**9, 30 * 10**9) + __EHF = __Band(30 * 10**9, 300 * 10**9) + BANDS = (__ELF, __SLF, __ULF, __VLF, __LF, __MF, __HF, __VHF, __UHF, __SHF, __EHF) + MAX_DIGITS = 3 + RANGE_SEPARATOR = ' ÷ ' + GFD_SITE = "http://qrg.globaltuners.com/" + CONVERSION_FACTORS = {"Hz" : 1, + "kHz": 1000, + "MHz": 1000000, + "GHz": 1000000000} + MODES = {"FM": ("NFM", "WFM"), + "AM": (), + "CW": (), + "SK": ("FSK", "PSK", "MSK"), + "SB": ("LSB", "USB", "DSB"), + "Chirp Spread Spectrum": (), + "FHSS-TDM": (), + "RAW": (), + "SC-FDMA": (),} + APPLY = "Apply" + REMOVE = "Remove" + UNKNOWN = "N/A" + MODULATIONS = ("8VSB", "AFSK", "AM", "BFSK", @@ -174,34 +176,34 @@ class Constants(object): "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",) + 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",) diff --git a/themes/2-dark/dark.qss b/themes/2-dark/dark.qss index cdc3f79..bece62f 100644 --- a/themes/2-dark/dark.qss +++ b/themes/2-dark/dark.qss @@ -137,7 +137,7 @@ QLabel { QDialog { background-color: transparent; color: #949a9c; -} +} QTextBrowser { background-color: transparent; @@ -157,15 +157,15 @@ QLineEdit { QLineEdit:hover { border-width: 1px; border-radius: 10px; - border-style: solid; - border-color: #4545e5 ; + border-style: solid; + border-color: #4545e5 ; } QLineEdit:focus { border-width: 1px; border-radius: 10px; - border-style: solid; - border-color: #4545e5 ; + border-style: solid; + border-color: #4545e5 ; } /************************************* @@ -307,7 +307,7 @@ QComboBox::drop-down { subcontrol-origin: padding; subcontrol-position: top right; width: 20px; - border-top-right-radius: 2px; + border-top-right-radius: 2px; border-bottom-right-radius: 2px; } @@ -433,6 +433,7 @@ TreeViewMenu (Mode) QTreeView { background-color: transparent; selection-background-color: transparent; + border: 0px; } QTreeView::item { diff --git a/themes/3-material_design_dark/material_design_dark.qss b/themes/3-material_design_dark/material_design_dark.qss index bdfe948..86f5544 100644 --- a/themes/3-material_design_dark/material_design_dark.qss +++ b/themes/3-material_design_dark/material_design_dark.qss @@ -158,7 +158,7 @@ QLabel { QDialog { background-color: transparent; color: #949a9c; -} +} QTextBrowser { background-color: transparent; @@ -172,19 +172,19 @@ QLineEdit { background-color: transparent; selection-background-color: #669900; color: #669900; - border-width: 1px; - border-style: solid; - border-color: transparent transparent #669900 transparent; + border-width: 1px; + border-style: solid; + border-color: transparent transparent #669900 transparent; } QLineEdit:hover { - border-width: 2px; - border-color: transparent transparent #88cc00 transparent; + border-width: 2px; + border-color: transparent transparent #88cc00 transparent; } QLineEdit:focus { - border-width: 2px; - border-color: transparent transparent #88cc00 transparent; + border-width: 2px; + border-color: transparent transparent #88cc00 transparent; } /************************************* @@ -326,7 +326,7 @@ QComboBox::drop-down { subcontrol-origin: padding; subcontrol-position: top right; width: 20px; - border-top-right-radius: 2px; + border-top-right-radius: 2px; border-bottom-right-radius: 2px; } @@ -452,6 +452,7 @@ TreeViewMenu (Mode) QTreeView { background-color: transparent; selection-background-color: transparent; + border: 0px; } QTreeView::item { diff --git a/themes/4-material_design_light/material_design_light.qss b/themes/4-material_design_light/material_design_light.qss index f206187..4874c85 100644 --- a/themes/4-material_design_light/material_design_light.qss +++ b/themes/4-material_design_light/material_design_light.qss @@ -158,7 +158,7 @@ QLabel { QDialog { background-color: transparent; color: #29353B; -} +} QTextBrowser { background-color: transparent; @@ -172,19 +172,19 @@ QLineEdit { background-color: transparent; selection-background-color: #669900; color: #669900; - border-width: 1px; - border-style: solid; - border-color: transparent transparent #669900 transparent; + border-width: 1px; + border-style: solid; + border-color: transparent transparent #669900 transparent; } QLineEdit:hover { - border-width: 2px; - border-color: transparent transparent #6ECE12 transparent; + border-width: 2px; + border-color: transparent transparent #6ECE12 transparent; } QLineEdit:focus { - border-width: 2px; - border-color: transparent transparent #6ECE12 transparent; + border-width: 2px; + border-color: transparent transparent #6ECE12 transparent; } /************************************* @@ -326,7 +326,7 @@ QComboBox::drop-down { subcontrol-origin: padding; subcontrol-position: top right; width: 20px; - border-top-right-radius: 2px; + border-top-right-radius: 2px; border-bottom-right-radius: 2px; } @@ -452,6 +452,7 @@ TreeViewMenu (Mode) QTreeView { background-color: transparent; selection-background-color: transparent; + border: 0px; } QTreeView::item { diff --git a/utilities.py b/utilities.py index 51d7c66..7401e24 100644 --- a/utilities.py +++ b/utilities.py @@ -97,8 +97,12 @@ def format_numbers(lower, upper): upper = int(upper) / upper_factor if lower.is_integer(): lower = int(lower) + else: + lower = round(lower, 2) if upper.is_integer(): upper = int(upper) + else: + upper = round(upper, 2) if pre_lower != pre_upper: return f"{lower:,} {units[lower_factor]} - {upper:,} {units[upper_factor]}" else: