pdf con scl

parent fb432ee0
...@@ -121,6 +121,12 @@ ...@@ -121,6 +121,12 @@
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading">{{ Viewname }}</div> <div class="panel-heading">{{ Viewname }}</div>
<div class="panel-body text-center"> <div class="panel-body text-center">
<div class="row col-md-1 pull-right ">
<a class="btn btn-success btn-sm col-md-6 col-sm-6 col-xs-6 col-lg-6 col-xl-6">New</a>
<br>
<br>
</div>
<table data-toggle="table" id="example" class="table table-striped table-bordered" <table data-toggle="table" id="example" class="table table-striped table-bordered"
style="width:100%"> style="width:100%">
<thead> <thead>
......
...@@ -19,17 +19,17 @@ from GeoInt_SIDT.settings import BASE_URL ...@@ -19,17 +19,17 @@ from GeoInt_SIDT.settings import BASE_URL
from administration.views import best_unit_size from administration.views import best_unit_size
from catalog.models import Purchase from catalog.models import Purchase
from reportlab.pdfgen.canvas import Canvas
from reportlab.lib.pagesizes import letter from reportlab.lib.pagesizes import letter
from reportlab.lib.styles import getSampleStyleSheet from reportlab.lib.styles import getSampleStyleSheet
from reportlab.lib.units import inch from reportlab.lib.units import inch
from reportlab.lib import colors from reportlab.lib import colors
from reportlab.platypus import Paragraph, Frame, Spacer, Image, Table, TableStyle, SimpleDocTemplate, PageBreak from reportlab.platypus import Paragraph, Frame, Spacer, Image, Table, TableStyle, SimpleDocTemplate, PageBreak
from reportlab.graphics.charts.barcharts import VerticalBarChart from reportlab.graphics.charts.barcharts import VerticalBarChart
from reportlab.graphics.shapes import Drawing, String from reportlab.graphics.shapes import Drawing
from reportlab.graphics.charts.textlabels import Label, LabelOffset
from reportlab.graphics.charts.legends import Legend from reportlab.graphics.charts.legends import Legend
# ------------------------------------------------------------------------------- # -------------------------------------------------------------------------------
########### lee archivo de configuración ################ ########### lee archivo de configuración ################
...@@ -334,6 +334,19 @@ def dataToTable(name, data): ...@@ -334,6 +334,19 @@ def dataToTable(name, data):
data.insert(0, name) data.insert(0, name)
return data return data
def mergeimages(path,file):
from PIL import Image
layer1 = Image.open(path + file[:8] + "_SCL_60m_0.tif")
for i in range(10):
print (file[:8] + "_SCL_60m_" + str(i) + ".tif")
layer2 = Image.open(path + file[:8] + "_SCL_60m_" + str(i) + ".tif")
nueva = Image.alpha_composite(layer1, layer2)
layer1 = nueva
nueva.save(path + file[:8] + "_SCL_60m_10.tif")
return path+file[:8]+"_SCL_60m_10.tif"
# create the table for our document # create the table for our document
def myTable(path1, path2, basefile): def myTable(path1, path2, basefile):
...@@ -351,8 +364,10 @@ def myTable(path1, path2, basefile): ...@@ -351,8 +364,10 @@ def myTable(path1, path2, basefile):
if file.startswith(basefile[:8]): if file.startswith(basefile[:8]):
if file.endswith('.tif') and not file.endswith('0.tif'): if file.endswith('.tif') and not file.endswith('0.tif'):
# image2 = Image(path2 + file, height=300, width=200, mask='auto') if image1.imageWidth < image1.imageHeight:
image3 = image2 image3 = Image(mergeimages(path2, file), height=300, width=200, mask='auto')
else:
image3 = Image(mergeimages(path2, file), height=150, width=400, mask='auto')
if image1.imageWidth < image1.imageHeight: if image1.imageWidth < image1.imageHeight:
data = [['TCI', 'SCL'], [image2, image3]] data = [['TCI', 'SCL'], [image2, image3]]
...@@ -622,7 +637,6 @@ def wsEditTitle(request): ...@@ -622,7 +637,6 @@ def wsEditTitle(request):
purchase.name = request.GET.get("zone") purchase.name = request.GET.get("zone")
purchase.description = request.GET.get("description") purchase.description = request.GET.get("description")
purchase.save() purchase.save()
print ("hola")
return HttpResponse("hola") return HttpResponse("hola")
else: else:
raise Http404 raise Http404
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