[squeak-dev] The Trunk: EToys-tpr.318.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Jan 8 00:50:26 UTC 2018


tim Rowledge uploaded a new version of EToys to project The Trunk:
http://source.squeak.org/trunk/EToys-tpr.318.mcz

==================== Summary ====================

Name: EToys-tpr.318
Author: tpr
Time: 7 January 2018, 4:50:04.77835 pm
UUID: e54e7a35-2e82-480c-b307-c6493a5d7e3c
Ancestors: EToys-dtl.317

Updates to connect some file loading methods to the new FileDialogs

=============== Diff against EToys-dtl.317 ===============

Item was changed:
  ----- Method: MentoringEventRecorder>>readTape (in category 'fileIn/Out') -----
  readTape
  	"Put up a prompt for reading an event tape; if one is provided, read it."
  
+ 	| fileName |
+ 	fileName := UIManager default chooseFileMatchingSuffixes: #('tape' ) .
+ 	fileName ifNotNil: [self readTapeFrom: (FileStream fileNamed: fileName)]!
- 	| aFileStream |
- 	aFileStream := (FileList2 modalFileSelectorForSuffixes: #('tape' )) .
- 	aFileStream ifNotNil: [self readTapeFrom: aFileStream]!

Item was changed:
  ----- Method: PDA>>loadDatabase (in category 'initialization') -----
  loadDatabase
  	| aName aFileStream list |
+ 	aName := UIManager default chooseFileMatchingSuffixes: #('pda' 'pda.gz' ) label: 'Choose a file to load'.
- 	aName := Utilities chooseFileWithSuffixFromList: #('.pda' '.pda.gz' ) withCaption: 'Choose a file to load'.
  	aName
  		ifNil: [^ self].
+ 
- 	"User made no choice"
- 	aName == #none
- 		ifTrue: [^ self inform: 'Sorry, no suitable files found
- (names should end with .data or .data.gz)'].
  	aFileStream := FileStream oldFileNamed: aName.
  	list := aFileStream fileInObjectAndCode.
  	userCategories := list first.
  	allPeople := list second.
  	allEvents := list third.
  	recurringEvents := list fourth.
  	allToDoItems := list fifth.
  	allNotes := list sixth.
  	date := Date today.
  	self selectCategory: 'all'!

Item was changed:
  ----- Method: PDA>>mergeDatabase (in category 'initialization') -----
  mergeDatabase
  	| aName aFileStream list |
+ 	aName :=  UIManager default chooseFileMatchingSuffixes: #('pda' 'pda.gz' ) label: 'Choose a file to load'.
- 	aName := Utilities chooseFileWithSuffixFromList: #('.pda' '.pda.gz' ) withCaption: 'Choose a file to load'.
  	aName
  		ifNil: [^ self].
- 	"User made no choice"
- 	aName == #none
- 		ifTrue: [^ self inform: 'Sorry, no suitable files found
- (names should end with .data or .data.gz)'].
  	aFileStream := FileStream oldFileNamed: aName.
  	list := aFileStream fileInObjectAndCode.
  	userCategories := (list first , userCategories) asSet asArray sort.
  	allPeople := (list second , allPeople) asSet asArray sort.
  	allEvents := (list third , allEvents) asSet asArray sort.
  	recurringEvents := (list fourth , recurringEvents) asSet asArray sort.
  	allToDoItems := (list fifth , allToDoItems) asSet asArray sort.
  	allNotes := ((list sixth)
  				, allNotes) asSet asArray sort.
  	date := Date today.
  	self selectCategory: 'all'!

Item was changed:
  ----- Method: SoundLibraryTool>>loadSoundFromDisk (in category 'menu') -----
  loadSoundFromDisk
  	"Put up a file chooser dialog inviting the user to import a sound file; accept it"
  
  	| aSound aName aFileStream fullName ext reply |
+ 	fullName := UIManager default chooseFileMatchingSuffixes: #(#AIFF #aiff #Wave #wav #wave ).
+ 	fullName
- 	aFileStream := FileList2 modalFileSelectorForSuffixes: #(#AIFF #aiff #Wave #wav #wave ).
- 	aFileStream
  		ifNil: [^ self].
+ 
- 	fullName := aFileStream name.
  	('*.AIFF' match: fullName)
  		ifTrue: [aSound := SampledSound fromAIFFfileNamed: fullName]
+ 		ifFalse: [aSound := SampledSound fromWaveStream: (aFileStream := FileStream oldFileNamed: fullName).
+ 			aFileStream close].
+ 
- 		ifFalse: [aSound := SampledSound fromWaveStream: aFileStream].
- 	aFileStream close.
  	ext := FileDirectory extensionFor: fullName.
+ 	aName :=  FileDirectory localNameFor: fullName.
- 	aName :=  (FileDirectory on: fullName) pathParts last.
  	ext size > 0 ifTrue:
  		[aName := aName copyFrom: 1 to: (aName size - (ext size + 1))].
  	
  	[reply := FillInTheBlank request: 'Please give a name for this sound' translated initialAnswer: aName.
  	reply isEmptyOrNil ifTrue: [^ self].
  	(SampledSound soundLibrary includesKey:  reply)
  		ifTrue:
  			[self inform: 'sorry, that name is already taken' translated.
  			false]
  		ifFalse:
  			[true]] whileFalse.
  	SampledSound addLibrarySoundNamed: reply samples: aSound samples samplingRate: aSound originalSamplingRate.
  	self update!



More information about the Squeak-dev mailing list