def addOutClicked(self): diag = AddAttributeDialog(self) if diag.exec_(): attName = diag.getAttributeName() if attName == "": coralApp.logError("Attribute name cannot be blank.") return attType = diag.getAttributeType() specs = diag.getSpecializations() node = self._coralNode() node.addOutput(attName, attType, specs) self.nodeInspector().refresh()
def _moveFiles(self, inData, out): for fromPath in inData["files"]: toPath = os.path.join(inData["outDir"], os.path.basename(fromPath)) if not os.path.isfile(fromPath): coralApp.logError("File doesn't exist: %s" % fromPath) self.setLog("File doesn't exist: %s" % fromPath) return elif not os.path.exists(inData["outDir"]): coralApp.logError("Folder doesn't exist: %s" % inData["outDir"]) self.setLog("Folder doesn't exist: %s" % inData["outDir"]) return else: shutil.move(fromPath, toPath) out.append(toPath) self._outfiles.outValue().setPathValues(out)
def _moveFiles(self, inData, out): for fromPath in inData["files"]: toPath = os.path.join(inData["outDir"], os.path.basename(fromPath)) if not os.path.isfile(fromPath): coralApp.logError("File doesn't exist: %s"%fromPath) self.setLog("File doesn't exist: %s"%fromPath) return elif not os.path.exists(inData["outDir"]): coralApp.logError("Folder doesn't exist: %s"%inData["outDir"]) self.setLog("Folder doesn't exist: %s"%inData["outDir"]) return else: shutil.move(fromPath, toPath) out.append(toPath) self._outfiles.outValue().setPathValues(out)
def update(self, attribute): coralApp.logDebug("FindFiles.update") location = self._location.value().stringValueAt(0) pattern = self._pattern.value().stringValueAt(0) assets = [] if location == "": return if not os.path.isdir(location): coralApp.logError("Location does not exist.") return filenames = os.listdir(location) for filename in filenames: if fnmatch.fnmatch(filename, pattern): fullPath = os.path.join(location, filename) if os.path.isfile(fullPath): assets.append(fullPath) self._files.outValue().setPathValues(assets) coralApp.logDebug("FindFiles.update: Done")