mwcraig / ipyevents

A custom widget for returning mouse and keyboard events to Python. Documentation:
https://ipyevents.readthedocs.io/en/latest/index.html
BSD 3-Clause "New" or "Revised" License
112 stars 27 forks source link

Spacebar does not activate Ginga's meta mode anymore #40

Closed pllim closed 5 years ago

pllim commented 5 years ago

This is a follow up of the fix made for #37. The "jumping" is gone but I cannot use spacebar to enter Ginga viewer's "meta [L]" mode anymore, as a result, astrowidgets.ImageWidget workflow is broken. This is using ipyevents 0.4.1.

cc @ejeschke and @eteq

pllim commented 5 years ago

Actually, this might be more serious than what I posted above. I think all keyboard key bindings for Ginga viewer are gone. I cannot use numeric keys to change zoom either.

ejeschke commented 5 years ago

Can you open the browser javascript console to see if there are any errors showing up there when you type into the widget?

pllim commented 5 years ago

I couldn't figure out how to save the log into plain text, so here is a screenshot.

console_errors

pllim commented 5 years ago

Actually, when I pip install ipyevents==0.4.0 into my conda environment, I get this same problem too! But it works when I do a conda install ipyevents. :confused:

mwcraig commented 5 years ago

Hi,

I'll try to take a look today (recovering from a bad cold so not sure hoe much progress I'll make). I made a couple of changes in 0.4.1 that might have led to this.

Can you please send the output from a terminal of jupyter nbextension list

After that, can you try these steps after pip installing:

jupyter nbextension install --sys-prefix ipyevents
jupyter nbextension enable --sys-prefix ipyevents

If you are running it in lab then you have to: jupyter labextensino install ipyevents

Matt

On Thu, Feb 28, 2019 at 11:04 AM P. L. Lim notifications@github.com wrote:

Actually, when I pip install ipyevents==0.4.0 into my conda environment, I get this same problem too! But it works when I do a conda install ipyevents. 😕

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mwcraig/ipyevents/issues/40#issuecomment-468353163, or mute the thread https://github.com/notifications/unsubscribe-auth/ABGBH6B3F7n3Y30F3iacj_Gb4S_JWyA6ks5vSAwbgaJpZM4bSxrX .

pllim commented 5 years ago
$ jupyter nbextension list
      - Validating: ok
      - Validating: ok
Known nbextensions:
  config dir: C:\...\Miniconda3\envs\py37\etc\jupyter\nbconfig
    notebook section
      ipyevents/extension enabled
      jupyter-js-widgets/extension enabled

Then I conda uninstall ipyevents followed by pip install ipyevents to pick up 0.4.1 (again). But jupyter nbextension install --sys-prefix ipyevents fails.

Traceback (most recent call last):
  File "C:\...\Miniconda3\envs\py37\Scripts\jupyter-nbextension-script.py", line 11, in <module>
    load_entry_point('notebook==5.7.4', 'console_scripts', 'jupyter-nbextension')()
  File "C:\...\Miniconda3\envs\py37\lib\site-packages\jupyter_core\application.py", line 266, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "C:\...\Miniconda3\envs\py37\lib\site-packages\traitlets\config\application.py", line 658, in launch_instance
    app.start()
  File "C:\...\Miniconda3\envs\py37\lib\site-packages\notebook\nbextensions.py", line 988, in start
    super(NBExtensionApp, self).start()
  File "C:\...\Miniconda3\envs\py37\lib\site-packages\jupyter_core\application.py", line 255, in start
    self.subapp.start()
  File "C:\...\Miniconda3\envs\py37\lib\site-packages\notebook\nbextensions.py", line 716, in start
    self.install_extensions()
  File "C:\...\Miniconda3\envs\py37\lib\site-packages\notebook\nbextensions.py", line 695, in install_extensions
    **kwargs
  File "C:\...\Miniconda3\envs\py37\lib\site-packages\notebook\nbextensions.py", line 199, in install_nbextension
    _maybe_copy(src, full_dest, logger=logger)
  File "C:\...\Miniconda3\envs\py37\lib\site-packages\notebook\nbextensions.py", line 1043, in _maybe_copy
    if _should_copy(src, dest, logger=logger):
  File "C:\...\Miniconda3\envs\py37\lib\site-packages\notebook\nbextensions.py", line 1019, in _should_copy
    if os.stat(src).st_mtime - os.stat(dest).st_mtime > 1e-6:
FileNotFoundError: [WinError 2] The system cannot find the file specified: 'ipyevents'
mwcraig commented 5 years ago

My bad, I left out a an option:

jupyter nbextension install --py --sys-prefix ipyevents

I don't think that will fix it though, since the ipyevents extension is already listed as installed and enabled.

mwcraig commented 5 years ago

Does the demo notebook for ipyevents work for you?

pllim commented 5 years ago

I think jupyter nbextension install --py --sys-prefix ipyevents fixed it. For lab, I also ran jupyter labextension install ipyevents. Now it works. Magic. Thanks!

ejeschke commented 5 years ago

Seems like I've seen two or three different incantations for the jupyter nbextension install command now (over the years), and it is a little difficult to remember which one is correct. @pllim, maybe we should double check that we have an up-to-date note somewhere in the ginga install docs that if you want to use the jupyterw version this is what you have to do.

pllim commented 5 years ago

The instructions in ginga/examples/jupyter-notebook/Jupyter Widget Ideas.ipynb said:

$ pip install ipyevents
$ jupyter nbextension enable --py --sys-prefix ipyevents

Is that still correct, @mwcraig ?

mwcraig commented 5 years ago

That is never incorrect, though in some cases it is unnecessary. In notebook v5.3 (or maybe 5.4) they introduced a directory-based scheme for installing notebook extensions that made it possible to install them via setup.py. ipyevents is set up to do that now so it shouldn't (in the future) require any extra steps.

The situation in jupyterlab is a little better because they decided to make all extensions npm packages and to use node/npm to handle the extension installation (instead of iterating through a couple years of custom installation approaches like with notebooks).

pllim commented 5 years ago

OK, I'll just leave it be for now then. Thanks for the clarifications!

ejeschke commented 5 years ago

Thanks, @mwcraig !