I've started a attempt to make Literate Etoys inspired by Literate Programming and Active Essays. This to make it easier to clarify the intent of the different scripts, document the project and hopefully help users or students get a overview.
It will have made a automated way of inserting ScriptEditors and text fields into a ScrollPane or a BookMorph. The first script attempt adds a ScriptEditor for each script to a Playfield.
Then I realized that the ScriptEditor got pulled of the Playfield and into the world if I opened the script from the Viewer.
Now I wonder if there is a way to keep two version of a ScriptEditor in sync, one in the Playfield or documentation and one in the world ?
Ideas and suggestions are welcomed
Karl
Here is a little workaround the issue that script can only have one instance of a script open: a updating screenshot morph. From the script menu you can get a screenshot of the script, and it is stepping so it changes when the script changes.
Enjoy.
Karl
karl wrote:
I've started a attempt to make Literate Etoys inspired by Literate Programming and Active Essays. This to make it easier to clarify the intent of the different scripts, document the project and hopefully help users or students get a overview.
It will have made a automated way of inserting ScriptEditors and text fields into a ScrollPane or a BookMorph. The first script attempt adds a ScriptEditor for each script to a Playfield.
Then I realized that the ScriptEditor got pulled of the Playfield and into the world if I opened the script from the Viewer.
Now I wonder if there is a way to keep two version of a ScriptEditor in sync, one in the Playfield or documentation and one in the world ?
Ideas and suggestions are welcomed
Karl _______________________________________________ Etoys mailing list Etoys@lists.laptop.org http://lists.laptop.org/listinfo/etoys
'From etoys3.0 of 24 February 2008 [latest update: #1996] on 13 May 2008 at 2:30:26 pm'! "Change Set: ScreeshotOfScripts Date: 13 May 2008 Author: Karl Ramberg
It is currently not possible to have two versions of a the same script editor open. I miss that when I'm documenting the projects I make, and I put a script in a text it will dissapear from the text when I open the script in the world.
Here is a work around that problem: A menu item in scripts that open a sketch morph that looks like the script and it even updates when the script changes. Hopefully this makes documenting scripts easier. "!
SketchMorph subclass: #UpdatingSketchMorph instanceVariableNames: 'referenceMorph' classVariableNames: '' poolDictionaries: '' category: 'Morphic-Basic'!
!ScriptEditorMorph methodsFor: 'access' stamp: 'kfr 5/13/2008 14:25'! showScreenshot | picture | picture := (UpdatingSketchMorph withForm: self imageForm). picture referenceMorph: self. picture openInHand.! !
!ScriptEditorMorph methodsFor: 'other' stamp: 'kfr 5/13/2008 14:10'! offerScriptorMenu "Put up a menu in response to the user's clicking in the menu-request area of the scriptor's heaer"
| aMenu count |
self modernize. ActiveHand showTemporaryCursor: nil.
Preferences eToyFriendly ifTrue: [^ self offerSimplerScriptorMenu].
aMenu _ MenuMorph new defaultTarget: self. aMenu addTitle: scriptName asString. aMenu addStayUpItem. "NB: the kids version in #offerSimplerScriptorMenu does not deploy the stay-up item"
aMenu addList: (self hasParameter ifTrue: [{ {'remove parameter' translated. #ceaseHavingAParameter}}] ifFalse: [{ {'add parameter' translated. #addParameter}}]).
self hasParameter ifFalse: [aMenu addTranslatedList: { {'button to fire this script' translatedNoop. #tearOfButtonToFireScript}. {'fires per tick...' translatedNoop. #chooseFrequency}. #- }].
aMenu addUpdating: #showingCaretsString target: self action: #toggleShowingCarets. aMenu addLine. aMenu addList: { {'edit balloon help for this script' translated. #editMethodDescription}. {'explain status alternatives' translated. #explainStatusAlternatives}. #- }.
Preferences universalTiles ifFalse: [count _ self savedTileVersionsCount. self showingMethodPane ifFalse: "currently showing tiles" [aMenu add: 'show code textually' translated action: #toggleWhetherShowingTiles. count > 0 ifTrue: [aMenu add: 'revert to tile version...' translated action: #revertScriptVersion]. aMenu add: 'save this version' translated action: #saveScriptVersion]
ifTrue: "current showing textual source" [count >= 1 ifTrue: [aMenu add: 'revert to tile version' translated action: #toggleWhetherShowingTiles]]].
"aMenu addLine. self addGoldBoxItemsTo: aMenu."
aMenu addLine. aMenu addTranslatedList: { {'reveal my object' translatedNoop. #findObject. 'This script belongs to some object. Show me where that object is on the screen' translatedNoop}. {'open viewer' translatedNoop. #openObjectsViewer. 'open the viewer of the object to which this script belongs' translatedNoop}. {'detached method pane' translatedNoop. #makeIsolatedCodePane. 'open a little window that shows the Smalltalk code underlying this script.' translatedNoop}. #-. {'destroy this script' translatedNoop. #destroyScript} }. aMenu add: 'screenshot of this script' translated action: #showScreenshot. aMenu popUpInWorld: self currentWorld. ! !
!UpdatingSketchMorph methodsFor: 'as yet unclassified' stamp: 'kfr 5/13/2008 14:02'! referenceMorph: aMorph referenceMorph := aMorph! !
!UpdatingSketchMorph methodsFor: 'as yet unclassified' stamp: 'kfr 5/13/2008 14:28'! step (referenceMorph isNil) | ((referenceMorph isInWorld) not) ifTrue: [^self stopStepping]. self form: referenceMorph imageForm! !
!UpdatingSketchMorph methodsFor: 'as yet unclassified' stamp: 'kfr 5/13/2008 13:57'! stepTime ^1000! !
etoys-dev@lists.squeakfoundation.org