Another Monticello/SAR question
Ned Konz
ned at squeakland.org
Tue Feb 17 04:08:04 UTC 2004
On Friday 13 February 2004 10:36 am, Steven Swerling wrote:
> First, could somebody point me to a sample SAR file that might be
> considered by SqueakMap/SAR/Monticello gurus to be a canonical, good
> example of a SAR that:
>
> 1. Provides a preamble w/ dependencies loaded at user request.
> 2. Loads in a monticello file (instead of putting a 'mypackage.st' file
> in the SAR, puts a 'mypackage.mcz' file instead)
>
Well, my most ambitious SAR file to date is one that I put together to load a
demo image. Unfortunately, it's 2.5Mb, but I can describe how it works:
Archive: /home/ned/Squeak/OOPSLA/demo.sar
contents:
RemoveWorldsOfSqueak-nk.1.cs
ActionSequenceFix-nk.3.cs
BalloonFillFix-nk.1.cs
FasterMouseOver-nk.1.cs
FlexibleVocabularies-nk.4.cs
ColorSeesTurtleTrailsToo-nk.1.cs
MouseMoveEvtStartPos-ar.1.cs
ReUseViewerFlaps-nk.1.cs
UsableSiblingInstanceFix-nk.2.cs
ImportantFixes.1.cs
SARInstaller-nk.27.mcz
CustomEvents-nk.13.mcz
Plot-nk.4.mcz
fonts/ARROWS1.TTF
fonts/ARROWS2.TTF
fonts/ARTBRUSH.TTF
..etc..
icons/broom.gif
icons/colorize.gif
..etc..
AlanAll.ggd
install/postscript
Connectors-nk.76.mcz
FSM-nk.24.mcz
Genie-nk.22B.mcz
ConnectingGenie-nk.18.mcz
EToySimulation-nk.16.mcz
Refactory-dvf.20.mcz
demo.prefs
MorphRemovalNotificationsFix-nk.1.cs
GenieRename-nk.1.cs
ChangeSetDirectoryPref-nk.1.cs
install/preamble
install/preamble is:
HandMorph allSubInstances do: [:each |
each disableGenie.
each instVarNamed: #genieGestureProcessor put: nil]. !
self extractMember: 'demo.prefs'.
Preferences loadPreferencesFrom: 'demo.prefs'. !
(self membersMatching: 'SARInstaller*.mcz') do: [ :m |
self fileInMonticelloZipVersionNamed: m.
self zip removeMember: m ]. !
{ 'RemoveWorldsOfSqueak-nk.*.cs'.
'MorphRemovalNotificationsFix-nk.*.cs'.
'GenieRename-nk*.cs'.
'ChangeSetDirectoryPref-nk*.cs'.
'ActionSequenceFix-nk.*.cs'.
'BalloonFillFix-nk.*.cs'.
'FasterMouseOver-nk.*.cs'.
'FlexibleVocabularies-nk.*.cs'.
'ColorSeesTurtleTrailsToo-nk.*.cs'.
'MouseMoveEvtStartPos-ar.*.cs'.
'ReUseViewerFlaps-nk.*.cs'.
'UsableSiblingInstanceFix-nk.*.cs'.
'ImportantFixes.*.cs'.
} do: [ :f | self installMember: f ]. !
{ 'Refactory*.mcz'.
'SARInstaller*.mcz'.
'CustomEvents-nk.*.mc#'.
'FSM-nk.*.mc#'.
'Connectors-nk.*.mc#'.
'Genie-nk.*.mc#'.
'ConnectingGenie-nk.*.mc#'.
'Plot-nk.4.mcz'.
'EToySimulation*.mcz' } do: [ :f | self installMember: f ]. !
{ 'fonts/arial.ttf'.
'fonts/arialbd.ttf'. "..etc.."
'fonts/VeraSeBd.ttf'.
'fonts/webdings.ttf'.
'fonts/wingding.ttf'. } do: [ :f | self fileInTrueTypeFontNamed: f ]. !
(self membersMatching: 'icons/*.gif') do: [ :f | self extractMember: f ]. !
(self membersMatching: 'images/*') do: [ :f | self importImage: f ]. !
self fileInGenieDictionaryNamed: 'AlanAll.ggd'.
install/postscript is:
(TextStyle named: 'Tahoma') addNewFontSize: 12; addNewFontSize: 15.
(TextStyle named: 'Arial') addNewFontSize: 12; addNewFontSize: 15.
(CRDictionary name: #AlanAll) exportedName: #AlanAll.
(CRDictionary name: #AlanText) exportedName: #Text.
(CRDictionary name: #AlanMorphWithText) exportedName: #AlanMorphWithText.
(CRDictionary name: #PertDuration) exportedName: #PertDuration.
(CRDictionary name: #PertProject) exportedName: #PertProject.
(CRDictionary name: #AlanLassoSelection) exportedName: #LassoSelection.
(CRDictionary name: #Connectors) exportedName: #NCAAConnectorMorph.
(CRDictionary name: #PertLassoSelection) exportedName: #PertLassoSelection.
(CRDictionary name: #QuickSketchMorphYellow) exportedName:
#QuickSketchMorphYellow.
(CRDictionary name: #AlanMorphYellow) exportedName: #AlanMorphYellow.
(CRDictionary name: #AlanWorldYellow) exportedName: #PasteUpMorphYellow.
(CRDictionary name: #AlanTextMorph) exportedName: #AlanTextMorph.
(CRDictionary name: #PertProjectYellow) exportedName: #PertProjectYellow.
(CRDictionary name: #PertActivity) exportedName: #PertActivity.
(CRDictionary name: #AlanWorld) exportedName: #PasteUpMorph.
(CRDictionary name: #PertName) exportedName: #PertName.
(CRDictionary name: #QuickSketch) exportedName: #QuickSketchMorph.
(CRDictionary name: #StellaStock) exportedName: #SimStockMorph.
(CRDictionary name: #PlotMorph) exportedName: #PlotMorph.
(CRDictionary name: #NumbersOnly) exportedName: #UpdatingStringMorph.
!
| style pointSizes texts flap |
style _ (TextStyle named: 'Arial') copy.
style fonts withIndexDo: [ :font :index | style fontAt: index put: (font
emphasis: 1) ].
texts _ OrderedCollection new.
style fonts withIndexDo: [ :font :i | | t |
t _ NCGrabbableDisplayTextMorph new
backgroundColor: Color transparent;
textColor: (Color r: 0.839 g: 0.323 b: 0.0);
setTextStyle: style;
contentsAsIs: ('abc' asText addAttribute: (TextFontChange fontNumber: i);
yourself);
setNameTo: 'Text';
hasDropShadow: true;
shadowColor: (TranslucentColor r: 0.29 g: 0.29 b: 0.29 alpha: 0.322);
shadowOffset: 2 at 2;
yourself.
t text addAttribute: (TextFontChange fontNumber: i).
texts add: t.
].
flap _ Flaps globalFlapTabWithID: 'Prototypes'.
flap ifNil: [
flap _ (Flaps newFlapTitled: 'Prototypes' onEdge: #left) openInWorld.
Flaps addGlobalFlap: flap.
Flaps enableGlobalFlaps
].
World addMorph: flap.
flap _ flap referent.
texts do: [ :t | flap addMorphBack: t ].
flap addMorphBack: (RectangleMorph new
extent: ( 968.0 at 22.0);
setNameTo: 'Rectangle';
shadowColor: (TranslucentColor r: 0.0 g: 0.0 b: 0.0 alpha: 0.153);
shadowOffset: 3 at 3;
hasDropShadow: true;
setProperty: #noGestureResize toValue: true;
borderWidth: 0;
fillStyle: ((GradientFillStyle ramp: {0.0->(Color r: 0.935 g: 0.548 b: 0.0).
1.0->(Color r: 0.935 g: 0.935 b: 0.935)}) origin: 436.0 at 74.0;
direction: 513 at 3;
normal: -70 at 149;
radial: false);
yourself).
flap addMorphBack: (EllipseMorph new
setNameTo: 'Ellipse';
extent: 100 at 100;
setProperty: #noGestureRotate toValue: true;
setProperty: #noGestureStretch toValue: true;
borderWidth: 1;
fillStyle: (Color blue muchLighter alpha: 0.3);
yourself).
flap addMorphBack: (EllipseMorph new
setNameTo: 'Ellipse';
extent: 200 at 50;
borderWidth: 1;
fillStyle: (Color red muchLighter);
yourself).
flap addMorphBack: (SimStockMorph bigSliderView
setNameTo: 'Stock';
extent: 65 at 140;
yourself).
flap addMorphBack: (SimControlsMorph new
setNameTo: 'Timer';
yourself).
flap addMorphBack: (NCAAConnectorMorph new
setNameTo: 'Connector';
lineWidth: 3;
makeForwardArrow;
color: (Color r: 0.4 g: 0.3 b: 0.9);
yourself).
flap
layoutPolicy: TableLayout new;
listCentering: #topLeft;
setProperty: #alwaysShowThumbnail toValue: true;
setProperty: #thumbnailHeight toValue: 100;
setPartsBinStatusTo: true;
updateSubmorphThumbnails.
!
Preferences setPreference: #displayUnrecognizedGestures toValue: true.
Preferences setPreference: #showDragControllerFeedback toValue: false.
Preferences setPreference: #showGenieFocusRectangle toValue: true.
World activeHand enableGenie.
Display newDepth: 32.
Preferences setPreference: #soundsEnabled toValue: false.
!
> Also, if you build SAR files like the above, could you point me to the
> script or describe the methodology used to create it? Or just chime in
> w/ a tip on the best way? Can PackageInfo be told to use an MC file
> instead of using it's "native" ability to include a changeset for the
> package?
I used the StarBrowser to collect the bits and pieces that make up the SAR
(files, changesets, MC packages, whatever).
I have a StarBrowser extension that uses my SARBuilder to make the SAR.
I hand-edited the install/preamble and install/postscript to avoid referring
to specific versions.
> Also, I'd like to provide a good 'unload' procedure. My guess is that
> the best way to do this is to have Monticello unload it, and also to
> somewhere override the #removeFromSystem method to do all the
> unregistering and severing of pointers and dependencies. Is this the
> best way? It assumes MC is in the image, however -- perhaps MCInstaller,
> which seems to be headed for base image inclusion, could be beefed up to
> include an unloader too, so it's presence can be relied upon.
I think the MC unload is the best bet. I'd put class-specific cleanup in the
class
> Would it be fair to say that SqueakMap, SAR, and Monticello have matured
> to the point that a thorough HOWTO for creating well behaved packages
> could now safely be written?
Sure. You want to do it <g>?
--
Ned Konz
http://bike-nomad.com/squeak/
More information about the Squeak-dev
mailing list
|