The Trunk: Tools-tpr.782.mcz

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

The Trunk: Tools-tpr.782.mcz

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

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

Name: Tools-tpr.782
Author: tpr
Time: 24 December 2017, 5:51:10.642614 pm
UUID: efa7a664-f28d-48b3-b2ca-db3519dd633a
Ancestors: Tools-tpr.781

Updates for file dialog stuff
Make DirectroyChooserDialog
a) return a Directory
b) return nil
 - as appropriate
Adopt most of dtl's suggested changes

=============== 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' "
+
+ ^super new
- ^DirectoryChooserDialog new
  directory: aDirectory;
  message: labelString;
  getUserResponse!

Item was added:
+ ----- Method: DirectoryChooserDialog>>acceptFileName (in category 'initialize-release') -----
+ acceptFileName
+ "User clicked to accept the current state so save the directory and close the dialog"
+
+ finalChoice := directory.
+ self changed: #close!

Item was changed:
  ----- 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"
 
+ ^ finalChoice
+ ifNotNil: [self directory]!
- ^self directory fullName!

Item was changed:
  ----- Method: FileAbstractSelectionDialog>>cancelFileChooser (in category 'initialize-release') -----
  cancelFileChooser
  "User clicked to cancel the current state so nil the filename and close the dialog"
 
+ directory := finalChoice := fileName := nil.
- fileName := nil.
  self changed: #close.!

Item was changed:
  ----- Method: FileAbstractSelectionDialog>>finalChoice (in category 'initialize-release') -----
  finalChoice
  "return the chosen directory/filename that was saved by an accept click or nil; client must check for validity"
+ ^ finalChoice
+ ifNotNil: [self directory fullNameFor: finalChoice]!
-
- ^self directory fullNameFor: finalChoice!

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
+ !
- !


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Tools-tpr.782.mcz

timrowledge

> On 24-12-2017, at 5:51 PM, [hidden email] wrote:
>
> tim Rowledge uploaded a new version of Tools to project The Trunk:
> http://source.squeak.org/trunk/Tools-tpr.782.mcz

… and the corresponding changes to make use of them - a constantly growing list of places as I uncover the myriad ways people have used to find a file over the past 25 years  - has been updated on http://wiki.squeak.org/squeak/2758

I haven’t even started on usages of StandardFileMenu yet!

tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Is reading in the bathroom considered Multi-Tasking?



Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Tools-tpr.782.mcz

marcel.taeumel
Hey Tim,

thank you for your efforts! :-) Consolidation of historical experiments and increased consistency through re-use is a huge improvement to Squeak's code base.

Best,
Marcel
________________________________________
From: Squeak-dev <[hidden email]> on behalf of tim Rowledge <[hidden email]>
Sent: Monday, December 25, 2017 2:57 AM
To: [hidden email]
Subject: Re: [squeak-dev] The Trunk: Tools-tpr.782.mcz

> On 24-12-2017, at 5:51 PM, [hidden email] wrote:
>
> tim Rowledge uploaded a new version of Tools to project The Trunk:
> http://source.squeak.org/trunk/Tools-tpr.782.mcz

… and the corresponding changes to make use of them - a constantly growing list of places as I uncover the myriad ways people have used to find a file over the past 25 years  - has been updated on http://wiki.squeak.org/squeak/2758

I haven’t even started on usages of StandardFileMenu yet!

tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Is reading in the bathroom considered Multi-Tasking?




Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Tools-tpr.782.mcz

timrowledge

> On 28-12-2017, at 1:01 AM, Taeumel, Marcel <[hidden email]> wrote:
>
> Hey Tim,
>
> thank you for your efforts! :-) Consolidation of historical experiments and increased consistency through re-use is a huge improvement to Squeak's code base.

I like to think so. I’m gradually building up my nerve to start pushing out some of the usages. I’m pretty sure some will ‘have issues’ but that’s always the way.

tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Strange OpCodes: CSF: Charge to NSF



Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Tools-tpr.782.mcz

timrowledge
In reply to this post by timrowledge
As promised I’ve pushed out the changes to start making use of the new file dialogs.

Give them a try and let us know about problems…

tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
A conscience is what hurts when all your other parts feel so good.



Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Tools-tpr.782.mcz

David T. Lewis
On Thu, Dec 28, 2017 at 01:29:55PM -0800, tim Rowledge wrote:

> As promised I???ve pushed out the changes to start making use of the new file dialogs.
>
> Give them a try and let us know about problems???
>
> tim
> --
> tim Rowledge; [hidden email]; http://www.rowledge.org/tim
> A conscience is what hurts when all your other parts feel so good.
>
>
>

No problems so far, and the new dialogs are a real improvement.

One of these days we'll have to get around to implementing MVCToolBuilder>>buildPluggableMultiColumnList:
so we can run tools like this in MVC too :-)

Dave