diff --git a/easymacro.py b/easymacro.py index e6ca331..15ea311 100644 --- a/easymacro.py +++ b/easymacro.py @@ -173,10 +173,12 @@ def debug(info): # ~ doc = app.newDoc(WRITER) # ~ out = OutputDoc(doc) # ~ sys.stdout = out - pprint(info) + # ~ pprint(info) + doc = LogWin(new_doc('writer').obj) + doc.write(info) return - log.debug(info) + log.debug(str(info)) return @@ -200,6 +202,11 @@ def run_in_thread(fn): return run +def sleep(sec): + time.sleep(sec) + return + + def _(msg): L = LANGUAGE.split('-')[0] if L == 'en': @@ -244,7 +251,10 @@ def get_dispatch(): def get_temp_file(): - return tempfile.NamedTemporaryFile() + delete = True + if IS_WIN: + delete = False + return tempfile.NamedTemporaryFile(delete=delete) def _path_url(path): diff --git a/files/ZAZBarCode_v0.2.1.oxt b/files/ZAZBarCode_v0.2.1.oxt index e438544..9f3ed56 100644 Binary files a/files/ZAZBarCode_v0.2.1.oxt and b/files/ZAZBarCode_v0.2.1.oxt differ diff --git a/source/ZAZBarCode.py b/source/ZAZBarCode.py index d068ad3..0b0557e 100644 --- a/source/ZAZBarCode.py +++ b/source/ZAZBarCode.py @@ -54,7 +54,6 @@ class ZAZBarCode(unohelper.Base, XJobExecutor): self._data = '' self._type = '' - @app.catch_exception def trigger(self, args): self._type = args if args == 'ask' and not self._get_values(): @@ -103,6 +102,8 @@ class ZAZBarCode(unohelper.Base, XJobExecutor): return cell = cell.offset() + if app.IS_WIN: + tf.close() cell.insert_image(tf.name) tf.close() return @@ -124,6 +125,8 @@ class ZAZBarCode(unohelper.Base, XJobExecutor): self._show_error(result) return + if app.IS_WIN: + tf.close() doc.insert_image(tf.name) tf.close() return @@ -136,6 +139,8 @@ class ZAZBarCode(unohelper.Base, XJobExecutor): self._show_error(result) return + if app.IS_WIN: + tf.close() doc.insert_image(tf.name) tf.close() return diff --git a/source/pythonpath/easymacro.py b/source/pythonpath/easymacro.py index e6ca331..a5bb2ea 100644 --- a/source/pythonpath/easymacro.py +++ b/source/pythonpath/easymacro.py @@ -143,6 +143,8 @@ def catch_exception(f): try: return f(*args, **kwargs) except Exception as e: + if IS_WIN: + debug(str(e)) log.error(f.__name__, exc_info=True) return func @@ -173,10 +175,12 @@ def debug(info): # ~ doc = app.newDoc(WRITER) # ~ out = OutputDoc(doc) # ~ sys.stdout = out - pprint(info) + # ~ pprint(info) + doc = LogWin(new_doc('writer').obj) + doc.write(info) return - log.debug(info) + log.debug(str(info)) return @@ -200,6 +204,11 @@ def run_in_thread(fn): return run +def sleep(sec): + time.sleep(sec) + return + + def _(msg): L = LANGUAGE.split('-')[0] if L == 'en': @@ -244,7 +253,10 @@ def get_dispatch(): def get_temp_file(): - return tempfile.NamedTemporaryFile() + delete = True + if IS_WIN: + delete = False + return tempfile.NamedTemporaryFile(delete=delete) def _path_url(path):