Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grc: fix showing docs from wrong block and add doc tab to qt #7271

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ZakyHermawan
Copy link
Contributor

@ZakyHermawan ZakyHermawan commented Apr 15, 2024

Description

  • Fix issue where the documentation come from another block
  • Add missing documentation tab for Qt GRC

Related Issue

Fixes #7265

Which blocks/areas does this affect?

Max block

Testing Done

max block now have correct documentation
image

docs for another blocks still working properly, here's few examples
image
image
image

Checklist

@willcode
Copy link
Member

@ZakyHermawan does the bug exist in the Qt version, and if so is there an equivalent fix?

@ZakyHermawan ZakyHermawan force-pushed the docs-7265 branch 2 times, most recently from 6ef17e1 to c26bd67 Compare April 15, 2024 22:02
@ZakyHermawan
Copy link
Contributor Author

Documentation for blocks in Qt version of grc:

image

image

image

@willcode willcode added Bug Fix Backport-3.10 Should be backported to 3.10 and removed Bug labels Apr 16, 2024
@willcode willcode changed the title fix issue where the documentation is coming from another block grc: fix showing docs from wrong block and add doc tab to qt Apr 16, 2024
@willcode
Copy link
Member

Would you remove the documentation for the max block and submit that as a separate PR? We can work on the wording a little there. I'll get the code part of this in for this release.

@willcode
Copy link
Member

This PR causes a failure when opening disable blocks. Let's hold off until the next release. A lot of blocks don't have any documentation in this field anyway and rely on the wiki ... something we need to think about.

@ZakyHermawan
Copy link
Contributor Author

ZakyHermawan commented Apr 19, 2024

@willcode would you please give an example on how to reproduce the bug ?

I can open properties of disabled max block
image

Btw I make mistake where i didn't set the textedit for documentation to readonly (i have fixed this on my latest commit)

@willcode
Copy link
Member

The QT Sink block is the one that didn't work in my test, when disabled. It evenutally caused a crash. If you can't replicate it, I'll look through the rather messy stack trace it caused before crashing.

…d documentation tab in qt gui of grc

Signed-off-by: ZakyHermawan <[email protected]>
@haakov
Copy link
Contributor

haakov commented Apr 22, 2024

I'm able to reproduce with a disabled qt sink block. Here's the trace:

Traceback (most recent call last):
  File "/home/hkon/qt_gr/grc/core/blocks/_templates.py", line 77, in render
    return template.render(**namespace)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mako/template.py", line 438, in render
    return runtime._render(self, self.callable_, args, data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mako/runtime.py", line 874, in _render
    _render_context(
  File "/usr/lib/python3.11/site-packages/mako/runtime.py", line 916, in _render_context
    _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
  File "/usr/lib/python3.11/site-packages/mako/runtime.py", line 943, in _exec_template
    callable_(context, *args, **kwargs)
  File "memory:0x75bb98128890", line 115, in render_body
TypeError: not all arguments converted during string formatting

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/hkon/qt_gr/grc/gui_qt/components/canvas/block.py", line 423, in mouseDoubleClickEvent
    self.open_properties()
  File "/home/hkon/qt_gr/grc/gui_qt/components/canvas/block.py", line 453, in open_properties
    self.props_dialog = PropsDialog(self.core, self.force_show_id)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/hkon/qt_gr/grc/gui_qt/components/dialogs.py", line 176, in __init__
    block_constructor = block_templates.render(
                        ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/hkon/qt_gr/grc/core/blocks/_templates.py", line 79, in render
    raise TemplateError(error, text)
grc.core.errors.TemplateError: (TypeError('not all arguments converted during string formatting'), "<%\n    win = 'self._%s_win'%id\n%>\\\nqtgui.${type.fcn}(\n    ${fftsize}, #fftsize\n    ${wintype}, #wintype\n    ${fc}, #fc\n    ${bw}, #bw\n    ${name}, #name\n    ${plotfreq}, #plotfreq\n    ${plotwaterfall}, #plotwaterfall\n    ${plottime}, #plottime\n    ${plotconst}, #plotconst\n    None # parent\n)\nself.${id}.set_update_time(1.0/${rate})\n${win} = sip.wrapinstance(self.${id}.qwidget(), Qt.QWidget)\n\nself.${id}.enable_rf_freq(${showrf})\n\n${gui_hint() % win}")

@haakov
Copy link
Contributor

haakov commented Apr 22, 2024

Actually, the error appears with GRC Gtk too! But it doesn't crash the application

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Documentation for Max block is incorrect
3 participants