Commit df85607b authored by John Tourtellott's avatar John Tourtellott

Update scripts to revised smtk::attribute::Item::Type enum

parent d1f9ca8a
......@@ -45,7 +45,7 @@ def ExportCMB(spec):
scope.sim_atts = spec.getSimulationAttributes()
if scope.sim_atts is not None:
scope.model_manager = scope.sim_atts.refModelManager()
mask = int(smtk.model.MODEL_ENTITY)
mask = int(smtk.model.ModelEntityType)
model_ents = scope.model_manager.entitiesMatchingFlags(mask, True)
#print 'model_ents', model_ents
if not model_ents:
......
......@@ -41,7 +41,7 @@ def ExportCMB(spec):
scope.sim_atts = spec.getSimulationAttributes()
if scope.sim_atts is not None:
scope.model_manager = scope.sim_atts.refModelManager()
mask = int(smtk.model.MODEL_ENTITY)
mask = int(smtk.model.ModelEntityType)
model_ents = scope.model_manager.entitiesMatchingFlags(mask, True)
#print 'model_ents', model_ents
if not model_ents:
......
......@@ -41,7 +41,7 @@ def ExportCMB(spec):
scope.sim_atts = spec.getSimulationAttributes()
if scope.sim_atts is not None:
scope.model_manager = scope.sim_atts.refModelManager()
mask = int(smtk.model.MODEL_ENTITY)
mask = int(smtk.model.ModelEntityType)
model_ents = scope.model_manager.entitiesMatchingFlags(mask, True)
#print 'model_ents', model_ents
if not model_ents:
......
......@@ -485,7 +485,7 @@ def write_items(scope, att, format_list, ent_id=None):
continue
# Check if item is group with multiple sub groups
if item.type() == smtk.attribute.Item.GROUP:
if item.type() == smtk.attribute.Item.GroupType:
n = concrete_item.numberOfGroups()
for i in range(n):
output_text = render_card(scope, concrete_item, card_format, \
......@@ -870,7 +870,7 @@ def get_values_as_strings(scope, item):
exp_att = item.expression(i)
exp_id = get_function_id(scope, exp_att)
output_list.append('%d' % exp_id)
elif item.type() == smtk.attribute.Item.DOUBLE and \
elif item.type() == smtk.attribute.Item.DoubleType and \
item.allowsExpressions():
# Create expression for constant-valued item
......
......@@ -22,7 +22,7 @@ def writeMethodItem(writer, i, indent):
if i.isEnabled():
if i.name() == "id_method":
writer.write("%s%s = '%s'\n"%(indent,i.name(),i.valueAsString()))
elif i.type() == smtk.attribute.Item.Type.VOID:
elif i.type() == smtk.attribute.Item.VoidType:
writer.write("%s%s\n"%(indent,i.name()))
else:
writer.write("%s%s = %s\n"%(indent,i.name(),i.valueAsString()))
......
......@@ -179,7 +179,7 @@ class ProjectCardFormat:
Returns string, or None if error occurs
'''
if parent_item.type() != smtk.attribute.Item.GROUP:
if parent_item.type() != smtk.attribute.Item.GroupType:
print 'ERROR: item %s is not a group item' % parent_item.name()
return None
group_item = smtk.attribute.to_concrete(parent_item)
......@@ -193,9 +193,6 @@ class ProjectCardFormat:
return None
child_item = smtk.attribute.to_concrete(item)
# if child_item.type() != smtk.attribute.Item.INT:
# print 'ERROR item %s is not type integer' % item_type
# return False
string_value = child_item.valueAsString(0)
if zfill_size:
......
......@@ -1062,7 +1062,7 @@ def get_item_value(item, index=0):
Returns Item value, handling VoidItem as a special case
'''
value = None
if item.type() == smtk.attribute.Item.VOID:
if item.type() == smtk.attribute.Item.VoidType:
value = 'on' if item.isEnabled() else 'off'
else:
value = item.value(index)
......
......@@ -116,7 +116,7 @@ class CardFormat:
self.write_value(out, value, tab=tab)
return self.finish_write(item)
if item.type() == smtk.attribute.Item.VOID:
if item.type() == smtk.attribute.Item.VoidType:
self.write_value(
out, item.isEnabled(), as_boolean=True, tab=tab)
return self.finish_write(item)
......@@ -139,7 +139,7 @@ class CardFormat:
value_list = list()
for i in range(concrete_item.numberOfValues()):
value_list.append(concrete_item.value(i))
if item.type() == smtk.attribute.Item.STRING:
if item.type() == smtk.attribute.Item.StringType:
string_list = ['\"%s\"' % x for x in value_list]
else:
string_list = [str(x) for x in value_list]
......
......@@ -427,7 +427,7 @@ def write_nfile(scope):
value = None
if name in alt_name_dict:
name = alt_name_dict.get(name)
if subitem.type() == smtk.attribute.Item.GROUP:
if subitem.type() == smtk.attribute.Item.GroupType:
value = dict()
num_components = subitem.numberOfItemsPerGroup()
for j in range(num_components):
......@@ -855,7 +855,7 @@ def write_format_info_instance(scope, lvalue, att_type, item_path, \
value = 'VALUE_NOT_FOUND'
if debug:
print 'debug value %d: %s' % (i, item.valueAsString(i))
if item.type() == smtk.attribute.Item.VOID:
if item.type() == smtk.attribute.Item.VoidType:
value = True
elif not item.isSet(i):
continue
......@@ -1010,7 +1010,7 @@ def get_item_value(item, index=0):
TODO handle RefItem type
'''
value = 'VALUE_NOT_FOUND'
if item.type() == smtk.attribute.Item.VOID:
if item.type() == smtk.attribute.Item.VoidType:
value = item.isEnabled()
elif not item.isEnabled():
value = None
......
......@@ -138,7 +138,7 @@ class CardFormat:
(att.name(), full_item_path)
return False
if item.type() == smtk.attribute.Item.VOID:
if item.type() == smtk.attribute.Item.VoidType:
self.__class__.write_value(
out, self.keyword, item.isEnabled(), as_boolean=True)
return self._finish_write()
......@@ -166,7 +166,7 @@ class CardFormat:
if self.skip_default and concrete_item.isUsingDefault(0):
return False
if item.type() == smtk.attribute.Item.MODEL_ENTITY:
if item.type() == smtk.attribute.Item.ModelEntityType:
id_string = self.__class__.get_model_entity_ids(concrete_item, as_string=True)
if id_string:
self.__class__.write_value(out, self.keyword, id_string, quote_string=False)
......
......@@ -341,9 +341,9 @@ class Writer:
CardFormat.write_value(
self.out, 'face_set_ids', face_set_string, quote_string=False)
if active_item.type() == smtk.attribute.Item.DOUBLE:
if active_item.type() == smtk.attribute.Item.DoubleType:
CardFormat.write_value(self.out, 'data_constant', active_item.value(0))
if active_item.type() == smtk.attribute.Item.GROUP:
if active_item.type() == smtk.attribute.Item.GroupType:
value_list = list()
for i in range(active_item.numberOfItemsPerGroup()):
subitem = active_item.item(0, i)
......@@ -735,7 +735,7 @@ class Writer:
CardFormat.ModelManager = self.model_manager
# Get mesh file from model manager
mask = int(smtk.model.MODEL_ENTITY)
mask = int(smtk.model.ModelEntityType)
model_ents = self.model_manager.entitiesMatchingFlags(mask, True)
#print 'model_ents', model_ents
if not model_ents:
......
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