From a91336462fa381e6744240580c545b01537ddbec Mon Sep 17 00:00:00 2001
From: jblum
Date: Wed, 17 Sep 2008 03:11:44 +0000
Subject: error message formatting
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@9595 221aa14e-8319-0410-a670-987f0aec2ac5
---
grc/data/platforms/python/Makefile.am | 2 +-
grc/data/platforms/python/default_flow_graph.grc | 43 ++++++++++++++++++++++
.../platforms/python/default_flow_graph.grc.xml | 43 ----------------------
grc/src/gui/ParamsDialog.py | 2 +-
grc/src/platforms/base/Block.py | 4 +-
grc/src/platforms/base/Connection.py | 8 +++-
grc/src/platforms/base/Port.py | 2 +-
grc/src/platforms/python/Constants.py.in | 2 +-
8 files changed, 56 insertions(+), 50 deletions(-)
create mode 100644 grc/data/platforms/python/default_flow_graph.grc
delete mode 100644 grc/data/platforms/python/default_flow_graph.grc.xml
(limited to 'grc')
diff --git a/grc/data/platforms/python/Makefile.am b/grc/data/platforms/python/Makefile.am
index 37ac87aa3..12e747faf 100644
--- a/grc/data/platforms/python/Makefile.am
+++ b/grc/data/platforms/python/Makefile.am
@@ -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
index 000000000..dea26f3a5
--- /dev/null
+++ b/grc/data/platforms/python/default_flow_graph.grc
@@ -0,0 +1,43 @@
+
+
+
+
+ options
+
+ id
+ top_block
+
+
+ _coordinate
+ (10, 10)
+
+
+ _rotation
+ 0
+
+
+
+ variable
+
+ id
+ samp_rate
+
+
+ value
+ 32000
+
+
+ _coordinate
+ (10, 170)
+
+
+ _rotation
+ 0
+
+
+
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
index dea26f3a5..000000000
--- a/grc/data/platforms/python/default_flow_graph.grc.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-
-
-
-
- options
-
- id
- top_block
-
-
- _coordinate
- (10, 10)
-
-
- _rotation
- 0
-
-
-
- variable
-
- id
- samp_rate
-
-
- value
- 32000
-
-
- _coordinate
- (10, 170)
-
-
- _rotation
- 0
-
-
-
diff --git a/grc/src/gui/ParamsDialog.py b/grc/src/gui/ParamsDialog.py
index 46940db2e..c424f282a 100644
--- a/grc/src/gui/ParamsDialog.py
+++ b/grc/src/gui/ParamsDialog.py
@@ -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):
diff --git a/grc/src/platforms/base/Block.py b/grc/src/platforms/base/Block.py
index e3ef84d94..cb350b7cb 100644
--- a/grc/src/platforms/base/Block.py
+++ b/grc/src/platforms/base/Block.py
@@ -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())
diff --git a/grc/src/platforms/base/Connection.py b/grc/src/platforms/base/Connection.py
index 3c0b42d78..954d4866a 100644
--- a/grc/src/platforms/base/Connection.py
+++ b/grc/src/platforms/base/Connection.py
@@ -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
diff --git a/grc/src/platforms/base/Port.py b/grc/src/platforms/base/Port.py
index 61134791c..672b2e4db 100644
--- a/grc/src/platforms/base/Port.py
+++ b/grc/src/platforms/base/Port.py
@@ -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())
diff --git a/grc/src/platforms/python/Constants.py.in b/grc/src/platforms/python/Constants.py.in
index 973304eba..199b24223 100644
--- a/grc/src/platforms/python/Constants.py.in
+++ b/grc/src/platforms/python/Constants.py.in
@@ -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'
--
cgit