Conversation
Member
Author
|
@clewis7 ready for review! |
|
📚 Docs preview built and uploaded! https://www.fastplotlib.org/ver/fix-imgui-popup-menus |
Member
Author
|
oh wait let me add a test |
Member
|
I'll wait for test before doing a review :D |
Member
Author
|
ok so I looked into how we could have a test for this and we can't right now since the offscreen canvas does not have things like click events, we can look into this later, can ask almar. |
e5cbc2d to
17730c4
Compare
Member
Author
|
so there is |
Member
Author
I just tried this, works for qt canvas but not offscreen 🤷♂️ . Documenting here for now, let's just merge this and figure it out later. """
Test right click menu
=====================
Screenshot test for the right click menu
"""
# test_example = true
# sphinx_gallery_pygfx_docs = 'hidden'
import fastplotlib as fpl
import numpy as np
figure = fpl.Figure(size=(700, 560))
# for some reason right click menu doesn't show if the scene is completely empty
figure[0, 0].add_image(np.zeros((2, 2)), cmap="gray")
figure[0, 0].axes.visible = False
figure.show()
data = {"x": 10, "y": 10, "modifiers": (), "n_touches": 0, "touches": {}}
move = {
"event_type": "pointer_move",
"button": 0,
"buttons": (),
**data,
}
down = {
"event_type": "pointer_down",
"button": 2,
"buttons": (2,),
**data,
}
up = {
"event_type": "pointer_up",
"button": 2,
"buttons": (),
**data,
}
figure.canvas.submit_event(move)
figure.canvas.submit_event(down)
figure.canvas.submit_event(up)
if __name__ == "__main__":
print(__doc__)
fpl.loop.run() |
clewis7
approved these changes
Jan 26, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #694
The kwargs for the imgui popup menu for right clicks got more strict in the v1.6.0 release. Was annoying to troubleshoot since I was first getting errors stating that the previous imgui frame had not been ended and to call
imgui.end_frame(). So then I added an extraimgui.end_frame()within the right click menu and it produced the actual error which was that imgui wasn't happy with the types of the kwargs 🤷♂️So before we had things like this for example:
args are: (item name, keyboard shortcut, selected)
So before it worked if we gave
Nonefor the second arg which is keyboard shortcut, now it has to explicitly be"". And it's not taking expressions that results in aboolfor whatever reason anymore.So in summary the above needs to become the following for imgui v1.6.0 to be happy: