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

User selections #311

Merged
merged 9 commits into from
Aug 25, 2021
Merged

User selections #311

merged 9 commits into from
Aug 25, 2021

Conversation

Carifio24
Copy link
Member

Overview

This PR adds fields in the pywwt widget for observing changes in selection in the WWT app (the SelectionStateMessage proposed in WorldWideTelescope/wwt-webgl-engine#133). Additionally, this adds functionality for a user client to add a callback to be called when the widget receives a selection message.

So this is what I was thinking for the basic callback setup. The callback function runs after the state is updated (and after any futures are resolved as well), and is passed two arguments: the widget itself, and a list of the names of properties that were updated. This gives the caller access to the updated state and the flexibility to do whatever they want with it, but minimizes the number of attached callbacks (I'm thinking that a user could attach one callback for each message type).

Checklist

  • Changed code has some test coverage (or justify why not)
  • Changes in functionality documented (or justify why not)

@pkgw
Copy link
Contributor

pkgw commented Aug 12, 2021

OK, some details might have to evolve pending discussion in WorldWideTelescope/wwt-webgl-engine#133, but I like the overall approach here. I think it makes a lot of sense to have the message-handling code primarily support futures, but also provide callback hooks when there's a demonstrated need in a downstream user that can't go full async.

@Carifio24
Copy link
Member Author

I've updated this to match the final version in WorldWideTelescope/wwt-webgl-engine#133 - namely, I've removed the field for selected HiPS catalogs, as well as the JSON parsing of the source fields that was previously present. I've also added a CallbackError exception for errors that occur within a user callback.

It looks like there's now an issue with one of the Qt tests, though, so I need to figure out what the issue is there.

pywwt/core.py Outdated Show resolved Hide resolved
pywwt/core.py Outdated Show resolved Hide resolved
@pkgw
Copy link
Contributor

pkgw commented Aug 24, 2021

CI failure has to do with some differences of the image tests on Linux — might be spurious? I've told Azure to relaunch those tests to find out.

@pkgw
Copy link
Contributor

pkgw commented Aug 24, 2021

Hmm, looks like the errors are reproducible. You should be able to go to the artifacts of the CI run and download packages of data showing the images generated during the failing runs, along with diffs against the reference images. (If you can't download the files there might be a permissions problem. If so, let me know.) There seem to be some teeny-tiny changes, just enough to fail the test, but nothing obviously broken. Azure might have upgraded its Linux builders recently? In which case, the solution would be to add the new image variations to the test corpus.

@Carifio24
Copy link
Member Author

I was able to download the generated images and diffs from Azure. The four images that failed all look 'good' to me (in the sense that, visually, I can't see any real difference between them and the reference images in tests/data).

The latest release on the Azure Pipelines agent repository is marked as being from 27 days ago, which is one day after the last commit here on pywwt, so it is possible that this is due to an Azure upgrade.

@pkgw
Copy link
Contributor

pkgw commented Aug 25, 2021

OK. I think you'll have to update the test corpus. Can you take the images that are currently failing and add them to the repo with filenames like pywwt/tests/data/refimg_qt_full_step?/e.png ?

Within the refimg_ directories, the sample PNG files can be named anything. I just went with a, b, c, etc., rather than trying to give informative names (e.g. something like linux_llvpmpipe) since it's possible that one image will work well for multiple platforms, and that the "correct" image for a given platform might even evolve over time (as we're seeing here).

Copy link
Contributor

@pkgw pkgw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code changes look great now, just need to update the test corpus.

@codecov
Copy link

codecov bot commented Aug 25, 2021

Codecov Report

Merging #311 (4dca09b) into master (8911198) will decrease coverage by 0.15%.
The diff coverage is 46.66%.

❗ Current head 4dca09b differs from pull request most recent head 9b02e0a. Consider uploading reports for the commit 9b02e0a to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master     #311      +/-   ##
==========================================
- Coverage   59.39%   59.24%   -0.16%     
==========================================
  Files          24       24              
  Lines        2490     2520      +30     
==========================================
+ Hits         1479     1493      +14     
- Misses       1011     1027      +16     
Impacted Files Coverage Δ
pywwt/core.py 78.80% <46.66%> (-2.48%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8911198...9b02e0a. Read the comment docs.

@pkgw pkgw merged commit 6860e65 into WorldWideTelescope:master Aug 25, 2021
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.

2 participants