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

Callback for clicking on annotations #76 #80

Merged
merged 3 commits into from
Dec 25, 2024

Conversation

t29mato
Copy link
Collaborator

@t29mato t29mato commented Dec 3, 2024

to support the callback function on annotation for #76

behavior

pr80.mov

I've tested using the application structure-vision lfoppiano/structure-vision#4

@t29mato
Copy link
Collaborator Author

t29mato commented Dec 3, 2024

The ci error comes from my code? ...

@t29mato
Copy link
Collaborator Author

t29mato commented Dec 3, 2024

https://github.com/lfoppiano/streamlit-pdf-viewer/actions/runs/12107866260
The test was working before on the main branch.
So, I'm going to figure it out by myself first.

@t29mato
Copy link
Collaborator Author

t29mato commented Dec 4, 2024

@lfoppiano
The tests passed in the local Python 3.11 environment.
image

Considering this, I’m beginning to think that it might be necessary to set up local environments for Python 3.7 and Python 3.8, where the tests have been failing so far.

However, looking at the specific error details in the GitHub Actions logs, as shown below, the test might be unstable since I haven’t made any changes to the code that would affect the height or the number of components.

https://github.com/lfoppiano/streamlit-pdf-viewer/actions/runs/12139594120/job/33847552805?pr=80

>       assert round(b_box_1['height']) < iframe_box['height'] and round(b_box_1['height']) > 0
E       assert (2378 < 926.9999694824219)
E        +  where 2378 = round(2377.7000427246094)

tests/test_tabs.py:86: AssertionError

https://github.com/lfoppiano/streamlit-pdf-viewer/actions/runs/12139709855/job/33847907010?pr=80

>       assert len(iframe_components) == 6
E       assert 5 == 6
E        +  where 5 = len([<Locator frame=<Frame name= url='http://localhost:40857/'> selector='iframe[title="streamlit_pdf_viewer.streamlit_pdf...me name= url='http://localhost:40857/'> selector='iframe[title="streamlit_pdf_viewer.streamlit_pdf_viewer"] >> nth=4'>])

tests/test_resolution_boost.py:42: AssertionError

Could you share your thoughts before I investigate further?

@Krastanov
Copy link

This works great locally for me (python 3.10)

@lfoppiano
Copy link
Owner

Thanks for this PR, it's great you've done it. I tried myself but I failed... I really appreciate.
Regarding the tests, they are not 100% accurate, but we need them for avoiding pushing stupid bugs. Maybe we would need to update them. I will look into them.

@lfoppiano
Copy link
Owner

lfoppiano commented Dec 7, 2024

@t29mato It seems tests work.

Could you please add some documentation in the readme.md? in particular we need some examples on how to define the function etc...

@lfoppiano
Copy link
Owner

I found that the tests are running with the 3.10.12 version no matter what we set up before... no idea why... 😭

@t29mato
Copy link
Collaborator Author

t29mato commented Dec 12, 2024

@lfoppiano I've updated the readme. please check it out

@lfoppiano lfoppiano merged commit 51e2ba3 into main Dec 25, 2024
3 of 14 checks passed
@lfoppiano lfoppiano deleted the feature/callback-fn-on-click-annotation branch December 25, 2024 06:10
@lfoppiano lfoppiano restored the feature/callback-fn-on-click-annotation branch December 25, 2024 08:38
lfoppiano added a commit that referenced this pull request Dec 25, 2024
…click-annotation"

This reverts commit 51e2ba3, reversing
changes made to c559d98.
@lfoppiano
Copy link
Owner

lfoppiano commented Dec 25, 2024

I mistakely merged by mistake. After merging I realised that I could not get it to work. I tested with the branch lfoppiano/structure-vision#4 but when clicking I did not have the same behaviour. I tried with both Brave and Firefox.

@t29mato could you please re-create the PR, please?

lfoppiano added a commit that referenced this pull request Dec 25, 2024
@lfoppiano
Copy link
Owner

Nevermind, it's working. I've reverted my mess and created version 0.0.20-dev0

@lfoppiano lfoppiano deleted the feature/callback-fn-on-click-annotation branch December 25, 2024 10:16
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.

3 participants