summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Koslowski <koslowski@kit.edu>2014-01-04 15:25:45 +0100
committerSebastian Koslowski <koslowski@kit.edu>2014-01-18 23:19:47 +0100
commit7548e467bda2985f241e5ae0ac3939ced303ca23 (patch)
tree4af2ee8af48d92670b69e4670eaa64b9a8078362
parent317833b7133353b4d3ea35099705b8b9fdebb7ce (diff)
grc: show xml parser error warning in report window
-rw-r--r--grc/gui/ActionHandler.py7
-rw-r--r--grc/gui/Messages.py6
2 files changed, 11 insertions, 2 deletions
diff --git a/grc/gui/ActionHandler.py b/grc/gui/ActionHandler.py
index 0ce81a8ac5..14a781a09b 100644
--- a/grc/gui/ActionHandler.py
+++ b/grc/gui/ActionHandler.py
@@ -117,8 +117,10 @@ class ActionHandler:
Actions.TYPES_WINDOW_DISPLAY, Actions.TOGGLE_BLOCKS_WINDOW,
Actions.TOGGLE_REPORTS_WINDOW,
): action.set_sensitive(True)
- Actions.PARSER_ERRORS.set_sensitive(bool(ParseXML.xml_failures))
-
+ if ParseXML.xml_failures:
+ Messages.send_xml_errors_if_any(ParseXML.xml_failures)
+ Actions.PARSER_ERRORS.set_sensitive(True)
+
if not self.init_file_paths:
self.init_file_paths = Preferences.files_open()
if not self.init_file_paths: self.init_file_paths = ['']
@@ -466,6 +468,7 @@ class ActionHandler:
self.main_window.btwin.clear()
self.platform.load_block_tree(self.main_window.btwin)
Actions.PARSER_ERRORS.set_sensitive(bool(ParseXML.xml_failures))
+ Messages.send_xml_errors_if_any(ParseXML.xml_failures)
elif action == Actions.FIND_BLOCKS:
self.main_window.btwin.show()
self.main_window.btwin.search_entry.show()
diff --git a/grc/gui/Messages.py b/grc/gui/Messages.py
index d903e40a45..a6620aa72f 100644
--- a/grc/gui/Messages.py
+++ b/grc/gui/Messages.py
@@ -53,6 +53,12 @@ def send_init(platform):
def send_page_switch(file_path):
send('\nShowing: "%s"\n'%file_path)
+################# functions for loading blocks ########################################
+def send_xml_errors_if_any(xml_failures):
+ if xml_failures:
+ send('\nXML parser: Found {} erroneous XML file{} while loading the block tree '
+ '(see "Help/Parser errors" for details)\n'.format(len(xml_failures), 's' if len(xml_failures) > 1 else ''))
+
################# functions for loading flow graphs ########################################
def send_start_load(file_path):
send('\nLoading: "%s"'%file_path + '\n')