First time here? Check out the FAQ!

Ask Your Question
3

How to change the default program which open the 2D picture which the plot producted?

asked 13 years ago

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

I'm using SageMath4.7.2 in Ubuntu10.04. When I called the plot() to draw the 2D picture of some functions in command line of SageMath(not the GUI session in web browser), SageMath show the pictures in evince,which is my PDF files reader. My default picture viewer in Ubuntu is set to gpicview, not evince. When I delete the evince?SageMath call the ImageMagic to display the result. But I need evince to read ebooks, so I installed the evince again. After that the SageMath still call evince to display the 2D pictures. I wonder are there any method to change the default program to open the 2D pictures in SageMath? PS: My mother language is Chinese, not English, so please forgive me for my language errors. Thanks!

Preview: (hide)

3 Answers

Sort by » oldest newest most voted
2

answered 13 years ago

DSM gravatar image

updated 13 years ago

Hi! On Ubuntu, I think Sage finds xdg-open and uses that, so it'll use whatever xdg-open is set to use to view pngs.

It looks like Sage calls sage.misc.viewer.browser() instead of sage.misc.viewer.png_viewer() even when it knows that the file is a png.

You can change the default viewer by typing

sage.misc.viewer.BROWSER = 'gpicview'

at the command line. (This may cause problems for anything which uses BROWSER but which gpicview can't handle, though..)

UPDATE:

If you want this to be the new default setting, you can add the above line to ~/.sage/init.sage:

localhost-2:~ $ cat ~/.sage/init.sage
# personal options
sage.misc.viewer.BROWSER = 'gpicview'

The init.sage file is executed at startup time.

Preview: (hide)
link

Comments

Thank you for your help! It works perfectly! I'm sorry I didn't see the comment function so I posted 2 answers.

zwdnet gravatar imagezwdnet ( 13 years ago )

See also http://trac.sagemath.org/sage_trac/ticket/11795 for a modified way to accomplish this, which should allow for easy setting of viewers for PNG, PDF, and DVI, in addition to the BROWSER setting.

John Palmieri gravatar imageJohn Palmieri ( 13 years ago )

Thank you very much, John!

zwdnet gravatar imagezwdnet ( 13 years ago )
0

answered 13 years ago

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

Thank you very much! It works! But I still have a problem: When I typed sage.misc.viewer.BROWSER = 'gpicview' at the sage command line, and called plot to draw picture again, the display program was changed to gpicview. That's what I want. But when I typed "quit" to exit the sage and ran sage command again, the display program was backed to evince again! How to change the sage.misc.view.BROWSER value forever? Or do I need to type this every time when I run SageMath?

Preview: (hide)
link

Comments

I've updated the answer.

DSM gravatar imageDSM ( 13 years ago )
0

answered 13 years ago

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

Haha, I find the answer! Put the

sage.misc.viewer.BROWSER = 'gpicview'

in the $HOME/.sage/init.sage file (If there isn't init.sage, create it), so I needn't type it every time when I run SageMath. I fount the answer in this web

http://comments.gmane.org/gmane.comp....

by google! Thank DSM!

Preview: (hide)
link

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 13 years ago

Seen: 2,898 times

Last updated: Nov 29 '11