- had a first shot in creating a way to show the log messages in the Tcl Shell if a setting in Preferences is set

- fixed Isolation Tool tool table context menu pointing at the same method for the menu entries: Add Tool and Pick from DB
This commit is contained in:
Marius Stanciu
2020-11-25 12:48:38 +02:00
committed by Marius
parent 1af4ec0474
commit ca77b8869c
5 changed files with 154 additions and 102 deletions

View File

@@ -25,6 +25,8 @@ import numpy as np
# from voronoi import Voronoi
# from voronoi import Polygon as voronoi_polygon
import logging
import gettext
import appTranslation as fcTranslate
import builtins
@@ -898,6 +900,35 @@ class ExclusionAreas(QtCore.QObject):
return ret_list
class AppLogging:
def __init__(self, app):
self.app = app
self._log = logging.getLogger('base')
self._log.setLevel(logging.DEBUG)
# log.setLevel(logging.WARNING)
formatter = logging.Formatter('[%(levelname)s][%(threadName)s] %(message)s')
handler = logging.StreamHandler()
handler.setFormatter(formatter)
self._log.addHandler(handler)
def info(self, msg):
self._log.info(msg=msg)
self.app.inform_shell.emit('*** LOG ***\t%s' % msg)
def debug(self, msg):
self._log.debug(msg=msg)
self.app.inform_shell.emit('*** LOG ***\t%s' % msg)
def warning(self, msg):
self._log.warning(msg=msg)
self.app.inform_shell.emit('*** LOG ***\t%s' % msg)
def error(self, msg):
self._log.error(msg=msg)
self.app.inform_shell.emit('*** LOG ***\t%s' % msg)
def farthest_point(origin, points_list):
"""
Calculate the farthest Point in a list from another Point