Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-1911

Provide a way to get the name of a Signal(Instance)

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Done
    • P4: Low
    • None
    • 6.3.0
    • PySide
    • None
    • bdfb36b880 (pyside/pyside-setup/dev) a7ec89fc56 (pyside/pyside-setup/6.3) 77e159e931 (pyside/pyside-setup/6.2) 77e159e931 (pyside/tqtc-pyside-setup/6.2) a7ec89fc56 (pyside/tqtc-pyside-setup/6.3) bdfb36b880 (pyside/tqtc-pyside-setup/dev)

    Description

      The repr() of signals makes it impossible to see what signal we are dealing with:

      >>> from PySide6.QtCore import QTimer
      >>> QTimer.timeout
      <PySide6.QtCore.Signal object at 0x7fcd97b2abf0>
      >>> QTimer().timeout
      <PySide6.QtCore.SignalInstance object at 0x7fcd9bc37510>
      

      compare this to PyQt6:

      
      

      >>> from PyQt6.QtCore import QTimer
      >>> QTimer.timeout
      <unbound PYQT_SIGNAL timeout()>
      >>> QTimer().timeout
      <bound PYQT_SIGNAL timeout of function object at 0x7fa19b886440>
      {code)

      This is useful for a variety of debugging scenarios, and would also be needed in pytest-qt so that the user doesn't have to pass both signals and their names (as string) to get usable debug output.

      Ideally, the name would be part of the repr() but also accessible via a .name attribute or so.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kleint Friedemann Kleint
            the compiler Florian Bruhin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes