Ejemplo n.º 1
0
    def __init__(self, name, parent):
        super(PathNode, self).__init__(name, parent)
        self._setSliceable(True)

        self._inPath = StringAttribute("input", self)
        self._op = EnumAttribute("operation", self)
        self._out = StringAttribute("output", self)

        self._allOps = [("split", os.path.split, "StringArray"),
                        ("splitAll", None, "StringArray"),
                        ("dirname", os.path.dirname, "Path"),
                        ("basename", os.path.basename, "String"),
                        ("splitext", os.path.splitext, "StringArray")]

        for n, op in enumerate(self._allOps):
            self._op.value().addEntry(n, op[0])

        self._setAttributeAllowedSpecializations(self._inPath,
                                                 ["Path", "PathArray"])
        self._setAttributeAllowedSpecializations(
            self._out, ["String", "Path", "StringArray"])

        self.addInputAttribute(self._inPath)
        self.addInputAttribute(self._op)
        self.addOutputAttribute(self._out)

        self._setAttributeAffect(self._inPath, self._out)
        self._setAttributeAffect(self._op, self._out)

        # self._catchAttributeDirtied(self._inPath, True)
        self._catchAttributeDirtied(self._op, True)
Ejemplo n.º 2
0
    def __init__(self, name, parent):
        Node.__init__(self, name, parent)

        self._fileName = StringAttribute("fileName", self)
        self._leftSpectrum = NumericAttribute("leftSpectrum", self)
        self._rightSpectrum = NumericAttribute("rightSpectrum", self)
        self._time = NumericAttribute("time", self)
        self._play = False

        self.addInputAttribute(self._fileName)
        self.addOutputAttribute(self._time)
        self.addOutputAttribute(self._leftSpectrum)
        self.addOutputAttribute(self._rightSpectrum)

        self._setAttributeAffect(self._fileName, self._time)
        self._setAttributeAffect(self._fileName, self._leftSpectrum)
        self._setAttributeAffect(self._fileName, self._rightSpectrum)

        self._setAttributeAllowedSpecializations(self._time, ["Float"])
        self._setAttributeAllowedSpecializations(self._leftSpectrum, ["FloatArray"])
        self._setAttributeAllowedSpecializations(self._rightSpectrum, ["FloatArray"])

        self._setUpdateEnabled(False)

        self._leftSpectrum.outValue().resize(64)
        self._rightSpectrum.outValue().resize(64)

        SoundManager.init()
Ejemplo n.º 3
0
    def __init__(self, name, parent):
        super(CustomPythonNode, self).__init__(name, parent)
        self._setSliceable(True)
        self._setAllowDynamicAttributes(True)
        self.setClassName("CustomPythonNode")

        self._filter = StringAttribute("filter", self)
        self._filter.setLongString(True)
        self.addInputAttribute(self._filter)
Ejemplo n.º 4
0
    def __init__(self, name, parent):
        super(MoveFilesNode, self).__init__(name, parent)
        self._from = StringAttribute("input", self)
        self._out = StringAttribute("outDir", self)
        self._outfiles = StringAttribute("output", self)

        self._setAttributeAllowedSpecializations(self._from,
                                                 ["PathArray", "Path"])
        self._setAttributeAllowedSpecializations(self._to,
                                                 ["Path", "PathArray"])
        self._setAttributeAllowedSpecializations(self._outfiles, ["PathArray"])

        self.addInputAttribute(self._from)
        self.addInputAttribute(self._to)
        self.addOutputAttribute(self._outfiles)

        self._setAttributeAffect(self._inFiles, self._outfiles)
        self._setAttributeAffect(self._outdir, self._outfiles)
        self.initDone()
Ejemplo n.º 5
0
    def __init__(self, name, parent):
        super(FindFilesNode, self).__init__(name, parent)

        self._location = StringAttribute("location", self)
        self._location.setSpecializationOverride("Path")
        self._pattern = StringAttribute("pattern", self)
        self._files = StringAttribute("files", self)
        self._setAttributeAllowedSpecializations(self._location, ["Path"])
        self._setAttributeAllowedSpecializations(self._pattern, ["String"])
        self._setAttributeAllowedSpecializations(self._files, ["PathArray"])

        self.addInputAttribute(self._location)
        self.addInputAttribute(self._pattern)
        self.addOutputAttribute(self._files)

        self._setAttributeAffect(self._location, self._files)
        self._setAttributeAffect(self._pattern, self._files)

        self._setSliceable(True)
Ejemplo n.º 6
0
    def __init__(self, name, parent):
        super(StringSort, self).__init__(name, parent)
        self._setSliceable(True)

        self._input = StringAttribute("input", self)
        self._key = StringAttribute("key", self)
        self._output = StringAttribute("output", self)

        self._setAttributeAllowedSpecializations(self._input,
                                                 ["StringArray", "PathArray"])
        self._setAttributeAllowedSpecializations(self._key, ["String"])
        self._setAttributeAllowedSpecializations(self._output,
                                                 ["StringArray", "PathArray"])

        self.addInputAttribute(self._input)
        self.addInputAttribute(self._key)
        self.addOutputAttribute(self._output)

        self._setAttributeAffect(self._input, self._output)
        self._setAttributeAffect(self._key, self._output)
        self._addAttributeSpecializationLink(self._input, self._output)
Ejemplo n.º 7
0
    def __init__(self, name, parent):
        super(CopyFilesNode, self).__init__(name, parent)
        self.setClassName("CopyFilesNode")
        self._filePairs = []  # list of tuples, (fromPath, toPath)
        self._from = StringAttribute("from", self)
        self._to = StringAttribute("to", self)
        self._out = StringAttribute("output", self)
        self._setAttributeAllowedSpecializations(self._from,
                                                 ["Path", "PathArray"])
        self._setAttributeAllowedSpecializations(self._to,
                                                 ["Path", "PathArray"])
        self._setAttributeAllowedSpecializations(self._out,
                                                 ["Path", "PathArray"])

        self.addInputAttribute(self._from)
        self.addInputAttribute(self._to)
        self.addOutputAttribute(self._out)
        self._setAttributeAffect(self._from, self._out)
        self._setAttributeAffect(self._to, self._out)

        self._addAttributeSpecializationLink(self._from, self._to)
        self._addAttributeSpecializationLink(self._from, self._out)

        self.initDone()