Changes in / [16417bb:5047898] in sasview
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Fitting/ReportPageLogic.py
r5330be2 r085ee014 99 99 canvas = FigureCanvas(fig) 100 100 png_output = BytesIO() 101 102 # Create a "safe" location - system tmp103 tmp_file = tempfile.TemporaryFile(suffix=".png")104 101 try: 105 fig.savefig(tmp_file.name, dpi=75) 106 fig.savefig(png_output, dpi=75) 107 except PermissionError: 108 # sometimes one gets "permission denied" for temp files 109 # mainly on Windows 7 *gasp*. Let's try local directory 110 tmp_file = open("_tmp.png", "w+") 111 try: 112 fig.savefig(tmp_file.name, dpi=75) 113 fig.savefig(png_output, dpi=75) 114 except Exception as ex: 115 logging.error("Creating of the report failed: %s"%str(ex)) 116 return 117 118 data_to_print = png_output.getvalue() == open(tmp_file.name, 'rb').read() 119 tmp_file.close() 102 fig.savefig(png_output, format="png", dpi=75) 103 except PermissionError as ex: 104 logging.error("Creating of the report failed: %s"%str(ex)) 105 return 120 106 data64 = base64.b64encode(png_output.getvalue()) 121 107 data_to_print = urllib.parse.quote(data64) 122 123 108 feet = FEET_2 124 109 if sys.platform == "darwin": # Mac … … 126 111 html += feet.format(data_to_print) 127 112 html += ELINE 113 png_output.close() 128 114 del canvas 129 115 return html
Note: See TracChangeset
for help on using the changeset viewer.