[squeak-dev] Embracing Projects
Andreas Raab
andreas.raab at gmx.de
Thu Nov 26 04:25:39 UTC 2009
Folks -
I always felt that one of the least used "big ideas" in Squeak is that
of projects. Projects are incredibly powerful but have often been
severely misunderstood. A Project in Squeak can define an entire
environment (MVC, Morphic, Tweak), it can be a modification to an
existing environment, it can identify a set of tools to be used in some
context and more.
The progress that we've made with refactoring of class Project makes it
feasible to illustrate the power of projects. If you install the
attached change set in an updated trunk image, you will find a new type
of project available - a GamesProject. When you choose this type of
project you will notice that it downloads and installs the MorphicGames
package that Edgar just announced (thanks Edgar!), sets up the
environment with a set of games before launching into it. (note that I
didn't go as far as setting up the menu bar with games, removing the
tools, sealing the programmer facilities etc. but all of this is
possible and should be considered for the various types of projects)
And of course, when we ship the next image, we could actually include a
number of such "proto projects" like the GamesProject - it takes a tiny
amount of space but makes it very accessible and very visible from an
user point of view. As a conseqence, we can hopefully ship the next
Squeak version with (proto-)Games, Etoys, VMMaker, Seaside and whatnot
projects.
Thoughts?
Cheers,
- Andreas
-------------- next part --------------
'From Squeak3.10.2 of ''5 June 2008'' [latest update: #7179] on 25 November 2009 at 8:19:39 pm'!
MorphicProject subclass: #GamesProject
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'Projects-Extras'!
!GamesProject methodsFor: 'initialize' stamp: 'ar 11/25/2009 20:08'!
initialize
"Make sure games are loaded, then set things up."
self install ifFalse:[^nil]. "install failed"
super initialize. "default Morphic setup"
"Now the good stuff. This really should be handled by MorphicGamesInfo.
So check if it knows how to set up a project and if so, let it take care of things."
(Smalltalk classNamed: #MorphicGamesinfo) ifNotNil:[:pkgInfo|
(pkgInfo canUnderstand: #setupProject:) ifTrue:[
pkgInfo setupProject: self.
^self]].
self setupProject: self.
! !
!GamesProject methodsFor: 'initialize' stamp: 'ar 11/25/2009 20:19'!
install
"Ensure MorphicGames are installed"
(MCWorkingCopy allManagers
anySatisfy:[:mcw| mcw packageName = 'MorphicGames']) ifTrue:[^true].
(UIManager default confirm: 'Morphic Games are not present.
Download and install them now?
(Requires Internet access)') ifFalse:[^false].
['Installing Morphic Games' displayProgressAt: Sensor cursorPoint
from: 0 to: 1 during:[:bar|
(Installer repository: 'http://www.squeaksource.com/Ladrillos')
install: 'MorphicGames'].
] on: Error do:[:ex|
self inform: 'Failed to load Morphic Games:\' withCRs, ex description.
^false
].
UIManager default inform: 'Morphic Games have been installed.
We recommended saving the image
to avoid repeated installation.'.
^true
! !
!GamesProject methodsFor: 'initialize' stamp: 'ar 11/25/2009 20:09'!
setupProject: aProject
"Set up a new Games Project"
| top quadList button |
top := 32.
quadList := OrderedCollection new.
#(AtomicGame ChessMorph
ChineseCheckers CipherPanel CrosticPanel
FreeCell Mines SameGame Tetris) do:[:each|
(Smalltalk classNamed: each) ifNotNil:[:gameClass|
gameClass addPartsDescriptorQuadsTo: quadList if:[:d| true]]].
quadList do:[:quad|
button := IconicButton new initializeWithThumbnail:
(PartsBin thumbnailForQuad: quad color: Color white) withLabel: quad third andColor: Color white andSend: quad second to: (Smalltalk at: quad first).
(quad size > 3 and: [quad fourth isEmptyOrNil not]) ifTrue:
[button setBalloonText: quad fourth].
button position: 40 - (button fullBounds width // 2) @ top.
aProject world addMorphBack: button.
top := top + button height + 20].! !
"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!
GamesProject class
instanceVariableNames: ''!
!GamesProject class methodsFor: 'class initialization' stamp: 'ar 11/25/2009 19:13'!
initialize
"We should fix this, TheMainWorldDockingBar should pick up new projects automatically"
TheWorldMainDockingBar updateInstances.
! !
GamesProject initialize!
More information about the Squeak-dev
mailing list
|