Exemple #1
0
 def writeScreenshot(self, shell):
     display = shell.getDisplay()
     gc = GC(display);
     image = Image(display, shell.getBounds())
     gc.copyArea(image, shell.getBounds().x, shell.getBounds().y)
     gc.dispose()
     
     imageLoader = ImageLoader()
     imageLoader.data = [ image.getImageData() ]
     self.screenshotNumber += 1
     screenshotDir = os.path.join(os.getenv("TEXTTEST_LOG_DIR", os.getcwd()), "screenshots")
     if not os.path.isdir(screenshotDir):
         os.makedirs(screenshotDir)
     fileName = self.getScreenshotFileName(screenshotDir)
     while os.path.isfile(fileName):
         self.screenshotNumber += 1
         fileName = self.getScreenshotFileName(screenshotDir)
     imageLoader.save(fileName, SWT.IMAGE_PNG) 
Exemple #2
0
 def getFontMetrics(self):
     gc = GC(self.parentCanvas)
     metrics = gc.getFontMetrics()
     gc.dispose()
     return metrics