예제 #1
0
 def compute(self):
     """ compute() -> None
     Use BatchDisplayCellEvent to display a serie of SVG files
     
     """
     if self.has_input("File"):
         fileValue = self.get_input("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
                 from os.path import abspath, basename, dirname, join
                 F = PathObject(
                     join(dirname(abspath(fileValue.name)),
                          basename(comps[0])))
                 e.inputPorts = (F, )
                 batchDisplayEvent.displayEvents.append(e)
         f.close()
         spreadsheetController.postEventToSpreadsheet(batchDisplayEvent)
예제 #2
0
파일: svg.py 프로젝트: AnyarInc/VisTrails
 def compute(self):
     """ compute() -> None
     Use BatchDisplayCellEvent to display a serie of SVG files
     
     """
     if self.has_input("File"):
         fileValue = self.get_input("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
                 from os.path import abspath, basename, dirname, join
                 F = PathObject(join(dirname(abspath(fileValue.name)),
                                     basename(comps[0])))
                 e.inputPorts = (F,)
                 batchDisplayEvent.displayEvents.append(e)
         f.close()
         spreadsheetController.postEventToSpreadsheet(batchDisplayEvent)
 def repaintCells(self):
     """ repaintCells() -> None
     Redraw all cells on the current sheet
     
     """
     from vistrails.packages.spreadsheet.spreadsheet_controller \
          import spreadsheetController
     from vistrails.packages.spreadsheet.spreadsheet_event \
          import RepaintCurrentSheetEvent
     spreadsheetController.postEventToSpreadsheet(RepaintCurrentSheetEvent())
예제 #4
0
 def repaintCells(self):
     """ repaintCells() -> None
     Redraw all cells on the current sheet
     
     """
     from vistrails.packages.spreadsheet.spreadsheet_controller \
          import spreadsheetController
     from vistrails.packages.spreadsheet.spreadsheet_event \
          import RepaintCurrentSheetEvent
     spreadsheetController.postEventToSpreadsheet(
         RepaintCurrentSheetEvent())