setoolsgui: Use symbol name attribute where now possible.

This commit is contained in:
Chris PeBenito 2018-08-18 13:35:09 -04:00
parent bbb41965fd
commit 87f28f850f
11 changed files with 19 additions and 19 deletions

View File

@ -53,7 +53,7 @@ class BooleanTableModel(SEToolsTableModel):
if role == Qt.DisplayRole:
if col == 0:
return str(boolean)
return boolean.name
elif col == 1:
return str(boolean.state)

View File

@ -37,9 +37,9 @@ class BoundsTableModel(SEToolsTableModel):
if col == 0:
return item.ruletype.name
elif col == 1:
return str(item.parent)
return item.parent.name
elif col == 2:
return str(item.child)
return item.child.name
elif role == Qt.UserRole:
return item

View File

@ -57,9 +57,9 @@ class CommonTableModel(SEToolsTableModel):
if role == Qt.DisplayRole:
if col == 0:
return str(item)
return item.name
elif col == 1:
return ", ".join(sorted(str(p) for p in item.perms))
return ", ".join(sorted(item.perms))
elif role == Qt.UserRole:
return item

View File

@ -38,7 +38,7 @@ class ConstraintTableModel(SEToolsTableModel):
if col == 0:
return rule.ruletype.name
elif col == 1:
return str(rule.tclass)
return rule.tclass.name
elif col == 2:
try:
return ", ".join(sorted(rule.perms))

View File

@ -35,7 +35,7 @@ class InitialSIDTableModel(SEToolsTableModel):
if role == Qt.DisplayRole:
if col == 0:
return str(rule)
return rule.name
elif col == 1:
return str(rule.context)

View File

@ -78,9 +78,9 @@ class MLSComponentTableModel(SEToolsTableModel):
if role == Qt.DisplayRole:
if col == 0:
return str(item)
return item.name
elif col == 1:
return ", ".join(sorted(str(a) for a in item.aliases()))
return ", ".join(sorted(a for a in item.aliases()))
elif role == Qt.UserRole:
return item

View File

@ -73,7 +73,7 @@ class ObjClassTableModel(SEToolsTableModel):
if role == Qt.DisplayRole:
if col == 0:
return str(item)
return item.name
elif col == 1:
try:
com_perms = item.common.perms

View File

@ -62,9 +62,9 @@ class RoleTableModel(SEToolsTableModel):
if role == Qt.DisplayRole:
if col == 0:
return str(item)
return item.name
elif col == 1:
return ", ".join(sorted(str(t) for t in item.types()))
return ", ".join(sorted(t.name for t in item.types()))
elif role == Qt.UserRole:
# get the whole object
return item

View File

@ -59,9 +59,9 @@ class TypeAttributeTableModel(SEToolsTableModel):
if role == Qt.DisplayRole:
if col == 0:
return str(item)
return item.name
elif col == 1:
return ", ".join(sorted(str(t) for t in item.expand()))
return ", ".join(sorted(t.name for t in item.expand()))
elif role == Qt.UserRole:
return item

View File

@ -65,11 +65,11 @@ class TypeTableModel(SEToolsTableModel):
if role == Qt.DisplayRole:
if col == 0:
return str(item)
return item.name
elif col == 1:
return ", ".join(sorted(str(a) for a in item.attributes()))
return ", ".join(sorted(a.name for a in item.attributes()))
elif col == 2:
return ", ".join(sorted(str(a) for a in item.aliases()))
return ", ".join(sorted(a for a in item.aliases()))
elif col == 3 and item.ispermissive:
return "Permissive"

View File

@ -75,9 +75,9 @@ class UserTableModel(SEToolsTableModel):
user = self.resultlist[row]
if col == 0:
return str(user)
return user.name
elif col == 1:
return ", ".join(sorted(str(r) for r in user.roles))
return ", ".join(sorted(r.name for r in user.roles))
elif col == 2:
try:
return str(user.mls_level)