setools/setoolsgui/widgets/models/bounds.py
Chris PeBenito 40254914ae Split SEToolsTableModel and SEToolsListModel into separate modules.
Signed-off-by: Chris PeBenito <pebenito@ieee.org>
2024-01-31 10:11:55 -05:00

33 lines
829 B
Python

# Copyright 2016, Tresys Technology, LLC
#
# SPDX-License-Identifier: LGPL-2.1-only
#
#
from PyQt5.QtCore import Qt
from .table import SEToolsTableModel
class BoundsTableModel(SEToolsTableModel):
"""Table-based model for *bounds."""
headers = ["Rule Type", "Parent", "Child"]
def data(self, index, role):
if self.item_list and index.isValid():
row = index.row()
col = index.column()
item = self.item_list[row]
if role == Qt.ItemDataRole.DisplayRole:
if col == 0:
return item.ruletype.name
elif col == 1:
return item.parent.name
elif col == 2:
return item.child.name
elif role == Qt.ItemDataRole.UserRole:
return item