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

Groovy output browser #82

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

SPalominos
Copy link
Contributor

Add an output browser for groovy, which is passed to the script into the bindings.

The browser is shown using the menu windows/shows view/other, and in the popup open other/Groovy Output Browser.
For now, only one single browser can be shown.

An handler for this browser is pass through the script bindings under the name browser.
This handler has the setText(String) methods because it should call Display.getCurrent().asyncExec(...) in order to update the SWT composite in the good thread.

An example of non working Demat script (the browser is not able to find the vega javascripts, so @ebocher if you want to fix it...)

@GrabResolver(name='orbisgis', root='https://oss.sonatype.org/content/repositories/snapshots')
@Grab(group='org.orbisgis', module='demat', version='0.0.7-SNAPSHOT')

import static org.orbisgis.demat.Plot.*
def chart = Chart(Data([
                ["a": "A", "b": 28], ["a": "B", "b": 55], ["a": "C", "b": 43],
                ["a": "D", "b": 91], ["a": "E", "b": 81], ["a": "F", "b": 53],
                ["a": "G", "b": 19], ["a": "H", "b": 87], ["a": "I", "b": 52]])).mark_bar().
                encode(X("a").nominal(), Y("b").quantitative())
chart.show()

def file = new File("/tmp/tempChart.html")
chart.save(file, true) 
browser.setText(file.text)

@ebocher
Copy link
Member

ebocher commented Mar 17, 2022

That's very interesting. I'll look on it. Thanks a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants