Skip to content

Update scene.py for display_type "none" bug#6

Open
jadenecke wants to merge 1 commit into
teanijarv:mainfrom
jadenecke:patch-1
Open

Update scene.py for display_type "none" bug#6
jadenecke wants to merge 1 commit into
teanijarv:mainfrom
jadenecke:patch-1

Conversation

@jadenecke
Copy link
Copy Markdown
Contributor

using display_type='none' would not render because the offscreen renderer flag would not be set.

code to reproduce error:

import yabplot
yabplot.plot_tracts(atlas='xtract_tiny', display_type='none', export_path="testTract.png")

results in

RuntimeError: Nothing to screenshot - call .show first or use the off_screen argument

I think it was just missing the off_screen flag if 'none' was specified in the plotter call, at least that seemed to fix it for me.

@jadenecke
Copy link
Copy Markdown
Contributor Author

I think this is not perfect yet, as the fix only allows for the exporting if the display_type is 'none'. However, otherwise the finalize_plot functionality needs to be reworked as the screenshot can not be taken before either a .show or a .render command is called, but the show opens the window, and the render requires the background flag to be set to true.
So far, the only solution I can think of is to create two plotters, one for the screenshot and the other for the viewer, but that doubles the compute time and that is not ideal. I don't know if there is a way to call the screenshot on the plotter somehow reactively, the moment the plotter calls show, or something like that.

@teanijarv
Copy link
Copy Markdown
Owner

I couldn't reproduce the error. It seems to be working for me currently too even though the changes you made make sense I think. Are you with the latest version bc I made some changes in there I think with the latest release

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