[etoys-dev] Etoys Inbox: Morphic-KR.9.mcz
commits at source.squeak.org
commits at source.squeak.org
Fri May 28 01:17:28 EDT 2010
A new version of Morphic was added to project Etoys Inbox:
http://source.squeak.org/etoysinbox/Morphic-KR.9.mcz
==================== Summary ====================
Name: Morphic-KR.9
Author: KR
Time: 28 May 2010, 2:16:04 pm
UUID: 6d5b26bc-2963-1448-817f-4cef8e622fd4
Ancestors: Morphic-bf.8
SQ-297: localized QuickGuides contents could be placed in "<imagePath>/locale/<lang>/QuickGuides". if the directory doesn't exist, fallback to default one "<imagePath>/QuickGuides"
=============== Diff against Morphic-bf.8 ===============
Item was added:
+ ----- Method: QuickGuideMorph classSide>>guidePath (in category 'defaults') -----
+ guidePath
+ | sepa defaultPath langPath|
+ sepa := FileDirectory slash.
+ defaultPath := Smalltalk imagePath, sepa, 'QuickGuides'.
+ langPath := Smalltalk imagePath, sepa, 'locale', sepa, (LocaleID current posixName).
+ ((FileDirectory on: langPath ) directoryExists: 'QuickGuides')
+ ifTrue: [^ langPath, sepa, 'QuickGuides' ]
+ ifFalse: [^defaultPath].
+ !
Item was changed:
----- Method: QuickGuideMorph classSide>>defaultOrderIn: (in category 'defaults') -----
defaultOrderIn: helpCategory
| dir baseNames suggestedOrder ret cat last |
+ dir _ FileDirectory on: QuickGuideMorph guidePath.
- 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 ifNotEmpty: [ret last]].
+ last ifNil: [ret add: e]
+ ifNotNil: [ret add: e after: last].
- last _ ret reverse detect: [:b | b beginsWith: cat] ifNone: [ret last].
- ret add: e after: last.
].
].
^ ret asArray.
!
Item was changed:
----- Method: QuickGuideHolderMorph>>load (in category 'file in/file out') -----
load
"If 'guide.00x.pr' is present, take the one with the largest x. If only '.sexp.data.gz', then use it"
| dir m fileName f unzipped zipped ours proj |
self submorphs size > 0 ifTrue: [^ self].
+ dir _ FileDirectory on: QuickGuideMorph guidePath.
- dir _ (FileDirectory on: (Smalltalk imagePath)) directoryNamed: 'QuickGuides'.
"#('xxx.001.pr' 'xxx.035.pr' 'xxx.sexp.data.gz') asSortedCollection ('xxx.001.pr' 'xxx.035.pr' 'xxx.sexp.data.gz')"
ours _ dir fileNames select: [:fName |
(fName beginsWith: guideName) and: [(fName endsWith: '.pr') or: [fName endsWith: '.sexp.data.gz']]].
ours _ ours asSortedCollection.
ours size = 0 ifTrue: [^ self].
fileName _ ours size > 1 ifTrue: [ours at: (ours size - 1) "most recent .pr file"] ifFalse: [ours last "sexp"].
proj _ fileName endsWith: '.pr'.
Cursor wait showWhile: [
proj ifFalse: [
unzipped _ WriteStream on: ByteArray new.
f _ dir readOnlyFileNamed: fileName.
zipped _ GZipReadStream on: f.
unzipped nextPutAll: zipped contents.
m _ BookMorph bookFromPagesInSISSFormat: (DataStream on: (ReadStream on: (unzipped contents))) next.
f close].
proj ifTrue: [
m _ self loadPR: fileName dir: dir.
m ifNil: [^ self]].
m position: 0 at 0.
self position: 0 at 0.
self extent: m extent.
m setNamePropertyTo: guideName.
m beSticky.
self translateGuide: m.
self addMorph: m.
].
!
Item was changed:
----- Method: QuickGuideMorph>>preloadIndex (in category 'initialization') -----
preloadIndex
"At system build time, load the Guide Index from file 'preload-index.sexp.data.gz'. Save in IndexPage."
| dir firstPage |
+ dir _ FileDirectory on: QuickGuideMorph guidePath.
- 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
!
Item was changed:
----- Method: QuickGuideMorph>>checkForIndexOnDisk (in category 'transition') -----
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: QuickGuideMorph guidePath.
- 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. "
!
More information about the etoys-dev
mailing list