summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnathan Corgan2009-09-18 22:27:38 -0700
committerJohnathan Corgan2009-09-18 22:27:38 -0700
commit4cadf11430e76cd79aa7df20b76c0ced6779248b (patch)
tree25d23752cee01651851251254d1b70f10fb66c5e
parentcc5657e25f8e8f364cb6553e9eb8289cc0aca027 (diff)
parent54f913876e5d92fa66f4bcf3a1c773a503e907f8 (diff)
downloadgnuradio-4cadf11430e76cd79aa7df20b76c0ced6779248b.tar.gz
gnuradio-4cadf11430e76cd79aa7df20b76c0ced6779248b.tar.bz2
gnuradio-4cadf11430e76cd79aa7df20b76c0ced6779248b.zip
Merge branch 'grc' of http://gnuradio.org/git/jblum into master
-rw-r--r--grc/base/Element.py3
-rw-r--r--grc/gui/ActionHandler.py3
-rw-r--r--grc/gui/Actions.py9
-rw-r--r--grc/gui/Bars.py4
-rw-r--r--grc/gui/Dialogs.py14
-rw-r--r--grc/python/Param.py4
6 files changed, 32 insertions, 5 deletions
diff --git a/grc/base/Element.py b/grc/base/Element.py
index e77e7ce08..a57090f3b 100644
--- a/grc/base/Element.py
+++ b/grc/base/Element.py
@@ -50,11 +50,12 @@ class Element(object):
def get_error_messages(self):
"""
Get the list of error messages from this element and all of its children.
+ Do not include the error messages from disabled children.
Cleverly indent the children error messages for printing purposes.
@return a list of error message strings
"""
error_messages = list(self._error_messages) #make a copy
- for child in self.get_children():
+ for child in filter(lambda c: c.get_enabled(), self.get_children()):
for msg in child.get_error_messages():
error_messages.append("%s:\n\t%s"%(child, msg.replace("\n", "\n\t")))
return error_messages
diff --git a/grc/gui/ActionHandler.py b/grc/gui/ActionHandler.py
index 361be1cf8..ee3e19a6c 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 b22279c1d..f374efde1 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='View flow graph errors',
+ stock_id=gtk.STOCK_DIALOG_ERROR,
+)
ABOUT_WINDOW_DISPLAY = Action(
label='_About',
tooltip='About this program',
@@ -222,13 +227,13 @@ ABOUT_WINDOW_DISPLAY = Action(
)
HELP_WINDOW_DISPLAY = Action(
label='_Help',
- tooltip='Usage Tips',
+ tooltip='Usage tips',
stock_id=gtk.STOCK_HELP,
keypresses=(gtk.keysyms.F1, NO_MODS_MASK),
)
TYPES_WINDOW_DISPLAY = Action(
label='_Types',
- tooltip='Types Color Mapping',
+ tooltip='Types color mapping',
stock_id=gtk.STOCK_DIALOG_INFO,
)
FLOW_GRAPH_GEN = Action(
diff --git a/grc/gui/Bars.py b/grc/gui/Bars.py
index fff5ebc08..8fd167869 100644
--- a/grc/gui/Bars.py
+++ b/grc/gui/Bars.py
@@ -39,6 +39,7 @@ TOOLBAR_LIST = (
Actions.FLOW_GRAPH_UNDO,
Actions.FLOW_GRAPH_REDO,
None,
+ Actions.ERRORS_WINDOW_DISPLAY,
Actions.FLOW_GRAPH_GEN,
Actions.FLOW_GRAPH_EXEC,
Actions.FLOW_GRAPH_KILL,
@@ -81,6 +82,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 3cf617b92..af40f47c0 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='Flow Graph Errors',
+ markup=Utils.parse_template(ERRORS_MARKUP_TMPL, errors=flowgraph.get_error_messages()),
+)
+
class AboutDialog(gtk.AboutDialog):
"""A cute little about dialog."""
diff --git a/grc/python/Param.py b/grc/python/Param.py
index 387fab548..34d5ab116 100644
--- a/grc/python/Param.py
+++ b/grc/python/Param.py
@@ -254,7 +254,7 @@ class Param(_Param, _GUIParam):
elif t in ('raw', 'complex', 'real', 'int', 'complex_vector', 'real_vector', 'int_vector', 'hex', 'bool'):
#raise exception if python cannot evaluate this value
try: e = self.get_parent().get_parent().evaluate(v)
- except Exception, e: raise Exception, 'Value "%s" cannot be evaluated: %s'%(v, e)
+ except Exception, e: raise Exception, 'Value "%s" cannot be evaluated:\n%s'%(v, e)
#raise an exception if the data is invalid
if t == 'raw': return e
elif t == 'complex':
@@ -385,7 +385,7 @@ class Param(_Param, _GUIParam):
try: notebook_block = filter(lambda b: b.get_id() == notebook_id, notebook_blocks)[0]
except: raise Exception, 'Notebook id "%s" is not an existing notebook id.'%notebook_id
#check that page index exists
- try: assert int(page_index) in range(len(notebook_block.get_param('labels').get_evaluated()))
+ try: assert int(page_index) in range(len(notebook_block.get_param('labels').evaluate()))
except: raise Exception, 'Page index "%s" is not a valid index number.'%page_index
return notebook_id, page_index
#########################