FileChooser/SaverDialog

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

Re: More pluggable dialog fun (was Re: FileChooser/SaverDialog)

timrowledge

On 05-11-2017, at 3:57 AM, Marcel Taeumel <[hidden email]> wrote:
Last year, I worked on UI themes and hence touched the sources of all relevant widgets. In the course of understanding and changing the existing implementations, I took the opportunity to clean-up and simplify things.

Always a good thing to do, and mostly it worked pretty well.

The biggest construction sites included windows, menus, buttons, and dialogs. The biggest clean-up was a consistent use of the #setDefaultParameters-pattern, which has been there for a long time.

Just goes to show how complex a lot of this has become - I haven’t even noticed that in all the spelunking I’ve been doing on this.


Until then, Squeak has had three kinds of dialogs: FillInTheBlankMorph, UserDialogBoxMorph, and SystemWindows that where "modal children" of other system windows. I merged the first two kinds and harmonized their visual appearance.

That works well as a concept. I like the ‘fairly generic’ dialogue idea with optional bits that make it simple to build specific dialogues as needed. Where I am seeing problems is with some less common aspects that ought to work.

For example, the panemorph is used as if it were a panel morph that can swap out its contents as part of an update message, but clearly it isn’t actually working very well. The BorderedMorph is initially set up to have resize handles, which kinda-sorta works as a UI thing except that some other part of the dialog structure prevents the window from shrinking, even if you try to shrink it back after stretching. Similarly if the BorderedMorph gets re-childed by the update it loses the resize handles which is sub-optimal. And something about the layout related settings prevents adding child morphs in a way that is consistent with typical usage.
We’re also not really taking advantage of some stuff in the dialogwindow class, in that buttons get ‘manually’ added even though there is a somewhat nicer way to add them; this is largely something that could be improved in the toolbuilder code I think.


I largely ignored system windows that where effectively treated as dialogs, which is (1) modal ownership and sometimes (2) modally exclusive user input. Two common candidates of these are the font-chooser dialog and the file/folder-chooser dialog:

As you can see, a conversion to a visual dialog-like appearance might entail some changes in DialogWindow and PluggableDialogWindow(Spec). Yet, I think there are still (1) title, (2) description, (3) opt. resizable content, and (4) a button bar --- like in all other dialogs.

I think that font/style choosing and file load/save dialogues should exists and be modal and in the general style of the simpler dialogues, which is why I’ve been making the new file load/save dialog things using the dialogwindow class(es). There is also a place for non-modal equivalents of some of those sorts of dialog - I suppose at that point they should be called something else - as tools that can be kept open to affect fonts/styles/colours/etc or even embedded in some bigger context as part of a tool (photoSqueakShop, anyone?).


One could even think of making those modally exclusive ... but the need for copying necessary information from another morph to fulfill the dialogs request is too common.

Sorry, don’t understand what you mean there.


Why do I write this? A dialog is no regular window because:
1. It poses a single request and therefore looks different.
2. It is modal in a sense that it can (a) belong to a window/dialog and (b) interrupt a complex job with user input and (c) closing it means aborting a job not just closing a view on objects.
3. It has a programming interface that is more like "request" and not like "open/show”.

I mostly agree here. I suspect that there is some terminology confusion in that dialog and modal window get mixed quite thoroughly in many contexts. Simple requests for a string or simple choice from a few buttons and so on are pretty clearly candidates for a ModalDialogWidget but a modal doohickey for choosing a place to save a snapshot shares many aspects even though it will be a much more complex UI. 

Maybe we can find a nice refactoring that helps us to encompass the full range. I initially tried working with the PluggableDialogWindow stuff because it looked like a reasonably clean approach through ToolBuilder and perhaps that wasn’t the best way. 


Consequently, file/folder choosers and font choosers should be real dialogs: code-wise and graphics-wise:

a) That’s pretty much what I’m aiming for
b) I’d say that dialogues - as in widgets opened modally from some other UI that must be used or closed before it can proceed - ought not have the window title stuff, to avoid confusion. They’re not regular windows, let’s not have them look like regular windows.
c) we should make them open in a sensible place more often; we can put them anywhere so let’s make it easy to put them where the user’s attention lies. The prime example of bad placing is the save/quit confirmation dialog.


Simple user requests don't need interactive content. Some might not have a description but only that content. Some might only have a title and the buttons. The message of title / description is debatable. I think that titles should be more generic like "Choose file" and descriptions should be more context specific to explain what kind of file is required. So that titles can be one-lines and descriptions be multi-liners.

This is all true but doesn’t really need to affect the outer layers. The addition of lists to a simple 
[a bit of text]
[buttonA] [buttonB]
doesn’t require a completely different class. 

If we had it arranged 
[optional title text]
[optional inner ui]
[row of buttons]
then I think we’d be covered for pretty much everything. After all the only essential part of a dialog type UI is at least one button!

And you’re dead right about the need for a proper drop-down menu for implementors/senders type usage. It would, in combination with the Browser button bar, allow for much better factoring of those huge menus I was complaining about.

So now the only major question is what we want to do and who can take part in doing it?

tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
A computer scientist is someone who fixes things that aren't broken.




Reply | Threaded
Open this post in threaded view
|

Re: More pluggable dialog fun (was Re: FileChooser/SaverDialog)

marcel.taeumel
If a dialog asks you for a URL and that thing is in a workspace window nearby, it should be possible to copy that to the clipboard w/o having to close the dialog. Modally exclusive dialogs wouldn't allow that.

You do not have to use the tool builder to construct your save dialog. Actually, I suggest not to use tool builder for know until you know what you want. Just put it in a subclass of DialogWindow.

Best,
Marcel

Am 05.11.2017 19:31:44 schrieb tim Rowledge <[hidden email]>:


On 05-11-2017, at 3:57 AM, Marcel Taeumel <[hidden email]> wrote:
Last year, I worked on UI themes and hence touched the sources of all relevant widgets. In the course of understanding and changing the existing implementations, I took the opportunity to clean-up and simplify things.

Always a good thing to do, and mostly it worked pretty well.

The biggest construction sites included windows, menus, buttons, and dialogs. The biggest clean-up was a consistent use of the #setDefaultParameters-pattern, which has been there for a long time.

Just goes to show how complex a lot of this has become - I haven’t even noticed that in all the spelunking I’ve been doing on this.


Until then, Squeak has had three kinds of dialogs: FillInTheBlankMorph, UserDialogBoxMorph, and SystemWindows that where "modal children" of other system windows. I merged the first two kinds and harmonized their visual appearance.

That works well as a concept. I like the ‘fairly generic’ dialogue idea with optional bits that make it simple to build specific dialogues as needed. Where I am seeing problems is with some less common aspects that ought to work.

For example, the panemorph is used as if it were a panel morph that can swap out its contents as part of an update message, but clearly it isn’t actually working very well. The BorderedMorph is initially set up to have resize handles, which kinda-sorta works as a UI thing except that some other part of the dialog structure prevents the window from shrinking, even if you try to shrink it back after stretching. Similarly if the BorderedMorph gets re-childed by the update it loses the resize handles which is sub-optimal. And something about the layout related settings prevents adding child morphs in a way that is consistent with typical usage.
We’re also not really taking advantage of some stuff in the dialogwindow class, in that buttons get ‘manually’ added even though there is a somewhat nicer way to add them; this is largely something that could be improved in the toolbuilder code I think.


I largely ignored system windows that where effectively treated as dialogs, which is (1) modal ownership and sometimes (2) modally exclusive user input. Two common candidates of these are the font-chooser dialog and the file/folder-chooser dialog:

As you can see, a conversion to a visual dialog-like appearance might entail some changes in DialogWindow and PluggableDialogWindow(Spec). Yet, I think there are still (1) title, (2) description, (3) opt. resizable content, and (4) a button bar --- like in all other dialogs.

I think that font/style choosing and file load/save dialogues should exists and be modal and in the general style of the simpler dialogues, which is why I’ve been making the new file load/save dialog things using the dialogwindow class(es). There is also a place for non-modal equivalents of some of those sorts of dialog - I suppose at that point they should be called something else - as tools that can be kept open to affect fonts/styles/colours/etc or even embedded in some bigger context as part of a tool (photoSqueakShop, anyone?).


One could even think of making those modally exclusive ... but the need for copying necessary information from another morph to fulfill the dialogs request is too common.

Sorry, don’t understand what you mean there.


Why do I write this? A dialog is no regular window because:
1. It poses a single request and therefore looks different.
2. It is modal in a sense that it can (a) belong to a window/dialog and (b) interrupt a complex job with user input and (c) closing it means aborting a job not just closing a view on objects.
3. It has a programming interface that is more like "request" and not like "open/show”.

I mostly agree here. I suspect that there is some terminology confusion in that dialog and modal window get mixed quite thoroughly in many contexts. Simple requests for a string or simple choice from a few buttons and so on are pretty clearly candidates for a ModalDialogWidget but a modal doohickey for choosing a place to save a snapshot shares many aspects even though it will be a much more complex UI. 

Maybe we can find a nice refactoring that helps us to encompass the full range. I initially tried working with the PluggableDialogWindow stuff because it looked like a reasonably clean approach through ToolBuilder and perhaps that wasn’t the best way. 


Consequently, file/folder choosers and font choosers should be real dialogs: code-wise and graphics-wise:

a) That’s pretty much what I’m aiming for
b) I’d say that dialogues - as in widgets opened modally from some other UI that must be used or closed before it can proceed - ought not have the window title stuff, to avoid confusion. They’re not regular windows, let’s not have them look like regular windows.
c) we should make them open in a sensible place more often; we can put them anywhere so let’s make it easy to put them where the user’s attention lies. The prime example of bad placing is the save/quit confirmation dialog.


Simple user requests don't need interactive content. Some might not have a description but only that content. Some might only have a title and the buttons. The message of title / description is debatable. I think that titles should be more generic like "Choose file" and descriptions should be more context specific to explain what kind of file is required. So that titles can be one-lines and descriptions be multi-liners.

This is all true but doesn’t really need to affect the outer layers. The addition of lists to a simple 
[a bit of text]
[buttonA] [buttonB]
doesn’t require a completely different class. 

If we had it arranged 
[optional title text]
[optional inner ui]
[row of buttons]
then I think we’d be covered for pretty much everything. After all the only essential part of a dialog type UI is at least one button!

And you’re dead right about the need for a proper drop-down menu for implementors/senders type usage. It would, in combination with the Browser button bar, allow for much better factoring of those huge menus I was complaining about.

So now the only major question is what we want to do and who can take part in doing it?

tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
A computer scientist is someone who fixes things that aren't broken.




Reply | Threaded
Open this post in threaded view
|

Re: More pluggable dialog fun (was Re: FileChooser/SaverDialog)

timrowledge

> On 06-11-2017, at 12:12 AM, Marcel Taeumel <[hidden email]> wrote:
>
> If a dialog asks you for a URL and that thing is in a workspace window nearby, it should be possible to copy that to the clipboard w/o having to close the dialog. Modally exclusive dialogs wouldn't allow that.

I think that argues for a different level of modal, one based on the originating window/application, and yes it would be very useful. How could we do that?

Could it be as simple as locking the originating window so it gets no events passed to it? A quick test by inspecting a random browser and locking it suggests it might be a good starting point. Obviously that won’t be enough if there are several windows involved but I guess if you are making an application like that you will probably be tracking multiple windows anyway and have some idea of what to do.
I wonder if system modal widgets might be done by locking the top pasteupmorph… ehh, probably it would interfere with the dialog getting any events unless we did something drastic like adding a new top layer morph blahblahblah. I can certainly lock the World, wait 5 secs and unlock it, so maybe there is a way.

>
> You do not have to use the tool builder to construct your save dialog. Actually, I suggest not to use tool builder for know until you know what you want. Just put it in a subclass of DialogWindow.

Oh, I know, but I actually thought that what I wanted was so simple and obvious that it should be easy. Hopefully it will be easy sometime soon.

tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Oxymorons: Legally drunk



Reply | Threaded
Open this post in threaded view
|

Re: More pluggable dialog fun (was Re: FileChooser/SaverDialog)

Hannes Hirzel
In reply to this post by Bob Arning-2
On 11/5/17, Bob Arning <[hidden email]> wrote:
> My hunch is that one major way things are made simple and intelligible
> is by limiting the choices available.

+1

This is the aim of ToolBuilder.

>Increasing the choices available
> probably probably comes at the expense of simplicity. I can look in the
> image and see what the things ToolBuilder is currently doing reasonably
> well,

+1


> but I get no sense of how far it was intended to go. Is it for
> building tools? What is a tool? Is a fileChooser a tool? Is a
> spreadsheet a tool? How about Photoshop? Seems like you draw a line
> somewhere and say things on the left belong to TB and things on the
> right are done another way. OR, you say the goal of TB is to manage the
> creation of every pixel on the screen. I'm wondering if your fileChooser
> is perhaps to the right of a plausibly drawn line. Hard to answer that
> without knowing what the fileChooser ends up being.


> One approach would
> be to get it working to your satisfaction in Morphic and then ask the
> question of how much TB would need to change to take over the job. Make
> it work then make it right, ya know?

Yes. A useful (intermediate only?) goal is to get a reworked and
configurable FileChooser/SaverDialog dialog and have duplication of
code removed (FileList2). Not necessarily done with ToolBuilder [1].


--Hannes


[1] ToolBuilder http://wiki.squeak.org/squeak/5607

> On 11/4/17 7:44 PM, tim Rowledge wrote:

>> A bit closer, yeah, but it’s just plain wrong that we need to add a panel
>> inside a morph that is supposed to be a sorta-panel. I mean, yes, make it
>> work and all but a tool intended to be a major part of the system ought to
>> make this stuff simple and intelligible.
>
>

Reply | Threaded
Open this post in threaded view
|

Re: More pluggable dialog fun (was Re: FileChooser/SaverDialog)

marcel.taeumel
In reply to this post by timrowledge
For now, you can "un-modal" every modal dialog via the menu in the upper right corner. Should work for the careful user. :-)

Best,
Marcel

Am 06.11.2017 18:45:52 schrieb tim Rowledge <[hidden email]>:


> On 06-11-2017, at 12:12 AM, Marcel Taeumel wrote:
>
> If a dialog asks you for a URL and that thing is in a workspace window nearby, it should be possible to copy that to the clipboard w/o having to close the dialog. Modally exclusive dialogs wouldn't allow that.

I think that argues for a different level of modal, one based on the originating window/application, and yes it would be very useful. How could we do that?

Could it be as simple as locking the originating window so it gets no events passed to it? A quick test by inspecting a random browser and locking it suggests it might be a good starting point. Obviously that won’t be enough if there are several windows involved but I guess if you are making an application like that you will probably be tracking multiple windows anyway and have some idea of what to do.
I wonder if system modal widgets might be done by locking the top pasteupmorph… ehh, probably it would interfere with the dialog getting any events unless we did something drastic like adding a new top layer morph blahblahblah. I can certainly lock the World, wait 5 secs and unlock it, so maybe there is a way.

>
> You do not have to use the tool builder to construct your save dialog. Actually, I suggest not to use tool builder for know until you know what you want. Just put it in a subclass of DialogWindow.

Oh, I know, but I actually thought that what I wanted was so simple and obvious that it should be easy. Hopefully it will be easy sometime soon.

tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Oxymorons: Legally drunk





Reply | Threaded
Open this post in threaded view
|

Re: More pluggable dialog fun (was Re: FileChooser/SaverDialog)

timrowledge
In reply to this post by Hannes Hirzel

> On 07-11-2017, at 12:09 AM, H. Hirzel <[hidden email]> wrote:
>
>
> Yes. A useful (intermediate only?) goal is to get a reworked and
> configurable FileChooser/SaverDialog dialog and have duplication of
> code removed (FileList2). Not necessarily done with ToolBuilder [1].
>

Take a look at FileChooserDialog/FileSaverDialog and see if it works for you. Any ideas for test cases, improvements, whatever, happily considered. Currently I’d describe the visuals as very plain but adequate. I think the file list ought to be a three column view with sort-order buttons at the top of each, for example.

tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
The colder the X-ray table, the more of your body is required on it.



cbc
Reply | Threaded
Open this post in threaded view
|

Re: More pluggable dialog fun (was Re: FileChooser/SaverDialog)

cbc
In reply to this post by timrowledge


On Mon, Nov 6, 2017 at 9:45 AM, tim Rowledge <[hidden email]> wrote:

> On 06-11-2017, at 12:12 AM, Marcel Taeumel <[hidden email]> wrote:
>
> If a dialog asks you for a URL and that thing is in a workspace window nearby, it should be possible to copy that to the clipboard w/o having to close the dialog. Modally exclusive dialogs wouldn't allow that.

I think that argues for a different level of modal, one based on the originating window/application, and yes it would be very useful. How could we do that?

Could it be as simple as locking the originating window so it gets no events passed to it? A quick test by inspecting a random browser and locking it suggests it might be a good starting point. 

Maybe the 'model dialog' is instead always on top of the calling outer most morph that isn't the world (or project)?

Or make modal be 'always on top' in Squeak?  The other windows are still active - you can't can't hide the model morph.  Or a slight variation - always on top, but tied to the calling morph.  If the calling morph is a system window that could be minimized, it would also minimize the modal morph; similar with un-minimize.  As long as the modal isn't minimized, it is on top, too.

-cbc


Reply | Threaded
Open this post in threaded view
|

Re: More pluggable dialog fun (was Re: FileChooser/SaverDialog)

timrowledge
In reply to this post by timrowledge

> On 07-11-2017, at 9:49 AM, tim Rowledge <[hidden email]> wrote:
> . I think the file list ought to be a three column view with sort-order buttons at the top of each, for example.

Turned out to be reasonably simple to hack a PluggableMultiColumnListMorph into ToolBuilder and make a decent 3 column file list. It *doesn’t* have any moving splitters, nor sorting buttons etc, both of which would be very nice. The
PluggableMultiColumnListMorph does not seem to have had much love in many years and doesn’t get a lot of use that I can find. The horizontal scrolling appeared to not work, for example, and it looks like that is because someone decided to force it not to. Some futzing with LazyListMorph>>#hUnadjustedScrollRange and friends seems to have solved that (so far!) though the ‘double it just in case’ fudge at the end of the method makes it a bit ugly.

tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Oxymorons: Sanitary landfill



Reply | Threaded
Open this post in threaded view
|

Re: More pluggable dialog fun (was Re: FileChooser/SaverDialog)

Hannes Hirzel
In reply to this post by timrowledge
On 11/7/17, tim Rowledge <[hidden email]> wrote:

>
>> On 07-11-2017, at 12:09 AM, H. Hirzel <[hidden email]> wrote:
>>
>>
>> Yes. A useful (intermediate only?) goal is to get a reworked and
>> configurable FileChooser/SaverDialog dialog and have duplication of
>> code removed (FileList2). Not necessarily done with ToolBuilder [1].
>>
>
> Take a look at FileChooserDialog/FileSaverDialog and see if it works for
> you.

Yes, I loaded it a few days ago (from where?).  It worked fine and the
ToolBuilder code is very readable.

The only problem I noticed is that the dialog  is not resizable and
this is what you have been discussing so far in this thread.

The folder or dirrectory hierarchy is not fully visible if you have
long directory names.
Maybe just using a scroll pane for the directory hierarchy would be sufficient.

> Any ideas for test cases, improvements, whatever, happily considered.
> Currently I’d describe the visuals as very plain but adequate. I think the
> file list ought to be a three column view with sort-order buttons at the top
> of each, for example.
>
> tim
> --
> tim Rowledge; [hidden email]; http://www.rowledge.org/tim
> The colder the X-ray table, the more of your body is required on it.
>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: More pluggable dialog fun (was Re: FileChooser/SaverDialog)

timrowledge

> On 08-11-2017, at 1:44 AM, H. Hirzel <[hidden email]> wrote:
>
> The only problem I noticed is that the dialog  is not resizable and
> this is what you have been discussing so far in this thread.

Yup, this is due to the slightly odd use of the BorderedMorph with resize handles (rather than the over all window having resize ability) combined with how the submorphs of the BorderedMorph (which included those resize handles….) get completely replaced when the directory/file views get added.

>
> The folder or dirrectory hierarchy is not fully visible if you have
> long directory names.
> Maybe just using a scroll pane for the directory hierarchy would be sufficient.

I get a horizontal scroller for the directory tree - do you?

Here’s a changeset (since the changes cover several packages and I don’t want to update them pointlessly) that adds the multi-column filelist.  If anyone can see how to add movable splitters that would be nice to know. DItto the sort on a column stuff.



Based on 17447 update level so beware if you are at a very different state.

tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Foolproof operation:  All parameters are hard coded.





FileDIalogs-three-column.1.cs (8K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: More pluggable dialog fun (was Re: FileChooser/SaverDialog)

timrowledge
OK, for the brave, here is a version that ties saveAs… to a new file saver dialog.


I’ve succeeded in making it scan directories for filenames somewhat less frequently, which speeds up opening a bit on slower machines. I’m not a big fan of the way the directory tree is handled; I don’t see why we would really go up to the root(s) [1] and then show all its subdirectories and then open & show everything on the path back down to where our default directory is. Might it not be nicer to show only the path upwards and the current directory? Or some other less expensive operation?


tim
[1] On some systems finding all the plausibly connected roots can be a very slow operation involving spinning up CD drives etc to test for an inserted disc or whatever.

--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Strange OpCodes: VDP: Violate Design Parameters





FileDIalogs-three-column.4.cs (26K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: More pluggable dialog fun (was Re: FileChooser/SaverDialog)

timrowledge
And now the dialogs are in the latest packages *except* for the hooking up to saveAs…

To try that out, simply edit

SmalltalkImage>getFileNameFromUserSuggesting: aName
        "Ask the user for a new image name"
        | newName |
        newName := UIManager default
                filenameSaverRequest: 'New File Name?' translated
                initialAnswer: aName.
        newName ifNil: [^nil].
        ((FileDirectory default fileOrDirectoryExists: (self fullNameForImageNamed: newName)) or:
         [FileDirectory default fileOrDirectoryExists: (self fullNameForChangesNamed: newName)]) ifTrue: [
                (self confirm: ('{1} already exists. Overwrite?' translated format: {newName})) ifFalse: [^nil]].
        ^newName


tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Fractured Idiom:- FUI GENERIS - What's mine is mine



Reply | Threaded
Open this post in threaded view
|

Re: More pluggable dialog fun (was Re: FileChooser/SaverDialog)

David T. Lewis
For the saveAs operation, I would want to be able to edit the default file name, and
that appears in the edit box at the top of the FileSaver window, so this is good. I
also might want to save in a different directory, and the directory navigator on the
lower left side lets me do that, also good.

If I highlight a specific file on the lower right side, that becomes the new suggested
file name in the top edit box. This makes sense if the file I select is foo.image but
not if it is foo.changes or foo.cs or foo.txt.

I think that I would expect the dialog (lower right side) to present only the file
names that I can legitimately select (because they end in '.image'). Or I would
expect it to "grey out" the entries that I am not permitted to use, such that only
file names that end in '.image' can be highlighted and thus moved into the top
file name edit box.

I think I would also expect the suggested file name that initially appears in the
top edit box to also be highlighted in the panels below. If my current image name
is 'foo.image' then I would expect 'foo.image' to appear both in the edit box on
the top, and also as the selected file in the lower right navigator pane. Then,
if I navigate to another directory and select some other file named 'bar.image',
I expect 'bar.image' to appear in the text edit box at the top. But if I navigate
to a directory and select 'bar.st', I expect the FileSave to say "I'm sorry Dave,
I'm afraid I can't do that".

Dave


On Fri, Nov 10, 2017 at 04:39:46PM -0800, tim Rowledge wrote:

> And now the dialogs are in the latest packages *except* for the hooking up to saveAs???
>
> To try that out, simply edit
>
> SmalltalkImage>getFileNameFromUserSuggesting: aName
> "Ask the user for a new image name"
> | newName |
> newName := UIManager default
> filenameSaverRequest: 'New File Name?' translated
> initialAnswer: aName.
> newName ifNil: [^nil].
> ((FileDirectory default fileOrDirectoryExists: (self fullNameForImageNamed: newName)) or:
> [FileDirectory default fileOrDirectoryExists: (self fullNameForChangesNamed: newName)]) ifTrue: [
> (self confirm: ('{1} already exists. Overwrite?' translated format: {newName})) ifFalse: [^nil]].
> ^newName
>
>
> tim
> --
> tim Rowledge; [hidden email]; http://www.rowledge.org/tim
> Fractured Idiom:- FUI GENERIS - What's mine is mine
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: More pluggable dialog fun (was Re: FileChooser/SaverDialog)

David T. Lewis
By the way I should say that I meant this as constructive input from a user's
first impression point of view, I have not actually looked at any of the code.
I just pasted in Tim's getFileNameFromUserSuggesting snippet to see what it looks
like when I do an image "save as". It looks good, and I am just trying to offer my
dumb-user first reactions.

Dave

On Fri, Nov 10, 2017 at 08:53:59PM -0500, David T. Lewis wrote:

> For the saveAs operation, I would want to be able to edit the default file name, and
> that appears in the edit box at the top of the FileSaver window, so this is good. I
> also might want to save in a different directory, and the directory navigator on the
> lower left side lets me do that, also good.
>
> If I highlight a specific file on the lower right side, that becomes the new suggested
> file name in the top edit box. This makes sense if the file I select is foo.image but
> not if it is foo.changes or foo.cs or foo.txt.
>
> I think that I would expect the dialog (lower right side) to present only the file
> names that I can legitimately select (because they end in '.image'). Or I would
> expect it to "grey out" the entries that I am not permitted to use, such that only
> file names that end in '.image' can be highlighted and thus moved into the top
> file name edit box.
>
> I think I would also expect the suggested file name that initially appears in the
> top edit box to also be highlighted in the panels below. If my current image name
> is 'foo.image' then I would expect 'foo.image' to appear both in the edit box on
> the top, and also as the selected file in the lower right navigator pane. Then,
> if I navigate to another directory and select some other file named 'bar.image',
> I expect 'bar.image' to appear in the text edit box at the top. But if I navigate
> to a directory and select 'bar.st', I expect the FileSave to say "I'm sorry Dave,
> I'm afraid I can't do that".
>
> Dave
>
>
> On Fri, Nov 10, 2017 at 04:39:46PM -0800, tim Rowledge wrote:
> > And now the dialogs are in the latest packages *except* for the hooking up to saveAs???
> >
> > To try that out, simply edit
> >
> > SmalltalkImage>getFileNameFromUserSuggesting: aName
> > "Ask the user for a new image name"
> > | newName |
> > newName := UIManager default
> > filenameSaverRequest: 'New File Name?' translated
> > initialAnswer: aName.
> > newName ifNil: [^nil].
> > ((FileDirectory default fileOrDirectoryExists: (self fullNameForImageNamed: newName)) or:
> > [FileDirectory default fileOrDirectoryExists: (self fullNameForChangesNamed: newName)]) ifTrue: [
> > (self confirm: ('{1} already exists. Overwrite?' translated format: {newName})) ifFalse: [^nil]].
> > ^newName
> >
> >
> > tim
> > --
> > tim Rowledge; [hidden email]; http://www.rowledge.org/tim
> > Fractured Idiom:- FUI GENERIS - What's mine is mine
> >
> >
> >
>

Reply | Threaded
Open this post in threaded view
|

Re: More pluggable dialog fun (was Re: FileChooser/SaverDialog)

timrowledge
In reply to this post by David T. Lewis

> On 10-11-2017, at 5:53 PM, David T. Lewis <[hidden email]> wrote:
>
> For the saveAs operation, I would want to be able to edit the default file name, and
> that appears in the edit box at the top of the FileSaver window, so this is good. I
> also might want to save in a different directory, and the directory navigator on the
> lower left side lets me do that, also good.

That is the idea.

>
> If I highlight a specific file on the lower right side, that becomes the new suggested
> file name in the top edit box. This makes sense if the file I select is foo.image but
> not if it is foo.changes or foo.cs or foo.txt.

Yes, for the case where one knows what kind of file is being saved it should be limiting the options  - I *think* that would work with setting the pattern appropriately. The saver doesn’t currently use the pattern at all. I suppose we’d want to parse and ‘correct’ any typed in filename to match that limit. Suggestions on expected behaviour welcomed.

There’s probably a case for allowing a no-new-file or no-old-file test too; at least to the extent that trying to choose an existing file can raise a warning of the ‘are you sure?’ kind.

>
> I think that I would expect the dialog (lower right side) to present only the file
> names that I can legitimately select (because they end in '.image'). Or I would
> expect it to "grey out" the entries that I am not permitted to use, such that only
> file names that end in '.image' can be highlighted and thus moved into the top
> file name edit box.

Perhaps solvable in the same changes as above?

>
> I think I would also expect the suggested file name that initially appears in the
> top edit box to also be highlighted in the panels below. If my current image name
> is 'foo.image' then I would expect 'foo.image' to appear both in the edit box on
> the top, and also as the selected file in the lower right navigator pane. Then,
> if I navigate to another directory and select some other file named 'bar.image',
> I expect 'bar.image' to appear in the text edit box at the top. But if I navigate
> to a directory and select 'bar.st', I expect the FileSave to say "I'm sorry Dave,
> I'm afraid I can't do that”.

I made it highlight any file matching the typed in name but maybe it isn’t working for the initial startup. Ah, nope.


tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
No, I don't explode cats. It's way too difficult to coax them into the microwave - http://tinyurl.com/yp3hgr


Reply | Threaded
Open this post in threaded view
|

Re: More pluggable dialog fun (was Re: FileChooser/SaverDialog)

timrowledge
>> On 10-11-2017, at 5:53 PM, David T. Lewis <[hidden email]> wrote:
>> If I highlight a specific file on the lower right side, that becomes the new suggested
>> file name in the top edit box. This makes sense if the file I select is foo.image but
>> not if it is foo.changes or foo.cs or foo.txt.


>>
>> I think that I would expect the dialog (lower right side) to present only the file
>> names that I can legitimately select (because they end in '.image'). Or I would
>> expect it to "grey out" the entries that I am not permitted to use, such that only
>> file names that end in '.image' can be highlighted and thus moved into the top
>> file name edit box.

I added setting a pattern list in the creation methods and it works ok; I’d prefer to have the file list able to show everything and grey out the invalid ones but that’s a job for anyone wanting to improve the multicolumn list stuff.

What is eluding me right now is a good heuristic to handle a typed in filename that doesn’t match the pattern. Obviously we can do what we want in the #inputText: method to test the proposed name but I’m just blanking on what that might be. Test against the list of patterns I suppose is a start … and what it if doesn’t? What’s the way to tell an input field to sound the klaxons and flash disaster-red to alert the user that they are an idiot?

>>
>> I think I would also expect the suggested file name that initially appears in the
>> top edit box to also be highlighted in the panels below. If my current image name
>> is 'foo.image' then I would expect 'foo.image' to appear both in the edit box on
>> the top, and also as the selected file in the lower right navigator pane.

OK, easily fixed and definitely an improvement.


tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Strange OpCodes: RDRI: Rotate Disk Right Immediate



Reply | Threaded
Open this post in threaded view
|

Re: More pluggable dialog fun (was Re: FileChooser/SaverDialog)

timrowledge
The latest status of the File dialogs is in the alpha trunk as of 17544 and details, plus a filein to hook them up to ‘normal’ file choose/save methods is downloadable from http://wiki.squeak.org/squeak/2758

Please give it a try and report problems. Next step would be to see about replacing the horrible StandardFileMenu stuff.

tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Strange OpCodes: HALT: No-Op



12