diff options
author | jblum | 2008-09-16 23:02:12 +0000 |
---|---|---|
committer | jblum | 2008-09-16 23:02:12 +0000 |
commit | 9578be938ed0ed43aa7cf87ef96079a9f0f8ce55 (patch) | |
tree | 425e44622eb8aacee3709804d61a82f3b5c9f38f /grc/src/platforms/gui/Param.py | |
parent | 5fe222b348b9adc515877ba7aa2d840fd82e51cd (diff) | |
download | gnuradio-9578be938ed0ed43aa7cf87ef96079a9f0f8ce55.tar.gz gnuradio-9578be938ed0ed43aa7cf87ef96079a9f0f8ce55.tar.bz2 gnuradio-9578be938ed0ed43aa7cf87ef96079a9f0f8ce55.zip |
some formatting changes
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@9585 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'grc/src/platforms/gui/Param.py')
-rw-r--r-- | grc/src/platforms/gui/Param.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/grc/src/platforms/gui/Param.py b/grc/src/platforms/gui/Param.py index e9ccb1c25..a2e09172c 100644 --- a/grc/src/platforms/gui/Param.py +++ b/grc/src/platforms/gui/Param.py @@ -148,7 +148,10 @@ class Param(Element): if self.is_enum(): value = self.get_option_keys()[int(value)] self.set_value(value) #set the markup on the label, red for errors in corresponding data type. - name = '<span font_desc="%s">%s</span>'%(PARAM_LABEL_FONT, Utils.xml_encode(self.get_name())) + name = '<span font_desc="%s">%s</span>'%( + PARAM_LABEL_FONT, + Utils.xml_encode(self.get_name()), + ) #special markups if param is involved in a callback if hasattr(self.get_parent(), 'get_callbacks') and \ filter(lambda c: self.get_key() in c, self.get_parent()._callbacks): @@ -165,7 +168,10 @@ class Param(Element): #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, 'Type: %s\nKey: %s\n%s'%(self.get_type(), self.get_key(), tip)) + if self.input.tp: self.input.tp.set_tip( + self.input.entry, + 'Key: %s\nType: %s\n%s'%(self.get_key(), self.get_type(), tip), + ) #execute the external callback if self.callback: self.callback(self) @@ -189,10 +195,10 @@ class Param(Element): def to_str(var): if isinstance(var, str): return var elif isinstance(var, complex): - if var.imag == var.real == 0: return '0' #value is zero + if var == 0: return '0' #value is zero elif var.imag == 0: return '%s'%float_to_str(var.real) #value is real elif var.real == 0: return '%sj'%float_to_str(var.imag) #value is imaginary - elif var.imag < 0: return '%s-%sj'%(float_to_str(var.real), float_to_str(var.imag*-1)) + elif var.imag < 0: return '%s-%sj'%(float_to_str(var.real), float_to_str(abs(var.imag))) else: return '%s+%sj'%(float_to_str(var.real), float_to_str(var.imag)) elif isinstance(var, float): return float_to_str(var) elif isinstance(var, int): return '%d'%var |