def __init__(self, document, attributes):
     Node.__init__(self, document)
     self._pinfos = []
     self._coord_system = attributes.get('registry-coordinate-system')
     if self._coord_system is None:
         self._coord_system = 'InstrumentScientist'
     return
Esempio n. 2
0
    def __init__(self, document, attributes):
        Node.__init__(self, document)

        # convert to dictionary
        attrs = {}
        for k,v in attributes.items(): attrs[str(k)] = v

        # new element
        self.element = self.elementFactory(**attrs)

        return
Esempio n. 3
0
    def __init__(self, document, attributes):
        Node.__init__(self, document)

        # convert to dictionary
        attrs = {}
        for k, v in attributes.items():
            attrs[str(k)] = v

        # new element
        self.element = self.elementFactory(**attrs)

        return
Esempio n. 4
0
    def __init__(self, document, attributes):
        Node.__init__(self, document)

        # convert to dictionary
        attrs = {}
        for k, v in attributes.items():
            attrs[str(k)] = v

        type = attrs['type']
        from sampleassembly.elements import phases
        factory = getattr(phases, type)
        self.element = factory()
        return
Esempio n. 5
0
    def __init__(self, document, attributes):
        Node.__init__(self, document)

        try:
            name = attributes['name']
        except KeyError:
            print(list(attributes.keys()))
            raise XMLFormatError("Element does not have the 'name' attribute."\
                  "Element type: %s" % (
                self.__class__.__name__ ))
        guid = attributes.get('guid')

        # convert to dictionary
        attrs = {}
        for k,v in list(attributes.items()): attrs[str(k)] = v
        del attrs['name'], attrs['guid']

        # see if we have instrument instance established
        try:
            instrument = document.instrument
        except AttributeError :
            instrument = None
            
        # create guid if necessary and possible
        if guid is None and instrument:
            guid = instrument.getUniqueID()
            pass

        # new element
        self.element = self.ElementFactory(name, guid = guid, **attrs)

        #register guid, element pair
        if instrument is None and isInstrument(self.element):
            #establish instrument instance
            document.instrument = instrument = self.element
            pass
        if instrument is None:
            raise RuntimeError("Instrument is not yet defined")
        #instrument.guidRegistry.register( self.element.guid(), self.element )

        # if new element is a copy, need to establish reference
##         element = self.element
##         if isCopy(element):
##             ref = element.attributes.reference
##             refelement = instrument.guidRegistry.guid2element( ref )
##             element._setReferenceElement( refelement )
##             pass
        return
Esempio n. 6
0
 def __init__(self, document, attributes):
     Node.__init__(self, document)
     self._coord_system = attributes.get('registry-coordinate-system')
     self._type = attributes.get('type')
     return
 def __init__(self, document, attributes):
     Node.__init__(self, document)
     self._coord_system = attributes.get('registry-coordinate-system')
     self._type = attributes.get('type')
     return
Esempio n. 8
0
 def __init__(self, root, attributes):
     Node.__init__(self, root)
     return
Esempio n. 9
0
 def __init__(self, document, attributes):
     Node.__init__(self, document)
     return
Esempio n. 10
0
 def __init__(self, document, attributes):
     Node.__init__(self, document)
     return