From 0e4b13385825aafc802797af41280632a460d9c4 Mon Sep 17 00:00:00 2001 From: guredora Date: Sun, 24 Jan 2021 11:05:49 +0900 Subject: [PATCH] add: configration invalid error dialog --- src/config_utils.py | 2 ++ src/wxUI/commonMessageDialogs.py | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/config_utils.py b/src/config_utils.py index f2cc10e6..a680e017 100644 --- a/src/config_utils.py +++ b/src/config_utils.py @@ -4,6 +4,7 @@ from validate import Validator, ValidateError import os import string from logging import getLogger +from wxUI import commonMessageDialogs log = getLogger("config_utils") class ConfigLoadError(Exception): pass @@ -21,6 +22,7 @@ def load_config(config_path, configspec_path=None, copy=True, *args, **kwargs): return config else: log.exception("Error in config file: {0}".format(validated,)) + commonMessageDialogs.invalid_configration() def is_blank(arg): "Check if a line is blank." diff --git a/src/wxUI/commonMessageDialogs.py b/src/wxUI/commonMessageDialogs.py index 8288af68..3e683a98 100644 --- a/src/wxUI/commonMessageDialogs.py +++ b/src/wxUI/commonMessageDialogs.py @@ -92,4 +92,7 @@ def common_error(reason): return wx.MessageDialog(None, reason, _(u"Error"), wx.OK).ShowModal() def dead_pid(): - return wx.MessageDialog(None, _(u"{0} quit unexpectedly the last time it was run. If the problem persists, please report it to the {0} developers.").format(application.name), _(u"Warning"), wx.OK).ShowModal() \ No newline at end of file + return wx.MessageDialog(None, _(u"{0} quit unexpectedly the last time it was run. If the problem persists, please report it to the {0} developers.").format(application.name), _(u"Warning"), wx.OK).ShowModal() + +def invalid_configration(): + return wx.MessageDialog(None, _(u"The configuration file is invalid."), _(u"Error"), wx.OK).ShowModal() \ No newline at end of file