Hide or show the waterfall+audio_widget based on the current main tab

This commit is contained in:
alessandro90
2019-06-25 18:46:06 +02:00
parent 497cdeed4a
commit 52ac5e7752
2 changed files with 22 additions and 1 deletions

View File

@@ -32,7 +32,8 @@ from constants import (Constants,
Database, Database,
ChecksumWhat, ChecksumWhat,
Messages, Messages,
Signal,) Signal,
MainTabs,)
from themesmanager import ThemeManager from themesmanager import ThemeManager
from utilities import (checksum_ok, from utilities import (checksum_ok,
uncheck_and_emit, uncheck_and_emit,
@@ -531,14 +532,24 @@ class Artemis(QMainWindow, Ui_MainWindow):
self.update_forecast_bar.set_idle() self.update_forecast_bar.set_idle()
self.forecast_data.update_complete.connect(self.update_forecast) self.forecast_data.update_complete.connect(self.update_forecast)
self.main_tab.currentChanged.connect(self.hide_show_right_widget)
# Final operations. # Final operations.
self.theme_manager.start() self.theme_manager.start()
self.load_db() self.load_db()
self.display_signals() 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() @pyqtSlot()
def set_visible_tab(self): 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: if self.main_tab.currentWidget() != self.signal_properties_tab:
self.main_tab.setCurrentWidget(self.signal_properties_tab) self.main_tab.setCurrentWidget(self.signal_properties_tab)
else: else:

View File

@@ -1,6 +1,16 @@
from collections import namedtuple from collections import namedtuple
from enum import Enum, auto from enum import Enum, auto
import os.path import os.path
from enum import IntEnum
class MainTabs(IntEnum):
"""The main tabs indeces."""
SIGNAL = 0
FILTERS = 1
GFD = 2
FORECAST = 3
class Ftype: class Ftype: