2016-04-14 13:55:40 +00:00
|
|
|
# Copyright 2016, Tresys Technology, LLC
|
|
|
|
#
|
|
|
|
# This file is part of SETools.
|
|
|
|
#
|
|
|
|
# SETools is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU Lesser General Public License as
|
|
|
|
# published by the Free Software Foundation, either version 2.1 of
|
|
|
|
# the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# SETools is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU Lesser General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Lesser General Public
|
|
|
|
# License along with SETools. If not, see
|
|
|
|
# <http://www.gnu.org/licenses/>.
|
|
|
|
#
|
|
|
|
from PyQt5.QtCore import Qt
|
|
|
|
|
|
|
|
from .models import SEToolsTableModel
|
|
|
|
|
|
|
|
|
|
|
|
class BoundsTableModel(SEToolsTableModel):
|
|
|
|
|
|
|
|
"""Table-based model for *bounds."""
|
|
|
|
|
2016-06-08 11:26:32 +00:00
|
|
|
headers = ["Rule Type", "Parent", "Child"]
|
2016-04-14 13:55:40 +00:00
|
|
|
|
|
|
|
def data(self, index, role):
|
2016-04-21 14:07:12 +00:00
|
|
|
if self.resultlist and index.isValid():
|
2016-04-14 13:55:40 +00:00
|
|
|
row = index.row()
|
|
|
|
col = index.column()
|
|
|
|
item = self.resultlist[row]
|
|
|
|
|
|
|
|
if role == Qt.DisplayRole:
|
|
|
|
if col == 0:
|
2016-09-03 20:37:43 +00:00
|
|
|
return item.ruletype.name
|
2016-04-14 13:55:40 +00:00
|
|
|
elif col == 1:
|
2018-08-18 17:35:09 +00:00
|
|
|
return item.parent.name
|
2016-04-14 13:55:40 +00:00
|
|
|
elif col == 2:
|
2018-08-18 17:35:09 +00:00
|
|
|
return item.child.name
|
2016-04-14 13:55:40 +00:00
|
|
|
|
|
|
|
elif role == Qt.UserRole:
|
|
|
|
return item
|