tim Rowledge uploaded a new version of EToys to project The Trunk:
http://source.squeak.org/trunk/EToys-tpr.322.mcz ==================== Summary ==================== Name: EToys-tpr.322 Author: tpr Time: 22 March 2018, 5:06:55.965192 pm UUID: b4b7d324-3922-4202-bf26-bb9e9bb17879 Ancestors: EToys-tpr.321, EToys-topa.321 Change CrosticPanel & FileInput to use the new file dialogues instead of the nasty old StandardFileMenu. Moved to trunk since no complaints of problems were made wrt the inbox version =============== Diff against EToys-topa.321 =============== Item was changed: ----- Method: CrosticPanel>>openFile (in category 'menu') ----- openFile + | fileName crostic file | + + fileName := FileChooserDialog openOn: FileDirectory default suffixList: { 'crostic' } label: 'Select a Crostic file...' translated. + fileName ifNil: [^nil]. + + file := FileStream readOnlyFileNamed: fileName. - | stdFileMenuResult crostic file | - stdFileMenuResult := (StandardFileMenu new pattern: '*.crostic'; - oldFileFrom: FileDirectory default) startUpWithCaption: 'Select a Crostic File...' translated. - stdFileMenuResult - ifNil: [^ nil]. - file := stdFileMenuResult directory readOnlyFileNamed: stdFileMenuResult name. crostic := CrosticPanel newFromFile: file. file close. (self isClean or: [self confirm: 'Is it OK to discard this crostic?' translated]) ifTrue: [self world addMorphFront: (crostic position: self position). self delete] ifFalse: [self world addMorphFront: crostic]! Item was changed: ----- Method: FileInput>>browse (in category 'accessing') ----- browse + | fileName | + fileName := (FileChooserDialog openOn: self directory) ifNil: [^nil]. - | file | - file := (StandardFileMenu oldFileFrom: self directory) ifNil: [^nil]. - file directory isNil ifTrue: [^ nil]. + textMorph setText: fileName; - textMorph setText: (file directory pathName, FileDirectory slash, file name); hasUnacceptedEdits: true; accept! Item was changed: ----- Method: StackMorph>>addCardsFromAFile (in category 'background') ----- addCardsFromAFile "Using the current background, create new cards by reading in data from a fileThe data are in each record are expected to be tab-delimited, and to occur in the same order as the instance variables of the current-background's cards " + | fileName | + fileName := FileChooserDialog openOn: FileDirectory default. + fileName ifNil:[^Beeper beep]. + FileStream oldFileNamed: fileName do:[:fs| + self addCardsFromFile: fs].! - | aFileStream | - (aFileStream := FileList2 modalFileSelector) ifNil: [^ Beeper beep]. - self addCardsFromString: aFileStream contentsOfEntireFile. - aFileStream close! Item was changed: ----- Method: SugarNavigatorBar>>loadASexp (in category 'button actions') ----- loadASexp + | fileName siss sexp | + fileName := FileChooserDialog openOnSuffixList: {'sexp'} label: nil. + fileName ifNil: [^ self]. + FileStream + oldFileNamed: fileName + do: [:file | + file binary. + siss := file contents. + sexp := [(DataStream on: (file reset; yourself)) next] + on: Error + do: [:e | (Smalltalk at: #MSExpParser) + parse: siss + with: #ksexp]]. + sexp sissReadObjectsAsEtoysProject submorphs do: #openInWorld! - | file siss sexp | - file := FileList2 modalFileSelectorForSuffixes: #('sexp'). - file ifNil: [^ self]. - file binary. - siss := file contents. - sexp := [(DataStream on: (file reset; yourself)) next] on: Error do: [:e | - (Smalltalk at: #MSExpParser) parse: siss with: #ksexp]. - sexp sissReadObjectsAsEtoysProject submorphs do: #openInWorld. - ! |
Free forum by Nabble | Edit this page |