From 52ac5e77522b106901c948fcceafd0a96d8bc244 Mon Sep 17 00:00:00 2001 From: alessandro90 Date: Tue, 25 Jun 2019 18:46:06 +0200 Subject: [PATCH] Hide or show the waterfall+audio_widget based on the current main tab --- artemis.py | 13 ++++++++++++- constants.py | 10 ++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/artemis.py b/artemis.py index f6e07b5..1b7e687 100644 --- a/artemis.py +++ b/artemis.py @@ -32,7 +32,8 @@ from constants import (Constants, Database, ChecksumWhat, Messages, - Signal,) + Signal, + MainTabs,) from themesmanager import ThemeManager from utilities import (checksum_ok, uncheck_and_emit, @@ -531,14 +532,24 @@ class Artemis(QMainWindow, Ui_MainWindow): self.update_forecast_bar.set_idle() self.forecast_data.update_complete.connect(self.update_forecast) + self.main_tab.currentChanged.connect(self.hide_show_right_widget) # Final operations. self.theme_manager.start() self.load_db() self.display_signals() + @pyqtSlot() + def hide_show_right_widget(self): + """Hide or show the waterfall+audio widget based on the current tab.""" + if self.main_tab.currentIndex() == MainTabs.FORECAST: + self.fixed_audio_and_image.setVisible(False) + elif not self.fixed_audio_and_image.isVisible(): + self.fixed_audio_and_image.setVisible(True) + @pyqtSlot() def set_visible_tab(self): + """Set the current main tab when double-clicking a signal name.""" if self.main_tab.currentWidget() != self.signal_properties_tab: self.main_tab.setCurrentWidget(self.signal_properties_tab) else: diff --git a/constants.py b/constants.py index 81449d6..0057942 100644 --- a/constants.py +++ b/constants.py @@ -1,6 +1,16 @@ from collections import namedtuple from enum import Enum, auto import os.path +from enum import IntEnum + + +class MainTabs(IntEnum): + """The main tabs indeces.""" + + SIGNAL = 0 + FILTERS = 1 + GFD = 2 + FORECAST = 3 class Ftype: