--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sympy-patches" group. To post to this group, send email to sympy-patches@googlegroups.com To unsubscribe from this group, send email to sympy-patches+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sympy-patches?hl=en -~----------~----~----~----~------~----~------~--~---
>From 0bdcb1052079fdc1fd3d397bccc6511f266ee790 Mon Sep 17 00:00:00 2001 From: Priit Laes <pl...@plaes.org> Date: Sun, 8 Nov 2009 18:58:02 +0200 Subject: [PATCH] Add xdg-open to the list of print preview viewers. xdg-open opens file or URL in user's preferred application. Also fix some typos and use better wording and clean up duplicates in the list of viewers. Signed-off-by: Priit Laes <pl...@plaes.org> --- sympy/printing/preview.py | 29 +++++++++++++++-------------- 1 files changed, 15 insertions(+), 14 deletions(-) diff --git a/sympy/printing/preview.py b/sympy/printing/preview.py index f913b71..9dcc744 100644 --- a/sympy/printing/preview.py +++ b/sympy/printing/preview.py @@ -9,13 +9,13 @@ def preview(expr, output='png', viewer=None, euler=True): """View expression in PNG, DVI, PostScript or PDF form. This will generate LaTeX representation of the given expression - and compile it using available TeX distribiution. Then it will + and compile it using available TeX distribution. Then it will run appropriate viewer for the given output format or use the - user defined one. If you prefer not to use external viewer - then you can use combination of 'png' output and 'pyglet' + user-defined one. If you prefer not to use an external viewer + then you can use a combination of 'png' output and 'pyglet' viewer. By default png output is generated. - By default pretty Euler fonts are used for typesetting (they + By default, pretty Euler fonts are used for typesetting (they were used to typeset the well known "Concrete Mathematics" book). If you prefer default AMS fonts or your system lacks 'eulervm' LaTeX package then unset 'euler' keyword argument. @@ -27,25 +27,25 @@ def preview(expr, output='png', viewer=None, euler=True): >> preview(x + y, output='png') - This will choose 'pyglet by default. To select different one:: + Previous example will use 'pyglet by default. To select different one:: >> preview(x + y, output='png', viewer='gimp') The 'png' format is considered special. For all other formats - the rules are sligtly different. As an example we will take - 'dvi' output format. If you would run:: + the rules are slightly different. As an example we will take + the 'dvi' output format. If you would run:: >> preview(x + y, output='dvi') - then 'view' will look for available 'dvi' viewers on your + then 'viewer' will look for available 'dvi' viewers on your system (predefined in the function, so it will try evince, first, then kdvi and xdvi). If nothing is found you will need to set the viewer explicitely:: - >> preview(x + y, output='dvi', viewer='superior-dvi-viwer') + >> preview(x + y, output='dvi', viewer='superior-dvi-viewer') - This will skip auto-dection and will run user specified - 'superior-dvi-viwer'. If 'view' fails to find it on + This will skip auto-detection and will run user specified + 'superior-dvi-viewer'. If 'viewer' fails to find it on your system it will gracefully raise an exception. Currently this depends on pexpect, which is not available for windows. @@ -63,10 +63,11 @@ def preview(expr, output='png', viewer=None, euler=True): else: # sorted in order from most pretty to most ugly # very discussable, but indeed 'gv' looks awful :) + basic = [ "xdg-open", "evince", "okular"] candidates = { - "dvi" : [ "evince", "okular", "kdvi", "xdvi" ], - "ps" : [ "evince", "okular", "gsview", "gv" ], - "pdf" : [ "evince", "okular", "kpdf", "acroread", "xpdf", "gv" ], + "dvi" : basic + [ "kdvi", "xdvi" ], + "ps" : basic + [ "gsview", "gv" ], + "pdf" : basic + [ "kpdf", "acroread", "xpdf", "gv" ], } try: -- 1.6.5.2