Ask Your Question
1

About sage.plot.plot.EMBEDDED_MODE

asked 2018-06-28 21:26:31 +0100

mmmm1998 gravatar image

Cantor program used sage-cli, and in this program there is need to disable external viewers. I found sage variable, which, I hope, will do it: sage.plot.plot.EMBEDDED_MODE.

But after setting sage.plot.plot.EMBEDDED_MODE to True I haven't any changes: external viewer starts, for example, for plots.

But in src/sage/structure/graphics_file.py on line 161 we have launch_viewer function, which, I think, start external viewer and where there is this condition:


from sage.plot.plot import EMBEDDED_MODE
if EMBEDDED_MODE:
    raise RuntimeError('should never launch viewer in embedded mode')

So, as I see, if sage.plot.plot.EMBEDDED_MODE is True, we don't start external viewer, because we exit from function launc_viewer with RuntimeError. But sage works fine with EMBEDDED_MODE = True. Could anyone explain this behavior, is it a bug with sage.plot.plot.EMBEDDED_MODE or I am wrong?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-07-06 14:02:44 +0100

vdelecroix gravatar image

updated 2018-07-06 14:06:23 +0100

You should be using

sage: from sage.repl.rich_output import get_display_manager
sage: dm = get_display_manager()
sage: dm.preferences.graphics='disable'

The other possibilities for graphics are 'raster' (for png) and 'vector' (for pdf).

The EMBEDDED_MODE is probably a left over of older Sage versions.

EDIT: you probably want to create a backend_cantor.py modeled on the various backend_XXX.py in $SAGE_ROOT/src/sage/repl/rich_output/ (see e.g. on github).

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2018-06-28 21:26:31 +0100

Seen: 571 times

Last updated: Jul 06 '18