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

Add more keypress events #434

Merged
merged 2 commits into from
Nov 2, 2019
Merged

Add more keypress events #434

merged 2 commits into from
Nov 2, 2019

Conversation

banesullivan
Copy link
Member

@banesullivan banesullivan commented Oct 31, 2019

Resolves #149 by adding the following nifty keyboard shortcuts:

  • shift+s: Save a screenhsot (only on BackgroundPlotter) (control/command would not register)
  • c: Enable interactive cell selection/picking
  • up/down (arrows): Zoom in and out
  • +/-: Increase/decrease the point sizes and line widths
  • numerical keys are linked to saved camera positions in the BackgroundPlotter

Note that this should resolve the issues where the key bindings were not being added to the BackgroundPlotter - someone may need to double-check my work to make sure the BackgroundPlotter is still closing properly

@banesullivan banesullivan added enhancement Changes that enhance the library bug-fix labels Oct 31, 2019
@banesullivan banesullivan added this to the 0.23.0 milestone Nov 1, 2019
@banesullivan
Copy link
Member Author

import pyvista as pv
from pyvista import examples

mesh = examples.download_bunny_coarse()

p = pv.BackgroundPlotter()
p.add_mesh(mesh, show_edges=True)
demo = lambda *args: p.add_text("Pressed: {}".format(p.iren.GetKeySym()), name="msg")
p.iren.AddObserver("KeyPressEvent", demo)

2019-11-01 17 44 38

2019-11-01 17 47 07

2019-11-01 17 48 18

Copy link
Member

@akaszynski akaszynski left a comment

Choose a reason for hiding this comment

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

Looks good. It's tricky getting the callbacks to play nicely as both vtk and pyqt want control of the main thread. These should work, but it's too bad we can't test them automatically.

@banesullivan banesullivan merged commit ab585df into master Nov 2, 2019
@banesullivan banesullivan deleted the keypress branch November 19, 2019 05:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Changes that enhance the library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

More render window keyboard shortcuts
2 participants