error message formatting
authorjblum <jblum@221aa14e-8319-0410-a670-987f0aec2ac5>
Wed, 17 Sep 2008 03:11:44 +0000 (03:11 +0000)
committerjblum <jblum@221aa14e-8319-0410-a670-987f0aec2ac5>
Wed, 17 Sep 2008 03:11:44 +0000 (03:11 +0000)
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@9595 221aa14e-8319-0410-a670-987f0aec2ac5

grc/data/platforms/python/Makefile.am
grc/data/platforms/python/default_flow_graph.grc [new file with mode: 0644]
grc/data/platforms/python/default_flow_graph.grc.xml [deleted file]
grc/src/gui/ParamsDialog.py
grc/src/platforms/base/Block.py
grc/src/platforms/base/Connection.py
grc/src/platforms/base/Port.py
grc/src/platforms/python/Constants.py.in

index 37ac87aa3da306885b0712674a82faa86ef0ec34..12e747faf4e7ae8e8df16bffb7222e32deafa8e9 100644 (file)
@@ -28,7 +28,7 @@ ourdatadir = $(grc_python_data_dir)
 ourdata_DATA = \
        block.dtd \
        block_tree.xml \
-       default_flow_graph.grc.xml \
+       default_flow_graph.grc \
        flow_graph.tmpl
 
 EXTRA_DIST = $(ourdata_DATA)
diff --git a/grc/data/platforms/python/default_flow_graph.grc b/grc/data/platforms/python/default_flow_graph.grc
new file mode 100644 (file)
index 0000000..dea26f3
--- /dev/null
@@ -0,0 +1,43 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Default Flow Graph:
+##     include an options block and a variable for sample rate
+###################################################
+ -->
+<flow_graph>
+       <block>
+               <key>options</key>
+               <param>
+                       <key>id</key>
+                       <value>top_block</value>
+               </param>
+               <param>
+                       <key>_coordinate</key>
+                       <value>(10, 10)</value>
+               </param>
+               <param>
+                       <key>_rotation</key>
+                       <value>0</value>
+               </param>
+       </block>
+       <block>
+               <key>variable</key>
+               <param>
+                       <key>id</key>
+                       <value>samp_rate</value>
+               </param>
+               <param>
+                       <key>value</key>
+                       <value>32000</value>
+               </param>
+               <param>
+                       <key>_coordinate</key>
+                       <value>(10, 170)</value>
+               </param>
+               <param>
+                       <key>_rotation</key>
+                       <value>0</value>
+               </param>
+       </block>
+</flow_graph>
diff --git a/grc/data/platforms/python/default_flow_graph.grc.xml b/grc/data/platforms/python/default_flow_graph.grc.xml
deleted file mode 100644 (file)
index dea26f3..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Default Flow Graph:
-##     include an options block and a variable for sample rate
-###################################################
- -->
-<flow_graph>
-       <block>
-               <key>options</key>
-               <param>
-                       <key>id</key>
-                       <value>top_block</value>
-               </param>
-               <param>
-                       <key>_coordinate</key>
-                       <value>(10, 10)</value>
-               </param>
-               <param>
-                       <key>_rotation</key>
-                       <value>0</value>
-               </param>
-       </block>
-       <block>
-               <key>variable</key>
-               <param>
-                       <key>id</key>
-                       <value>samp_rate</value>
-               </param>
-               <param>
-                       <key>value</key>
-                       <value>32000</value>
-               </param>
-               <param>
-                       <key>_coordinate</key>
-                       <value>(10, 170)</value>
-               </param>
-               <param>
-                       <key>_rotation</key>
-                       <value>0</value>
-               </param>
-       </block>
-</flow_graph>
index 46940db2eeda876dbf933715a76614fc593c1a66..c424f282af6a6002c2b3ab59c95a1f09f64439e6 100644 (file)
@@ -86,7 +86,7 @@ class ParamsDialog(gtk.Dialog):
                """
                if self.block.is_valid(): self._error_messages_box.hide()
                else: self._error_messages_box.show()
-               messages = '\n'.join(self.block.get_error_messages())
+               messages = '\n\n'.join(self.block.get_error_messages())
                self._error_messages_text_display.set_text(messages)
 
        def _handle_key_press(self, widget, event):
index e3ef84d9451cf227180fb0d5802fa7a33c2c23d8..cb350b7cb5f746c9e06665f73f39aff9141c81e9 100644 (file)
@@ -146,11 +146,11 @@ class Block(Element):
                All checks must evaluate to true.
                """
                if not self.get_enabled(): return
-               for c in self.get_params() + self.get_sinks() + self.get_sources():
+               for c in self.get_params() + self.get_sinks() + self.get_sources() + self.get_connections():
                        try: assert(c.is_valid())
                        except AssertionError:
                                for msg in c.get_error_messages():
-                                       self._add_error_message('%s: %s'%(c, msg))
+                                       self._add_error_message('>>> %s:\n\t%s'%(c, msg))
 
        def __str__(self): return 'Block - %s - %s(%s)'%(self.get_id(), self.get_name(), self.get_key())
 
index 3c0b42d78116e37ccafcd8f38f5f5651babed975..954d4866a54a879d0dd3d198cacb641573673141 100644 (file)
@@ -44,7 +44,13 @@ class Connection(Element):
                self._source = source
                self._sink = sink
 
-       def __str__(self): return 'Connection (%s -> %s)'%(self.get_source(), self.get_sink())
+       def __str__(self):
+               return 'Connection (\n\t%s\n\t\t%s\n\t%s\n\t\t%s\n)'%(
+                       self.get_source().get_parent(),
+                       self.get_source(),
+                       self.get_sink().get_parent(),
+                       self.get_sink(),
+               )
 
        def is_connection(self): return True
 
index 61134791c18d2f0221faf619cf25504551dcdde1..672b2e4db5b9a36a14a9bfce2dd48ddb3619c7e7 100644 (file)
@@ -48,7 +48,7 @@ class Port(Element):
                The port must be non-empty and type must a possible type.
                """
                try: assert(not self.is_empty())
-               except AssertionError: self._add_error_message('is empty.')
+               except AssertionError: self._add_error_message('Port is not connected.')
                try: assert(self.get_type() in self.TYPES)
                except AssertionError: self._add_error_message('Type "%s" is not a possible type.'%self.get_type())
 
index 973304ebafd739ee16c847b378edd5c4f0cad372..199b242236aa9d93c93a4a2aec549f0941b3bdd8 100644 (file)
@@ -37,7 +37,7 @@ HIER_BLOCK_FILE_MODE = stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP | stat.S_IWGRP
 FLOW_GRAPH_TEMPLATE = os.path.join(DATA_DIR, 'flow_graph.tmpl')
 BLOCK_DTD = os.path.join(DATA_DIR, 'block.dtd')
 BLOCK_TREE = os.path.join(DATA_DIR, 'block_tree.xml')
-DEFAULT_FLOW_GRAPH = os.path.join(DATA_DIR, 'default_flow_graph.grc.xml')
+DEFAULT_FLOW_GRAPH = os.path.join(DATA_DIR, 'default_flow_graph.grc')
 
 #coloring
 COMPLEX_COLOR_SPEC = '#3399FF'