Commit 26febca0 authored by Bob Obara's avatar Bob Obara

ENH: Changing Icons for Model and Attribute

Added new icons for model and attribute resources as well as an icon for attributes.
parent 28d5a364
......@@ -33,9 +33,44 @@ if __name__ == '__main__':
defn = resource.createDefinition('testdef')
resource.setRefModelResource(mmgr)
defn.setLocalAssociationMask(int(mask))
defn.associationRule().setIsExtensible(True)
# Create attribute and associate to group item
att = resource.createAttribute('testatt', defn)
att.associateEntity(group_item.entity())
a = att.associateEntity(group_item.entity())
if a:
print "Association Worked"
else:
print "Association Failed"
status = -1
uuids = att.associatedModelEntityIds()
print "the number of ents associated with the att is ", len(uuids)
# Check to see if the attribute is associated with the entity
if att.isEntityAssociated(group_item):
print "Attribute knows about the entity via UUID"
else:
print "Attribute does not know about the entity via UUID"
status = -1
# Check to see if the model entity knows about the attribute
if group_item.hasAttributes():
print "Model Entity does have attributes"
if group_item.hasAttribute(att.id()):
print "Model Entity has this attribute associated"
else:
print "Model Entity does not have this attribute associated with it"
status = -1
uuids = group_item.attributes()
print "the number of attributes associated with the ent is ", len(uuids)
# There should be only 1 attribute on it
if len(uuids) == 1:
print "Model Entity return correct attribute list size"
if att.id() in uuids:
print "Model Entity did return the attribute via attributes() call"
else:
print "Model Entity does not have any attributes"
sys.exit(status)
......@@ -28,6 +28,7 @@
#include "smtk/attribute/Attribute.h"
#include "smtk/attribute/ComponentItem.h"
#include "smtk/attribute/MeshItem.h"
#include "smtk/attribute/Resource.h"
#include <QtCore/QDir>
#include <QtCore/QDirIterator>
......@@ -489,6 +490,7 @@ QIcon qtDescriptivePhraseModel::lookupIconForPhraseFlags(
// REFERENCE: https://stackoverflow.com/questions/3942878/how-to-decide-font-color-in-white-or-black-depending-on-background-color
double lightness = 0.2126 * color.redF() + 0.7152 * color.greenF() + 0.0722 * color.blueF();
auto modelComp = dynamic_pointer_cast<smtk::model::Entity>(item->relatedComponent());
auto attComp = dynamic_pointer_cast<smtk::attribute::Attribute>(item->relatedComponent());
std::ostringstream resourceName;
resourceName << ":/icons/entityTypes/";
if (modelComp)
......@@ -543,6 +545,26 @@ QIcon qtDescriptivePhraseModel::lookupIconForPhraseFlags(
resourceName << "_w";
}
}
else if (attComp)
{
resourceName << "attribute";
}
else if (item->relatedComponent() == nullptr)
{
// Lets check the resource
if (dynamic_pointer_cast<smtk::model::Resource>(item->relatedResource()) != nullptr)
{
resourceName << "modelResource";
}
else if (dynamic_pointer_cast<smtk::attribute::Resource>(item->relatedResource()) != nullptr)
{
resourceName << "attributeResource";
}
else
{
resourceName << "invalid";
}
}
else
{
resourceName << "invalid";
......
<RCC>
<qresource prefix="/icons/entityTypes">
<file alias = "attribute.png">icons/attribute.png</file>
<file alias = "attributeResource.png">icons/attributeResource.png</file>
<file alias = "cell_01_b.png">icons/cell_01_b.png</file>
<file alias = "cell_01_w.png">icons/cell_01_w.png</file>
<file alias = "cell_02_b.png">icons/cell_02_b.png</file>
......@@ -11,6 +13,7 @@
<file alias = "generic_entity.png">icons/generic_entity.png</file>
<file alias = "cell_04.png">icons/cell_04.png</file>
<file alias = "model.png">icons/model.png</file>
<file alias = "modelResource.png">icons/modelResource.png</file>
<file alias = "group.png">icons/group.png</file>
<file alias = "aux_geom.png">icons/aux_geom.png</file>
</qresource>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment