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.

Snapshot widget state when syncing

See original GitHub issue

Summary

We should snapshot the widget state when syncing state from the frontend to the kernel, since the sync may happen asynchronously because of the throttling.


Original issue

hi

we have simple code in nglview that works fine with ipywidgets 5.2.2. However, there is no effect if using mode.set(...) in 6.0.0.beta5 version.

one example:

this.model.set('camera_str', JSON.stringify(this.stage.viewer.camera))

will not update camera_str in Python. https://github.com/arose/nglview/blob/master/js/src/widget_ngl.js#L77-L82

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:55 (28 by maintainers)

github_iconTop GitHub Comments

1reaction
jasongroutcommented, Apr 13, 2017

Okay, for now, how about you change it to:

class NGLWidget(DOMWidget):
    _view_name = Unicode("NGLView").tag(sync=True)
    _view_module = Unicode("nglview-js-widgets").tag(sync=True)
    _model_name = Unicode("DOMWidgetModel").tag(sync=True)
    _model_module = Unicode("jupyter-js-widgets").tag(sync=True)
1reaction
jasongroutcommented, Apr 12, 2017

I’ll work on the ipywidgets end - making it so that the syncing takes a snapshot of the state when you ask it to sync, and getting the state updates merging to work.

@hainm - this is now done in #1270, so I’ll close this issue. If you can try on current master, can you see if it helps your issue? (If not, we should be releasing a beta soon that you can try with.)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Keeping a Widget Up To Date | Apple Developer Documentation
Plan your widget's timeline to show timely, relevant information using dynamic views, and update the timeline when things change.
Read more >
How to sync a resource or a model object across different ...
How to sync a resource or a model object across different screens/widgets when it is updated? Ask Question. Asked 2 years, 9 months...
Read more >
Get realtime updates with Cloud Firestore - Firebase
If there is state available in a local cache, the query snapshot will be initially populated with the cached data, then updated with...
Read more >
Syncing Video with Annotations | Adobe Acrobat
... annotation to a embedded video it creates a snapshot of the video ... putting the playback component of the widget into a...
Read more >
Snapshot widgets - Palantir
By default, embedded charts and tables will update as the underlying source data changes. To retain the current state of a widget by...
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