From 5fe222b348b9adc515877ba7aa2d840fd82e51cd Mon Sep 17 00:00:00 2001 From: jblum Date: Tue, 16 Sep 2008 16:59:13 +0000 Subject: color coding for param entry boxes git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@9584 221aa14e-8319-0410-a670-987f0aec2ac5 --- grc/src/platforms/gui/Param.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'grc/src/platforms/gui') diff --git a/grc/src/platforms/gui/Param.py b/grc/src/platforms/gui/Param.py index f45d80bba..e9ccb1c25 100644 --- a/grc/src/platforms/gui/Param.py +++ b/grc/src/platforms/gui/Param.py @@ -43,6 +43,7 @@ class InputParam(gtk.HBox): self.pack_start(self.label, False) self.set_markup = lambda m: self.label.set_markup(m) self.tp = None + def set_color(self, color): pass class EntryParam(InputParam): """Provide an entry box for strings and numbers.""" @@ -58,6 +59,7 @@ class EntryParam(InputParam): self.tp = gtk.Tooltips() self.tp.set_tip(self.entry, '') self.tp.enable() + def set_color(self, color): self.entry.modify_base(gtk.STATE_NORMAL, gtk.gdk.color_parse(color)) class FileParam(EntryParam): """Provide an entry box for filename and a button to browse for a file.""" @@ -153,15 +155,17 @@ class Param(Element): name = '%s'%name if not self.is_valid(): self.input.set_markup('%s'%name) - tip = '- ' + '\n- '.join(self.get_error_messages()) + tip = 'Error: ' + ' '.join(self.get_error_messages()) else: self.input.set_markup(name) - tip = self.evaluate() + tip = 'Value: %s'%str(self.evaluate()) #hide/show if self.get_hide() == 'all': self.input.hide_all() else: self.input.show_all() + #set the color + self.input.set_color(self.get_color()) #set the tooltip - if self.input.tp: self.input.tp.set_tip(self.input.entry, str(tip)) + if self.input.tp: self.input.tp.set_tip(self.input.entry, 'Type: %s\nKey: %s\n%s'%(self.get_type(), self.get_key(), tip)) #execute the external callback if self.callback: self.callback(self) -- cgit