Managing external Pharo scripts with GTInspector and GTSpotter

The classic Smalltalk Workspace has the possibility of saving and loading script files explicitly. GTPlayground does not have these options because we think they are not needed. Indeed, in most cases, all you want is to play with code and be able to retrieve it later without worrying of where you stored it. To this end, the playground saves transparently all scripts and GTSpotter helps you find them afterwards.

However, on the Pharo mailing list, Phil described recently an interesting use case that goes like this:

  1. some Pharo scripts are placed in a folder where a sysadmin has the possibility of tweaking them with basic text editors. These scripts are taken into account by various running images.
  2. at the same time, a Pharo developer would like to be able to look at these scripts from a development image and debug them with Pharo tools.

Indeed, this type of use cases is what can lead an IDE developer to create an save/load feature in a workspace. But, there exists another way. Suppose you want to you want to edit a demo-scripts/get-pharo-picture.st script. You first search for the demo-scripts folder and find the script.

Spotting-script.png

Triggering the default action, opens an inspector which already gives you a built in playground with all navigation options it entails. And because we have a dedicated file reference in hand, we can just save the contents in place.

Inspecting-script.png

And if you want a more persistent navigator for your files, you can also inspect the containing folder and manipulate the scripts exclusively in the inspector.

Inspecting-script-folder.png

The Glamorous Toolkit comes with very few classes of operations but the combinations that spawn from these cover a surprising amount of use cases. In our case, all of a sudden the inspector is turned into a full blown playground with no extra effort. At the same time the global Playground is freed by the quaint constraint of saving and loading files.

Posted by Tudor Girba at 3 May 2015, 10:29 pm link
|