Example #1
0
 def createFieldsRoot(self, p_field, p_subitems_type):
     """Create single fields root in properties model. This root represents
     either field or stimulus, and contains its attributes.
     This function is used when recreating model from configuration file."""
     if (p_subitems_type == 'fields'):
         l_rootName = 'Pole'
         l_type = 'field'
         l_attributes = self.fieldAttributes
     else: # stimuluses
         l_type = p_field['stimulus_type']
         l_rootName = 'Bodziec (typ: ' + l_type + ')'
         l_attributes = self.stimulusAttributes[l_type]
     
     l_root = UGMPropertiesRoot(l_rootName, l_type)
     p_property = UGMProperty('id', p_field['id'], 'int', {})
     for i_attributeName in l_attributes:
         p_property = UGMProperty(i_attributeName, p_field[i_attributeName], 
                                  self.attributeTypes[i_attributeName]['type'], 
                                  self.attributeTypes[i_attributeName]['parameters'])
         l_root.addChild(p_property)
     if 'stimuluses' in p_field:
         p_stimulusesRoot = self.createRoot(p_field['stimuluses'], 'stimuluses', 'stimuluses')
         l_root.addChild(p_stimulusesRoot)
     l_root.setupDependents()
     return l_root
Example #2
0
 def createEmptyRoot(self, p_type):
     """Creates empty root of given type to be inserted into model."""
     if p_type == 'field':
         l_attributes = self.fieldAttributes
         l_rootName = 'Pole'
     else:
         l_attributes = self.stimulusAttributes[p_type]
         l_rootName = 'Bodziec (typ: ' + p_type + ')'
         
     l_root = UGMPropertiesRoot(l_rootName, p_type)
     p_property = UGMProperty('id', 0, 'int', {})
     for i_attributeName in l_attributes:
         p_property = UGMProperty(i_attributeName, 
                                  self.attributeTypes[i_attributeName]['default'], 
                                  self.attributeTypes[i_attributeName]['type'], 
                                  self.attributeTypes[i_attributeName]['parameters'])
         l_root.addChild(p_property)
     p_stimulusesRoot = UGMPropertiesRoot('stimuluses', 'list')
     l_root.addChild(p_stimulusesRoot)
     l_root.setupDependents()
     return l_root
Example #3
0
 def createRoot(self, p_subitems, p_subitems_type, p_name):
     """Creates single list root in properites model. This root contains
     stimuluses or fields
     This function is used when recreating model from configuration file."""
     l_root = UGMPropertiesRoot(p_name, 'list')
     for i_subitem in p_subitems:
         p_subItemsRoot = self.createFieldsRoot(i_subitem, p_subitems_type)
         l_root.addChild(p_subItemsRoot)
     l_root.setupDependents()
     return l_root