devbisme / myhdlpeek

Monitor and display signal waveforms from your MyHDL/nMigen digital design in a Jupyter notebook.
MIT License
39 stars 8 forks source link

Unable to get horizontal scrolling for to_wavedom() to work #6

Open etch32 opened 5 years ago

etch32 commented 5 years ago

Hi I am running peeker_options,ipynb in examples directory. The example for horizontal scrolling, doesn't display any output unless I comment the line #Peeker.clear_traces(). If I comment this line output will display but is compressed to width of browser with no scroll bars.

import myhdlpeek
myhdlpeek.USE_JUPYTERLAB = False
Peeker.clear_traces()
Simulation(add_1, test(100), *Peeker.instances()).run()
Peeker.to_wavedrom(signals, width=4000)
Peeker.clear_traces()

The other examples in this notebook render fine but they do display the following Javascript error which may be related:

Javascript error adding output!
TypeError: Cannot read property 'removeChild' of null
See your browser Javascript console for more details.

Here's the Console error detail

main.min.js:34573 
TypeError: Cannot read property 'removeChild' of null
    at m (main.min.js:2)
    at Re (main.min.js:2)
    at w.fn.init.append (main.min.js:2)
    at OutputArea._safe_append (main.min.js:34570)
    at OutputArea.append_execute_result (main.min.js:34607)
    at OutputArea.append_output (main.min.js:34439)
    at OutputArea.handle_output (main.min.js:34370)
    at output (main.min.js:36214)
    at Kernel._handle_output_message (main.min.js:37973)
    at i (main.min.js:2)

outputarea.js:460 
TypeError: Cannot read property 'removeChild' of null
    at m (jquery.min.js:2)
    at Re (jquery.min.js:2)
    at w.fn.init.append (jquery.min.js:2)
    at OutputArea._safe_append (outputarea.js:457)
    at OutputArea.append_execute_result (outputarea.js:494)
    at OutputArea.append_output (outputarea.js:326)
    at OutputArea.handle_output (outputarea.js:257)
    at output (codecell.js:391)
    at Kernel._handle_output_message (kernel.js:1196)
    at i (jquery.min.js:2)

Finally, my setup: Ubuntu 18.04,

Software    Version
Python  3.5.6 64bit [GCC 7.3.0]
IPython 6.5.0
OS  Linux 4.15.0 58 generic x86_64 with debian buster sid
myhdl   0.11
myhdlpeek   0.0.8
Fri Aug 16 10:20:14 2019 PDT

Have also tried on Windows 10, python 3.7 (am running 3.5 due to pygmyhdl issue with byteplay3), jupyter lab vs notebook, firefox v chrome

xesscorp commented 5 years ago

Thanks for the detailed bug report. I created an Ubuntu 18.04 VM with the software versions you listed and I got the same behavior.

You were on the right track by setting myhdlpeek.USE_JUPYTERLAB = False. I did the same but it had no effect. I'm wondering if that ever worked. I had to go directly into the myhdlpeek.py file and set USE_JUPYTERLAB to False in order to get the scrolling to work and also to eliminate the Javascript errors.

Obviously, there needs to be a setter function in myhdlpeek.py for setting the USE_JUPYTERLAB flag.

etch32 commented 5 years ago

Thanks for your quick reply. I was able to get scrolling to work in jupyter notebook by setting USE_JUPYTERFLAG=False in myhdlpeek.py as you said. Still no luck with jupyter lab no matter which setting but at least I have a way to view scrolling (and eliminate the other js errors) in notebook.

etch32 commented 5 years ago

Hi, I just wanted to confirm that you were also able to replicate "no scrolling" behaviour in jupyter lab (with of course the default myhdlpeek.USE_JUPYTERLAB = True; i.e. no edits). I can get it to work in jupyter notebook by applying the edit directly to myhdlpeek.py but is there a work around for jupyter lab? (Or maybe it just works for you in jupyter lab?).

xesscorp commented 5 years ago

I'll try Jupyter Lab tomorrow. If it's not working for you, then I'm betting there's something wrong with the wavedrom function that I'm calling when USE_JUPYTERLAB is True.

etch32 commented 5 years ago

OK cool. Thanks for looking into it

xesscorp commented 5 years ago

The scrolling isn't working with Jupyter Lab. Looking at the nbwavedrom code, it does appear to handle the width parameter. I'll have to look deeper to see why it is ignored.