def compute(self): """ compute() -> None Use BatchDisplayCellEvent to display a serie of SVG files """ if self.hasInputFromPort("File"): fileValue = self.getInputFromPort("File") else: fileValue = None if fileValue: batchDisplayEvent = BatchDisplayCellEvent() # FIXME: Will this work? there should be no # self.currentVersion in the module (there is a # self.version) batchDisplayEvent.vistrail = (self.vistrailName, self.currentVersion) f = open(fileValue.name, 'r') for line in f.read().split('\n'): comps = line.split('|') if len(comps)==2: e = DisplayCellEvent() e.sheetReference = StandardSingleCellSheetReference() e.sheetReference.sheetName = comps[1] e.cellType = SVGCellWidget F = File() from os.path import abspath, basename, dirname F.name = (dirname(abspath(fileValue.name))+ '/'+basename(comps[0])) e.inputPorts = (F,) batchDisplayEvent.displayEvents.append(e) f.close() spreadsheetController.postEventToSpreadsheet(batchDisplayEvent)