- 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
|
- App - trying to speed up the new project creation
|
||||||
- Tcl Shell - Browser Edit - added Undo/Redo, Cut and Delete selection
|
- 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)
|
- 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
|
18.12.2020
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ from appTool import AppTool
|
|||||||
|
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
import collections
|
import collections
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
# from voronoi import Voronoi
|
# from voronoi import Voronoi
|
||||||
@@ -913,20 +914,40 @@ class AppLogging:
|
|||||||
self._log.addHandler(handler)
|
self._log.addHandler(handler)
|
||||||
|
|
||||||
def info(self, msg):
|
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._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):
|
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._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):
|
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._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):
|
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._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):
|
def farthest_point(origin, points_list):
|
||||||
|
|||||||
@@ -148,6 +148,10 @@ class TermWidget(QWidget):
|
|||||||
text = ''
|
text = ''
|
||||||
elif style.lower() == 'raw':
|
elif style.lower() == 'raw':
|
||||||
text = text
|
text = text
|
||||||
|
else:
|
||||||
|
if text.startswith('[log]'):
|
||||||
|
text = text.replace('[log]', '', 1)
|
||||||
|
text = '<span style="color: gray;">%s</span>' % text
|
||||||
else:
|
else:
|
||||||
# without span <br/> is ignored!!!
|
# without span <br/> is ignored!!!
|
||||||
text = '<span>%s</span>' % text
|
text = '<span>%s</span>' % text
|
||||||
@@ -213,6 +217,12 @@ class TermWidget(QWidget):
|
|||||||
def add_line_break_to_input(self):
|
def add_line_break_to_input(self):
|
||||||
self._edit.textCursor().insertText('\n')
|
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):
|
def append_output(self, text):
|
||||||
"""
|
"""
|
||||||
Append text to output widget
|
Append text to output widget
|
||||||
|
|||||||
Reference in New Issue
Block a user