Closed banesullivan closed 5 years ago
I don't know if we can do something about it. However we sould document the key bindings somwhere.
we should document the key bindings somewhere.
I definitely agree that they should be documented - I only discovered v
for vertex/point representation and s
for surface by typing code slowly.
I don't know if we can do something about it.
I think this is a panel
issue. If you display a VTKjs rendering via HTML this behavior is not experienced:
from IPython.core.display import display, HTML
display(HTML(
'''
<div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; max-width: 100%; height: auto;">
<iframe src="http://volcano.pvgeo.org" frameborder="0" allowfullscreen style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"></iframe>
</div>
'''))
panel
is on top, HTML is bottom. Note that the HTML output is simply pointing to this url: http://volcano.pvgeo.org which has keyboard shortcuts when on the webpage but not in the notebook
The other thing to note is that this is causing a noticeable lag when typing s
, v
, w
, or other keys that affect the panel
scene.
If a notebook has more than a few VTK panel scenes, then adding new code with the letters v
, s
, or w
will heavily lag the notebook (and be quite an annoyance). For example, typing examples.download_st_helens().warp_by_scalar().plot()
took almost a minute after loading up 5 other scenes:
key events are set by vtkjs interactor: https://github.com/Kitware/vtk-js/blob/cc48e943037e0ed980c5e370b0e716df3309a5b2/Sources/Rendering/Core/RenderWindowInteractor/index.js#L214-L222
They are attached to the document body so it's not a panel bug. What I can try to do is to add an option to activate or deactivate keybindings
Does something like this would be sufficient?
Yeah, I don't see a better solution either. The iframe example doesn't capture the keybindings because that's how iframe's work, anything embedded in a page will. If VTK had some concept of giving focus to the view window maybe we could make sure it only responds if the viewing window has been selected.
Actually I don't if the best is not just to remove all keybindings
I've installed panel
from the master branch and this still isn't resolved. Am I missing something?
Did you recompiled extensions? pip install git+... will not recompile extensions. you need to run a python setup.py install or develop
@philippjfr shouldn't we subclass distutils.command.build.build
in setup.py ? with something like :
class CustomBuildCommand(build):
"""Custom installation for build mode."""
def run(self):
try:
from panel.compiler import build_custom_models
print("Building custom models:")
build_custom_models()
except ImportError as e:
print("Custom model compilation failed with: %s" % e)
build.run(self)
@xavArtley You're probably right, I don't know enough about how distutils works to know for sure. Do the develop
and install
commands both call the build
command, i.e. could it replace them?
@xavArtley, thanks for the tip! I had some build artifact lying around from a previous conda install after I cloned the repo that needed to be cleaned up - all good now!
When using
panel
's new VTK functionality in a Joptyer notebook, the panel listens to key events outside of its scope.When writing new code in a different cell, buttons like
v
ands
alter the scene - this is unexpected behavior. See example below usingvtki
which sends its renderer to panel's VTK code: