Source code for kvalikirstu2.warning_handler
"""A module for the warning handler in the GUI."""
import logging
import wx
from kvalikirstu2.localization import _
[docs]class WarningHandler(logging.StreamHandler):
"""
A handler class which gives pop-ups on logger warnings, does not
give pop-ups on errors(errors should be handled separately).
"""
[docs] def emit(self, record):
if record.levelno == logging.WARN:
msg = self.format(record)
wx.MessageBox(msg, _("Warning"), wx.ICON_WARNING)