The Trunk: Tools-tpr.777.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Tools-tpr.777.mcz

commits-2
tim Rowledge uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-tpr.777.mcz

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

Name: Tools-tpr.777
Author: tpr
Time: 27 November 2017, 4:03:09.56613 pm
UUID: 71e5c1c3-35d0-4c3d-bbe2-83174f32e145
Ancestors: Tools-dtl.776

Add a directory chooser tool.
Some improvements to FileSaverDIalogs

=============== Diff against Tools-dtl.776 ===============

Item was added:
+ FileAbstractSelectionDialog subclass: #DirectoryChooserDialog
+ instanceVariableNames: ''
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'Tools-FileDialogs'!

Item was added:
+ ----- Method: DirectoryChooserDialog>>buildWith: (in category 'toolbuilder') -----
+ buildWith: builder
+ "assemble the spec for the chooser dialog UI"
+
+ | windowSpec window |
+ windowSpec := self buildWindowWith: builder specs: {
+ (self frameOffsetFromTop: 0
+ fromLeft: 0
+ width: 1
+ offsetFromBottom: self buttonHeight) -> [self buildDirectoryTreeWith: builder].
+ }.
+ windowSpec buttons add:( builder pluggableButtonSpec new
+ model: self;
+ label: 'Accept';
+ action: #acceptFileName).
+ windowSpec buttons add:( builder pluggableButtonSpec new
+ model: self;
+ label: 'Cancel';
+ action: #cancelFileChooser).
+ window := builder build: windowSpec.
+ self changed: #selectedPath.
+ ^window
+ !

Item was added:
+ ----- Method: DirectoryChooserDialog>>finalChoice (in category 'ui details') -----
+ finalChoice
+ "return the chosen directory that was saved by an accept click or nil; client must check for validity"
+
+ ^self directory fullName!

Item was added:
+ ----- Method: DirectoryChooserDialog>>userMessage (in category 'ui details') -----
+ userMessage
+ "return the string to present to the user  in order to explain the purpose of this dialog appearing"
+
+ ^message ifNil:['Choose a directory name']!

Item was added:
+ ----- Method: FileChooserDialog class>>openOnSuffixList:label: (in category 'instance creation') -----
+ openOnSuffixList: patternList label: messageString
+ "open a modal dialog to choose a file. Start the dialog with aDirectory selected and files matching the default 'everything' pattern"
+
+ ^self new
+ suffixList: patternList;
+ message: messageString;
+ getUserResponse!

Item was added:
+ ----- Method: FileSaverDialog class>>openOnInitialFilename:label: (in category 'instance creation') -----
+ openOnInitialFilename: filenameString label: labelString
+ "open a modal dialog to save a file. Start the dialog with the default directory selected and the suggested file name, set the user message to labelString"
+
+
+ ^self new
+ initialFilename: filenameString;
+ message: labelString;
+ getUserResponse
+
+ !

Item was changed:
  ----- Method: FileSaverDialog>>initialFilename: (in category 'initialize-release') -----
+ initialFilename: aFilenameOrNil
- initialFilename: aFilename
  "Set the initial choice of filename to highlight.
  We split the potential filename to see if it includes a path and if so, use that as the chosen directory - the client can manually change that with a subsequent send of #directory: if wanted.
  We split the root filename to find an extension and use that as the suffix - again, the client can manually change that later"
 
  | e f p |
+ aFilenameOrNil ifNil:[^self].
+
+ p := FileDirectory dirPathFor: aFilenameOrNil.
- p := FileDirectory dirPathFor: aFilename.
  p isEmpty ifFalse:[self directory: (FileDirectory on: p)].
+ f := FileDirectory localNameFor: aFilenameOrNil.
- f := FileDirectory localNameFor: aFilename.
  fileName := f.
  e := FileDirectory extensionFor: f.
  e isEmpty ifFalse:[self suffix: e]!