Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding inspector transmission node #510

Merged

Conversation

jordanmontt
Copy link
Contributor

Currently there is two solutions for having the transmissions on the inspector

  • Either you use StInspectorNode to wrap your data, but it very limited with the transmissions
  • Either you create a presenter class and customize the transmissions. Bad side is that you need to create a class and for simple presenters is not convenient.

I was thinking on this the other day. So you are right, the blog post and StInspectorNode are not compatible.

One solution that I can think is to create a StInspectorTransmissionNode that manages the transmission. This can be a third option when you have a small presenter that you want to put in the inspector and you don't want to create a class but you want the power of transmissions.

This PR introduces the class StInspectorTransmissionNode that allows to the user to specify custom transmissions inside the Inspector in an easy way.

Let's take this code:

<inspectorPresentationOrder: 1 title: 'Demo'>
    | items |
    items := #( 1 2 3 4 5 6 7 8 ).

    ^ SpListPresenter new
        items: (items collect: [ :e |
            StInspectorTransmissionNode hostObject: e transmissionBlock: [ :theObject | theObject + 100 ] ]);
        display: [ :e | e hostObject ];
        yourself

This produces the inspector extension that add 100 when you click on a number

image

@svenvc
Copy link

svenvc commented Apr 21, 2023

LGTM

@MarcusDenker MarcusDenker merged commit fa5ce86 into pharo-spec:Pharo12 Apr 25, 2023
@jordanmontt jordanmontt deleted the adding-inspector-transmission-node branch April 25, 2023 12:33
@estebanlm
Copy link
Member

sorry for coming late to this, but an example in the class comment would be useful.
also, I do not like transmissionBlock: as a name :P
(I never liked the "type declaring names", transmissionAction: or just transmits: or similar are better names IMO.

@jordanmontt
Copy link
Contributor Author

Hello @estebanlm
I will add a new PR with your observations. Maybe tomorrow on the Pharo sprint

@jordanmontt
Copy link
Contributor Author

Related PR: #547

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants