Commit 12210f5c authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Merge branch '4-chrome' into 'master'

4 chrome

* Require `plugin_dbui` 0.8.0
* Minor modification to run with the navigator Chrome.
* Close #4 and others issues appearing in the forum.

See merge request !51
parents d5499bc4 534b4bef
......@@ -2,6 +2,7 @@
""" Controllers for building graphs using pandas library
"""
import base64
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
......@@ -90,4 +91,9 @@ def index():
extension = request.extension
fmt = "svg" if extension == "html" else extension
return dict(data=savefig(ax.get_figure(), fmt))
# base64 string encoding
data = savefig(ax.get_figure(), fmt)
if fmt in ("pdf", "png"):
data = base64.b64encode(data)
return dict(data=data)
......@@ -101,8 +101,11 @@
// instantiate the grid with a summary row.
// data can be extracted via the plugin pGridExport
//
var grid = Ext.create('Ext.grid.Panel', {
plugins: ['pGridExport'],
var grid = Ext.create('App.grid.Panel', {
plugins: [{
fileRoot: 'metrics',
ptype:'pGridExport'
}],
store: Ext.create('Ext.data.ArrayStore', cfgStore),
columns: columns,
features: [{ftype:'summary'}],
......
......@@ -4,6 +4,7 @@
# Converte to transform a tex file generate by a view as a pdf file
#
#--------------------------------------------------------------------------
import base64
import cStringIO
import os
......@@ -43,21 +44,23 @@
call(cmd, stdout=TemporaryFile())
#
# copy the pdf in the new response
# copy the pdf into a base64 string
#
response.headers['Content-Type']='application/pdf'
fn_pdf = '%s.pdf' % fn
if os.path.exists(fn_pdf):
fi = open(fn_pdf, 'rb')
response.write(fi.read(), escape=False)
data = fi.read()
fi.close()
else:
response.write("\nThe generation of the PDF file failed.", escape=False)
response.write("\nPlease, check the LaTeX file.", escape=False)
data = "\nThe generation of the PDF file failed."
data += "\nPlease, check the LaTeX file."
pass
s64 = base64.b64encode(data)
#
# clean files
# cleaning
#
for ext in ('aux', 'log', 'out', 'pdf', 'tex'):
f = '%s.%s' % (fn, ext)
......@@ -66,8 +69,11 @@
pass
pass
os.chdir(cwd)
#
# go back to the web2py main directory
# Prepare the response
#
os.chdir(cwd)
response.headers['Content-Type']='application/pdf'
response.write(s64, escape=False)
}}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment