forked from elmau/empresa-libre
Borrar temporales
This commit is contained in:
parent
f90539df82
commit
d3419b5878
|
@ -917,13 +917,17 @@ class LIBO(object):
|
||||||
self._set_cell('{timbre.%s}' % k, v)
|
self._set_cell('{timbre.%s}' % k, v)
|
||||||
pd = self._sheet.getDrawPage()
|
pd = self._sheet.getDrawPage()
|
||||||
image = self._template.createInstance('com.sun.star.drawing.GraphicObjectShape')
|
image = self._template.createInstance('com.sun.star.drawing.GraphicObjectShape')
|
||||||
image.GraphicURL = data['path_cbb']
|
gp = self._create_instance('com.sun.star.graphic.GraphicProvider')
|
||||||
|
# ~ image.GraphicURL = data['path_cbb']
|
||||||
pd.add(image)
|
pd.add(image)
|
||||||
|
properties = self._set_properties({'URL': self._path_url(data['path_cbb'])})
|
||||||
|
image.Graphic = gp.queryGraphic(properties)
|
||||||
s = Size()
|
s = Size()
|
||||||
s.Width = 4150
|
s.Width = 4150
|
||||||
s.Height = 4500
|
s.Height = 4500
|
||||||
image.setSize(s)
|
image.setSize(s)
|
||||||
image.Anchor = self._set_cell('{timbre.cbb}')
|
image.Anchor = self._set_cell('{timbre.cbb}')
|
||||||
|
_kill(data['path_cbb'])
|
||||||
return
|
return
|
||||||
|
|
||||||
def _donataria(self, data):
|
def _donataria(self, data):
|
||||||
|
@ -1046,19 +1050,25 @@ class LIBO(object):
|
||||||
self._template.setPrinter(self._set_properties({'PaperFormat': LETTER}))
|
self._template.setPrinter(self._set_properties({'PaperFormat': LETTER}))
|
||||||
self._render(data)
|
self._render(data)
|
||||||
|
|
||||||
path = '{}.ods'.format(tempfile.mkstemp()[1])
|
# ~ path = '{}.ods'.format(tempfile.mkstemp()[1])
|
||||||
|
path = get_path_temp('.ods')
|
||||||
self._template.storeToURL(self._path_url(path), ())
|
self._template.storeToURL(self._path_url(path), ())
|
||||||
if ods:
|
if ods:
|
||||||
return self._read(path)
|
data = self._read(path)
|
||||||
|
_kill(path)
|
||||||
|
return data
|
||||||
|
|
||||||
doc = self._doc_open(path, {'Hidden': True})
|
doc = self._doc_open(path, {'Hidden': True})
|
||||||
options = {'FilterName': 'calc_pdf_Export'}
|
options = {'FilterName': 'calc_pdf_Export'}
|
||||||
path = tempfile.mkstemp()[1]
|
# ~ path = tempfile.mkstemp()[1]
|
||||||
|
path = get_path_temp('.pdf')
|
||||||
doc.storeToURL(self._path_url(path), self._set_properties(options))
|
doc.storeToURL(self._path_url(path), self._set_properties(options))
|
||||||
doc.close(True)
|
doc.close(True)
|
||||||
self._template.close(True)
|
self._template.close(True)
|
||||||
|
|
||||||
return self._read(path)
|
data = self._read(path)
|
||||||
|
_kill(path)
|
||||||
|
return data
|
||||||
|
|
||||||
def _get_data(self, doc, name=0):
|
def _get_data(self, doc, name=0):
|
||||||
try:
|
try:
|
||||||
|
@ -1351,7 +1361,8 @@ def to_letters(value, moneda):
|
||||||
|
|
||||||
|
|
||||||
def get_qr(data):
|
def get_qr(data):
|
||||||
path = tempfile.mkstemp()[1]
|
# ~ path = tempfile.mkstemp()[1]
|
||||||
|
path = get_path_temp('.qr')
|
||||||
qr = pyqrcode.create(data, mode='binary')
|
qr = pyqrcode.create(data, mode='binary')
|
||||||
qr.png(path, scale=7)
|
qr.png(path, scale=7)
|
||||||
return path
|
return path
|
||||||
|
@ -1743,8 +1754,8 @@ def get_path_info(path):
|
||||||
return (path, filename, name, extension)
|
return (path, filename, name, extension)
|
||||||
|
|
||||||
|
|
||||||
def get_path_temp():
|
def get_path_temp(s=''):
|
||||||
return tempfile.mkstemp()[1]
|
return tempfile.mkstemp(s)[1]
|
||||||
|
|
||||||
|
|
||||||
def get_date(value, next_day=False):
|
def get_date(value, next_day=False):
|
||||||
|
|
Loading…
Reference in New Issue