[etoys-dev] Etoys: Sugar-bf.7.mcz
commits at source.squeak.org
commits at source.squeak.org
Tue Aug 24 20:47:34 EDT 2010
Bert Freudenberg uploaded a new version of Sugar to project Etoys:
http://source.squeak.org/etoys/Sugar-bf.7.mcz
==================== Summary ====================
Name: Sugar-bf.7
Author: bf
Time: 25 August 2010, 2:46:52 am
UUID: 39bb1c74-b8e6-4018-ab17-2d0da5239201
Ancestors: Sugar-bf.6
- do not save automatically when quitting under Sugar
- keep button brings up details dialog (but not yet synced with Sugar properties)
- the old behavior can be restored by enabling the sugarAutoSave preference
=============== Diff against Sugar-bf.6 ===============
Item was changed:
----- Method: SugarNavigatorBar>>startUp (in category 'initialization') -----
startUp
self checkSugarButtons
!
Item was changed:
----- Method: SugarLauncher>>quit (in category 'commands') -----
quit
+ | autoSave |
+ autoSave := self shouldSaveOnQuit.
- self leaveSharedActivity.
+ Preferences sugarAutoSave ifFalse: [
+ autoSave := false.
+ (self
+ confirm: 'Are you sure you want to quit Etoys?
+ (the project will NOT be saved)' translated)
+ ifFalse: [^self]].
+
+ autoSave
- self shouldAutoSave
ifFalse: [^Smalltalk quitPrimitive].
Project current
projectParameterAt: #sugarAutoSave put: true;
storeOnServerWithNoInteractionThenQuit.!
Item was added:
+ ----- Method: SugarLauncher>>shouldSaveOnQuit (in category 'testing') -----
+ shouldSaveOnQuit
+ "Don't save the home project to avoid confusion. Also, don't save if something was loaded from the XO bundle - this is for Etoys-based Sugar activities (e.g. made using #bundle:)."
+
+ ^Project current ~~ Project home
+ and: [(Smalltalk getSystemAttribute: 2) isEmptyOrNil]!
Item was added:
+ ----- Method: SugarNavigatorBar>>stopButtonAppearance (in category 'event handling') -----
+ stopButtonAppearance
+ "Indicated whether stopping in Sugar will keep or not"
+ | wasStop isStop oldButton |
+ (self isSugar and: [stopButton notNil]) ifTrue: [
+ wasStop := stopButton actionSelector = #stopSqueak.
+ isStop := SugarLauncher current willSaveOnQuit.
+ wasStop = isStop ifFalse: [
+ oldButton := stopButton.
+ stopButton := isStop ifTrue: [self buttonStop] ifFalse: [self buttonQuit].
+ oldButton owner replaceSubmorph: oldButton by: stopButton]].
+
+ !
Item was changed:
----- Method: SugarNavigatorBar>>checkSugarButtons (in category 'initialization') -----
checkSugarButtons
| wasSugar |
(owner hasProperty: #collapsedMode) ifTrue: [^self].
+ wasSugar := paintButton owner submorphs anySatisfy:
+ [:e | e isButton and: [e actionSelector = #chooseObject]].
+ isSugar := SugarLauncher current isRunningInSugar.
- wasSugar := isSugar == true.
- isSugar := SugarLauncher isRunningInSugar.
wasSugar = isSugar ifFalse: [self rebuildButtons].
!
Item was added:
+ ----- Method: SugarLauncher>>willSaveOnQuit (in category 'testing') -----
+ willSaveOnQuit
+
+ ^Preferences sugarAutoSave
+ and: [self shouldSaveOnQuit]!
Item was changed:
----- Method: SugarLauncher>>makeJournalEntryFor:filename:mimetype: (in category 'datastore') -----
makeJournalEntryFor: aProject filename: aFilename mimetype: mimetypeString
+ "If this is a new project (no journal id yet), create a new Journal object, and remember the new id.
+ Otherwise, if this is an auto-save, update the existing Journal entry.
+ But if it is an explicit save, always create a new entry. Which entry we continue to work on depends on the sugarAutoSave preference. If enabled (before 4.1), the new entry is just a checkpoint, the project continues to use the old id/entry, and will be saved again on quit. If disabled (default since 4.1), we switch to the newly created id/entry."
| id |
(id := aProject sugarObjectId)
ifNil: [
id := self createJournalEntryFor: aProject filename: aFilename mimetype: mimetypeString.
aProject sugarObjectId: id.
self monitorJournalEntry: id]
ifNotNil: [
+ (Preferences sugarAutoSave and: [aProject projectParameterAt: #sugarAutoSave ifAbsent: [true]])
- (aProject projectParameterAt: #sugarAutoSave ifAbsent: [true])
ifTrue: [self updateJournalEntry: id for: aProject filename: aFilename mimetype: mimetypeString]
+ ifFalse: [
+ id := self createJournalEntryFor: aProject filename: aFilename mimetype: mimetypeString.
+ Preferences sugarAutoSave ifFalse: [
+ self unmonitorJournalEntry: aProject sugarObjectId.
+ aProject sugarObjectId: id.
+ self monitorJournalEntry: id]]]!
- ifFalse: [self createJournalEntryFor: aProject filename: aFilename mimetype: mimetypeString]]!
Item was changed:
----- Method: SugarNavigatorBar>>makeTheButtons (in category 'initialization') -----
makeTheButtons
^ {
self buttonHelp.
self makeProjectNameLabel.
},
(
Preferences showAdvancedNavigatorButtons
ifTrue: [{self buttonNewProject}]
ifFalse: [#()]
),
{
self buttonPrev.
self buttonNext.
self buttonPaint.
self buttonSupplies.
self buttonLanguage.
},
(SugarLauncher isRunningInSugar
ifTrue: [{
self buttonShare.
#spacer.
self buttonChoose.
self buttonKeep.
+ stopButton := SugarLauncher current willSaveOnQuit
+ ifTrue: [self buttonStop]
+ ifFalse: [self buttonQuit] }]
- self buttonStop.
- }]
ifFalse: [{
self buttonZoom.
#spacer.
self buttonFind.
self buttonPublish.
self buttonQuit}]
),
(Preferences navControlInNavBar
ifTrue: [{self buttonHideNavBar}]
ifFalse: [#()])!
Item was changed:
ProjectNavigationMorph subclass: #SugarNavigatorBar
+ instanceVariableNames: 'sugarLib highLightColor paintButton undoButton shareButton stopButton supplies listener suppliesFlap projectNameField isSugar'
- instanceVariableNames: 'sugarLib highLightColor paintButton undoButton shareButton supplies listener suppliesFlap projectNameField isSugar'
classVariableNames: ''
poolDictionaries: ''
category: 'Sugar'!
Item was changed:
----- Method: SugarLauncher>>propertiesFrom: (in category 'datastore') -----
propertiesFrom: aProject
+ | preview autoSave props markFavorite setActivity |
- | preview autoSave props |
preview := [ByteArray streamContents: [:s | PNGReadWriter
putForm: (aProject thumbnail asFormOfDepth: 16)
onStream: s]] ifError: [''].
autoSave := aProject projectParameterAt: #sugarAutoSave ifAbsent: [true].
+ setActivity := Preferences sugarAutoSave not | autoSave.
+ markFavorite := Preferences sugarAutoSave & autoSave not.
props := (aProject sugarProperties ifNil: [Dictionary new]) copy.
{
'activity' -> self bundleId.
+ 'activity_id' -> (setActivity ifTrue: [self activityId] ifFalse: ['']).
- 'activity_id' -> (autoSave ifTrue: [self activityId] ifFalse: ['']). "temp hack for trial-3"
'title:text' -> (self titleFromProject: aProject) squeakToUtf8.
'title_set_by_user' -> (aProject currentVersionNumber>0 ifTrue: ['1'] ifFalse: ['0']).
+ 'keep' -> (markFavorite ifTrue: ['1'] ifFalse: ['0']).
- 'keep' -> (autoSave ifTrue: ['0'] ifFalse: ['1']).
'mtime' -> (DateAndTime now asString first: 19).
'timestamp' -> (DateAndTime now asUnixTime).
'preview' -> preview.
'icon-color' -> self ownerBuddy colors.
} do: [:each | props add: each].
^props
!
Item was added:
+ ----- Method: SugarLauncher>>unmonitorJournalEntry: (in category 'datastore') -----
+ unmonitorJournalEntry: objectId
+ self dataStore
+ onUpdated: objectId
+ send: nil
+ to: self.!
Item was changed:
----- Method: SugarLauncher classSide>>defaultDatastoreDirName (in category 'utilities') -----
defaultDatastoreDirName
+ ^ '[Journal]'
- ^ '[Projects in Journal]'
!
Item was changed:
----- Method: SugarNavigatorBar>>buttonStop (in category 'buttons creation') -----
buttonStop
+ ^self makeButton: 'stop' balloonText: 'Quit Etoys (with saving)' translated for: #stopSqueak
- ^ self makeButton: 'stop' balloonText: 'Stop and Quit Etoys' translated for: #stopSqueak
!
Item was changed:
----- Method: SugarNavigatorBar>>step (in category 'morphic interaction') -----
step
+ self checkSugarButtons.
self checkForResize.
self undoButtonAppearance.
+ self stopButtonAppearance.!
- !
Item was added:
+ ----- Method: SugarNavigatorBar>>isSugar (in category 'accessing') -----
+ isSugar
+ ^isSugar == true!
Item was changed:
----- Method: SugarNavigatorBar>>keepProject (in category 'the actions') -----
keepProject
+ Preferences sugarAutoSave
+ ifTrue: [SugarLauncher current save]
+ ifFalse: [self publishProject]
+ !
- ^SugarLauncher current save!
Item was added:
+ ----- Method: SugarLauncher classSide>>initialize (in category 'services') -----
+ initialize
+ Preferences
+ addPreference: #sugarAutoSave
+ category: #morphic
+ default: false
+ balloonHelp: 'If enabled, quitting under Sugar will automatically save the current project.'.
+ !
Item was removed:
- ----- Method: SugarLauncher>>shouldAutoSave (in category 'testing') -----
- shouldAutoSave
- "Don't auto-save the home project to avoid confusion. Also, don't auto-save if something was loaded from the XO bundle - this is for Etoys-based Sugar activities (e.g. made using #bundle:)."
-
- ^Project current ~~ Project home
- and: [(Smalltalk getSystemAttribute: 2) isEmptyOrNil]!
More information about the etoys-dev
mailing list