From 9dce2cc503ed8f03c1f0ac9442d3f253caca7978 Mon Sep 17 00:00:00 2001 From: Mauricio Baeza Date: Mon, 16 Sep 2019 15:39:03 -0500 Subject: [PATCH] Add example shortcut --- source/conf.py.example | 4 ++-- source/easymacro.py | 16 +++++++++++++--- source/zaz.py | 4 +++- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/source/conf.py.example b/source/conf.py.example index 6480863..e503778 100644 --- a/source/conf.py.example +++ b/source/conf.py.example @@ -436,7 +436,7 @@ if TYPE_EXTENSION == 3: FILE_MANIFEST = f""" - {NODE_ADDONS} + {NODE_ADDONS} """ @@ -590,7 +590,7 @@ if TYPE_EXTENSION == 1: node_global = [] node_module = {} for m in MENUS: - if not m['shortcut']: + if not m.get('shortcut', ''): continue if m['context']: for c in m['context'].split(','): diff --git a/source/easymacro.py b/source/easymacro.py index e6ca331..15ea311 100644 --- a/source/easymacro.py +++ b/source/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/source/zaz.py b/source/zaz.py index 8d977d4..5669ec1 100644 --- a/source/zaz.py +++ b/source/zaz.py @@ -46,7 +46,7 @@ def _join(*paths): def _mkdir(path): - return os.mkdir(path) + return Path(path).mkdir(parents=True, exist_ok=True) def _save(path, data): @@ -225,6 +225,8 @@ def _update_files(): path = _join(path_source, DIRS['meta'], FILES['manifest']) _save(path, DATA['manifest']) + path = _join(path_source, DIRS['office']) + _mkdir(path) path = _join(path_source, DIRS['office'], FILES['shortcut']) _save(path, DATA['shortcut'])