[Pharo-users] Updated Pharo By Example

Stephan Eggermont stephan at stack.nl
Fri Oct 23 15:19:21 EDT 2015


On 23-10-15 19:15, Thierry Goubier wrote:
> Le 23 oct. 2015 7:00 PM, "Dimitris Chloupis" <kilon.alios at gmail.com> a
> écrit :
>>
>> I completely agree with Stef, I did actually removed some screenshots and
> someone put them pack
>>
>> Maybe I can create a pharo script to auto make them for each version
>
> Wasn't there a way to run Smalltalk code inside pillar? Code that would
> open windows, screenshot and return a png.

Well, there is Documentation-Screenshots in StephanEggermont/Documentation

You create a DOScreenshotExporter, set its directory and tell it which
forms/morphs/nautilus/world you want stored there under which filename.
I fixed a few remaining bugs today.

I presume you should be able to use it in pillar.

You can use it like

so := DOScreenshotExporter new.
so directory: FileLocator home.
so writeNautilusMethod: DOScreenshotExporter>>#directory: as: 
'directoryMethod.png'

It has methods like
DOScreenshotExporter>>writeNautilusMethod: aMethod as: aFileName
   self writeBlock: [(Nautilus openOnMethod: aMethod) ui window 
imageForm ] as: aFileName

This makes sure to first rename an existing file before overwriting it.

DOScreenshotExporter>>writeBlock: aBlock as: aFileName
   |temp|
   (directory / aFileName) exists ifTrue: [
     temp := (directory / aFileName) renameTo: (aFileName,'tmp') ].
   PNGReadWriter putForm: aBlock value onFileNamed: (directory / aFileName).
   temp ifNotNil: [ temp ensureDelete ]
	
Stephan





More information about the Pharo-users mailing list