poliastro / czml3

Python 3 library to write CZML
https://pypi.org/project/czml3/
MIT License
40 stars 33 forks source link

Fixes #64 #92

Open niharsalunke opened 3 years ago

niharsalunke commented 3 years ago

Made some changes to fix bug #64.

Hi @astrojuanlu, I was able to solve the missing earth problem. We need to generate a Cesium ion token before can proceed to display plots. To generate a free token, I followed this link . And after that, I also made a few modifications to the widgets.py file. Everything seems to be working now.

However, with the fullscreen issue, I have worked up to a point where if you perform "cesium_widget_object.fullscreen()" in a python code, you will be able to trigger the fullscreen mode of the canvas.

I was not satisfied here so I tried to write a bit of javascript event listener code in the CESIUM_TPL string of widgets.py and tried to bind the event listeners on the fullscreen button. Now the functions are being triggered correctly. Meaning, if you click on the "fullscreen" button of the CZMLWidget, a JavaScript code responsible to "FULLSCREEN-ize" the canvas gets triggered. But after all this, I got this error: "Failed to execute 'requestFullscreen' on 'Element': API can only be initiated by a user gesture."

This is not easily solvable since it will require external permissions. More here.

In the example file, I have included a basic example demonstrating how a simple widget-plot can be generated and how it can be switched to full-screen mode and back.

Example: image

Fullscreen mode after executing feature example_widget.request_full_screen(): image

niharsalunke commented 3 years ago

Hi @astrojuanlu , I have removed the JS code which was being bound at runtime. It wasn't helping and I believe that it's not the standard practice. I went through the complete documentation of attrs as you had suggested and found it to be very helpful. Now, I have implemented the earlier procedure but with the help of attrs.

However, I am struggling to pass any test beyond refactor and quality. It is because I am unable to import the 'IPython' module while running the test. The test always throws an error saying "IPython not found". I had mentioned it in the tox.ini and mypy.ini files but that won't help either.

Could you please help me here? Many Thanks.

astrojuanlu commented 3 years ago

Hi @astrojuanlu, I was able to solve the missing earth problem. We need to generate a Cesium ion token before can proceed to display plots. To generate a free token, I followed this link .

Just a clarification: it's not mandatory to have an Ion token to display the Earth. The user either needs to:

I don't think we should change any of that. If anything, we should document it (feel free to open an issue about it)