Borrar temporales

This commit is contained in:
Mauricio Baeza 2018-02-05 23:59:49 -06:00
parent f90539df82
commit d3419b5878
1 changed files with 19 additions and 8 deletions

View File

@ -917,13 +917,17 @@ class LIBO(object):
self._set_cell('{timbre.%s}' % k, v)
pd = self._sheet.getDrawPage()
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)
properties = self._set_properties({'URL': self._path_url(data['path_cbb'])})
image.Graphic = gp.queryGraphic(properties)
s = Size()
s.Width = 4150
s.Height = 4500
image.setSize(s)
image.Anchor = self._set_cell('{timbre.cbb}')
_kill(data['path_cbb'])
return
def _donataria(self, data):
@ -1046,19 +1050,25 @@ class LIBO(object):
self._template.setPrinter(self._set_properties({'PaperFormat': LETTER}))
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), ())
if ods:
return self._read(path)
data = self._read(path)
_kill(path)
return data
doc = self._doc_open(path, {'Hidden': True})
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.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):
try:
@ -1351,7 +1361,8 @@ def to_letters(value, moneda):
def get_qr(data):
path = tempfile.mkstemp()[1]
# ~ path = tempfile.mkstemp()[1]
path = get_path_temp('.qr')
qr = pyqrcode.create(data, mode='binary')
qr.png(path, scale=7)
return path
@ -1743,8 +1754,8 @@ def get_path_info(path):
return (path, filename, name, extension)
def get_path_temp():
return tempfile.mkstemp()[1]
def get_path_temp(s=''):
return tempfile.mkstemp(s)[1]
def get_date(value, next_day=False):