diff --git a/CHANGELOG.md b/CHANGELOG.md
index 62d911fb..ac6bd974 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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
diff --git a/appCommon/Common.py b/appCommon/Common.py
index ad6dd50b..c6eae3bc 100644
--- a/appCommon/Common.py
+++ b/appCommon/Common.py
@@ -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):
diff --git a/appTools/ToolShell.py b/appTools/ToolShell.py
index a6ed0804..555605f0 100644
--- a/appTools/ToolShell.py
+++ b/appTools/ToolShell.py
@@ -149,8 +149,12 @@ class TermWidget(QWidget):
elif style.lower() == 'raw':
text = text
else:
- # without span
is ignored!!!
- text = '%s' % text
+ if text.startswith('[log]'):
+ text = text.replace('[log]', '', 1)
+ text = '%s' % text
+ else:
+ # without span
is ignored!!!
+ text = '%s' % 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