Add clickable progress bar class. Few changes of main screen. Round floating point numbers to 2 decimanl digits in man screen. Hide border in mode screen for themes
This commit is contained in:
@@ -27,7 +27,7 @@ from audio_player import AudioPlayer
|
|||||||
from space_weather_data import SpaceWeatherData
|
from space_weather_data import SpaceWeatherData
|
||||||
from double_text_button import DoubleTextButton
|
from double_text_button import DoubleTextButton
|
||||||
from download_window import DownloadWindow
|
from download_window import DownloadWindow
|
||||||
from switchable_label import SwitchableLabel, SwitchableLabelsIterable
|
from switchable_label import SwitchableLabelsIterable
|
||||||
from constants import (Constants,
|
from constants import (Constants,
|
||||||
Ftype,
|
Ftype,
|
||||||
GfdType,
|
GfdType,
|
||||||
@@ -376,7 +376,8 @@ class Artemis(QMainWindow, Ui_MainWindow):
|
|||||||
|
|
||||||
# Space weather
|
# Space weather
|
||||||
self.info_now_btn.clicked.connect(lambda : webbrowser.open(Constants.FORECAST_INFO))
|
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 = SpaceWeatherData()
|
||||||
self.space_weather_data.update_complete.connect(self.update_space_weather)
|
self.space_weather_data.update_complete.connect(self.update_space_weather)
|
||||||
self.switchable_r_labels = SwitchableLabelsIterable(self.r0_now_lbl,
|
self.switchable_r_labels = SwitchableLabelsIterable(self.r0_now_lbl,
|
||||||
@@ -464,12 +465,12 @@ class Artemis(QMainWindow, Ui_MainWindow):
|
|||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
def start_update_space_weather(self):
|
def start_update_space_weather(self):
|
||||||
if not self.space_weather_data.is_updating:
|
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()
|
self.space_weather_data.update()
|
||||||
|
|
||||||
@pyqtSlot(bool)
|
@pyqtSlot(bool)
|
||||||
def update_space_weather(self, status_ok):
|
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:
|
if status_ok:
|
||||||
xray_long = float(self.space_weather_data.xray[-1][7])
|
xray_long = float(self.space_weather_data.xray[-1][7])
|
||||||
format_text = lambda letter, power : letter + f"{xray_long * 10**power:.1f}"
|
format_text = lambda letter, power : letter + f"{xray_long * 10**power:.1f}"
|
||||||
|
|||||||
966
artemis.ui
966
artemis.ui
File diff suppressed because it is too large
Load Diff
31
clickable_progress_bar.py
Normal file
31
clickable_progress_bar.py
Normal file
@@ -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)
|
||||||
182
constants.py
182
constants.py
@@ -91,65 +91,67 @@ class Colors(object):
|
|||||||
YELLOW_LIGHT = "#ffff33"
|
YELLOW_LIGHT = "#ffff33"
|
||||||
|
|
||||||
class Constants(object):
|
class Constants(object):
|
||||||
ACF_DOCS = "https://aresvalley.com/documentation/"
|
CLICK_TO_UPDATE_STR = "Click to update"
|
||||||
FORECAST_XRAY = "https://services.swpc.noaa.gov/text/goes-xray-flux-primary.txt"
|
UPDATING_STR = "Updating..."
|
||||||
FORECAST_PROT = "https://services.swpc.noaa.gov/text/goes-particle-flux-primary.txt"
|
ACF_DOCS = "https://aresvalley.com/documentation/"
|
||||||
FORECAST_AK_IND = "https://services.swpc.noaa.gov/text/wwv.txt"
|
FORECAST_XRAY = "https://services.swpc.noaa.gov/text/goes-xray-flux-primary.txt"
|
||||||
FORECAST_SGAS = "https://services.swpc.noaa.gov/text/sgas.txt"
|
FORECAST_PROT = "https://services.swpc.noaa.gov/text/goes-particle-flux-primary.txt"
|
||||||
FORECAST_G = "https://services.swpc.noaa.gov/text/3-day-forecast.txt"
|
FORECAST_AK_IND = "https://services.swpc.noaa.gov/text/wwv.txt"
|
||||||
FORECAST_INFO = "https://www.swpc.noaa.gov/sites/default/files/images/NOAAscales.pdf"
|
FORECAST_SGAS = "https://services.swpc.noaa.gov/text/sgas.txt"
|
||||||
FORECAST_IMG_0 = "http://www.mmmonvhf.de/eme/eme.png"
|
FORECAST_G = "https://services.swpc.noaa.gov/text/3-day-forecast.txt"
|
||||||
FORECAST_IMG_1 = "http://www.mmmonvhf.de/ms/ms.png"
|
FORECAST_INFO = "https://www.swpc.noaa.gov/sites/default/files/images/NOAAscales.pdf"
|
||||||
FORECAST_IMG_2 = "http://www.mmmonvhf.de/es/es.png"
|
FORECAST_IMG_0 = "http://www.mmmonvhf.de/eme/eme.png"
|
||||||
FORECAST_IMG_3 = "http://www.mmmonvhf.de/solar/solar.png"
|
FORECAST_IMG_1 = "http://www.mmmonvhf.de/ms/ms.png"
|
||||||
FORECAST_IMG_4 = "http://amunters.home.xs4all.nl/eskipstatusNA.gif"
|
FORECAST_IMG_2 = "http://www.mmmonvhf.de/es/es.png"
|
||||||
FORECAST_IMG_5 = "http://amunters.home.xs4all.nl/aurorastatus.gif"
|
FORECAST_IMG_3 = "http://www.mmmonvhf.de/solar/solar.png"
|
||||||
FORECAST_IMG_6 = "http://amunters.home.xs4all.nl/eskipstatus.gif"
|
FORECAST_IMG_4 = "http://amunters.home.xs4all.nl/eskipstatusNA.gif"
|
||||||
FORECAST_IMG_7 = "http://amunters.home.xs4all.nl/eskip50status.gif"
|
FORECAST_IMG_5 = "http://amunters.home.xs4all.nl/aurorastatus.gif"
|
||||||
FORECAST_IMG_8 = "http://amunters.home.xs4all.nl/eskip70status.gif"
|
FORECAST_IMG_6 = "http://amunters.home.xs4all.nl/eskipstatus.gif"
|
||||||
SEARCH_LABEL_IMG = "search_icon.png"
|
FORECAST_IMG_7 = "http://amunters.home.xs4all.nl/eskip50status.gif"
|
||||||
VOLUME_LABEL_IMG = "volume.png"
|
FORECAST_IMG_8 = "http://amunters.home.xs4all.nl/eskip70status.gif"
|
||||||
DATA_FOLDER = "Data"
|
SEARCH_LABEL_IMG = "search_icon.png"
|
||||||
SPECTRA_FOLDER = "Spectra"
|
VOLUME_LABEL_IMG = "volume.png"
|
||||||
SPECTRA_EXT = ".png"
|
DATA_FOLDER = "Data"
|
||||||
AUDIO_FOLDER = "Audio"
|
SPECTRA_FOLDER = "Spectra"
|
||||||
ACTIVE = "active"
|
SPECTRA_EXT = ".png"
|
||||||
INACTIVE = "inactive"
|
AUDIO_FOLDER = "Audio"
|
||||||
NOT_AVAILABLE = "spectrumnotavailable.png"
|
ACTIVE = "active"
|
||||||
NOT_SELECTED = "nosignalselected.png"
|
INACTIVE = "inactive"
|
||||||
__Band = namedtuple("Band", ["lower", "upper"])
|
NOT_AVAILABLE = "spectrumnotavailable.png"
|
||||||
__ELF = __Band(0, 30) # Formally it is (3, 30) Hz.
|
NOT_SELECTED = "nosignalselected.png"
|
||||||
__SLF = __Band(30, 300)
|
__Band = namedtuple("Band", ["lower", "upper"])
|
||||||
__ULF = __Band(300, 3000)
|
__ELF = __Band(0, 30) # Formally it is (3, 30) Hz.
|
||||||
__VLF = __Band(3000, 30000)
|
__SLF = __Band(30, 300)
|
||||||
__LF = __Band(30 * 10**3, 300 * 10**3)
|
__ULF = __Band(300, 3000)
|
||||||
__MF = __Band(300 * 10 ** 3, 3000 * 10**3)
|
__VLF = __Band(3000, 30000)
|
||||||
__HF = __Band(3 * 10**6, 30 * 10**6)
|
__LF = __Band(30 * 10**3, 300 * 10**3)
|
||||||
__VHF = __Band(30 * 10**6, 300 * 10**6)
|
__MF = __Band(300 * 10 ** 3, 3000 * 10**3)
|
||||||
__UHF = __Band(300 * 10**6, 3000 * 10**6)
|
__HF = __Band(3 * 10**6, 30 * 10**6)
|
||||||
__SHF = __Band(3 * 10**9, 30 * 10**9)
|
__VHF = __Band(30 * 10**6, 300 * 10**6)
|
||||||
__EHF = __Band(30 * 10**9, 300 * 10**9)
|
__UHF = __Band(300 * 10**6, 3000 * 10**6)
|
||||||
BANDS = (__ELF, __SLF, __ULF, __VLF, __LF, __MF, __HF, __VHF, __UHF, __SHF, __EHF)
|
__SHF = __Band(3 * 10**9, 30 * 10**9)
|
||||||
MAX_DIGITS = 3
|
__EHF = __Band(30 * 10**9, 300 * 10**9)
|
||||||
RANGE_SEPARATOR = ' ÷ '
|
BANDS = (__ELF, __SLF, __ULF, __VLF, __LF, __MF, __HF, __VHF, __UHF, __SHF, __EHF)
|
||||||
GFD_SITE = "http://qrg.globaltuners.com/"
|
MAX_DIGITS = 3
|
||||||
CONVERSION_FACTORS = {"Hz" : 1,
|
RANGE_SEPARATOR = ' ÷ '
|
||||||
"kHz": 1000,
|
GFD_SITE = "http://qrg.globaltuners.com/"
|
||||||
"MHz": 1000000,
|
CONVERSION_FACTORS = {"Hz" : 1,
|
||||||
"GHz": 1000000000}
|
"kHz": 1000,
|
||||||
MODES = {"FM": ("NFM", "WFM"),
|
"MHz": 1000000,
|
||||||
"AM": (),
|
"GHz": 1000000000}
|
||||||
"CW": (),
|
MODES = {"FM": ("NFM", "WFM"),
|
||||||
"SK": ("FSK", "PSK", "MSK"),
|
"AM": (),
|
||||||
"SB": ("LSB", "USB", "DSB"),
|
"CW": (),
|
||||||
"Chirp Spread Spectrum": (),
|
"SK": ("FSK", "PSK", "MSK"),
|
||||||
"FHSS-TDM": (),
|
"SB": ("LSB", "USB", "DSB"),
|
||||||
"RAW": (),
|
"Chirp Spread Spectrum": (),
|
||||||
"SC-FDMA": (),}
|
"FHSS-TDM": (),
|
||||||
APPLY = "Apply"
|
"RAW": (),
|
||||||
REMOVE = "Remove"
|
"SC-FDMA": (),}
|
||||||
UNKNOWN = "N/A"
|
APPLY = "Apply"
|
||||||
MODULATIONS = ("8VSB",
|
REMOVE = "Remove"
|
||||||
|
UNKNOWN = "N/A"
|
||||||
|
MODULATIONS = ("8VSB",
|
||||||
"AFSK",
|
"AFSK",
|
||||||
"AM",
|
"AM",
|
||||||
"BFSK",
|
"BFSK",
|
||||||
@@ -174,34 +176,34 @@ class Constants(object):
|
|||||||
"PSK",
|
"PSK",
|
||||||
"QAM",
|
"QAM",
|
||||||
"TDMA",)
|
"TDMA",)
|
||||||
LOCATIONS = (UNKNOWN,
|
LOCATIONS = (UNKNOWN,
|
||||||
"Australia",
|
"Australia",
|
||||||
"Canada",
|
"Canada",
|
||||||
"Central Europe",
|
"Central Europe",
|
||||||
"China",
|
"China",
|
||||||
"Cyprus",
|
"Cyprus",
|
||||||
"Eastern Europe",
|
"Eastern Europe",
|
||||||
"Europe",
|
"Europe",
|
||||||
"Europe, japan and Asia",
|
"Europe, japan and Asia",
|
||||||
"Exmouth, Australia",
|
"Exmouth, Australia",
|
||||||
"Finland",
|
"Finland",
|
||||||
"France",
|
"France",
|
||||||
"Germany",
|
"Germany",
|
||||||
"Home Base Mobile , AL",
|
"Home Base Mobile , AL",
|
||||||
"Hungary",
|
"Hungary",
|
||||||
"Iran",
|
"Iran",
|
||||||
"Israel",
|
"Israel",
|
||||||
"Japan",
|
"Japan",
|
||||||
"LaMour, North Dakota",
|
"LaMour, North Dakota",
|
||||||
"Lualualei, Hawaii",
|
"Lualualei, Hawaii",
|
||||||
"North America",
|
"North America",
|
||||||
"North Korea",
|
"North Korea",
|
||||||
"Poland",
|
"Poland",
|
||||||
"Romania",
|
"Romania",
|
||||||
"Ruda, Sweden",
|
"Ruda, Sweden",
|
||||||
"UK",
|
"UK",
|
||||||
"United Kingdom",
|
"United Kingdom",
|
||||||
"United States",
|
"United States",
|
||||||
"Varberg, Sweden",
|
"Varberg, Sweden",
|
||||||
"World Wide",
|
"World Wide",
|
||||||
"Worldwide",)
|
"Worldwide",)
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ QLabel {
|
|||||||
QDialog {
|
QDialog {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
color: #949a9c;
|
color: #949a9c;
|
||||||
}
|
}
|
||||||
|
|
||||||
QTextBrowser {
|
QTextBrowser {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
@@ -157,15 +157,15 @@ QLineEdit {
|
|||||||
QLineEdit:hover {
|
QLineEdit:hover {
|
||||||
border-width: 1px;
|
border-width: 1px;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
border-color: #4545e5 ;
|
border-color: #4545e5 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
QLineEdit:focus {
|
QLineEdit:focus {
|
||||||
border-width: 1px;
|
border-width: 1px;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
border-color: #4545e5 ;
|
border-color: #4545e5 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************
|
/*************************************
|
||||||
@@ -307,7 +307,7 @@ QComboBox::drop-down {
|
|||||||
subcontrol-origin: padding;
|
subcontrol-origin: padding;
|
||||||
subcontrol-position: top right;
|
subcontrol-position: top right;
|
||||||
width: 20px;
|
width: 20px;
|
||||||
border-top-right-radius: 2px;
|
border-top-right-radius: 2px;
|
||||||
border-bottom-right-radius: 2px;
|
border-bottom-right-radius: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -433,6 +433,7 @@ TreeViewMenu (Mode)
|
|||||||
QTreeView {
|
QTreeView {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
selection-background-color: transparent;
|
selection-background-color: transparent;
|
||||||
|
border: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
QTreeView::item {
|
QTreeView::item {
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ QLabel {
|
|||||||
QDialog {
|
QDialog {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
color: #949a9c;
|
color: #949a9c;
|
||||||
}
|
}
|
||||||
|
|
||||||
QTextBrowser {
|
QTextBrowser {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
@@ -172,19 +172,19 @@ QLineEdit {
|
|||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
selection-background-color: #669900;
|
selection-background-color: #669900;
|
||||||
color: #669900;
|
color: #669900;
|
||||||
border-width: 1px;
|
border-width: 1px;
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
border-color: transparent transparent #669900 transparent;
|
border-color: transparent transparent #669900 transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
QLineEdit:hover {
|
QLineEdit:hover {
|
||||||
border-width: 2px;
|
border-width: 2px;
|
||||||
border-color: transparent transparent #88cc00 transparent;
|
border-color: transparent transparent #88cc00 transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
QLineEdit:focus {
|
QLineEdit:focus {
|
||||||
border-width: 2px;
|
border-width: 2px;
|
||||||
border-color: transparent transparent #88cc00 transparent;
|
border-color: transparent transparent #88cc00 transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************
|
/*************************************
|
||||||
@@ -326,7 +326,7 @@ QComboBox::drop-down {
|
|||||||
subcontrol-origin: padding;
|
subcontrol-origin: padding;
|
||||||
subcontrol-position: top right;
|
subcontrol-position: top right;
|
||||||
width: 20px;
|
width: 20px;
|
||||||
border-top-right-radius: 2px;
|
border-top-right-radius: 2px;
|
||||||
border-bottom-right-radius: 2px;
|
border-bottom-right-radius: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -452,6 +452,7 @@ TreeViewMenu (Mode)
|
|||||||
QTreeView {
|
QTreeView {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
selection-background-color: transparent;
|
selection-background-color: transparent;
|
||||||
|
border: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
QTreeView::item {
|
QTreeView::item {
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ QLabel {
|
|||||||
QDialog {
|
QDialog {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
color: #29353B;
|
color: #29353B;
|
||||||
}
|
}
|
||||||
|
|
||||||
QTextBrowser {
|
QTextBrowser {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
@@ -172,19 +172,19 @@ QLineEdit {
|
|||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
selection-background-color: #669900;
|
selection-background-color: #669900;
|
||||||
color: #669900;
|
color: #669900;
|
||||||
border-width: 1px;
|
border-width: 1px;
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
border-color: transparent transparent #669900 transparent;
|
border-color: transparent transparent #669900 transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
QLineEdit:hover {
|
QLineEdit:hover {
|
||||||
border-width: 2px;
|
border-width: 2px;
|
||||||
border-color: transparent transparent #6ECE12 transparent;
|
border-color: transparent transparent #6ECE12 transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
QLineEdit:focus {
|
QLineEdit:focus {
|
||||||
border-width: 2px;
|
border-width: 2px;
|
||||||
border-color: transparent transparent #6ECE12 transparent;
|
border-color: transparent transparent #6ECE12 transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************
|
/*************************************
|
||||||
@@ -326,7 +326,7 @@ QComboBox::drop-down {
|
|||||||
subcontrol-origin: padding;
|
subcontrol-origin: padding;
|
||||||
subcontrol-position: top right;
|
subcontrol-position: top right;
|
||||||
width: 20px;
|
width: 20px;
|
||||||
border-top-right-radius: 2px;
|
border-top-right-radius: 2px;
|
||||||
border-bottom-right-radius: 2px;
|
border-bottom-right-radius: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -452,6 +452,7 @@ TreeViewMenu (Mode)
|
|||||||
QTreeView {
|
QTreeView {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
selection-background-color: transparent;
|
selection-background-color: transparent;
|
||||||
|
border: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
QTreeView::item {
|
QTreeView::item {
|
||||||
|
|||||||
@@ -97,8 +97,12 @@ def format_numbers(lower, upper):
|
|||||||
upper = int(upper) / upper_factor
|
upper = int(upper) / upper_factor
|
||||||
if lower.is_integer():
|
if lower.is_integer():
|
||||||
lower = int(lower)
|
lower = int(lower)
|
||||||
|
else:
|
||||||
|
lower = round(lower, 2)
|
||||||
if upper.is_integer():
|
if upper.is_integer():
|
||||||
upper = int(upper)
|
upper = int(upper)
|
||||||
|
else:
|
||||||
|
upper = round(upper, 2)
|
||||||
if pre_lower != pre_upper:
|
if pre_lower != pre_upper:
|
||||||
return f"{lower:,} {units[lower_factor]} - {upper:,} {units[upper_factor]}"
|
return f"{lower:,} {units[lower_factor]} - {upper:,} {units[upper_factor]}"
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user