2222class PlotThatLutException (Exception ):
2323 pass
2424
25+
2526def set_matplotlib_backend ():
2627 """ Select display backend
2728
@@ -61,10 +62,10 @@ def show_plot(fig, filename):
6162 split_filename [1 ].replace ("." , "_" ))
6263 export_path = 'img/export_{0}.png' .format (filename )
6364 fig .savefig (export_path )
64- return """
65- <img src="/{0}"" width="640" height="480"
66- border="0"/>
67- """ .format (export_path )
65+ return (
66+ ' <img src="/{0}" width="640" height="480"'
67+ ' border="0"/>'
68+ ) .format (export_path )
6869 else :
6970 matplotlib .pyplot .show ()
7071 return ""
@@ -232,21 +233,19 @@ def help():
232233 str.
233234
234235 """
235- return """
236- ----
237- plot_that_lut.py <path to a LUT>
238- dispay a cube ({0} segments) for 3D LUTs and matrixes
239- or a curve ({1} points) for 1D/2D LUTs.
240-
241- plot_that_lut.py <path to a LUT> curve [points count]
242- display a curve with x points (default value : {2}).
243-
244- plot_that_lut.py <path to a LUT> cube [cube size]
245- display a cube with x segments (default value : {3}).
236+ return (
237+ "----\n "
238+ "plot_that_lut.py <path to a LUT>\n "
239+ " dispay a cube ({0} segments) for 3D LUTs and matrixes\n "
240+ " or a curve ({1} points) for 1D/2D LUTs.\n "
246241
247- {4}
248- """ .format (DEFAULT_CUBE_SIZE , DEFAULT_SAMPLE , DEFAULT_SAMPLE ,
249- DEFAULT_CUBE_SIZE , supported_formats ())
242+ "plot_that_lut.py <path to a LUT> curve [points count]\n "
243+ " display a curve with x points (default value : {2}).\n "
244+ " plot_that_lut.py <path to a LUT> cube [cube size]\n "
245+ " display a cube with x segments (default value : {3}).\n "
246+ "\n {4}"
247+ ).format (DEFAULT_CUBE_SIZE , DEFAULT_SAMPLE , DEFAULT_SAMPLE ,
248+ DEFAULT_CUBE_SIZE , supported_formats ())
250249
251250
252251def plot_that_lut (lutfile , plot_type = None , count = None ):
@@ -268,10 +267,10 @@ def plot_that_lut(lutfile, plot_type=None, count=None):
268267 # check if LUT format is supported
269268 fileext = os .path .splitext (lutfile )[1 ]
270269 if not fileext :
271- raise PlotThatLutException ("""
272- Error: Couldn't extract extension in this
273- path : {0}
274- """ .format (lutfile ))
270+ raise PlotThatLutException ((
271+ " Error: Couldn't extract extension in this\n "
272+ " path : {0}"
273+ ) .format (lutfile ))
275274 if fileext not in OCIO_LUTS_FORMATS :
276275 raise PlotThatLutException ("Error: {0} file aren't supported.\n {1}"
277276 .format (fileext , supported_formats ()))
@@ -296,9 +295,10 @@ def plot_that_lut(lutfile, plot_type=None, count=None):
296295 elif plot_type == 'cube' :
297296 return plot_cube (lutfile , count , processor )
298297 else :
299- raise PlotThatLutException ("""Unknown plot type : {0}
300- Plot type should be curve or cube.\n {1}
301- """ .format (plot_type , help ()))
298+ raise PlotThatLutException ((
299+ "Unknown plot type : {0}\n "
300+ "Plot type should be curve or cube.\n {1}"
301+ ).format (plot_type , help ()))
302302
303303if __name__ == '__main__' :
304304 """ Command line interface for plot_that_lut
0 commit comments