[squeak-dev] MorphicProject subclass: #EtoysProject

H. Hirzel hannes.hirzel at gmail.com
Thu Oct 5 19:25:12 UTC 2017


If you drop

    http://etoys.laptop.org/src/Content/ExampleEtoys/CarAndPen.014.pr

on to the desktop Squeak asks you for a replacement for
'MultiNewParagraph' as this class was removed in April (The Trunk:
EToys-nice.292.mcz)

Answer 'NewParagraph'. Then the Etoys project loads and gives some
error messages. Some are related to preferences. An issue to fix
first.

Another issue is that actually a MorphicProject is created instead of
the new #EtoysProject type we want.

I do not now yet where to do this.
The call chain passes through

MultiByteBinaryOrTextStream>>fileInObjectAndCodeForProject [1]

The stream [2] has code and an  object to be read by a SmartRefStream.

More investigation needed.

--Hannes






[1] MultiByteBinaryOrTextStream>>fileInObjectAndCodeForProject

fileInObjectAndCodeForProject
	"This file may contain:
1) a fileIn of code
2) just an object in SmartReferenceStream format
3) both code and an object.
	File it in and return the object.  Note that self must be a
FileStream or RWBinaryOrTextStream.  Maybe ReadWriteStream incorporate
RWBinaryOrTextStream?"
	| refStream object |
	self halt.
	self text.
	self peek asciiValue = 4
		ifTrue: [  "pure object file"
			self binary.
			refStream := SmartRefStream on: self.
			object := refStream nextAndClose]
		ifFalse: [  "objects mixed with a fileIn"
			self fileInProject.  "reads code and objects, then closes the file"
			self binary.
			object := SmartRefStream scannedObject].	"set by side effect of one
of the chunks"
	SmartRefStream scannedObject: nil.  "clear scannedObject"
	^ object






[2] Content of the Etoys pr file readstream

'''From etoys4.0 of 9 October 2008 [latest update: #2319] on 18
September 2009 at 3:39:18 pm''!
 | cont | (Smalltalk includesKey: #MorphExtensionPlus) ifFalse: [self
inform: ''This project cannot be loaded into an older system.\Please
use an OLPC Etoys compatible image.'' translated withCRs.
		cont _ thisContext.
		[cont notNil] whileTrue: [
			cont selector == #handleEvent: ifTrue: [cont return: nil].
			cont _ cont sender.
		]]!

!ObjectScanner new initialize!



!self smartRefStream!

On 10/5/17, H. Hirzel <hannes.hirzel at gmail.com> wrote:
> This later on goes to
>
>
> ProjectLoading class>>
>
> openName: aFileName stream: preStream fromDirectory: aDirectoryOrNil
> withProjectView: existingView clearOriginFlag: clearOriginFlag
> 	"Reconstitute a Morph from the selected file, presumed to
> represent a Morph saved via the SmartRefStream mechanism, and open it
> in an appropriate Morphic world."
>
>    	| morphOrList archive mgr substituteFont numberOfFontSubstitutes
> resultArray anObject project manifests dict |
> 	(self checkStream: preStream) ifTrue: [^ self].
> 	ProgressNotification signal: '0.2'.
> 	archive := preStream isZipArchive
> 		ifTrue:[ZipArchive new readFrom: preStream]
> 		ifFalse:[nil].
> 	archive ifNotNil:[
> 	manifests := (archive membersMatching: '*manifest').
> 	(manifests size = 1 and: [((dict := self parseManifest: manifests
> first contents) at: 'Project-Format' ifAbsent: []) = 'S-Expression'])
> 		ifTrue: [
> 			^ (self respondsTo:
> #openSexpProjectDict:stream:fromDirectory:withProjectView:)
> 				ifTrue: [self openSexpProjectDict: dict stream: preStream
> fromDirectory: aDirectoryOrNil withProjectView: existingView]
> 				ifFalse: [self inform: 'Cannot load S-Expression format projects
> without Etoys' translated]]].
>
> 	morphOrList := self morphOrList: aFileName stream: preStream
> fromDirectory: aDirectoryOrNil archive: archive.
> 	morphOrList ifNil: [^ self].
> 	ProgressNotification  signal: '0.4'.
> 	resultArray := self fileInName: aFileName archive: archive
> morphOrList: morphOrList.
> 	anObject := resultArray first.
> 	numberOfFontSubstitutes := resultArray second.
> 	substituteFont := resultArray third.
> 	mgr := resultArray fourth.
> 	preStream close.
> 	ProgressNotification  signal: '0.7'.
> 		"the hard part is over"
> 	(anObject isKindOf: ImageSegment) ifTrue: [
> 		project := self loadImageSegment: anObject
> 			fromDirectory: aDirectoryOrNil
> 			withProjectView: existingView
> 			numberOfFontSubstitutes: numberOfFontSubstitutes
> 			substituteFont: substituteFont
> 			mgr: mgr.
> 		project noteManifestDetailsIn: dict.
> 		project removeParameter: #sugarProperties.
> 		Smalltalk at: #SugarPropertiesNotification ifPresent: [:sp |
> 			sp signal ifNotNil: [:props |
> 				project keepSugarProperties: props monitor: true]].
> 		clearOriginFlag ifTrue: [project forgetExistingURL].
> 		ProgressNotification  signal: '0.8'.
> 			^ project
> 				ifNil: [self inform: 'No project found in this file' translated]
> 				ifNotNil: [ProjectEntryNotification signal: project]].
> 	Project current openViewAndEnter: anObject
>
> On 10/5/17, H. Hirzel <hannes.hirzel at gmail.com> wrote:
>> A few steps more: when I drop a project file onto the desktop the
>> following methods are called
>>
>> PasteUpMorph handleDroppedItem: anItem event: anEvent
>> ExternalDropHandler lookupExternalDropHandler: anItem
>> ExternalDropHandler handle: dropStream in: pasteUp dropEvent: anEvent
>> ExternalDropHandler class defaultProjectHandler
>>
>> ProjectLoading openOn: aMultiByteFileStream:
>> "'/home/user/Downloads/CarAndPen.014(2).pr'"
>>
>> So we have to fix ProjectLoading
>>
>>
>> On 10/5/17, H. Hirzel <hannes.hirzel at gmail.com> wrote:
>>> Note: MorphWithGrid does not really make sense unless you have a
>>> superclass MorphWithDnD (Drag and Drop) which handles the morph droped
>>> and makes them 'sticky'.
>>>
>>> Though refactoring PastUpMorph by inserting superclasses is an issue I
>>> suggest to put this on the backburner at the moment and focus on
>>> getting the Etoys setting straight as Dave suggests in the initial
>>> mail.
>>>
>>> A use case to follow: What happens when you drop  the exapme project
>>>
>>>     http://etoys.laptop.org/src/Content/ExampleEtoys/CarAndPen.014.pr
>>>
>>> on to the desktop.
>>>
>>> ExternalDropHandler>>handleDroppedItem:event:  [21]
>>>
>>> is called in this case and then dispatches to do the necessary things
>>> to deal with the
>>>     ExampleEtoys/CarAndPen.014.pr
>>> file.
>>>
>>> There is a message box which needs attention.
>>>
>>> And I assume that in the course of these events some settings are
>>> necessary. Most prominently to choose EtoysProject and no longer
>>> MorphicProject
>>>
>>> --Hannes
>>>
>>> [21] http://wiki.squeak.org/squeak/4283
>>>
>>> On 10/5/17, H. Hirzel <hannes.hirzel at gmail.com> wrote:
>>>> I added a demo file Morphic-hjh.1354 [11] to the repository
>>>>
>>>> MCHttpRepository
>>>> 	location: 'http://www.squeaksource.com/EtoysProject'
>>>> 	user: ''
>>>> 	password: ''
>>>>
>>>> This file should be loaded into a fully updated trunk test image.
>>>>
>>>> I agree with what Tobias noted earlier in this thread that it is
>>>> probably better to avoid renaming PasteUpMorph. I see as a solution to
>>>> easier deal with PasteUpMorph functions the insertion of superclasses
>>>> of PasteUpMorph (and thus subclasses of BorderedMorph) [12]
>>>>
>>>> The next thing I will come up with is a class
>>>>     MorphWithDnD
>>>>
>>>> a morph class which supports drag and drop.
>>>> As a superclass of MorphWithGrid
>>>>
>>>> A third class would be PlayField which contains all the Etoys
>>>> selectors.
>>>> In an image without Etoys that class would then be just empty.
>>>>
>>>> --Hannes
>>>>
>>>>
>>>> --------------------
>>>>
>>>> [11]
>>>> Name: Morphic-hjh.1354
>>>> Author: hjh
>>>> Time: 5 October 2017, 11:51:21.903338 am
>>>> UUID: e96d5a46-453f-418c-b95f-26f1674ca329
>>>> Ancestors: Morphic-hjh.1353
>>>>
>>>> Demo which shows how to remove selectors from PasteUpMorph and insert
>>>> them into a newy created superclass
>>>>
>>>> Inserted
>>>>      MorphWithGrid
>>>> as a subclass of BorderedMorph and superclass of
>>>>     PasteUpMorph
>>>>
>>>> gridding protocol was moved from
>>>>     PasteUpMorph
>>>> to
>>>>     MorphWithGrid
>>>>
>>>>
>>>> Morphic-hjh.1353:
>>>> 	Ancestors: Morphic-hjh.1352
>>>>
>>>> Note: I tried to save this update several times. That accounts for the
>>>> empty updates in between.
>>>>
>>>>
>>>> ---------
>>>> [12]
>>>> After filing in Morphic-hjh.1354
>>>> PasteUpMorph printHierarchy '
>>>> ProtoObject #()
>>>> 	Object #()
>>>> 		Morph #()
>>>> 			BorderedMorph #()
>>>> 				MorphWithGrid #(''griddingOn'')
>>>> 					PasteUpMorph #(...)
>>>> 						ComponentLayout #(...)
>>>> 						EventTimeline #(...)
>>>> 						GeeBookPageMorph #(...)
>>>> 						IndexTabs #(...)
>>>> 						MouseEventEditor #(...)
>>>> 						PartsBin #(...)
>>>> 						QuickGuideHolderMorph #(...)
>>>> 						SyntaxTestMethods #(...)
>>>> 						TetrisBoard #(...)
>>>> 						TextPlusPasteUpMorph #(...)
>>>> 						WiWPasteUpMorph #(...)
>>>> 							MVCWiWPasteUpMorph #(...)
>>>> 						Worldlet #(...)
>>>> 						ZASMScriptMorph #(...)
>>>> 						ZoomAndScrollMorph #(...)'
>>>>
>>>> On 10/5/17, Marcel Taeumel <marcel.taeumel at hpi.de> wrote:
>>>>> Done. :)
>>>>>
>>>>> Best,
>>>>> Marcel
>>>>> Am 05.10.2017 06:21:44 schrieb David T. Lewis <lewis at mail.msen.com>:
>>>>> We did have a problem on squeaksource.com, but I think it is mostly
>>>>> resolved
>>>>> now.
>>>>>
>>>>> Hannes,
>>>>>
>>>>> The password reset for your HJH account was lost, so I set it back to
>>>>> the
>>>>> new password that I sent to you earlier in private email. Hopefully
>>>>> your
>>>>> access is working again now.
>>>>>
>>>>> Marcel,
>>>>>
>>>>> Your new account disappeared when squeaksource recovered from some
>>>>> internal
>>>>> problem. Sorry, I do not know the cause. But could I ask you to please
>>>>> register
>>>>> again on squeaksource.com, and I will then add you back to
>>>>> EtoysProject?
>>>>>
>>>>> Sorry for the disruption,
>>>>> Dave
>>>>>
>>>>>
>>>>> On Thu, Oct 05, 2017 at 02:03:47AM +0200, H. Hirzel wrote:
>>>>>> Dave
>>>>>>
>>>>>> Earlier today login worked. Currently it does not.
>>>>>>
>>>>>> --Hannes
>>>>>>
>>>>>> On 10/5/17, David T. Lewis wrote:
>>>>>> > Hannes,
>>>>>> >
>>>>>> > You did not cause the problem. It may have been me, I saved the
>>>>>> > squeaksource.com
>>>>>> > image from a VNC session (because I wanted to make an up to date
>>>>>> > backup
>>>>>> > of
>>>>>> > it),
>>>>>> > and I am now unable to log in to squeaksource. Maybe I triggered a
>>>>>> > bug
>>>>>> > :-/
>>>>>> >
>>>>>> > Can you please tell me if you are able to log in to your
>>>>>> > http://squeaksource.com
>>>>>> > page? I am getting authorization errors, and I suspect it is a
>>>>>> > problem
>>>>>> > that
>>>>>> > affects
>>>>>> > everyone.
>>>>>> >
>>>>>> > Thanks,
>>>>>> > Dave
>>>>>> >
>>>>>> > On Thu, Oct 05, 2017 at 01:52:35AM +0200, H. Hirzel wrote:
>>>>>> >> Dave,
>>>>>> >>
>>>>>> >> Yes, I encounter problems. They might be related to what I just
>>>>>> >> tried
>>>>>> >> to
>>>>>> >> do:
>>>>>> >>
>>>>>> >> I wanted to save an updated version of Morphic to the ProjectEtoys
>>>>>> >> repository but by mistake I tried to commit it to the trunk. As I
>>>>>> >> do
>>>>>> >> not have commit rights to trunk this prevented me from changing it
>>>>>> >> inadvertently. Later on I wanted to commit that version to
>>>>>> >> ProjectEtoys. It did not work.
>>>>>> >>
>>>>>> >> --Hannes
>>>>>> >>
>>>>>> >>
>>>>>> >>
>>>>>> >> On 10/5/17, David T. Lewis wrote:
>>>>>> >> > I'm seeing problems with SqueakSource right now, trying to
>>>>>> >> > figure
>>>>>> >> > out
>>>>>> >> > what is wrong. So the project may not be accessible right now
>>>>>> >> > :-/
>>>>>> >> >
>>>>>> >> > Dave
>>>>>> >> >
>>>>>> >> >
>>>>>> >> > On Thu, Oct 05, 2017 at 01:17:58AM +0200, H. Hirzel wrote:
>>>>>> >> >> Karl,
>>>>>> >> >>
>>>>>> >> >> So far entering and existing the Etoys project works smoothly.
>>>>>> >> >>
>>>>>> >> >> Load mcz from into current Squeak 6.0a
>>>>>> >> >>
>>>>>> >> >> MCHttpRepository
>>>>>> >> >> location: 'http://www.squeaksource.com/EtoysProject'
>>>>>> >> >> user: ''
>>>>>> >> >> password: ''
>>>>>> >> >>
>>>>>> >> >> The issue is about providing more settings when entering.
>>>>>> >> >>
>>>>>> >> >> Karl, do you want to be added to the list of developers?
>>>>>> >> >>
>>>>>> >> >> --HH
>>>>>> >> >>
>>>>>> >> >> On 10/5/17, H. Hirzel wrote:
>>>>>> >> >> > PasteUpMorph is useful and the functions have to be
>>>>>> >> >> > maintained.
>>>>>> >> >> >
>>>>>> >> >> > However adding more functions to Morph does not make sense.
>>>>>> >> >> >
>>>>>> >> >> > Squeak 6.0a
>>>>>> >> >> > Morph selectors size 1345
>>>>>> >> >> > PasteUpMorph selectors size 530
>>>>>> >> >> >
>>>>>> >> >> > --Hannes
>>>>>> >> >> >
>>>>>> >> >> > On 10/4/17, karl ramberg wrote:
>>>>>> >> >> >> I'm not sure anybody uses Etoys anymore, but PasteUpMorph is
>>>>>> >> >> >> very
>>>>>> >> >> >> useful
>>>>>> >> >> >> in
>>>>>> >> >> >> direct manipulation because of it's various layout and event
>>>>>> >> >> >> handling
>>>>>> >> >> >> options. It also act as a container of other morphs, with
>>>>>> >> >> >> automatic
>>>>>> >> >> >> layout, enumeration etc.
>>>>>> >> >> >> I'm sure most of this could be refactored into Morph class
>>>>>> >> >> >> or
>>>>>> >> >> >> another
>>>>>> >> >> >> class.
>>>>>> >> >> >>
>>>>>> >> >> >> Best,
>>>>>> >> >> >> Karl
>>>>>> >> >> >>
>>>>>> >> >> >> On Tue, Oct 3, 2017 at 3:03 PM, Marcel Taeumel
>>>>>> >> >> >>
>>>>>> >> >> >> wrote:
>>>>>> >> >> >>
>>>>>> >> >> >>> +1 :)
>>>>>> >> >> >>>
>>>>>> >> >> >>> And then later: Rename PasteUpMorph to WorldMorph, and keep
>>>>>> >> >> >>> an
>>>>>> >> >> >>> empty
>>>>>> >> >> >>> PasteUpMorph subclass around for compatibility reasons. So
>>>>>> >> >> >>> many
>>>>>> >> >> >>> ideas
>>>>>> >> >> >>> have
>>>>>> >> >> >>> been ported down to Morph class over the past years. New
>>>>>> >> >> >>> applications
>>>>>> >> >> >>> have
>>>>>> >> >> >>> no reason to ever use other instances of PasteUpMorph.
>>>>>> >> >> >>>
>>>>>> >> >> >>> Best,
>>>>>> >> >> >>> Marcel
>>>>>> >> >> >>>
>>>>>> >> >> >>> Am 03.10.2017 14:57:55 schrieb H. Hirzel :
>>>>>> >> >> >>> On 10/3/17, H. Hirzel wrote:
>>>>>> >> >> >>> > Dave
>>>>>> >> >> >>> >
>>>>>> >> >> >>> > your change set contains the class EtoysProject with
>>>>>> >> >> >>> >
>>>>>> >> >> >>> > EtoysProject selectors
>>>>>> >> >> >>> >
>>>>>> >> >> >>> > #(#finalEnterActions: #restoreGlobalPreferences
>>>>>> >> >> >>> > #saveGlobalPreferences
>>>>>> >> >> >>> > #initializeProjectPreferences #configureOnFirstEntry
>>>>>> >> >> >>> > #finalExitActions:)
>>>>>> >> >> >>> >
>>>>>> >> >> >>> > For complete configuration of a EtoysProject it might be
>>>>>> >> >> >>> > necessary
>>>>>> >> >> >>> > to
>>>>>> >> >> >>> > do
>>>>>> >> >> >>> >
>>>>>> >> >> >>> > PasteUpMorph subclass: EtoysPasteUpMorph
>>>>>> >> >> >>> >
>>>>>> >> >> >>> > as well. http://wiki.squeak.org/squeak/6461
>>>>>> >> >> >>> >
>>>>>> >> >> >>> > Then Etoys related methods may be pushed down to
>>>>>> >> >> >>> > EtoysPasteUpMorph.
>>>>>> >> >> >>>
>>>>>> >> >> >>> See screen shot attached.
>>>>>> >> >> >>>
>>>>>> >> >> >>> > And probably an Etoys specific subclass of WorldMenu
>>>>>> >> >> >>> > would
>>>>>> >> >> >>> > be
>>>>>> >> >> >>> > fine
>>>>>> >> >> >>> > as
>>>>>> >> >> >>> well
>>>>>> >> >> >>> > http://wiki.squeak.org/squeak/6461
>>>>>> >> >> >>> >
>>>>>> >> >> >>> >
>>>>>> >> >> >>> > there is a test project [2] and some more information
>>>>>> >> >> >>> > about
>>>>>> >> >> >>> > adaptions
>>>>>> >> >> >>> > needed because of the UI changes in the thread 'Etoys in
>>>>>> >> >> >>> > 2017?' -
>>>>>> >> >> >>> > UI
>>>>>> >> >> >>> > preferences [3]. And it would be good to have Etoys
>>>>>> >> >> >>> > methods
>>>>>> >> >> >>> > /
>>>>>> >> >> >>> > configuration separate [4].
>>>>>> >> >> >>> >
>>>>>> >> >> >>> > I suggest that you start go ahead and start implementing
>>>>>> >> >> >>> > this
>>>>>> >> >> >>> > while
>>>>>> >> >> >>> > using a test Etoys project dropped onto the desktop.
>>>>>> >> >> >>> >
>>>>>> >> >> >>> > --Hannes
>>>>>> >> >> >>> >
>>>>>> >> >> >>> >
>>>>>> >> >> >>> > [2] > You simply drop it in. E.g. download this project
>>>>>> >> >> >>> >> http://etoys.laptop.org/src/Content/ExampleEtoys/CarAndPen.014.pr
>>>>>> >> >> >>> >
>>>>>> >> >> >>> > [3] Hannes Hirzel, 'Etoys in 2017?' mail, Wed, Feb 22,
>>>>>> >> >> >>> > 2017
>>>>>> >> >> >>> > at
>>>>>> >> >> >>> > 11:01
>>>>>> >> >> >>> > AM
>>>>>> >> >> >>> >
>>>>>> >> >> >>> > [4] David T. Lewis, Sep 4, 2016 at 3:34 PM
>>>>>> >> >> >>> > "I think it would be great if both Etoys and Scratch were
>>>>>> >> >> >>> > easily
>>>>>> >> >> >>> > loadable and unloadable in trunk."
>>>>>> >> >> >>> >
>>>>>> >> >> >>> > On 10/2/17, David T. Lewis wrote:
>>>>>> >> >> >>> >> An EtoysProject is a project that is configured for
>>>>>> >> >> >>> >> running
>>>>>> >> >> >>> >> Etoys.
>>>>>> >> >> >>> >> On
>>>>>> >> >> >>> >> first entry to a new EtoysProject, the playground and
>>>>>> >> >> >>> >> project
>>>>>> >> >> >>> preferences
>>>>>> >> >> >>> >> are initialized to provide an environment similar to
>>>>>> >> >> >>> >> that
>>>>>> >> >> >>> >> of
>>>>>> >> >> >>> >> a
>>>>>> >> >> >>> >> traditional
>>>>>> >> >> >>> >> standalone Etoys image.
>>>>>> >> >> >>> >>
>>>>>> >> >> >>> >> Certain preferences that are required for Etoys are
>>>>>> >> >> >>> >> initialized
>>>>>> >> >> >>> >> on
>>>>>> >> >> >>> >> project
>>>>>> >> >> >>> >> entry, overriding their global preference values while
>>>>>> >> >> >>> >> this
>>>>>> >> >> >>> EtoysProject
>>>>>> >> >> >>> >> is active. On leaving the project, these preferences are
>>>>>> >> >> >>> >> restored
>>>>>> >> >> >>> >> to
>>>>>> >> >> >>> >> their
>>>>>> >> >> >>> >> previous values.
>>>>>> >> >> >>> >>
>>>>>> >> >> >>> >> "ProjectViewMorph openOn: EtoysProject new"
>>>>>> >> >> >>> >>
>>>>>> >> >> >>> >> Change set attached for a minimal implementation.
>>>>>> >> >> >>> >>
>>>>>> >> >> >>> >> Anyone with Etoys knowledge care to help? I do not know
>>>>>> >> >> >>> >> enough
>>>>>> >> >> >>> >> about
>>>>>> >> >> >>> >> Etoys
>>>>>> >> >> >>> >> to fill in the rest of the initialization that will be
>>>>>> >> >> >>> >> required,
>>>>>> >> >> >>> >> but
>>>>>> >> >> >>> >> it
>>>>>> >> >> >>> >> should not be hard to do.
>>>>>> >> >> >>> >>
>>>>>> >> >> >>> >> Dave
>>>>>> >> >> >>> >>
>>>>>> >> >> >>> >>
>>>>>> >> >> >>> >
>>>>>> >> >> >>>
>>>>>> >> >> >>>
>>>>>> >> >> >>>
>>>>>> >> >> >>>
>>>>>> >> >> >>>
>>>>>> >> >> >>
>>>>>> >> >> >
>>>>>> >> >
>>>>>> >> >
>>>>>> >> >>
>>>>>> >> >
>>>>>> >> >
>>>>>> >> >
>>>>>> >>
>>>>>> >
>>>>>> >
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>


More information about the Squeak-dev mailing list