# Path: alignak_app/backend/datamanager.py
# class DataManager(object):
#     def __init__(self):
#     def is_ready(self):
#     def update_database(self, item_type, items_list):
#     def get_item(self, item_type, key, value=None):
#     def remove_item(self, item_type, key, value=None):
#     def update_item_data(self, item_type, item_id, data):
#     def get_realm_name(self, realm):
#     def get_period_name(self, period):
#     def get_synthesis_count(self):
#     def get_all_hostnames(self):
#     def get_host_services(self, host_id):
#     def get_host_with_services(self, host_field):
#     def get_events(self):
#     def get_items_and_problems(self):
#     def update_problems(self):
#     def get_problems(self):
#     def is_problem(item_type, item_data):
# 
# Path: alignak_app/utils/config.py
# class Settings(object):
#     def __init__(self):
#     def init_config(self):
#     def get_config(self, section, option, boolean=False):
#     def set_config(self, section, option, new_value):
#     def get_image(self, name):
#     def init_css(self):
# def open_url(endpoint='login'):  # pragma: no cover
# def get_url_endpoint_from_icon_name(icon_name):
# 
# Path: alignak_app/items/item.py
# def get_icon_name_from_state(item_type, state):
#     """
#     Return icon name from state for host or service
# 
#     :param item_type: type of item: host or service
#     :type item_type: str
#     :param state: state of item
#     :type state: str
#     :return:
#     """
# 
#     if state == 'DOWNTIME':
#         return 'downtime'
#     if state == 'ACKNOWLEDGE':
#         return 'acknowledge'
# 
#     return '%ss_%s' % (item_type, state.lower())


from logging import getLogger
from PyQt5.Qt import QIcon, QStandardItem, Qt, QAbstractItemView, QSize, QTableView
from PyQt5.Qt import QSortFilterProxyModel, QStandardItemModel
from alignak_app.backend.datamanager import data_manager
from alignak_app.utils.config import settings
from alignak_app.items.item import get_icon_name_from_state
        super(ProblemsQTableView, self).__init__(parent)
        self.setWindowIcon(QIcon(settings.get_image('icon')))
        self.setObjectName('problems')
        self.verticalHeader().hide()
        self.verticalHeader().setDefaultSectionSize(40)
        self.setIconSize(QSize(24, 24))
        self.setHorizontalScrollMode(QAbstractItemView.ScrollPerPixel)
        self.setEditTriggers(QAbstractItemView.NoEditTriggers)
        self.horizontalHeader().setStretchLastSection(True)
        self.horizontalHeader().setMinimumHeight(40)
        self.horizontalHeader().setDefaultAlignment(Qt.AlignCenter)
        self.setSelectionMode(QAbstractItemView.SingleSelection)
        # Fields
        self.headers_list = [
            _('Items in problem'), _('Output')
        ]

    def get_tableitem(self, item):
        """
        Return centered QTableWidgetItem with problem

        :param item: host or service item
        :type item: alignak_app.items.host.Host | alignak_app.items.service.Service
        :return: table item with text
        :rtype: QStandardItem
        """

        tableitem = QStandardItem(self.get_item_text(item))
        tableitem.setData(item, Qt.UserRole)


# Path: alignak_app/backend/datamanager.py
# class DataManager(object):
#     def __init__(self):
#     def is_ready(self):
#     def update_database(self, item_type, items_list):
#     def get_item(self, item_type, key, value=None):
#     def remove_item(self, item_type, key, value=None):
#     def update_item_data(self, item_type, item_id, data):
#     def get_realm_name(self, realm):
#     def get_period_name(self, period):
#     def get_synthesis_count(self):
#     def get_all_hostnames(self):
#     def get_host_services(self, host_id):
#     def get_host_with_services(self, host_field):
#     def get_events(self):
#     def get_items_and_problems(self):
#     def update_problems(self):
#     def get_problems(self):
#     def is_problem(item_type, item_data):
# 
# Path: alignak_app/utils/config.py
# class Settings(object):
#     def __init__(self):
#     def init_config(self):
#     def get_config(self, section, option, boolean=False):
#     def set_config(self, section, option, new_value):
#     def get_image(self, name):
#     def init_css(self):
# def open_url(endpoint='login'):  # pragma: no cover
# def get_url_endpoint_from_icon_name(icon_name):
# 
# Path: alignak_app/items/item.py
# def get_icon_name_from_state(item_type, state):
#     """
#     Return icon name from state for host or service
# 
#     :param item_type: type of item: host or service
#     :type item_type: str
#     :param state: state of item
#     :type state: str
#     :return:
#     """
# 
#     if state == 'DOWNTIME':
#         return 'downtime'
#     if state == 'ACKNOWLEDGE':
#         return 'acknowledge'
# 
#     return '%ss_%s' % (item_type, state.lower())


# Path: alignak_app/qobjects/alignak/problems_table.py
from logging import getLogger
from PyQt5.Qt import QIcon, QStandardItem, Qt, QAbstractItemView, QSize, QTableView
from PyQt5.Qt import QSortFilterProxyModel, QStandardItemModel
from alignak_app.backend.datamanager import data_manager
from alignak_app.utils.config import settings
from alignak_app.items.item import get_icon_name_from_state

        super(ProblemsQTableView, self).__init__(parent)
        self.setWindowIcon(QIcon(settings.get_image('icon')))
        self.setObjectName('problems')
        self.verticalHeader().hide()
        self.verticalHeader().setDefaultSectionSize(40)
        self.setIconSize(QSize(24, 24))
        self.setHorizontalScrollMode(QAbstractItemView.ScrollPerPixel)
        self.setEditTriggers(QAbstractItemView.NoEditTriggers)
        self.horizontalHeader().setStretchLastSection(True)
        self.horizontalHeader().setMinimumHeight(40)
        self.horizontalHeader().setDefaultAlignment(Qt.AlignCenter)
        self.setSelectionMode(QAbstractItemView.SingleSelection)
        # Fields
        self.headers_list = [
            _('Items in problem'), _('Output')
        ]

    def get_tableitem(self, item):
        """
        Return centered QTableWidgetItem with problem

        :param item: host or service item
        :type item: alignak_app.items.host.Host | alignak_app.items.service.Service
        :return: table item with text
        :rtype: QStandardItem
        """

        tableitem = QStandardItem(self.get_item_text(item))
        tableitem.setData(item, Qt.UserRole)


        icon = QIcon(settings.get_image(