Author: bugman Date: Wed Sep 4 09:54:06 2013 New Revision: 20787 URL: http://svn.gna.org/viewcvs/relax?rev=20787&view=rev Log: Python 3 space fixes for the lib.software.grace.script_grace2images() function. As the script is encoded by strings, the 2to3 program cannot fix this script. Therefore the changes were made by hand. Modified: branches/relax_disp/lib/software/grace.py Modified: branches/relax_disp/lib/software/grace.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/lib/software/grace.py?rev=20787&r1=20786&r2=20787&view=diff ============================================================================== --- branches/relax_disp/lib/software/grace.py (original) +++ branches/relax_disp/lib/software/grace.py Wed Sep 4 09:54:06 2013 @@ -42,10 +42,10 @@ file.write("#!/usr/bin/env python\n") file.write("\n") file.write("import glob, os, sys\n") - file.write("import shlex,subprocess\n") + file.write("import shlex, subprocess\n") file.write("import optparse\n") file.write("\n") - file.write("# Define a callback function, for a multiple input of PNG,EPS,SVG\n") + file.write("# Define a callback function, for a multiple input of PNG, EPS, SVG\n") file.write("def foo_callback(option, opt, value, parser):\n") file.write(" setattr(parser.values, option.dest, value.split(','))\n") file.write("\n") @@ -60,14 +60,14 @@ file.write("args = parser.parse_args()\n") file.write("\n") file.write("# Lets print help if no arguments are passed\n") - file.write("if len(sys.argv)==1 or len(args[0].types)==0:\n") - file.write(" print('system argument is:',sys.argv)\n") + file.write("if len(sys.argv) == 1 or len(args[0].types) == 0:\n") + file.write(" print('system argument is:', sys.argv)\n") file.write(" parser.print_help()\n") file.write(" print('Performing a default PNG conversion')\n") file.write(" # If no input arguments, we make a default PNG option\n") file.write(" args[0].types = ['PNG']\n") file.write("\n") - file.write("# If we run through the GUI, we cannot pass input arguments, so we make a default PNG option\n") + file.write("# If we run through the GUI we cannot pass input arguments so we make a default PNG option\n") file.write("if args[0].relax_gui:\n") file.write(" args[0].types = ['PNG']\n") file.write("\n") @@ -76,12 +76,12 @@ file.write("# A easy search for files with *.agr, is to use glob, which is pathnames matching a specified pattern according to the rules used by the Unix shell, not opening a shell\n") file.write("gracefiles = glob.glob(\"*.agr\")\n") file.write("\n") - file.write("# For png conversion, several parameters can be passed to xmgrace. These can be altered later afterwards, and the script rerun. \n") - file.write("# The option for transparent is good for poster or insertion in color backgrounds. The ability for this, still depends on xmgrace compilation\n") + file.write("# For png conversion, several parameters can be passed to xmgrace. These can be altered later afterwards and the script rerun. \n") + file.write("# The option for transparent is good for poster or insertion in color backgrounds. The ability for this still depends on xmgrace compilation\n") file.write("if \"PNG\" in types:\n") file.write(" pngpar = \"png.par\"\n") file.write(" if not os.path.isfile(pngpar):\n") - file.write(" wpngpar = open(pngpar,\"w\")\n") + file.write(" wpngpar = open(pngpar, \"w\")\n") file.write(" wpngpar.write(\"DEVICE \\\"PNG\\\" FONT ANTIALIASING on\\n\")\n") file.write(" wpngpar.write(\"DEVICE \\\"PNG\\\" OP \\\"transparent:on\\\"\\n\")\n") file.write(" wpngpar.write(\"DEVICE \\\"PNG\\\" OP \\\"compression:9\\\"\\n\")\n") @@ -93,23 +93,23 @@ file.write(" fname = grace.split(\".agr\")[0]\n") file.write(" if (\"PNG\" in types or \".PNG\" in types or \"png\" in types or \".png\" in types):\n") file.write(" # Produce the argument string\n") - file.write(" im_args = r\"xmgrace -hdevice PNG -hardcopy -param %s -printfile %s.png %s\"%(pngpar,fname,grace)\n") - file.write(" # Split the arguments the right way, to call xmgrace\n") + file.write(" im_args = r\"xmgrace -hdevice PNG -hardcopy -param %s -printfile %s.png %s\" % (pngpar, fname, grace)\n") + file.write(" # Split the arguments the right way to call xmgrace\n") file.write(" im_args = shlex.split(im_args)\n") file.write(" return_code = subprocess.call(im_args)\n") file.write(" if (\"EPS\" in types or \".EPS\" in types or \"eps\" in types or \".eps\" in types):\n") - file.write(" im_args = r\"xmgrace -hdevice EPS -hardcopy -printfile %s.eps %s\"%(fname,grace)\n") + file.write(" im_args = r\"xmgrace -hdevice EPS -hardcopy -printfile %s.eps %s\" % (fname, grace)\n") file.write(" im_args = shlex.split(im_args)\n") file.write(" return_code = subprocess.call(im_args)\n") file.write(" if (\"JPG\" in types or \".JPG\" in types or \"jpg\" in types or \".jpg\" in types):\n") - file.write(" im_args = r\"xmgrace -hdevice JPEG -hardcopy -printfile %s.jpg %s\"%(fname,grace)\n") + file.write(" im_args = r\"xmgrace -hdevice JPEG -hardcopy -printfile %s.jpg %s\" % (fname, grace)\n") file.write(" im_args = shlex.split(im_args)\n") file.write(" if (\"JPEG\" in types or \".JPEG\" in types or \"jpeg\" in types or \".jpeg\" in types):\n") - file.write(" im_args = r\"xmgrace -hdevice JPEG -hardcopy -printfile %s.jpg %s\"%(fname,grace)\n") + file.write(" im_args = r\"xmgrace -hdevice JPEG -hardcopy -printfile %s.jpg %s\" % (fname, grace)\n") file.write(" im_args = shlex.split(im_args)\n") file.write(" return_code = subprocess.call(im_args)\n") file.write(" if (\"SVG\" in types or \".SVG\" in types or \"svg\" in types or \".svg\" in types):\n") - file.write(" im_args = r\"xmgrace -hdevice SVG -hardcopy -printfile %s.svg %s\"%(fname,grace)\n") + file.write(" im_args = r\"xmgrace -hdevice SVG -hardcopy -printfile %s.svg %s\" % (fname, grace)\n") file.write(" im_args = shlex.split(im_args)\n") file.write(" return_code = subprocess.call(im_args)\n")