Minor details in utilities.py

This commit is contained in:
alessandro90
2018-11-18 18:43:33 +01:00
parent 402cc0e4e8
commit 9cd87a12fb

View File

@@ -12,6 +12,9 @@ class _ReadOnlyProperty(object):
def __set__(self, obj, value): def __set__(self, obj, value):
return NotImplementedError("Cannot change a constant.") return NotImplementedError("Cannot change a constant.")
# def change_hardcoded_value(self, value):
# self.__value = value
def __make_read_only(cls): def __make_read_only(cls):
for k, v in cls.__dict__.items(): for k, v in cls.__dict__.items():
if not callable(getattr(cls, k)) and '__' not in k: if not callable(getattr(cls, k)) and '__' not in k:
@@ -23,12 +26,12 @@ def __make_read_only(cls):
@__make_read_only @__make_read_only
class __Constants(object): class __Constants(object):
DB_LOCATION = 'https://aresvalley.com/Storage/Artemis/Database/data.zip' DB_LOCATION = "https://aresvalley.com/Storage/Artemis/Database/data.zip"
REF_LOC = 'https://aresvalley.com/Storage/Artemis/Database/data.zip.log' REF_LOC = "https://aresvalley.com/Storage/Artemis/Database/data.zip.log"
DATA_FOLDER = 'Data' DATA_FOLDER = "Data"
SPECTRA_FOLDER = 'Spectra' SPECTRA_FOLDER = "Spectra"
AUDIO_FOLDER = 'Audio' AUDIO_FOLDER = "Audio"
ICONS_FOLDER = 'icons_imgs' ICONS_FOLDER = "icons_imgs"
__Band = namedtuple("Band", ["lower", "upper"]) __Band = namedtuple("Band", ["lower", "upper"])
__ELF = __Band(0, 30) # Formally it is (3, 30) Hz. __ELF = __Band(0, 30) # Formally it is (3, 30) Hz.
__SLF = __Band(30, 300) __SLF = __Band(30, 300)
@@ -44,16 +47,19 @@ class __Constants(object):
BANDS = (__ELF, __SLF, __ULF, __VLF, __LF, __MF, __HF, __VHF, __UHF, __SHF, __EHF) BANDS = (__ELF, __SLF, __ULF, __VLF, __LF, __MF, __HF, __VHF, __UHF, __SHF, __EHF)
ACTIVE_COLOR = "#39eaff" ACTIVE_COLOR = "#39eaff"
INACTIVE_COLOR = "#9f9f9f" INACTIVE_COLOR = "#9f9f9f"
CONVERSION_FACTORS = {"Hz": 1, "kHz": 1000, "MHz": 1000000, "GHz": 1000000000} CONVERSION_FACTORS = {"Hz" : 1,
MODES = {"FM": ["NFM", "WFM"], "kHz": 1000,
"AM": [], "MHz": 1000000,
"CW": [], "GHz": 1000000000}
"SK": ["FSK", "PSK", "MSK"], MODES = {"FM": ("NFM", "WFM"),
"SB": ["LSB", "USB", "DSB"], "AM": (),
"Chirp Spread Spectrum": [], "CW": (),
"FHSS-TDM": [], "SK": ("FSK", "PSK", "MSK"),
"RAW": [], "SB": ("LSB", "USB", "DSB"),
"SC-FDMA": [],} "Chirp Spread Spectrum": (),
"FHSS-TDM": (),
"RAW": (),
"SC-FDMA": (),}
APPLY = "Apply" APPLY = "Apply"
REMOVE = "Remove" REMOVE = "Remove"
UNKNOWN = "N/A" UNKNOWN = "N/A"