question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot connect event callbacks to MagicFactory

See original GitHub issue

As noticed by @uschmidt83, the @magic_factory decorator is not compatible with the current callback connection approach (widget.param.changed.connect). That’s a big bummer and needs to be fixed ASAP. One possibility would be to allow for MagicFactory to accept a widget_init function, that would be called with the widget instance each time a new one is created…

def init(widget):
    widget.x.changed.connect(print)

@magic_factory(init=init)
def func(x: int):
    ...

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
uschmidt83commented, Feb 19, 2021

…it will remember all of the kwargs passed to it, but also allow you to override them when you call the factory. …in which case the factory is a convenient way to create multiple widgets based on a single template…

That makes sense, thanks for the explanation. But it then probably needs some sort of init function as you suggested in the first post of this issue.

0reactions
tlambert03commented, Feb 19, 2021

yeah, I’m thinking that’s a nice way to keep the functional interface. Will add it soon. Thanks for revealing the need!

Read more comments on GitHub >

github_iconTop Results From Across the Web

.net - Understanding events and event handlers in C#
NET and peels away the "magic" - an event is really, under the covers, just a list of methods of the same "shape"....
Read more >
The Action args emit wrong handler · Issue #12854 - GitHub
Describe the bug In an Angular component, the Actions display the name of the event handler that is being invoked from the template, ......
Read more >
MacOS 12.0.1 Monterey Bluetooth issues - Apple Developer
1 Monterey Bluetooth is broken customer wide. Hence pairing works but our driver cannot connect (code worked for MacOS 10.7 - 11.3). The...
Read more >
Custom Event Inquiries | The Magic Factory
Custom, Magical Event Decor + Styling Services! To inquire about pricing and availability of custom event services, leave us your info below!
Read more >
Using Hooks — The Pyramid Web Framework v2.0
All response callbacks are called before the NewResponse event is sent. Errors raised by response callbacks are not handled specially. They will ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found