-
Notifications
You must be signed in to change notification settings - Fork 16
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
Debugging signals 🩻 #1389
Comments
I found a workaround for my issue, so I can make progress. All I have to do (in
which I can presumably do for every other button. I'd sooner not, for obvious reasons. But it does show me that the |
@rickmcgeer on a general level, we are also not happy with this part of the system, but until now never had an idea how to tackle it. I now thought of something that might be worthwhile and hope to prototype it soon. We have #163 for this - the problem persists since basically forever, as you mentioned. In a first step we will provide better documentation soon and I hope that alleviates some of the pain already. Regarding this concrete problem: We do not recommend using
binds a signal fired inside of the The alternative to using
I checked the dashboard out locally and replaced As a general rule, components coming from the lively core will signal their stuff on the view, so than As we recommend not binding onto I hope this helps, let me know if you have any more questions. |
@linusha Thanks!
Does this make sense? The big advantage is that all bindings are local to the Morph and the programmer can inspect the queue to see what will fire. |
@linusha would |
Good question! In the case you want to bind a signal directly on the I'll come back to your other reply tomorrow! |
Thanks, @linusha |
@rickmcgeer I have to say I did not grok your code code totally, but I tend to say yes, this would work too. I'd say the advantage of the The obvious downside to this is, as you rightly pointed out, that we provide no tooling at this point in time to quickly find out if everything is setup correctly. Just for my understanding: Previsouly, Robin and I often talked about an interactive interface to setup bindings, and had problems thinking of something that scales. |
@linusha yes, that's correct. The problem is that there's no way to see what is actually bound to the signal. That was also the case with "pins" in the Lively Web. The other problem is that binding is by name (instead of by object) and this is ambiguous -- the actual binding is to some object, of course, but which object isn't known until runtime.
Then the binding is to any subclass. Let me explain where the code in my previous comment came from. In many systems, UI elements export out events. An event is basically the same thing as a signal in Lively. Each event maintains a queue of listeners, and there's a specific method to add and delete listeners from events. When an event is fired, the listeners are invoked. The advantages to this architecture are:
This is a common architecture (and it's easy to implement on top of the current FWIW (and this is just advice) I don't think scaling is the problem; I've never seen a case where there are lots of signals in a system. What I think the problem is is that it isn't obvious, to me at least, which method is being bound to which signal. I suspect that (and there was a lot of this in the original Lively) the original mechanism was designed to be very general and flexible -- so a connection could be made pretty much arbitrarily and in a number of different ways. That's a benefit in a lot of ways, but it does mean that the underlying semantics aren't clear and are sometimes ambiguous. |
@linusha What Rick basically wants is X-Ray vision for morphs that visualizes where the connections flow, and also where attachments for connections are located |
What would you like to achieve?
I'm clicking on a Button and nothing is happening, even through the code says it should. When I click the
Close
Button onBugReporter
nothing happens.BugReporter
is implemented here:BugReporter
's model isBugReporterModel
, which has the following code:The
close
method isthis.view.remove()
, and when I execute it by hand (pull up the Object Editor, choose to edit the model, then run the method directly, theBugReporter
instance is removed.BugReporter
's close button is an instance ofMenuBarButton
, defined here:Its
defaultViewModel
isButtonModel
and
ButtonModel
clearly has the signalfire
defined:From the
get properties()
method:In other words,
ButtonModel
defines the signalfire
,BugReporterModel
binds button'sfire
signal toclose
, and it's quite clearclose
isn't getting called.The thing is, I don't know how to debug this, and I don't have an alternative solution other than to subclass the View and override the appropriate pressed method to call it directly
How are you trying to achieve that
Alternative solutions
If applicable, what other solutions have you tried?
Additional Resources
Please provide links to any custom code that might be necessary to grasp your problem. Screenshots of custom component, etc. are also appreciated.
Version: Please paste the lively.next commit on which the problem occurred here (use the copy button of the Version Checker in the bottom left corner).
9d55f9b
The text was updated successfully, but these errors were encountered: