- in verbose log made the messages in Tcl Shell to be displayed in gray color and to include the date
This commit is contained in:
@@ -15,6 +15,7 @@ CHANGELOG for FlatCAM beta
|
||||
- App - trying to speed up the new project creation
|
||||
- Tcl Shell - Browser Edit - added Undo/Redo, Cut and Delete selection
|
||||
- replace all the exec_() calls with exec() (except one situation in Tcl where I'm not sure of the effect)
|
||||
- in verbose log made the messages in Tcl Shell to be displayed in gray color and to include the date
|
||||
|
||||
18.12.2020
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ from appTool import AppTool
|
||||
|
||||
from copy import deepcopy
|
||||
import collections
|
||||
from datetime import datetime
|
||||
|
||||
import numpy as np
|
||||
# from voronoi import Voronoi
|
||||
@@ -913,20 +914,40 @@ class AppLogging:
|
||||
self._log.addHandler(handler)
|
||||
|
||||
def info(self, msg):
|
||||
# current date now
|
||||
date = str(datetime.today()).rpartition('.')[0]
|
||||
date = ''.join(c for c in date if c not in ':-')
|
||||
date = date.replace(' ', '_')
|
||||
|
||||
self._log.info(msg=msg)
|
||||
self.app.inform_shell.emit('*** LOG ***\t%s' % msg)
|
||||
self.app.inform_shell.emit('[log]INFO %s ***\t%s' % (date, msg))
|
||||
|
||||
def debug(self, msg):
|
||||
# current date now
|
||||
date = str(datetime.today()).rpartition('.')[0]
|
||||
date = ''.join(c for c in date if c not in ':-')
|
||||
date = date.replace(' ', '_')
|
||||
|
||||
self._log.debug(msg=msg)
|
||||
self.app.inform_shell.emit('*** LOG ***\t%s' % msg)
|
||||
self.app.inform_shell.emit('[log]DEBUG %s ***\t%s' % (date, msg))
|
||||
|
||||
def warning(self, msg):
|
||||
# current date now
|
||||
date = str(datetime.today()).rpartition('.')[0]
|
||||
date = ''.join(c for c in date if c not in ':-')
|
||||
date = date.replace(' ', '_')
|
||||
|
||||
self._log.warning(msg=msg)
|
||||
self.app.inform_shell.emit('*** LOG ***\t%s' % msg)
|
||||
self.app.inform_shell.emit('[log]WARNING %s ***\t%s' % (date, msg))
|
||||
|
||||
def error(self, msg):
|
||||
# current date now
|
||||
date = str(datetime.today()).rpartition('.')[0]
|
||||
date = ''.join(c for c in date if c not in ':-')
|
||||
date = date.replace(' ', '_')
|
||||
|
||||
self._log.error(msg=msg)
|
||||
self.app.inform_shell.emit('*** LOG ***\t%s' % msg)
|
||||
self.app.inform_shell.emit('[log]ERROR %s ***\t%s' % (date, msg))
|
||||
|
||||
|
||||
def farthest_point(origin, points_list):
|
||||
|
||||
@@ -149,8 +149,12 @@ class TermWidget(QWidget):
|
||||
elif style.lower() == 'raw':
|
||||
text = text
|
||||
else:
|
||||
# without span <br/> is ignored!!!
|
||||
text = '<span>%s</span>' % text
|
||||
if text.startswith('[log]'):
|
||||
text = text.replace('[log]', '', 1)
|
||||
text = '<span style="color: gray;">%s</span>' % text
|
||||
else:
|
||||
# without span <br/> is ignored!!!
|
||||
text = '<span>%s</span>' % text
|
||||
|
||||
scrollbar = self._browser.verticalScrollBar()
|
||||
old_value = scrollbar.value()
|
||||
@@ -213,6 +217,12 @@ class TermWidget(QWidget):
|
||||
def add_line_break_to_input(self):
|
||||
self._edit.textCursor().insertText('\n')
|
||||
|
||||
def append_input(self, text):
|
||||
"""
|
||||
Append text to output widget in bolded style
|
||||
"""
|
||||
self._append_to_browser('in', text)
|
||||
|
||||
def append_output(self, text):
|
||||
"""
|
||||
Append text to output widget
|
||||
|
||||
Reference in New Issue
Block a user