summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--grc/gui/Block.py8
-rw-r--r--grc/gui/Param.py10
2 files changed, 10 insertions, 8 deletions
diff --git a/grc/gui/Block.py b/grc/gui/Block.py
index 8c65bf06f..bed50de9f 100644
--- a/grc/gui/Block.py
+++ b/grc/gui/Block.py
@@ -29,6 +29,7 @@ from Constants import \
import pygtk
pygtk.require('2.0')
import gtk
+import pango
BLOCK_MARKUP_TMPL="""\
#set $foreground = $block.is_valid() and 'black' or 'red'
@@ -130,8 +131,11 @@ class Block(Element):
layout.set_markup(Utils.parse_template(BLOCK_MARKUP_TMPL, block=self))
self.label_width, self.label_height = layout.get_pixel_size()
#display the params
- for param in filter(lambda p: p.get_hide() not in ('all', 'part'), self.get_params()):
- layout = param.get_layout()
+ markups = [param.get_markup() for param in self.get_params() if param.get_hide() not in ('all', 'part')]
+ if markups:
+ layout = gtk.DrawingArea().create_pango_layout('')
+ layout.set_spacing(LABEL_SEPARATION*pango.SCALE)
+ layout.set_markup('\n'.join(markups))
layouts.append(layout)
w,h = layout.get_pixel_size()
self.label_width = max(w, self.label_width)
diff --git a/grc/gui/Param.py b/grc/gui/Param.py
index cb8bfdc52..b3018dab2 100644
--- a/grc/gui/Param.py
+++ b/grc/gui/Param.py
@@ -165,11 +165,9 @@ class Param(Element):
if self.get_options(): return EnumEntryParam(self, *args, **kwargs)
return EntryParam(self, *args, **kwargs)
- def get_layout(self):
+ def get_markup(self):
"""
- Create a layout based on the current markup.
- @return the pango layout
+ Get the markup for this param.
+ @return a pango markup string
"""
- layout = gtk.DrawingArea().create_pango_layout('')
- layout.set_markup(Utils.parse_template(PARAM_MARKUP_TMPL, param=self))
- return layout
+ return Utils.parse_template(PARAM_MARKUP_TMPL, param=self)