The Inbox: Tools-dtl.782.mcz

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

The Inbox: Tools-dtl.782.mcz

commits-2
David T. Lewis uploaded a new version of Tools to project The Inbox:
http://source.squeak.org/inbox/Tools-dtl.782.mcz

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

Name: Tools-dtl.782
Author: dtl
Time: 21 December 2017, 10:51:28.91189 pm
UUID: fcb991de-fc3c-4cdc-9cf2-a2aa3f961a2a
Ancestors: Tools-tpr.781

Make instance creation methods more uniform for FileChooserDialog andFileSaverDialog, and update class comments accordingly.

=============== Diff against Tools-tpr.781 ===============

Item was changed:
  ----- Method: DirectoryChooserDialog class>>openOn:label: (in category 'instance creation') -----
  openOn: aDirectory label: labelString
  "open a directory chooser starting with aDirectory"
 
+ "DirectoryChooserDialog openOn: FileDirectory default label: 'Choose the directory to use' "
+
  ^DirectoryChooserDialog new
  directory: aDirectory;
  message: labelString;
  getUserResponse!

Item was changed:
  FileAbstractSelectionDialog subclass: #FileChooserDialog
  instanceVariableNames: ''
  classVariableNames: ''
  poolDictionaries: ''
  category: 'Tools-FileDialogs'!
 
+ !FileChooserDialog commentStamp: 'dtl 12/21/2017 22:18' prior: 0!
- !FileChooserDialog commentStamp: 'tpr 11/21/2017 18:02' prior: 0!
  A FileChooserDialog is a modal dialog to allow choosing a file. The full file name is returned, or nil if no selection was made.
 
  Normal usage would be
+ myFilename := FileChooserDialog openOn: myApplicationDefaultDirectory pattern: '*.myapp' label: 'Choose the file to load'
- myFilename := FileChooserDialog openOn: myApplicationDefaultDirectory pattern: '*.myapp' message: 'Choose the file to load'
  to find a file with a name matching *.myapp and with the directory initial choice set to myApplicationDefaultDirectory.  Only filenames matching the pattern will appear in the file list view.
  !

Item was changed:
  ----- Method: FileChooserDialog class>>openOn: (in category 'instance creation') -----
  openOn: aDirectory
+ "Open a modal dialog to choose a file. Start the dialog with aDirectory selected
+ and files matching the default 'everything' pattern"
- "open a modal dialog to choose a file. Start the dialog with aDirectory selected and files matching the default 'everything' pattern"
 
+ "FileChooserDialog openOn: FileDirectory default"
+
+ ^self openOn: aDirectory pattern: nil label: nil
+ !
- ^self new directory: aDirectory;
- getUserResponse!

Item was added:
+ ----- Method: FileChooserDialog class>>openOn:pattern:label: (in category 'instance creation') -----
+ openOn: aDirectory pattern: matchString label: labelString
+ "Open a modal dialog to choose a file. Start the dialog with aDirectory selected
+ and files matching the matchString pattern. Set the user message to labelString."
+
+ "FileChooserDialog openOn: FileDirectory default pattern: '*.changes' label: 'Do something with the selected files' "
+
+ ^self new
+ directory: aDirectory;
+ pattern: matchString;
+ message: labelString;
+ getUserResponse!

Item was added:
+ ----- Method: FileChooserDialog class>>openOn:suffixList:label: (in category 'instance creation') -----
+ openOn: aDirectory suffixList: patternList label: labelString
+ "Open a modal dialog to choose a file. Start the dialog with aDirectory selected
+ and files matching the file name suffixes in patternList. Set the user message
+ to labelString."
+
+ "FileChooserDialog openOn: FileDirectory default suffixList: { '*.changes' . '*image' } label: 'Do something with the selected files' "
+
+ ^self new
+ directory: aDirectory;
+ suffixList: patternList;
+ message: labelString;
+ getUserResponse!

Item was changed:
  ----- Method: FileChooserDialog class>>openOnPattern:label: (in category 'instance creation') -----
+ openOnPattern: matchString label: labelString
+ "Open a modal dialog to choose a file. Start the dialog with a default directory
+ selected and with files matching the default 'everything' pattern  Set the user
+ message to labelString"
- openOnPattern: patternList label: messageString
- "open a modal dialog to choose a file. Start the dialog with aDirectory selected and files matching the default 'everything' pattern"
 
+ "FileChooserDialog openOnPattern: '*.changes' label: 'Do something with the selected files' "
+
+ ^self openOn: nil pattern: matchString label: labelString
+ !
- ^self new
- pattern: patternList;
- message: messageString;
- getUserResponse!

Item was changed:
  ----- Method: FileChooserDialog class>>openOnSuffixList:label: (in category 'instance creation') -----
+ openOnSuffixList: patternList label: labelString
+ "Open a modal dialog to choose a file. Start the dialog with a default directory
+ selected and with files matching the file name suffixes in patternList. Set the
+ user message to labelString."
- 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"
 
+ "FileChooserDialog openOnSuffixList: { '*.changes' . '*image' } label: 'Do something with the selected files' "
+
+ ^self openOn: nil suffixList: patternList label: labelString
+ !
- ^self new
- suffixList: patternList;
- message: messageString;
- getUserResponse!

Item was changed:
  FileAbstractSelectionDialog subclass: #FileSaverDialog
  instanceVariableNames: ''
  classVariableNames: ''
  poolDictionaries: ''
  category: 'Tools-FileDialogs'!
 
+ !FileSaverDialog commentStamp: 'dtl 12/21/2017 22:47' prior: 0!
- !FileSaverDialog commentStamp: 'tpr 11/21/2017 17:53' prior: 0!
  A FileSaverDialog is a modal dialog for choosing a file name to use for saving a file.
 
  Users can enter a filename in the text input view that will
  a) if it exists in the current directry listing, be selected
  b) over ride any filenames in the current directory, providing a way to specify a completely new file.
  This will not affect the selected directory path.
 
  Normal usage would be
  myFilename := FileSaverDialog openOnInitialFilename: myApp saveFileName
  which would derive a directory, an initial filename and filename suffix from the given file name. Thus a typical application save might be
  ...  openOnInitialFilename: '/home/pi/myApp/examplePicture.jpg'
  and would set the initial directory to /home/pi/myapp, the initial filename to examplePicture.jpg and set a suffix pattern of 'jpg'. Only filenames with the specified suffix will appear in the file list view. It is possible to specify several suffices, (see #suffixList:) and use wildcards within the suffix.
 
  myFilename := FileSaverDialog openOn: myApplicationDefaultDirectory initialFilename: 'foo.myapp'
  would set directory initial choice set to myApplicationDefaultDirectory and ignore any directory found in the filename. It would be quite possible to choose a file from any other directory and with any other name  that matches the suffix if the user wishes, so the file name must be carefully checked.
 
  The full set of options would involve
  myFilename := FileSaverDialog  openOn: myApplicationDefaultDirectory initialFilename: 'foo.myapp' suffix: 'mya' message: 'Save your myApp file to ... '
 
+ It is also possible to set a more general pattern to match filenames against but since this seems less useful for normal application usage there are no convenience messages as yet.
- It is also possible to set a more general pattern to match filenames against but since this seems less useful for normal application usage ther are no convenience messages as yet.
 
  See the class side methods for details. See my parent class for most implementation details!

Item was changed:
  ----- Method: FileSaverDialog class>>openOn: (in category 'instance creation') -----
  openOn: aDirectory
+ "open a modal dialog to save a file. Start the dialog with aDirectory selected
+ and no suggested file name"
- "open a modal dialog to save a file. Start the dialog with aDirectory selected and no suggested file name"
 
+ "FileSaverDialog openOn: FileDirectory default"
- ^self new directory: aDirectory;
- getUserResponse
 
+ ^self openOn: aDirectory initialFilename: nil label: nil
  !

Item was changed:
  ----- Method: FileSaverDialog class>>openOn:initialFilename: (in category 'instance creation') -----
  openOn: aDirectory initialFilename: aString
+ "Open a modal dialog to save a file. Start the dialog with aDirectory selected
+ and aString as the suggested file name. Note that we set the directory after
+ the initialFilename becuase we want a specific directory and not neccesarily
+ the directory of the file."
- "open a modal dialog to save a file. Start the dialog with aDirectory selected and the suggested file name. Note that we set the directory after the initialFilename becuase we want a specific directory and not neccesarily the directory of the file"
 
+ "FileSaverDialog openOn: FileDirectory default initialFilename: 'aSuggestedFileName' "
- ^self new
- initialFilename: aString;
- directory: aDirectory;
- getUserResponse
 
+ ^self openOn: aDirectory initialFilename: aString label: nil
+ !
- !

Item was added:
+ ----- Method: FileSaverDialog class>>openOn:initialFilename:label: (in category 'instance creation') -----
+ openOn: aDirectory initialFilename: aString label: labelString
+ "Open a modal dialog to save a file. Start the dialog with aDirectory selected
+ and aString as the suggested file name. Set the user message to labelString.
+ Note that we set the directory after the initialFilename becuase we want a
+ specific directory and not neccesarily the directory of the file"
+
+ "FileSaverDialog openOn: FileDirectory default initialFilename: 'aSuggestedFileName' label: 'Select a flie and do something with it' "
+
+ ^self new
+ initialFilename: aString;
+ directory: aDirectory;
+ message: labelString;
+ getUserResponse
+
+ !

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

Item was changed:
  ----- 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"
- "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"
 
+ "FileSaverDialog openOnInitialFilename: 'aSuggestedFileName' label: 'Select a flie and do something with it' "
-
- ^self new
- initialFilename: filenameString;
- message: labelString;
- getUserResponse
 
+ ^self openOn: nil initialFilename: filenameString label: labelString
+ !
- !