pharo-spec / Spec

Spec is a framework in Pharo for describing user interfaces.
MIT License
61 stars 63 forks source link

would it make sense to have inform: and alert: #1416

Closed Ducasse closed 1 year ago

Ducasse commented 1 year ago

In morphic or even spec code people use self inform: or alert: because it is defined on Object. Would it make sense to propose an alternate implementation of such methods in SpPresenter that opens a configured SpDialog. Like that we can get rid of the self uiManager inform:

I can do a PR but only if it makes sense so let me know.

estebanlm commented 1 year ago

in fact we had that but we removed it because is not a good API (that ends in a profusion of methods for each minimal variant). what you have now (we can always improve the api and enhance it) is the equivallent of what we had there in application, as builders e. g. :

self application newInform
title: 'A 'window title';
label: 'a label';
acceptLabel: 'Yes, do it';
openModal

and you have also newRequest, newRequestText, newConfirm and newSelect. this is a lot more maleable, IMO.

On Jun 30 2023, at 1:58 pm, StéphaneDucasse @.***> wrote:

In morphic or even spec code people use self inform: or alert: because it is defined on Object. Would it make sense to propose an alternate implementation of such methods in SpPresenter that opens a configured SpDialog. Like that we can get rid of the self uiManager inform:

I can do a PR but only if it makes sense so let me know. — Reply to this email directly, view it on GitHub (https://github.com/pharo-spec/Spec/issues/1416), or unsubscribe (https://github.com/notifications/unsubscribe-auth/AAD5MXRYRZSYUAMKUWRSDNLXN25PRANCNFSM6AAAAAAZZYCHBU). You are receiving this because you were assigned.

Ducasse commented 1 year ago

Ok I started to convert all the call from within Syc*Presenter to uiManager to an internal self inform: method. And I was thinking that I could define it following the pseudo code below (no idea if there is a NullApplication.

inform: astring
    self application 
     ifNil:[ self localInform: astring
    ifNotNil: [:a | a inform: astring ]

But I will use the self application newInform I will remove the uiManager call in Syc and in the copy I'm working on for the refactoring driver.