Add support for multiple modulations and locations per signal.

Also remove numbers from theme folders and order the themes
appearence in action menu
This commit is contained in:
alessandro90
2019-05-18 21:37:57 +02:00
parent f87df03147
commit ddce1519a4
44 changed files with 71 additions and 65 deletions

View File

@@ -922,12 +922,13 @@ class Artemis(QMainWindow, Ui_MainWindow):
) )
) )
def collect_list(self, list_property): def collect_list(self, list_property, separator=';'):
values = self.db[list_property] values = self.db[list_property]
values = list( values = list(
set( set([
values[values != Constants.UNKNOWN] x.strip() for value in values[values != Constants.UNKNOWN]
) for x in value.split(separator)
])
) )
values.sort() values.sort()
values.insert(0, Constants.UNKNOWN) values.insert(0, Constants.UNKNOWN)
@@ -1249,7 +1250,10 @@ class Artemis(QMainWindow, Ui_MainWindow):
return False return False
selected_items = [item for item in self.mode_tree_widget.selectedItems()] selected_items = [item for item in self.mode_tree_widget.selectedItems()]
selected_items_text = [i.text(0) for i in selected_items] selected_items_text = [i.text(0) for i in selected_items]
parents = [item for item in selected_items_text if item in Constants.MODES.keys()] parents = [
item for item in selected_items_text
if item in Constants.MODES.keys()
]
ok = [] ok = []
for item in selected_items: for item in selected_items:
if item.text(0) in parents: if item.text(0) in parents:
@@ -1261,9 +1265,11 @@ class Artemis(QMainWindow, Ui_MainWindow):
def modulation_filters_ok(self, signal_name): def modulation_filters_ok(self, signal_name):
if not self.apply_remove_modulation_filter_btn.isChecked(): if not self.apply_remove_modulation_filter_btn.isChecked():
return True return True
signal_modulation = self.db.at[signal_name, Signal.MODULATION] signal_modulation = [
x.strip() for x in self.db.at[signal_name, Signal.MODULATION].split(',')
]
for item in self.modulation_list.selectedItems(): for item in self.modulation_list.selectedItems():
if item.text() == signal_modulation: if item.text() in signal_modulation:
return True return True
return False return False
@@ -1298,7 +1304,7 @@ class Artemis(QMainWindow, Ui_MainWindow):
@pyqtSlot(QListWidgetItem, QListWidgetItem) @pyqtSlot(QListWidgetItem, QListWidgetItem)
def display_specs(self, item, previous_item): def display_specs(self, item, previous_item):
self.display_spectrogram() self.display_spectrogram()
if item: if item is not None:
self.current_signal_name = item.text() self.current_signal_name = item.text()
self.name_lab.setText(self.current_signal_name) self.name_lab.setText(self.current_signal_name)
self.name_lab.setAlignment(Qt.AlignHCenter) self.name_lab.setAlignment(Qt.AlignHCenter)

View File

@@ -312,15 +312,15 @@ QComboBox::drop-down {
} }
QComboBox::down-arrow:enabled { QComboBox::down-arrow:enabled {
image: url("./themes/2-dark/icons/down-arrow.png"); image: url("./themes/dark/icons/down-arrow.png");
} }
QComboBox::down-arrow:disabled { QComboBox::down-arrow:disabled {
image: url("./themes/2-dark/icons/down-arrow_off.png"); image: url("./themes/dark/icons/down-arrow_off.png");
} }
QComboBox::down-arrow:hover { QComboBox::down-arrow:hover {
image: url("./themes/2-dark/icons/down-arrow_hover.png"); image: url("./themes/dark/icons/down-arrow_hover.png");
} }
QComboBox::down-arrow:on { QComboBox::down-arrow:on {
@@ -349,27 +349,27 @@ QRadioButton::indicator{
} }
QRadioButton::indicator::unchecked { QRadioButton::indicator::unchecked {
image: url("./themes/2-dark/icons/off.png"); image: url("./themes/dark/icons/off.png");
} }
QRadioButton::indicator:unchecked:hover { QRadioButton::indicator:unchecked:hover {
image: url("./themes/2-dark/icons/off_press.png"); image: url("./themes/dark/icons/off_press.png");
} }
QRadioButton::indicator:unchecked:pressed { QRadioButton::indicator:unchecked:pressed {
image: url("./themes/2-dark/icons/off_press.png"); image: url("./themes/dark/icons/off_press.png");
} }
QRadioButton::indicator::checked { QRadioButton::indicator::checked {
image: url("./themes/2-dark/icons/on.png"); image: url("./themes/dark/icons/on.png");
} }
QRadioButton::indicator:checked:hover { QRadioButton::indicator:checked:hover {
image: url("./themes/2-dark/icons/on_press.png"); image: url("./themes/dark/icons/on_press.png");
} }
QRadioButton::indicator:checked:pressed { QRadioButton::indicator:checked:pressed {
image: url("./themes/2-dark/icons/on_press.png"); image: url("./themes/dark/icons/on_press.png");
} }
/************************************* /*************************************
@@ -390,41 +390,41 @@ QSpinBox::up-button {
subcontrol-origin: border; subcontrol-origin: border;
subcontrol-position: top right; subcontrol-position: top right;
width: 16px; width: 16px;
image: url("./themes/2-dark/icons/up-arrow.png"); image: url("./themes/dark/icons/up-arrow.png");
border-width: 0px; border-width: 0px;
} }
QSpinBox::up-button:hover { QSpinBox::up-button:hover {
image: url("./themes/2-dark/icons/up-arrow_hover.png"); image: url("./themes/dark/icons/up-arrow_hover.png");
} }
QSpinBox::up-button:pressed { QSpinBox::up-button:pressed {
image: url("./themes/2-dark/icons/up-arrow.png"); image: url("./themes/dark/icons/up-arrow.png");
} }
QSpinBox::up-button:disabled { QSpinBox::up-button:disabled {
image: url("./themes/2-dark/icons/up-arrow_off.png"); image: url("./themes/dark/icons/up-arrow_off.png");
} }
QSpinBox::down-button { QSpinBox::down-button {
subcontrol-origin: border; subcontrol-origin: border;
subcontrol-position: bottom right; subcontrol-position: bottom right;
width: 16px; width: 16px;
image: url("./themes/2-dark/icons/down-arrow.png"); image: url("./themes/dark/icons/down-arrow.png");
border-width: 0px; border-width: 0px;
border-top-width: 0; border-top-width: 0;
} }
QSpinBox::down-button:hover { QSpinBox::down-button:hover {
image: url("./themes/2-dark/icons/down-arrow_hover.png"); image: url("./themes/dark/icons/down-arrow_hover.png");
} }
QSpinBox::down-button:pressed { QSpinBox::down-button:pressed {
image: url("./themes/2-dark/icons/down-arrow.png"); image: url("./themes/dark/icons/down-arrow.png");
} }
QSpinBox::down-button:disabled { QSpinBox::down-button:disabled {
image: url("./themes/2-dark/icons/down-arrow_off.png"); image: url("./themes/dark/icons/down-arrow_off.png");
} }
/************************************* /*************************************

View File

Before

Width:  |  Height:  |  Size: 270 B

After

Width:  |  Height:  |  Size: 270 B

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 820 B

After

Width:  |  Height:  |  Size: 820 B

View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

Before

Width:  |  Height:  |  Size: 916 B

After

Width:  |  Height:  |  Size: 916 B

View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 827 B

After

Width:  |  Height:  |  Size: 827 B

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

Before

Width:  |  Height:  |  Size: 270 B

After

Width:  |  Height:  |  Size: 270 B

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 820 B

After

Width:  |  Height:  |  Size: 820 B

View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

Before

Width:  |  Height:  |  Size: 916 B

After

Width:  |  Height:  |  Size: 916 B

View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 827 B

After

Width:  |  Height:  |  Size: 827 B

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -331,15 +331,15 @@ QComboBox::drop-down {
} }
QComboBox::down-arrow:enabled { QComboBox::down-arrow:enabled {
image: url("./themes/3-material_design_dark/icons/down-arrow.png"); image: url("./themes/material_design_dark/icons/down-arrow.png");
} }
QComboBox::down-arrow:disabled { QComboBox::down-arrow:disabled {
image: url("./themes/3-material_design_dark/icons/down-arrow_off.png"); image: url("./themes/material_design_dark/icons/down-arrow_off.png");
} }
QComboBox::down-arrow:hover { QComboBox::down-arrow:hover {
image: url("./themes/3-material_design_dark/icons/down-arrow_hover.png"); image: url("./themes/material_design_dark/icons/down-arrow_hover.png");
} }
QComboBox::down-arrow:on { QComboBox::down-arrow:on {
@@ -368,27 +368,27 @@ QRadioButton::indicator{
} }
QRadioButton::indicator::unchecked { QRadioButton::indicator::unchecked {
image: url("./themes/3-material_design_dark/icons/off.png"); image: url("./themes/material_design_dark/icons/off.png");
} }
QRadioButton::indicator:unchecked:hover { QRadioButton::indicator:unchecked:hover {
image: url("./themes/3-material_design_dark/icons/off_press.png"); image: url("./themes/material_design_dark/icons/off_press.png");
} }
QRadioButton::indicator:unchecked:pressed { QRadioButton::indicator:unchecked:pressed {
image: url("./themes/3-material_design_dark/icons/off_press.png"); image: url("./themes/material_design_dark/icons/off_press.png");
} }
QRadioButton::indicator::checked { QRadioButton::indicator::checked {
image: url("./themes/3-material_design_dark/icons/on.png"); image: url("./themes/material_design_dark/icons/on.png");
} }
QRadioButton::indicator:checked:hover { QRadioButton::indicator:checked:hover {
image: url("./themes/3-material_design_dark/icons/on_press.png"); image: url("./themes/material_design_dark/icons/on_press.png");
} }
QRadioButton::indicator:checked:pressed { QRadioButton::indicator:checked:pressed {
image: url("./themes/3-material_design_dark/icons/on_press.png"); image: url("./themes/material_design_dark/icons/on_press.png");
} }
/************************************* /*************************************
@@ -409,41 +409,41 @@ QSpinBox::up-button {
subcontrol-origin: border; subcontrol-origin: border;
subcontrol-position: top right; subcontrol-position: top right;
width: 16px; width: 16px;
image: url("./themes/3-material_design_dark/icons/up-arrow.png"); image: url("./themes/material_design_dark/icons/up-arrow.png");
border-width: 0px; border-width: 0px;
} }
QSpinBox::up-button:hover { QSpinBox::up-button:hover {
image: url("./themes/3-material_design_dark/icons/up-arrow_hover.png"); image: url("./themes/material_design_dark/icons/up-arrow_hover.png");
} }
QSpinBox::up-button:pressed { QSpinBox::up-button:pressed {
image: url("./themes/3-material_design_dark/icons/up-arrow.png"); image: url("./themes/material_design_dark/icons/up-arrow.png");
} }
QSpinBox::up-button:disabled { QSpinBox::up-button:disabled {
image: url("./themes/3-material_design_dark/icons/up-arrow_off.png"); image: url("./themes/material_design_dark/icons/up-arrow_off.png");
} }
QSpinBox::down-button { QSpinBox::down-button {
subcontrol-origin: border; subcontrol-origin: border;
subcontrol-position: bottom right; subcontrol-position: bottom right;
width: 16px; width: 16px;
image: url("./themes/3-material_design_dark/icons/down-arrow.png"); image: url("./themes/material_design_dark/icons/down-arrow.png");
border-width: 0px; border-width: 0px;
border-top-width: 0; border-top-width: 0;
} }
QSpinBox::down-button:hover { QSpinBox::down-button:hover {
image: url("./themes/3-material_design_dark/icons/down-arrow_hover.png"); image: url("./themes/material_design_dark/icons/down-arrow_hover.png");
} }
QSpinBox::down-button:pressed { QSpinBox::down-button:pressed {
image: url("./themes/3-material_design_dark/icons/down-arrow.png"); image: url("./themes/material_design_dark/icons/down-arrow.png");
} }
QSpinBox::down-button:disabled { QSpinBox::down-button:disabled {
image: url("./themes/3-material_design_dark/icons/down-arrow_off.png"); image: url("./themes/material_design_dark/icons/down-arrow_off.png");
} }
/************************************* /*************************************

View File

Before

Width:  |  Height:  |  Size: 270 B

After

Width:  |  Height:  |  Size: 270 B

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 820 B

After

Width:  |  Height:  |  Size: 820 B

View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

Before

Width:  |  Height:  |  Size: 916 B

After

Width:  |  Height:  |  Size: 916 B

View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 827 B

After

Width:  |  Height:  |  Size: 827 B

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -331,15 +331,15 @@ QComboBox::drop-down {
} }
QComboBox::down-arrow:enabled { QComboBox::down-arrow:enabled {
image: url("./themes/4-material_design_light/icons/down-arrow.png"); image: url("./themes/material_design_light/icons/down-arrow.png");
} }
QComboBox::down-arrow:disabled { QComboBox::down-arrow:disabled {
image: url("./themes/4-material_design_light/icons/down-arrow_off.png"); image: url("./themes/material_design_light/icons/down-arrow_off.png");
} }
QComboBox::down-arrow:hover { QComboBox::down-arrow:hover {
image: url("./themes/4-material_design_light/icons/down-arrow_hover.png"); image: url("./themes/material_design_light/icons/down-arrow_hover.png");
} }
QComboBox::down-arrow:on { QComboBox::down-arrow:on {
@@ -368,27 +368,27 @@ QRadioButton::indicator{
} }
QRadioButton::indicator::unchecked { QRadioButton::indicator::unchecked {
image: url("./themes/4-material_design_light/icons/off.png"); image: url("./themes/material_design_light/icons/off.png");
} }
QRadioButton::indicator:unchecked:hover { QRadioButton::indicator:unchecked:hover {
image: url("./themes/4-material_design_light/icons/off_press.png"); image: url("./themes/material_design_light/icons/off_press.png");
} }
QRadioButton::indicator:unchecked:pressed { QRadioButton::indicator:unchecked:pressed {
image: url("./themes/4-material_design_light/icons/off_press.png"); image: url("./themes/material_design_light/icons/off_press.png");
} }
QRadioButton::indicator::checked { QRadioButton::indicator::checked {
image: url("./themes/4-material_design_light/icons/on.png"); image: url("./themes/material_design_light/icons/on.png");
} }
QRadioButton::indicator:checked:hover { QRadioButton::indicator:checked:hover {
image: url("./themes/4-material_design_light/icons/on_press.png"); image: url("./themes/material_design_light/icons/on_press.png");
} }
QRadioButton::indicator:checked:pressed { QRadioButton::indicator:checked:pressed {
image: url("./themes/4-material_design_light/icons/on_press.png"); image: url("./themes/material_design_light/icons/on_press.png");
} }
/************************************* /*************************************
@@ -409,41 +409,41 @@ QSpinBox::up-button {
subcontrol-origin: border; subcontrol-origin: border;
subcontrol-position: top right; subcontrol-position: top right;
width: 16px; width: 16px;
image: url("./themes/4-material_design_light/icons/up-arrow.png"); image: url("./themes/material_design_light/icons/up-arrow.png");
border-width: 0px; border-width: 0px;
} }
QSpinBox::up-button:hover { QSpinBox::up-button:hover {
image: url("./themes/4-material_design_light/icons/up-arrow_hover.png"); image: url("./themes/material_design_light/icons/up-arrow_hover.png");
} }
QSpinBox::up-button:pressed { QSpinBox::up-button:pressed {
image: url("./themes/4-material_design_light/icons/up-arrow.png"); image: url("./themes/material_design_light/icons/up-arrow.png");
} }
QSpinBox::up-button:disabled { QSpinBox::up-button:disabled {
image: url("./themes/4-material_design_light/icons/up-arrow_off.png"); image: url("./themes/material_design_light/icons/up-arrow_off.png");
} }
QSpinBox::down-button { QSpinBox::down-button {
subcontrol-origin: border; subcontrol-origin: border;
subcontrol-position: bottom right; subcontrol-position: bottom right;
width: 16px; width: 16px;
image: url("./themes/4-material_design_light/icons/down-arrow.png"); image: url("./themes/material_design_light/icons/down-arrow.png");
border-width: 0px; border-width: 0px;
border-top-width: 0; border-top-width: 0;
} }
QSpinBox::down-button:hover { QSpinBox::down-button:hover {
image: url("./themes/4-material_design_light/icons/down-arrow_hover.png"); image: url("./themes/material_design_light/icons/down-arrow_hover.png");
} }
QSpinBox::down-button:pressed { QSpinBox::down-button:pressed {
image: url("./themes/4-material_design_light/icons/down-arrow.png"); image: url("./themes/material_design_light/icons/down-arrow.png");
} }
QSpinBox::down-button:disabled { QSpinBox::down-button:disabled {
image: url("./themes/4-material_design_light/icons/down-arrow_off.png"); image: url("./themes/material_design_light/icons/down-arrow_off.png");
} }
/************************************* /*************************************

View File

@@ -14,7 +14,7 @@ class ThemeConstants:
FOLDER = "themes" FOLDER = "themes"
EXTENSION = ".qss" EXTENSION = ".qss"
ICONS_FOLDER = "icons" ICONS_FOLDER = "icons"
DEFAULT = "1-dark" DEFAULT = "dark"
CURRENT = ".current_theme" CURRENT = ".current_theme"
COLORS = "colors.txt" COLORS = "colors.txt"
COLOR_SEPARATOR = "=" COLOR_SEPARATOR = "="
@@ -117,7 +117,7 @@ class ThemeManager:
def __pretty_name(self, bad_name): def __pretty_name(self, bad_name):
return ' '.join( return ' '.join(
map(lambda s: s.capitalize(), map(lambda s: s.capitalize(),
bad_name.split('-')[1].split('_') bad_name.split('_')
) )
) )
@@ -125,7 +125,7 @@ class ThemeManager:
themes = [] themes = []
ag = QActionGroup(self.__parent, exclusive=True) ag = QActionGroup(self.__parent, exclusive=True)
if os.path.exists(ThemeConstants.FOLDER): if os.path.exists(ThemeConstants.FOLDER):
for theme_folder in os.listdir(ThemeConstants.FOLDER): for theme_folder in sorted(os.listdir(ThemeConstants.FOLDER)):
relative_folder = os.path.join(ThemeConstants.FOLDER, theme_folder) relative_folder = os.path.join(ThemeConstants.FOLDER, theme_folder)
if os.path.isdir(os.path.abspath(relative_folder)): if os.path.isdir(os.path.abspath(relative_folder)):
relative_folder = os.path.join(ThemeConstants.FOLDER, theme_folder) relative_folder = os.path.join(ThemeConstants.FOLDER, theme_folder)
@@ -157,7 +157,7 @@ class ThemeManager:
return match_ok(colors) return match_ok(colors)
def __change(self): def __change(self):
theme_name = os.path.basename(self.__theme_path).split('-')[1] + ThemeConstants.EXTENSION theme_name = os.path.basename(self.__theme_path) + ThemeConstants.EXTENSION
try: try:
with open( with open(
os.path.join(self.__theme_path, theme_name), "r" os.path.join(self.__theme_path, theme_name), "r"