From f35c33ef11de2b8e43ffe1012d6e84cb380ae389 Mon Sep 17 00:00:00 2001 From: Luke Pflibsen-Jones Date: Thu, 5 Aug 2021 15:25:49 -0700 Subject: [PATCH 1/2] Use update_log instead of sys.stdout for consistent log order --- gui.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gui.py b/gui.py index 4020a11..c4bf0c5 100644 --- a/gui.py +++ b/gui.py @@ -252,13 +252,13 @@ def _construct(self, context, params, callback_queue): # Reduce chance of Blender crashing when generation fails or the user does something ill-advised except Exception: - sys.stdout.write('\n{}\n'.format(traceback.format_exc())) - sys.stdout.write('Tree generation failed\n\n') - sys.stdout.flush() + update_log('\n{}\n'.format(traceback.format_exc())) + update_log('Tree generation failed\n\n') if success: - callback_queue.put('KILL') # Kill modal used for running tasks in main thread - sys.stdout.write('\nTree generated in {:.6f} seconds\n\n'.format(time.time() - start_time)) + update_log('\nTree generated in {:.6f} seconds\n\n'.format(time.time() - start_time)) + + callback_queue.put('KILL') # Kill modal used for running tasks in main thread # ---- @staticmethod From 09786a5e7d03c7b48a0ccca165ae3b3da8d2e4a4 Mon Sep 17 00:00:00 2001 From: Luke Pflibsen-Jones Date: Fri, 6 Aug 2021 12:45:39 -0700 Subject: [PATCH 2/2] Switch to import of update_log --- gui.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui.py b/gui.py index c4bf0c5..eb97da5 100644 --- a/gui.py +++ b/gui.py @@ -10,10 +10,10 @@ from copy import deepcopy from . import parametric, utilities +from .parametric.gen import update_log from .parametric.tree_params import tree_param -update_log = parametric.gen.update_log main_thread_callback_queue = queue.Queue()