summaryrefslogtreecommitdiff
path: root/grc/gui
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2009-09-18 02:10:13 -0700
committerJosh Blum <josh@joshknows.com>2009-09-18 02:10:13 -0700
commit14895064d7345c2223ff2b8ff3b9cbcdf69dd8c9 (patch)
tree0db94cb03f5ae40357760d3b16fb8d34c20b704b /grc/gui
parent3f16d0acf93bbe8da7690f209782783ae8afb1c6 (diff)
added errors dialog to show all error messages in flow graph
Diffstat (limited to 'grc/gui')
-rw-r--r--grc/gui/ActionHandler.py3
-rw-r--r--grc/gui/Actions.py5
-rw-r--r--grc/gui/Bars.py3
-rw-r--r--grc/gui/Dialogs.py14
4 files changed, 25 insertions, 0 deletions
diff --git a/grc/gui/ActionHandler.py b/grc/gui/ActionHandler.py
index 361be1cf8f..ee3e19a6c6 100644
--- a/grc/gui/ActionHandler.py
+++ b/grc/gui/ActionHandler.py
@@ -210,6 +210,8 @@ class ActionHandler:
Dialogs.HelpDialog()
elif action == Actions.TYPES_WINDOW_DISPLAY:
Dialogs.TypesDialog(self.get_flow_graph().get_parent())
+ elif action == Actions.ERRORS_WINDOW_DISPLAY:
+ Dialogs.ErrorsDialog(self.get_flow_graph())
##################################################
# Param Modifications
##################################################
@@ -307,6 +309,7 @@ class ActionHandler:
# Global Actions for all States
##################################################
#update general buttons
+ Actions.ERRORS_WINDOW_DISPLAY.set_sensitive(not self.get_flow_graph().is_valid())
Actions.ELEMENT_DELETE.set_sensitive(bool(self.get_flow_graph().get_selected_elements()))
Actions.BLOCK_PARAM_MODIFY.set_sensitive(bool(self.get_flow_graph().get_selected_block()))
Actions.BLOCK_ROTATE_CCW.set_sensitive(bool(self.get_flow_graph().get_selected_blocks()))
diff --git a/grc/gui/Actions.py b/grc/gui/Actions.py
index b22279c1da..1cc12a8194 100644
--- a/grc/gui/Actions.py
+++ b/grc/gui/Actions.py
@@ -215,6 +215,11 @@ BLOCK_PASTE = Action(
stock_id=gtk.STOCK_PASTE,
keypresses=(gtk.keysyms.v, gtk.gdk.CONTROL_MASK),
)
+ERRORS_WINDOW_DISPLAY = Action(
+ label='_Errors',
+ tooltip='Flowgraph error messages',
+ stock_id=gtk.STOCK_DIALOG_ERROR,
+)
ABOUT_WINDOW_DISPLAY = Action(
label='_About',
tooltip='About this program',
diff --git a/grc/gui/Bars.py b/grc/gui/Bars.py
index fff5ebc08d..17835eb004 100644
--- a/grc/gui/Bars.py
+++ b/grc/gui/Bars.py
@@ -81,6 +81,9 @@ MENU_BAR_LIST = (
None,
Actions.BLOCK_PARAM_MODIFY,
]),
+ (gtk.Action('View', '_View', None, None), [
+ Actions.ERRORS_WINDOW_DISPLAY,
+ ]),
(gtk.Action('Build', '_Build', None, None), [
Actions.FLOW_GRAPH_GEN,
Actions.FLOW_GRAPH_EXEC,
diff --git a/grc/gui/Dialogs.py b/grc/gui/Dialogs.py
index 3cf617b92c..a8e7afb057 100644
--- a/grc/gui/Dialogs.py
+++ b/grc/gui/Dialogs.py
@@ -57,6 +57,20 @@ def MessageDialogHelper(type, buttons, title=None, markup=None):
message_dialog.destroy()
return response
+
+ERRORS_MARKUP_TMPL="""\
+#for $i, $err_msg in enumerate($errors)
+<b>Error $i:</b>
+$encode($err_msg.replace('\t', ' '))
+
+#end for"""
+def ErrorsDialog(flowgraph): MessageDialogHelper(
+ type=gtk.MESSAGE_ERROR,
+ buttons=gtk.BUTTONS_CLOSE,
+ title='Flowgraph Errors',
+ markup=Utils.parse_template(ERRORS_MARKUP_TMPL, errors=flowgraph.get_error_messages()),
+)
+
class AboutDialog(gtk.AboutDialog):
"""A cute little about dialog."""