예제 #1
0
파일: svg.py 프로젝트: painter1/vistrails
 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)
예제 #2
0
 def repaintCells(self):
     """ repaintCells() -> None
     Redraw all cells on the current sheet
     
     """
     from packages.spreadsheet.spreadsheet_controller \
          import spreadsheetController
     from packages.spreadsheet.spreadsheet_event \
          import RepaintCurrentSheetEvent
     spreadsheetController.postEventToSpreadsheet(RepaintCurrentSheetEvent())