Exemplo n.º 1
0
    def load(self, pSection, prereqs=None):
        """
        This method loads a RampTimeTriggeredParticles event from an XML
        data section.  It reads in "MinDelay" and "MaxDelay" as floats. All
        other sections are treated as inline events that are to be triggered
        after the specified delay.
        """
        for name, section in pSection.items():
            eventSection = pSection.items()[0][1]
            result = None
            if name not in ('MinDelay', 'MaxDelay'):
                if s_sectionProcessors.has_key(name):
                    result = s_sectionProcessors[name]().load(section)
                else:
                    ERROR_MSG('No section processor matches the tag ', name,
                              section.asString)
                if result:
                    self.events.append(result)

        self.minDelay = pSection.readFloat('MinDelay', self.minDelay)
        self.maxDelay = pSection.readFloat('MaxDelay', self.maxDelay)
        if self.minDelay > self.maxDelay:
            ERROR_MSG('Min Delay was greater than Max Delay', self,
                      pSection.asString)
            self.minDelay = 0.0
        self.nextDelay = self.getNextDelay()
        return self
Exemplo n.º 2
0
    def load(self, pSection, prereqs = None):
        """
        This method loads a RampTimeTriggeredParticles event from an XML
        data section.  It reads in "MinDelay" and "MaxDelay" as floats. All
        other sections are treated as inline events that are to be triggered
        after the specified delay.
        """
        for name, section in pSection.items():
            eventSection = pSection.items()[0][1]
            result = None
            if name not in ('MinDelay', 'MaxDelay'):
                if s_sectionProcessors.has_key(name):
                    result = s_sectionProcessors[name]().load(section)
                else:
                    ERROR_MSG('No section processor matches the tag ', name, section.asString)
                if result:
                    self.events.append(result)

        self.minDelay = pSection.readFloat('MinDelay', self.minDelay)
        self.maxDelay = pSection.readFloat('MaxDelay', self.maxDelay)
        if self.minDelay > self.maxDelay:
            ERROR_MSG('Min Delay was greater than Max Delay', self, pSection.asString)
            self.minDelay = 0.0
        self.nextDelay = self.getNextDelay()
        return self
Exemplo n.º 3
0
    def _parse(self,
               tag,
               store,
               pSection,
               prereqs=None,
               gatherPrerequisites=False):
        for sname, ds in pSection.items():
            if sname == tag:
                section = ds.items()[0][1]
                if s_sectionProcessors.has_key(section.name):
                    instance = s_sectionProcessors[section.name]()
                    if not gatherPrerequisites:
                        result = instance.load(section, prereqs)
                        if result != None:
                            try:
                                store[ds.asString] = result
                            except:
                                store.append((ds.asString, result))

                        else:
                            ERROR_MSG(
                                'None was returned.  Not adding to this effect : ',
                                section.name, ds.asString)
                    else:
                        self.prereqs.add(section.asString)
                        if hasattr(instance, 'prerequisites'):
                            self.prereqs.update(
                                instance.prerequisites(section))
                else:
                    ERROR_MSG('No section processor matches the tag ',
                              section.name, ds.asString)
                    result = None

        return
Exemplo n.º 4
0
    def _parse(self, tag, store, pSection, prereqs = None, gatherPrerequisites = False):
        for sname, ds in pSection.items():
            if sname == tag:
                section = ds.items()[0][1]
                if s_sectionProcessors.has_key(section.name):
                    instance = s_sectionProcessors[section.name]()
                    if not gatherPrerequisites:
                        result = instance.load(section, prereqs)
                        if result != None:
                            try:
                                store[ds.asString] = result
                            except:
                                store.append((ds.asString, result))

                        else:
                            ERROR_MSG('None was returned.  Not adding to this effect : ', section.name, ds.asString)
                    else:
                        self.prereqs.add(section.asString)
                        if hasattr(instance, 'prerequisites'):
                            self.prereqs.update(instance.prerequisites(section))
                else:
                    ERROR_MSG('No section processor matches the tag ', section.name, ds.asString)
                    result = None

        return