Skip to content

Commit

Permalink
Merge pull request #59 from luketimothyjones/logging-fix
Browse files Browse the repository at this point in the history
Use update_log instead of sys.stdout for consistent log order
  • Loading branch information
friggog authored Aug 6, 2021
2 parents 35a8156 + 9517723 commit c4d0a57
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()


Expand Down Expand Up @@ -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
Expand Down

0 comments on commit c4d0a57

Please sign in to comment.