[etoys-dev] Persistent preferences

kharness at illinois.edu kharness at illinois.edu
Mon Aug 9 09:00:29 EDT 2010


Hi, 
I think the real estate of the blank screen is a valuable feature of Etoys and adding an extra flap and book to the opening page sort of demands that authors decide to use them or to discard them. I'd prefer that we not try to manage their thinking that much.

If you give lined paper to people, they follow the lines and thinking is linear and text based. If you give them graph paper you send them in another direction and if you give them a blank slate you give them the option to do . . . anything.

Making template projects for your uses of Etoys is a good one. I would not want to start every project by having to delete a flap and book. Since it is so easy to move objects from one project to another I do not understand what benefit to authors, who we will never meet, is gained by loading the Supplies Bin and Object Catalog with objects. The clip art in Alice, Scratch and StarLogo TNG is one of the features I like the least; the images limit imagination, creativity, and originality. 

A different topic but I will add it here. I also like the lack of strong colors in the Etoys interface; it is a functional and neutral place to work.
Regards, 
Kathleen

---- Original message ----
>Date: Sun, 8 Aug 2010 23:53:29 -0400
>From: Steve Thomas <sthomas1 at gosargon.com>  
>Subject: Re: [etoys-dev] Persistent preferences  
>To: etoys-dev at squeakland.org
>
>   Does this change apply only to preferences?
>   Or does it cover the things Scott Wallace mentioned
>   in tracker:
>
>     More things than just preference values might also
>     be stored in such a file, e.g. default screen
>     background color/picture, maybe even presence of
>     some "standard morphs" to be inserted into new
>     projects, etc
>
>   The ability to have "standard morphs" (either in the
>   Object Catalog,  or Supplies Bin) would be useful.
>   Also after Squeakfest and thinking about Walter
>   Benders comments on flaps and books, the ability to
>   start all new projects with a book and default flap
>   would be nice as well.  Of course I could
>   accomplish this with a few extra mouse clicks by
>   simply making a "starter project" that has these
>   objects and then modify  and rename that project.
>   Stephen
>   On Sun, Aug 8, 2010 at 12:58 PM, Bert Freudenberg
>   <bert at freudenbergs.de> wrote:
>
>     Hi folks,
>
>     I uploaded a proposed implementation to the inbox.
>     This allows you a user to change certain
>     preferences automatically on startup. The feature
>     has been requested quite often, e.g. you could
>     turn on unlimitedPaintArea permanently, or
>     debugHaloHandle, etc.
>
>     We are in feature freeze, but OTH we still have no
>     alpha version yet. I think it's relatively low
>     risk. Please comment.
>
>     - Bert -
>
>     On 08.08.2010, at 16:46, commits at source.squeak.org
>     wrote:
>
>     > Bert Freudenberg uploaded a new version of
>     System to project Etoys Inbox:
>     >
>     http://source.squeak.org/etoysinbox/System-bf.26.mcz
>     >
>     > ==================== Summary
>     ====================
>     >
>     > Name: System-bf.26
>     > Author: bf
>     > Time: 8 August 2010, 6:46:40 pm
>     > UUID: 49a53b17-2294-4f3a-9fe1-f4051afce791
>     > Ancestors: System-bf.25
>     >
>     > - allow to persist preferences (SQ-134)
>     > - store value using menu in preferences tool
>     > - restore on startup
>     >
>     > =============== Diff against System-bf.25
>     ===============
>     >
>     > Item was added:
>     > + ----- Method: Preferences
>     class>>persistedValueFor: (in category
>     'persistence') -----
>     > + persistedValueFor: aSymbol
>     > +     ^self persistedValueFor: aSymbol in:
>     ExternalSettings preferenceDirectory!
>     >
>     > Item was added:
>     > + ----- Method: Preferences
>     class>>persistedFileNameFor: (in category
>     'persistence') -----
>     > + persistedFileNameFor: aSymbol
>     > +     ^aSymbol, self
>     persistedFileNameExtension!
>     >
>     > Item was added:
>     > + ----- Method: Preferences
>     class>>fetchExternalSettingsIn: (in category
>     'persistence') -----
>     > + fetchExternalSettingsIn: aDirectory
>     > +     "Load persisted preferences"
>     > +     "Preferences fetchExternalSettingsIn:
>     ExternalSettings preferenceDirectory"
>     > +
>     > +     ^ (aDirectory fileNamesMatching: '*',
>     self persistedFileNameExtension)
>     > +                     do: [:fileName |
>     > +                             |
>     pref value |
>     > +                             pref
>     := fileName allButLast: self
>     persistedFileNameExtension size.
>     > +                            
>     value := self persistedValueFor: pref in:
>     aDirectory.
>     > +                            
>     (value isKindOf: Boolean) ifTrue:
>     > +                              
>           [self enableOrDisable: pref asSymbol
>     asPer: value]]!
>     >
>     > Item was added:
>     > + ----- Method:
>     Preference>>isNotSetOnStartupString (in category
>     'persistence') -----
>     > + isNotSetOnStartupString
>     > +     "Answer a string representing whether
>     this preference is not persisted"
>     > +
>     > +     | aStr |
>     > +     aStr :=  'do not set preference on
>     startup' translated.
>     > +     ^ self persistedValue == nil
>     > +             ifTrue: ['<yes>', aStr]
>     > +             ifFalse:        ['<no>',
>     aStr]!
>     >
>     > Item was changed:
>     >  ----- Method: ExternalSettings
>     class>>preferenceDirectory (in category
>     'accessing') -----
>     >  preferenceDirectory
>     > +     | prefDirName imgPath vmPath secDir |
>     > -     | prefDirName imgPath vmPath |
>     >       prefDirName := self
>     preferenceDirectoryName.
>     > +     Preferences startInUntrustedDirectory
>     > +             ifTrue: [
>     > +                     secDir :=
>     (FileDirectory on: SecurityManager default
>     secureUserDirectory)
>     > +                            
>     directoryNamed: prefDirName.
>     > +                     ^secDir exists
>     ifTrue: [secDir]].
>     >       imgPath := SmalltalkImage current
>     imagePath. "might be different from default!!"
>     >       vmPath := SmalltalkImage current
>     vmPath.
>     >       ^((FileDirectory on: imgPath)
>     directoryExists: prefDirName)
>     >               ifTrue: [(FileDirectory on:
>     imgPath) directoryNamed: prefDirName]
>     >               ifFalse: [
>     >                       ((FileDirectory
>     on: vmPath) directoryExists: prefDirName)
>     >                              
>     ifTrue: [(FileDirectory on: vmPath)
>     directoryNamed: prefDirName]
>     >                              
>     ifFalse: [nil]]
>     >  !
>     >
>     > Item was added:
>     > + ----- Method: Preferences
>     class>>persistedFileNameExtension (in category
>     'persistence') -----
>     > + persistedFileNameExtension
>     > +     ^'.pref'!
>     >
>     > Item was added:
>     > + ----- Method: Preferences
>     class>>persistValue:for: (in category
>     'persistence') -----
>     > + persistValue: aBooleanOrNil for: aSymbol
>     > +     "Save the preference aSymbol on file, so
>     it can be restored to the given value on startup.
>     If nil, delete persistent value."
>     > +
>     > +     | fileName file |
>     > +     fileName := self persistedFileNameFor:
>     aSymbol.
>     > +     aBooleanOrNil ifNil: [
>     > +             ^ExternalSettings
>     preferenceDirectory ifNotNilDo: [:fd |
>     > +                     fd
>     deleteFileNamed: fileName ifAbsent: []]].
>     > +     file := ExternalSettings
>     assuredPreferenceDirectory
>     > +             forceNewFileNamed: fileName.
>     > +     [file
>     > +             wantsLineEndConversion:
>     true;
>     > +             nextPutAll: 'value: ';
>     print: aBooleanOrNil; cr.
>     > +     ]       ensure: [file close]!
>     >
>     > Item was added:
>     > + ----- Method: Preferences
>     class>>persistedValueFor:in: (in category
>     'persistence') -----
>     > + persistedValueFor: aSymbol in: aDirectory
>     > +     "Read the value of preference aSymbol
>     from file. Answer nil if not found."
>     > +
>     > +     | tokens value f |
>     > +     aDirectory ifNil: [^nil].
>     > +     f := (aDirectory oldFileOrNoneNamed:
>     (self persistedFileNameFor: aSymbol)) ifNil:
>     [^nil].
>     > +     [
>     > +             f wantsLineEndConversion:
>     true.
>     > +             f contentsOfEntireFile
>     linesDo: [:line |
>     > +                     tokens := line
>     findTokens: '    :' keep: ':'.
>     > +                     (tokens size = 3
>     and: [tokens second = ':']) ifTrue: [
>     > +                            
>     tokens first caseOf: {
>     > +                              
>           ['value'] -> [tokens third caseOf: {
>     > +                              
>                   ['true'] -> [value := true].
>     > +                              
>                   ['false'] -> [value :=
>     false].
>     > +                              
>           } otherwise: []].
>     > +                             }
>     otherwise: []]].
>     > +     ] ensure: [f close].
>     > +     ^value!
>     >
>     > Item was changed:
>     >  ----- Method: Preferences class>>initialize
>     (in category 'class initialization') -----
>     >  initialize
>     >
>     > +     ExternalSettings registerClient: self.
>     > +     self registerInFlapsRegistry.
>     > + !
>     > -     self registerInFlapsRegistry.   !
>     >
>     > Item was changed:
>     >  ----- Method: ExternalSettings
>     class>>assuredPreferenceDirectory (in category
>     'accessing') -----
>     >  assuredPreferenceDirectory
>     >       "Answer the preference directory,
>     creating it if necessary"
>     >
>     > +     |  prefDir topDir |
>     > +     prefDir := self preferenceDirectory.
>     > -     |  prefDir |
>     > -     prefDir _ self preferenceDirectory.
>     >       prefDir
>     >               ifNil:
>     > +                     [topDir :=
>     Preferences startInUntrustedDirectory
>     > +                            
>     ifTrue: [FileDirectory on: SecurityManager default
>     secureUserDirectory]
>     > +                            
>     ifFalse: [FileDirectory default].
>     > +                     prefDir :=
>     topDir directoryNamed: self
>     preferenceDirectoryName.
>     > -                     [prefDir _
>     FileDirectory default directoryNamed: self
>     preferenceDirectoryName.
>     >                       prefDir
>     assureExistence].
>     >       ^ prefDir!
>     >
>     > Item was added:
>     > + ----- Method:
>     Preference>>isDisabledOnStartupString (in category
>     'persistence') -----
>     > + isDisabledOnStartupString
>     > +     "Answer a string representing whether
>     this preference is persisted to false"
>     > +
>     > +     | aStr |
>     > +     aStr :=  'disable preference on
>     startup' translated.
>     > +     ^ self persistedValue == false
>     > +             ifTrue: ['<yes>', aStr]
>     > +             ifFalse:        ['<no>',
>     aStr]!
>     >
>     > Item was added:
>     > + ----- Method:
>     Preference>>isEnabledOnStartupString (in category
>     'persistence') -----
>     > + isEnabledOnStartupString
>     > +     "Answer a string representing whether
>     this preference is persisted to true"
>     > +
>     > +     | aStr |
>     > +     aStr :=  'enable preference on startup'
>     translated.
>     > +     ^ self persistedValue == true
>     > +             ifTrue: ['<yes>', aStr]
>     > +             ifFalse:        ['<no>',
>     aStr]!
>     >
>     > Item was changed:
>     >  ----- Method:
>     BooleanPreferenceView>>offerPreferenceNameMenu:with:in:
>     (in category 'user interface') -----
>     >  offerPreferenceNameMenu: aPanel with: ignored1
>     in: ignored2
>     >       "the user clicked on a preference name
>     -- put up a menu"
>     >
>     >       | aMenu |
>     >       ActiveHand showTemporaryCursor: nil.
>     >       aMenu := MenuMorph new defaultTarget:
>     self preference.
>     >       aMenu addTitle: self preference name.
>     >
>     >       (Preferences
>     okayToChangeProjectLocalnessOf: self preference
>     name) ifTrue:
>     >               [aMenu addUpdating:
>     #isProjectLocalString target: self preference
>     action: #toggleProjectLocalness.
>     >               aMenu
>     balloonTextForLastItem: 'Some preferences are best
>     applied uniformly to all projects, and others are
>     best set by each individual project.  If this
>     item is checked, then this preference will be
>     printed in bold and will have a separate value for
>     each project' translated].
>     >
>     >       aMenu add: 'browse senders' translated
>     target: self systemNavigation selector:
>     #browseAllCallsOn: argument: self preference name.
>     >       aMenu balloonTextForLastItem: 'This
>     will open a method-list browser on all methods
>     that the send the preference "' translated, self
>     preference name, '".'.
>     >       aMenu add: 'show category...'
>     translated target: aPanel selector:
>     #findCategoryFromPreference: argument: self
>     preference name.
>     >       aMenu balloonTextForLastItem: 'Allows
>     you to find out which category, or categories,
>     this preference belongs to.' translated.
>     >
>     >       Smalltalk isMorphic ifTrue:
>     >               [aMenu add: 'hand me a
>     button for this preference' translated target:
>     self selector: #tearOffButton.
>     >               aMenu
>     balloonTextForLastItem: 'Will give you a button
>     that governs this preference, which you may
>     deposit wherever you wish' translated].
>     >
>     >       aMenu add: 'copy this name to
>     clipboard' translated target: self preference
>     selector: #copyName.
>     >       aMenu balloonTextForLastItem: 'Copy the
>     name of the preference to the text clipboard, so
>     that you can paste into code somewhere'
>     translated.
>     > +     aMenu add: 'set automatically on
>     startup...' translated target: self selector:
>     #offerPersistenceMenu.
>     > +     aMenu balloonTextForLastItem: 'Store a
>     value for this preference on file. On startup, it
>     will be automatically restored.' translated.
>     >
>     >       aMenu popUpInWorld!
>     >
>     > Item was added:
>     > + ----- Method:
>     BooleanPreferenceView>>offerPersistenceMenu (in
>     category 'user interface') -----
>     > + offerPersistenceMenu
>     > +     | aMenu |
>     > +     Preferences
>     persistedPreferencesAccessible
>     > +             ifFalse: [^self inform:
>     ('{1} is in secure mode.
>     > + You cannot access the persistent preferences
>     now.
>     > + To change them, start {1} without loading a
>     project.' translated
>     > +     format: {SystemVersion current baseName
>     capitalized})].
>     > +
>     > +     aMenu := MenuMorph new defaultTarget:
>     self preference.
>     > +     aMenu addTitle: self preference name.
>     > +     aMenu addUpdating:
>     #isEnabledOnStartupString target: self preference
>      selector: #persistValue: argumentList: {true}.
>     > +     aMenu addUpdating:
>     #isDisabledOnStartupString target: self preference
>      selector: #persistValue: argumentList: {false}.
>     > +     aMenu addUpdating:
>     #isNotSetOnStartupString target: self preference
>      selector: #persistValue: argumentList: {nil}.
>     > +     aMenu popUpInWorld!
>     >
>     > Item was added:
>     > + ----- Method: Preference>>persistValue: (in
>     category 'persistence') -----
>     > + persistValue: aBooleanOrNil
>     > +     "Save this preference on file, so it can
>     be restored on startup. If nil, delete persistent
>     value."
>     > +     Preferences persistValue: aBooleanOrNil
>     for: self name!
>     >
>     > Item was added:
>     > + ----- Method: Preference>>persistedValue (in
>     category 'persistence') -----
>     > + persistedValue
>     > +     "Answer the value of this preference
>     saved on file, otherwise nil"
>     > +     ^Preferences persistedValueFor: self
>     name!
>     >
>     > Item was added:
>     > + ----- Method: Preferences
>     class>>persistedPreferencesAccessible (in category
>     'persistence') -----
>     > + persistedPreferencesAccessible
>     > +     ^SecurityManager default hasFileAccess
>     > + !
>
>     _______________________________________________
>     etoys-dev mailing list
>     etoys-dev at squeakland.org
>     http://lists.squeakland.org/mailman/listinfo/etoys-dev
>________________
>_______________________________________________
>etoys-dev mailing list
>etoys-dev at squeakland.org
>http://lists.squeakland.org/mailman/listinfo/etoys-dev


More information about the etoys-dev mailing list