armory/blender/arm/log.py

51 lines
1 KiB
Python
Raw Normal View History

2017-03-15 12:30:14 +01:00
import arm.utils
import arm.bridge as bridge
import arm.make_state as state
2016-10-19 13:28:06 +02:00
progress = 100.0
tag_redraw = False
2017-03-15 12:30:14 +01:00
info_text = ''
header_info_text = ''
2016-10-19 13:28:06 +02:00
def clear():
2017-03-15 12:30:14 +01:00
global info_text
global header_info_text
info_text = ''
if arm.utils.with_krom():
header_info_text = ''
2016-10-19 13:28:06 +02:00
def format_text(text):
return (text[:80] + '..') if len(text) > 80 else text # Limit str size
2017-10-18 09:51:35 +02:00
def krom_trace(text):
2016-11-12 18:30:39 +01:00
txt = text.split(' ', 1)
if len(txt) > 1 and txt[1].startswith('__arm'):
2016-11-26 22:33:31 +01:00
bridge.parse_operator(txt[1])
2016-11-12 18:30:39 +01:00
else:
print_info(text)
2016-10-19 13:28:06 +02:00
def print_info(text):
global tag_redraw
2017-03-15 12:30:14 +01:00
global info_text
2016-10-19 13:28:06 +02:00
print(text)
2017-03-15 12:30:14 +01:00
info_text = format_text(text)
2016-10-19 13:28:06 +02:00
tag_redraw = True
def print_player(text):
2017-03-15 12:30:14 +01:00
global header_info_text
2016-12-01 18:28:07 +01:00
if state.krom_running:
2017-03-15 12:30:14 +01:00
header_info_text = format_text(text)
2016-10-19 13:28:06 +02:00
def print_progress(value):
global progress
global tag_redraw
progress = value
tag_redraw = True
def get_progress(self):
global progress
return progress
2016-11-05 20:57:04 +01:00
def warn(text):
print('Armory Warning: ' + text)