diff options
author | Johnathan Corgan | 2010-05-11 18:00:19 -0700 |
---|---|---|
committer | Johnathan Corgan | 2010-05-11 18:00:19 -0700 |
commit | c1c29651e8a13c090228723684d6f693a6ae8c34 (patch) | |
tree | 7f38fa94a51e68be60243e5a2bd3bb3acc1e700d /grc | |
parent | c76897abcbfe1c149bffd27fba0224d3ebc83503 (diff) | |
parent | 1fc7c57f778a9f05ded1d216247242ee13632d03 (diff) | |
download | gnuradio-c1c29651e8a13c090228723684d6f693a6ae8c34.tar.gz gnuradio-c1c29651e8a13c090228723684d6f693a6ae8c34.tar.bz2 gnuradio-c1c29651e8a13c090228723684d6f693a6ae8c34.zip |
Merge branch 'master' into wip/burx_support
* master: (39 commits)
Add gru.hexshort to deal with short hex constants
Assign USB PID for Hans de Bok
Add missing buffer allocator hint to gr_ofdm_sampler.cc
Really fix the missing include for boost::bind
gr-wxgui: Added additional color table entries
Missed updates for omnithread/mblock removal
Remove omnithreads library.
Remove mblock library. We hardly knew 'ye.
Convert gr-audio-portaudio to Boost via gruel
Further updates for removing omnithreads
Update build configuration for OSX omnithreads changeover
Add missing include file for boost::bind
Convert gcell to use boost::threads instead of omnithread.
Fix sequence error indication after stopping then restarting streaming on USRP2.
initial move from mld_threads to gruel:: namespace threads and such
Initial changes to remove mld_thread and instead use gruel:: namespace classes
Fixing doxygen warnings from arb_resampler. Also, removed set_taps from public
Fixing doxygen warnings from channelizer block.
Fixing documentation to get rid of doxygen warnings.
Adding documentation for fff version of othe PFB clock sync algorithm.
...
Diffstat (limited to 'grc')
-rw-r--r-- | grc/gui/Param.py | 15 | ||||
-rw-r--r-- | grc/python/Param.py | 32 |
2 files changed, 33 insertions, 14 deletions
diff --git a/grc/gui/Param.py b/grc/gui/Param.py index b3018dab2..7c00c1b67 100644 --- a/grc/gui/Param.py +++ b/grc/gui/Param.py @@ -1,5 +1,5 @@ """ -Copyright 2007, 2008, 2009 Free Software Foundation, Inc. +Copyright 2007, 2008, 2009, 2010 Free Software Foundation, Inc. This file is part of GNU Radio GNU Radio Companion is free software; you can redistribute it and/or @@ -135,10 +135,21 @@ PARAM_LABEL_MARKUP_TMPL="""\ <span underline="$underline" foreground="$foreground" font_desc="Sans 9">$encode($param.get_name())</span>""" TIP_MARKUP_TMPL="""\ +######################################## +#def truncate(string) + #set $max_len = 100 + #set $string = str($string) + #if len($string) > $max_len +$('%s...%s'%($string[:$max_len/2], $string[-$max_len/2:]))#slurp + #else +$string#slurp + #end if +#end def +######################################## Key: $param.get_key() Type: $param.get_type() #if $param.is_valid() -Value: $param.get_evaluated() +Value: $truncate($param.get_evaluated()) #elif len($param.get_error_messages()) == 1 Error: $(param.get_error_messages()[0]) #else diff --git a/grc/python/Param.py b/grc/python/Param.py index e04bc8fcb..6dd008d1d 100644 --- a/grc/python/Param.py +++ b/grc/python/Param.py @@ -1,5 +1,5 @@ """ -Copyright 2008, 2009 Free Software Foundation, Inc. +Copyright 2008, 2009, 2010 Free Software Foundation, Inc. This file is part of GNU Radio GNU Radio Companion is free software; you can redistribute it and/or @@ -108,7 +108,23 @@ class Param(_Param, _GUIParam): Get the repr (nice string format) for this param. @return the string representation """ - if not self.is_valid(): return self.get_value() + ################################################## + # truncate helper method + ################################################## + def _truncate(string, style=0): + max_len = max(27 - len(self.get_name()), 3) + if len(string) > max_len: + if style < 0: #front truncate + string = '...' + string[3-max_len:] + elif style == 0: #center truncate + string = string[:max_len/2 -3] + '...' + string[-max_len/2:] + elif style > 0: #rear truncate + string = string[:max_len-3] + '...' + return string + ################################################## + # simple conditions + ################################################## + if not self.is_valid(): return _truncate(self.get_value()) if self.get_value() in self.get_option_keys(): return self.get_option(self.get_value()).get_name() ################################################## # display logic for numbers @@ -126,7 +142,6 @@ class Param(_Param, _GUIParam): # split up formatting by type ################################################## truncate = 0 #default center truncate - max_len = max(27 - len(self.get_name()), 3) e = self.get_evaluated() t = self.get_type() if isinstance(e, bool): return str(e) @@ -141,16 +156,9 @@ class Param(_Param, _GUIParam): truncate = -1 else: dt_str = str(e) #other types ################################################## - # truncate + # done ################################################## - if len(dt_str) > max_len: - if truncate < 0: #front truncate - dt_str = '...' + dt_str[3-max_len:] - elif truncate == 0: #center truncate - dt_str = dt_str[:max_len/2 -3] + '...' + dt_str[-max_len/2:] - elif truncate > 0: #rear truncate - dt_str = dt_str[:max_len-3] + '...' - return dt_str + return _truncate(dt_str, truncate) def get_input(self, *args, **kwargs): if self.get_type() in ('file_open', 'file_save'): return FileParam(self, *args, **kwargs) |