from PyQt5.QtCore import Qt
from PyQt5.QtGui import QPixmap
from PyQt5.QtWidgets import QWidget, QLabel, QVBoxLayout
import os
from ..model.gui_data_interface import GUIDataInterface
from ..styles import style_tab_behaviours
from .animal_tab import AnimalTab
HERE = os.path.dirname(os.path.abspath(__file__))
[docs]
class TabBehaviours(QWidget):
"""Behaviours tab — define animals and their behaviours.
Provides a sub-tab per animal where behaviours can be added,
removed, renamed, coloured, and assigned icons.
"""
def __init__(self, parent: QWidget, gui_data_interface: GUIDataInterface):
super(TabBehaviours, self).__init__(parent)
self.gui_data_interface = gui_data_interface
self.init_UI()
[docs]
def init_UI(self):
self._init_background_image()
stylesheetTab = self._init_animal_tab()
self.setStyleSheet(stylesheetTab)
def _init_animal_tab(self):
vbox = QVBoxLayout()
self.setLayout(vbox)
self.tabs = AnimalTab(self, self.gui_data_interface)
self.setStyleSheet(style_tab_behaviours)
vbox.addStretch()
vbox.addWidget(self.tabs)
vbox.addStretch()
stylesheetTab = """
QTabBar::tab:selected {background: rgba(255, 255, 255, 100);}
QTabWidget>QWidget{background: rgba(255, 255, 255, 100);}
"""
return stylesheetTab
def _init_background_image(self):
pass # replaced by global dark theme
[docs]
def resizeEvent(self, event):
pass
[docs]
def get_number_of_animals(self):
return len(self.tabs.tabs_)
[docs]
def get_number_of_behaviours_of_animal(self, i):
return len(self.tabs.tabs_[i].behav_widgets)