00001 # This file is part of repro, a Python package for automating 00002 # reproducible research in scientific computing. 00003 # 00004 # Copyright (C) 2008 Gilles Hennenfent, Sean Ross-Ross 00005 # 00006 # This program is free software: you can redistribute it and/or modify 00007 # it under the terms of the GNU General Public License as published by 00008 # the Free Software Foundation, either version 3 of the License, or 00009 # (at your option) any later version. 00010 # 00011 # This program is distributed in the hope that it will be useful, 00012 # but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 # GNU General Public License for more details. 00015 # 00016 # You should have received a copy of the GNU General Public License 00017 # along with this program. If not, see <http://www.gnu.org/licenses/>. 00018 00019 ## 00020 # 00021 # @package view 00022 # Provide one builder, View, to display documents of different types 00023 # (e.g., .pdf, .eps, .png, .jpeg). 00024 # 00025 # @page pg_displayblds Display data 00026 # 00027 # @section sec_viewbld View 00028 # 00029 # Defined in the view tool. Builder to display documents of different 00030 # types (e.g., .pdf, .eps, .png, .jpeg). 00031 # 00032 00033 from os import environ 00034 00035 ## 00036 # 00037 # @brief Alias target(s) of View to 'scons view'. 00038 # 00039 def view_emitter( target, source, env ): 00040 env.Default( source ) 00041 env.Alias( 'view',target) 00042 return target, source 00043 00044 ## 00045 # 00046 # @brief Define different Actions for different image file format and 00047 # add View builder to the environment. 00048 # 00049 # @todo Make an external tool for xtpen executable. 00050 # @todo Make an external tool for xpdf executable. 00051 # @todo Make an external tool for gv executable. 00052 # @todo Make an external tool for xv executable. 00053 # @todo Make an external tool for suximage executable. 00054 # 00055 def generate(env): 00056 00057 env["VPLVIEWER"] = 'xtpen' 00058 env["PDFVIEWER"] = 'xpdf' 00059 env["EPSVIEWER"] = 'gv' 00060 env["JPEGVIEWER"] = 'xv' 00061 env["PNGVIEWER"] = 'xv' 00062 env["SUVIEWER"] = 'suximage' 00063 00064 env["VIEWWAIT"] = True 00065 env["_VW"] = "${VIEWWAIT and ' ' or '&'}" 00066 00067 env['XIMAGEOPTS'] = "" 00068 00069 viewBuilder = env.Builder( action={ 00070 None : "$VIEWCMD $SOURCE ${_VW}", 00071 ".vpl":"$VPLVIEWER $SOURCE ${_VW}", 00072 ".pdf":"$PDFVIEWER $SOURCE ${_VW}", 00073 ".eps":"$EPSVIEWER $SOURCE ${_VW}", 00074 ".png":"$PNGVIEWER $SOURCE ${_VW}", 00075 ".jpeg":"$JPEGVIEWER $SOURCE ${_VW}", 00076 ".su":"$SUVIEWER <$SOURCE $XIMAGEOPTS ${_VW}"}, 00077 suffix=".view", 00078 single_source=1, 00079 emitter=view_emitter 00080 ) 00081 00082 env["BUILDERS"]['View'] = viewBuilder 00083 env["ENV"]['DISPLAY'] = environ['DISPLAY'] 00084 env["ENV"]['HOME'] = environ['HOME'] 00085 env["ENV"]['CWPROOT'] = environ.get('CWPROOT') 00086 00087 ## 00088 # 00089 # @brief Return True (this tool always exists). 00090 # 00091 def exists( env ): 00092 return 1 00093 00094