'From etoys2.3 of 2 December 2007 [latest update: #1870] on 6 January 2008 at 12:34:45 pm'! "Change Set: GuideToWeb-tk Date: 4 January 2008 Author: Ted Kaehler Code that writes out the QuickGuides as web pages. User will then move manually them to: http://tinlizzie.org/olpc/QG-web/ Some Guides will need new .jpeg images of their pages. The other guides will need the index in the left sidebar updated. Call to write all Guides including page images. Also call to write a few Guides, and correct the index of the rest. Creates the text of an index page. User can install it at: http://wiki.laptop.org/go/Etoys_QuickGuides_Index Also, all digits at the end of Guide names are removed."! !QuickGuideGenerator commentStamp: 'tk 1/3/2008 10:32' prior: 0! Used to generate .sexp files for the Quick Guides. These are the help system for Etoys. How to use: Pressing the Help button [?] at the top left of the screen, brings up the QuickGuides flap. The index page has categories of help. The Jump To... button allows you to get to any help guide. To create a new guide, copy the bookmorph out of the flap. Use the halos to completely change the contents. Create help pages for a new topic. When you are done, write the entire project out using "Keep the current project". It is now a .pr file. If you put the .pr into the QuickGuides folder, you will be able to see it in the Help flap. (Click the Help button [?] once to close help, and once again to open it.) You can test a .pr file in the QuickGuides folder, but it is not in the proper format to include in the OLPC build. The purpose of QuickGuideGenerator is to put a guide in to the proper format for distribution. 0) Get the new Guides from http://tinlizzie.org/quickguides 1) Make a folder called "To-Be-Translated" at the top level of your file system. Put the .pr files of all new guides into this folder. 1.5) Make a folder called "Newer" in the folder that has the Etoys image file. Must be a fresh new folder. 2) Start Etoys. You will NOT save this image. 3) Execute QuickGuideGenerator new openInWorld. 4) Wait until a new window appears. 5) Find the folder "To-Be-Translated" in the list and click on it. It's path will appear in the top pane. 6) Press the "Generate" button. Wait. 7) Quit Etoys. 8) "Newer" will now have a .sexp file for each guide that was a .pr file. Files ending in .sexp contain Yoshiki's S-expression linearization of object trees. 9) Copy the .sexp files to QuickGuides, and delete the .pr files of the same name. 10) Rename Newer to be Newer-day-month-year 11) Copy Newer-xx to http://tinlizzie.org/share/QG-compressed 12) copy the .sexp files into http://tinlizzie.org/share/QG-compressed/Quickguides ! ]style[(745 88 16 1111 1)f3,f2,f3,f2,f3! BookMorph subclass: #QuickGuideMorph instanceVariableNames: 'control order ' classVariableNames: 'Colors Descriptions IndexPage IndexPageMimeString Thumbnails HTMLJumpTo ' poolDictionaries: '' category: 'Morphic-Books'! !QuickGuideMorph commentStamp: 'tk 12/7/2007 15:15' prior: 0! A BookMorph that holds QuickGuides. World an AlignementMorph (the flap) an AlignementMorph a QuickGuideMorph (one page per guide, 54 pages. Page may be a stub if guide not in) a QuickGuideHolderMorph a BookMorph (4 pages) a PasteUpMorph (a page)! !QuickGuideMorph methodsFor: 'initialization' stamp: 'tk 1/4/2008 10:44'! preloadIndex "At system build time, load the Guide Index from file 'preload-index.sexp.data.gz'. Save in IndexPage." | dir firstPage | dir _ (FileDirectory on: Smalltalk imagePath) directoryNamed: 'QuickGuides'. (dir fileExists: 'index.pr') ifTrue: [ self inform: 'Raw index.pr is not supposed to be in QuickGuides during a build. I will delete it now'. dir deleteFileNamed: 'index.pr']. (dir fileExists: 'preload-index.sexp.data.gz') ifFalse: [ ^ self error: 'could not find QuickGuides/preload-index.sexp.data.gz']. firstPage _ pages first. firstPage guideName: 'preload-index'. firstPage guideCategory: ''. firstPage load. "allow index.sexp.data.gz" firstPage guideName: 'index'. self class indexPage: firstPage submorphs first. "the goal, sets name" IndexPageMimeString _ ''. "remove old" self class purgeIndexProjects. ^ true ! ! !QuickGuideMorph methodsFor: 'transition' stamp: 'tk 1/4/2008 10:45'! checkForIndexOnDisk "For debugging only, Look on disk every time for a new Index as a .pr file. Must be named index.pr. Overwrite IndexPage if found." | dir firstPage | dir _ (FileDirectory on: Smalltalk imagePath) directoryNamed: 'QuickGuides'. (dir fileExists: 'index.pr') ifFalse: [ (dir fileExists: 'index.sexp.data.gz') ifFalse: [^ false]]. firstPage _ pages first. firstPage guideName: 'index'. firstPage guideCategory: ''. firstPage load. "allow index.sexp.data.gz" IndexPage _ firstPage submorphs first. ^ true " IndexPage _ QuickGuideHolderMorph new loadPR: 'index.pr' dir: dir. " ! ! !QuickGuideMorph methodsFor: 'transition' stamp: 'tk 1/4/2008 10:44'! goToPageMorph: newPage transitionSpec: transitionSpec newPage load. super goToPageMorph: newPage transitionSpec: transitionSpec. ! ! !QuickGuideMorph methodsFor: 'write web pages' stamp: 'tk 1/4/2008 13:34'! allGuidesToWeb "Write out web pages for each of the Guides in the QuickGuides folder. In an inspector on the current help flap, evaluate self allGuidesToWeb. Write both a web page and the .jpegs for each guide page. Method to write N new guides, and update the index for the others: self rewriteGuidesAndIndexInOthers: 'name name name'. Return the text for the wiki page: http://wiki.laptop.org/go/Etoys_QuickGuides_Index self guidesIndexForWiki. To allow the text in Guides to show in other languages. When the text of guides change, we need to write it out to the .pot and .po files. To translate guides that are already written out in English: In the folder po/quickguides/ copy an existing .po file and name it similar to pt-BR.po (pt for Portugese and BR for Brazil). Edit the file in a UFT-8 aware editor (not the Squeak file list). Save As in UFT-8. In the shell terminal. (langCode is pt_BR in this example) execute msgfmt langCode.po -o quickguides.mo (how add on to existing .mo with other languages?) Move quickguides.mo to lang/langCode/LC_MESSAGES/ Get into Etoys, set the language to the language you are working with, and look at a guide. " self htmlForJumpTo. "reset" 1 to: pages size do: [:ii | self goToPage: ii. self guideToWebWithJPEGs: true ]. self beep.! ! !QuickGuideMorph methodsFor: 'write web pages' stamp: 'tk 1/2/2008 13:07'! guidesIndexForWiki "Create the html for a long list of guide categories and guides. Each is a clickable link. For the laptop.org wiki. An index to the web pages for the Guides. Inspect a Guide and go up the owner chain to a QuickGuideMorph. self guidesIndexForWiki " | strm categories | strm _ WriteStream on: (String new: 6000). strm nextPutAll: 'At the top left of the screen in Etoys is a "?" button. Clicking it brings up a help flap with more than 50 QuickGuides. These tell how to use different parts of Etoys. [[Image:Help-icon.jpeg]] The QuickGuides are also available on the web. Note that the active buttons and Etoys controls will not work in the web version. __NOTOC__'; cr. strm nextPutAll: '=== Guides about topics in EToys ==='; cr; cr. categories _ self class suggestedCategoryOrder. categories do: [:catName | strm nextPutAll: '==== '; nextPutAll: catName translated; nextPutAll: ' ===='; cr. pages do: [:pp | pp guideCategory = catName ifTrue: [ strm nextPutAll: '* [http://tinlizzie.org/olpc/QG-web/', pp guideName, '.html'. strm space; nextPutAll: pp guideNameInWords translated; nextPutAll: ']'; cr. ]]. ]. ^ strm contents " "! ! !QuickGuideMorph methodsFor: 'write web pages' stamp: 'tk 1/2/2008 12:20'! guideToWeb "Write all the info in this guide to a web page. Pages are images (jPEGs). Create a page to hold them." | dir qgh bk strm ff | dir _ FileDirectory default directoryNamed: 'QG-web'. "picutres of guide pages" qgh _ self submorphOfClass: QuickGuideHolderMorph. bk _ qgh submorphOfClass: BookMorph. strm _ WriteStream on: (String new: 500). strm nextPutAll: (self htmlPreamble: qgh guideNameInWords). 1 to: bk pages size do: [:ii | false ifTrue: [ "can turn off image writing when tuning the text" bk goToPage: ii. "show it" self jPegOutDir: dir]. strm nextPutAll: ' '.
		strm nextPutAll: qgh guideName, ', page ', ii printString,' '. ]. strm nextPutAll: '

Jump to Top

Squeak Etoys is a "media authoring tool"-- software that you can download to your computer
and then use to create your own media or share and play with others. It is free.    Find out about Etoys.

'. ff _ dir fileNamed: qgh guideName, '.html'. ff nextPutAll: strm contents; close.! ! !QuickGuideMorph methodsFor: 'write web pages' stamp: 'tk 1/2/2008 13:41'! guideToWebWithJPEGs: withPics "Write all the info in this guide to a web page. Pages are images (jPEGs). Create a page to hold them." | dir qgh bk strm ff | dir _ FileDirectory default directoryNamed: 'QG-web'. "picutres of guide pages" qgh _ self submorphOfClass: QuickGuideHolderMorph. bk _ qgh submorphOfClass: BookMorph. strm _ WriteStream on: (String new: 500). strm nextPutAll: (self htmlPreamble: qgh guideNameInWords). "includes index side bar" 1 to: bk pages size do: [:ii | withPics ifTrue: [ "Make images of pages" bk goToPage: ii. "show it" self jPegOutDir: dir]. strm nextPutAll: ' '.
		strm nextPutAll: qgh guideName, ', page ', ii printString,' '. ]. strm nextPutAll: '

Jump to Top

Squeak Etoys is a "media authoring tool"-- software that you can download to your computer
and then use to create your own media or share and play with others. It is free.    Find out about Etoys.

'. ff _ dir fileNamed: qgh guideName, '.html'. ff nextPutAll: strm contents; close.! ! !QuickGuideMorph methodsFor: 'write web pages' stamp: 'tk 12/10/2007 17:17'! htmlForJumpTo "Create the html for a long list of guide categories and guides. Each is a clickable link. Store in the class var HTMLJumpTo. For creating web pages from the Guides." | strm categories | strm _ WriteStream on: (String new: 500). strm nextPutAll: 'Guides about topics in EToys
'. categories _ self class suggestedCategoryOrder. categories do: [:catName | strm nextPutAll: catName translated; nextPutAll: '
'; cr. pages do: [:pp | pp guideCategory = catName ifTrue: [ strm tab; tab. strm nextPutAll: '   '. strm nextPutAll: pp guideNameInWords translated; nextPutAll: '
'; cr. ]]. ]. ^ HTMLJumpTo _ strm contents! ! !QuickGuideMorph methodsFor: 'write web pages' stamp: 'tk 1/2/2008 12:02'! htmlPreamble: theGuideName "All the stuff at the beginning of an html file. Includes the JumpTo menu of links to other Guides." | strm | strm _ WriteStream on: (String new: 500). strm nextPutAll: ' '. strm nextPutAll: theGuideName. strm nextPutAll: ', an Etoys Quick Guide

'. strm nextPutAll: theGuideName. strm nextPutAll: '

'. strm nextPutAll: '

A Quick Guide for Etoys


'. strm nextPutAll: HTMLJumpTo. "Jump to menu" strm nextPutAll: '
'. ^ strm contents! ! !QuickGuideMorph methodsFor: 'write web pages' stamp: 'tk 12/10/2007 17:29'! jPegOutDir: fileDir "Write the current page of the current Guide as an image file on the directory" "Does it need to be showing?" | fName gn num qgh bk | qgh _ self submorphOfClass: QuickGuideHolderMorph. bk _ qgh submorphOfClass: BookMorph. num _ (bk pages indexOf: bk currentPage ifAbsent: [0]) printString. gn _ qgh guideName. fName _ fileDir pathName, fileDir pathNameDelimiter asString, gn, '-', num, '.jpg'. currentPage imageForm writeJPEGfileNamed: fName. "need to go deeper??"! ! !QuickGuideMorph methodsFor: 'write web pages' stamp: 'tk 1/4/2008 13:35'! rewriteGuidesAndIndexInOthers: nameList "Create new files for guides in list, including jpegs. For all other guides, just redo the HTML to get a revised index column." self htmlForJumpTo. "reset" nameList do: [:gg | self goToCardNamed: gg. self guideToWebWithJPEGs: true ]. "Later could make entire html for a guide without loading it. See htmlForJumpTo " 1 to: pages size do: [:ii | self goToPage: ii. self guideToWebWithJPEGs: false ]. self beep.! ! !QuickGuideMorph class methodsFor: 'defaults' stamp: 'tk 1/4/2008 12:58'! defaultOrderIn: helpCategory | dir baseNames suggestedOrder ret cat last | dir _ (FileDirectory on: (Smalltalk imagePath)) directoryNamed: 'QuickGuides'. baseNames _ ((dir fileNames select: [:f | f endsWith: '.sexp.data.gz']) collect: [:f | f copyFrom: 1 to: f size - '.sexp.data.gz' size]) asSet. suggestedOrder _ self suggestedOrder. helpCategory ifNotNil: [ suggestedOrder _ suggestedOrder select: [:e | e beginsWith: helpCategory]. baseNames _ baseNames select: [:e | e beginsWith: helpCategory]]. ret _ OrderedCollection new. baseNames _ baseNames collect: [:bb | bb withoutTrailingDigits]. suggestedOrder do: [:e | (baseNames includes: e) ifTrue: [ baseNames remove: e. ret add: e. ]. ]. baseNames ifNotEmpty: [ baseNames asArray do: [:e | cat _ self categoryOf: e. last _ ret reverse detect: [:b | b beginsWith: cat] ifNone: [ret last]. ret add: e after: last. ]. ]. ^ ret asArray. ! ! !QuickGuideMorph class methodsFor: 'defaults' stamp: 'tk 1/3/2008 14:45'! suggestedOrder ^ #( 'BooksTopBorderIcons' 'BooksExpandedControls' 'BooksWorking-withLayers' 'BooksViewerCategoryTiles' 'HaloMake-theHandlesShow' 'HaloViewer-ofScriptTiles' 'HaloSizeColorCopy' 'HaloMove-andPickUp' 'HaloRotateHandle' 'HaloTrash' 'HaloArrow-atCenter' 'HaloCenter-ofRotation' 'HaloMenuTools' 'HaloMake-aScriptTile' 'HaloCollapse' 'MenuNormalTicking' 'MenuViewerIconsSet' 'MenuScriptorIconsSet' 'MenuButtonFires-aScript' 'MenuGrabMeRevealMe' 'MenuWatchers' 'NavBarKeepFindProjects' 'NavBarChoose-aLanguage' 'ObjectCatSliderBar' 'ObjectCatGrabPatchTool' 'ObjectCatLassoTool' 'ObjectCatDigitalImages' 'ObjectCatMakerButton' 'PaintBrushes' 'PaintColorPalette' 'PaintBucketTool' 'PaintStraightLineTool' 'PaintEllipseTool' 'PaintRectangleTool' 'PaintPolygonTool' 'PaintColorPicker' 'PaintStampsTool' 'ScriptTileForward-by' 'ScriptTileTurn-by' 'ScriptTilesForward-andTurn' 'ScriptTileBounceMotion' 'ScriptTileX-andYTiles' 'ScriptTilesTestsCategory' 'ScriptTilePenUse' 'ScriptTilePlayfieldTrail' 'ScriptTileBatchTrail' 'ScriptTileStamps' 'ScriptTileHeading' 'ScriptTileScaleFactor' 'ScriptTileHide-andShow' 'ScriptTileWorldInput' 'ScriptTileSoundCategory' 'SuppliesObjectCatalog' 'SuppliesText' 'SuppliesAllScripts' 'SuppliesJoystickControl' 'SuppliesSoundRecorder' )! ! QuickGuideMorph removeSelector: #htmlAbsoluteJumpTo! QuickGuideMorph removeSelector: #translateGuide:! BookMorph subclass: #QuickGuideMorph instanceVariableNames: 'control order' classVariableNames: 'Colors Descriptions HTMLJumpTo IndexPage IndexPageMimeString Thumbnails' poolDictionaries: '' category: 'Morphic-Books'! !QuickGuideMorph reorganize! ('initialization' initialize initializeIndexPage order: preloadIndex setInitializePage) ('submorphs add/remove' delete unloadPages) ('transition' checkForIndexOnDisk goToPageMorph:transitionSpec:) ('page controls' jumpToAdjust: pageNumberReport shortControlSpecs) ('write web pages' allGuidesToWeb guidesIndexForWiki guideToWeb guideToWebWithJPEGs: htmlForJumpTo htmlPreamble: jPegOutDir: rewriteGuidesAndIndexInOthers:) ('menu actions' descriptionReport goToCardNamed: goToIndex handCopyCard makeCategoryMenu: nextCard nextPage previousCard previousPage showDescriptionMenu: showJumpToMenu showMenuCategory:) ! "For language translation, do this: TextDomainManager registerClass: #QuickGuideMorph domain: 'quickguides'. TextDomainManager registerClass: #QuickGuideHolderMorph domain: 'quickguides'. " TextDomainManager initialize.!