def test_set_instance_properties(self): o = pyo.Noise() success = intro.set_instance_property(o, "add", 0.5) if not success: return False success = intro.set_instance_property(o, "dummy", 0.5) if success: print("There should be not property called dummy.") return False success = intro.set_instance_property(o, "add", "hello") if success: print("Should not be able to set a float property with a string.") return False return True
props = introspection.get_instance_properties(self._source) log.debug(props) if property_name == "play": log.debug("trying to play: ") try: self._source.play() except TypeError, e: print(e) elif property_name == "stop": try: self._source.stop() except TypeError, e: print("Cannot stop because of {0}".format(e)) elif property_name in props: log.debug("Set %s property %s to %s" %(self._source, property_name, str(value))) introspection.set_instance_property(self._source, property_name, value) else: log.debug("%s does not have %s property" % (self._source, property_name)) def _set_aed_to_previous(self): self.set_relative_aed(self._previous_aed, self._previous_speakers_angles) def set_spread(self, spread): self._spread = float(spread) def set_relative_aed(self, aed, speaker_angles): """ @param aed: azimuth, elevation, distance @param speaker_angles: list of aed for each speaker @type aed: list @type speaker_angles: list