This commit is contained in:
Mauricio Baeza 2019-09-16 14:25:08 -05:00
parent d3caa8e171
commit fed3f6a020
4 changed files with 34 additions and 7 deletions

View File

@ -173,10 +173,12 @@ def debug(info):
# ~ doc = app.newDoc(WRITER) # ~ doc = app.newDoc(WRITER)
# ~ out = OutputDoc(doc) # ~ out = OutputDoc(doc)
# ~ sys.stdout = out # ~ sys.stdout = out
pprint(info) # ~ pprint(info)
doc = LogWin(new_doc('writer').obj)
doc.write(info)
return return
log.debug(info) log.debug(str(info))
return return
@ -200,6 +202,11 @@ def run_in_thread(fn):
return run return run
def sleep(sec):
time.sleep(sec)
return
def _(msg): def _(msg):
L = LANGUAGE.split('-')[0] L = LANGUAGE.split('-')[0]
if L == 'en': if L == 'en':
@ -244,7 +251,10 @@ def get_dispatch():
def get_temp_file(): def get_temp_file():
return tempfile.NamedTemporaryFile() delete = True
if IS_WIN:
delete = False
return tempfile.NamedTemporaryFile(delete=delete)
def _path_url(path): def _path_url(path):

Binary file not shown.

View File

@ -54,7 +54,6 @@ class ZAZBarCode(unohelper.Base, XJobExecutor):
self._data = '' self._data = ''
self._type = '' self._type = ''
@app.catch_exception
def trigger(self, args): def trigger(self, args):
self._type = args self._type = args
if args == 'ask' and not self._get_values(): if args == 'ask' and not self._get_values():
@ -103,6 +102,8 @@ class ZAZBarCode(unohelper.Base, XJobExecutor):
return return
cell = cell.offset() cell = cell.offset()
if app.IS_WIN:
tf.close()
cell.insert_image(tf.name) cell.insert_image(tf.name)
tf.close() tf.close()
return return
@ -124,6 +125,8 @@ class ZAZBarCode(unohelper.Base, XJobExecutor):
self._show_error(result) self._show_error(result)
return return
if app.IS_WIN:
tf.close()
doc.insert_image(tf.name) doc.insert_image(tf.name)
tf.close() tf.close()
return return
@ -136,6 +139,8 @@ class ZAZBarCode(unohelper.Base, XJobExecutor):
self._show_error(result) self._show_error(result)
return return
if app.IS_WIN:
tf.close()
doc.insert_image(tf.name) doc.insert_image(tf.name)
tf.close() tf.close()
return return

View File

@ -143,6 +143,8 @@ def catch_exception(f):
try: try:
return f(*args, **kwargs) return f(*args, **kwargs)
except Exception as e: except Exception as e:
if IS_WIN:
debug(str(e))
log.error(f.__name__, exc_info=True) log.error(f.__name__, exc_info=True)
return func return func
@ -173,10 +175,12 @@ def debug(info):
# ~ doc = app.newDoc(WRITER) # ~ doc = app.newDoc(WRITER)
# ~ out = OutputDoc(doc) # ~ out = OutputDoc(doc)
# ~ sys.stdout = out # ~ sys.stdout = out
pprint(info) # ~ pprint(info)
doc = LogWin(new_doc('writer').obj)
doc.write(info)
return return
log.debug(info) log.debug(str(info))
return return
@ -200,6 +204,11 @@ def run_in_thread(fn):
return run return run
def sleep(sec):
time.sleep(sec)
return
def _(msg): def _(msg):
L = LANGUAGE.split('-')[0] L = LANGUAGE.split('-')[0]
if L == 'en': if L == 'en':
@ -244,7 +253,10 @@ def get_dispatch():
def get_temp_file(): def get_temp_file():
return tempfile.NamedTemporaryFile() delete = True
if IS_WIN:
delete = False
return tempfile.NamedTemporaryFile(delete=delete)
def _path_url(path): def _path_url(path):