Ben Coman wrote:
Stephan Eggermont wrote:
This code allows me to generate some screenshots.
The exporter deletes the old picture, if it exists.

|directory exporter window bounds |
directory := FileSystem workingDirectory / 'pictures' .
directory ensureCreateDirectory.
exporter := DOScreenshotExporter new.
exporter directory: directory.
exporter writeWorldAs: 'world.png'.
window := DOPartiesList new openWithSpec window.
exporter writeMorph: window value as: 'PartiesList.png'.
bounds := window fullBounds.
exporter writeMorph: window value rectangle: (bounds insetBy: 20@20) as: 'PartOfPartiesList.png'.
window close.
Now what is the best way to associate such code with a Pillar source file.
1. Put screenshot generation script inline?
2. Put screenshot generation script in a separate file with same basename as the produced bitmap file?
  2a. Have a command line handler to manually invoke snapshot generation?
2b. Have a Pillar notation that references the script rather than the produced file, and generate snapshot each time? (maybe good for CI, but slows user down)

cheers -ben


Thinking further on this, it could be useful when Pillar processes a source file to mark code to be executed in the image running Pillar. For instance when the reader is asked to do something, sometimes a snapshot taken manually might be done out of order and something not-yet-done (in the sequence of the tutorial) slips into the snapshot. For example, if the reader is asked to add a class, Pillar source might hypothetically look like this...
   [[[
   Object subclass: #BlankCell
          instanceVariableNames: ''
          classVariableNames: ''
          category: 'LaserGame-Model'
   ]]] executeInImage
+First class created>generateFrom://figures/firstClass.st>file://figures/firstClass.png|width=50|label=firstClass+

This would ensure the snapshots a synchronised with the narrative.

That is how it might work for code blocks that are shown in the narrative, but you might also want to be able to execute support code in the background. Probably you would want to save the image to a new file to avoid accidentally corrupting the Pillar program.

This is not something I'd want to play with right now, but just interested in feedback while its fresh in my mind.

cheers -ben

Reply via email to