[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] How do I use formatter in QT GUI Label?

From: Richard Bell
Subject: Re: [Discuss-gnuradio] How do I use formatter in QT GUI Label?
Date: Tue, 10 May 2016 14:52:38 -0700


I'm still not sure what's going on with this. Is it a problem with my installation or a bug in the code related to the formatter? Has anyone tested using the formatter field recently?


On Mon, May 9, 2016 at 1:05 PM, Richard Bell <address@hidden> wrote:
Dan and Marcus (from another thread related to this),

I'm trying to do what you say, but I get an error when using "{0:.3e}".format in the formatter field. The default value (0) is now formatted properly but it won't ever update and in terminal I get the following error

Exception in thread Thread-8:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
  File "/usr/lib/python2.7/threading.py", line 763, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/home/rbell/Documents/pcodes/radio_devel/production/Stream/pcodes_bpsk_stream_FEC_complexDecoder_loopback.py", line 1704, in _ber_probe
  File "/home/rbell/Documents/pcodes/radio_devel/production/Stream/pcodes_bpsk_stream_FEC_complexDecoder_loopback.py", line 2043, in set_ber
  File "/home/rbell/Documents/pcodes/radio_devel/production/Stream/pcodes_bpsk_stream_FEC_complexDecoder_loopback.py", line 2106, in set_variable_qtgui_label_0
    Qt.QMetaObject.invokeMethod(self._variable_qtgui_label_0_label, "setText", Qt.Q_ARG("QString", eng_notation.num_to_str(self.variable_qtgui_label_0)))
  File "/usr/local/lib/python2.7/dist-packages/gnuradio/eng_notation.py", line 41, in num_to_str
    m = abs(n)
TypeError: bad operand type for abs(): 'str'

I also get this error whenever I double click the QT GUI Label in question:

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/gnuradio/grc/gui/Param.py", line 72, in _update_gui
    Utils.parse_template(TIP_MARKUP_TMPL, param=self.param).strip(),
  File "/usr/local/lib/python2.7/dist-packages/gnuradio/grc/gui/Utils.py", line 121, in __call__
    return str(template(namespaces=kwargs))
  File "/usr/lib/python2.7/dist-packages/Cheetah/Template.py", line 1005, in __str__
    rc = getattr(self, mainMethName)()
  File "cheetah_DynamicallyCompiledCheetahTemplate_1462212927_77_69202.py", line 130, in respond
  File "cheetah_DynamicallyCompiledCheetahTemplate_1462212927_77_69202.py", line 87, in truncate
IndexError: tuple index out of range

Am I doing something wrong?


On Fri, May 6, 2016 at 5:54 PM, Dan CaJacob <address@hidden> wrote:
I am not sure about this, but you may try the standard python formatters.  See https://docs.python.org/2/library/string.html

On Fri, May 6, 2016 at 5:13 PM Richard Bell <address@hidden> wrote:
I am displaying a number using QT GUI Label in GRC like this


when I want it to display like this

20.6e-6 or 20.6x10-6, something along these lines.

What do I put in the formatter section to make this happen?


Discuss-gnuradio mailing list
Very Respectfully,

Dan CaJacob

reply via email to

[Prev in Thread] Current Thread [Next in Thread]