[PyQt] with PyQt's input hook, is it expected that sending to stdin dismisses a modal dialog created in response to a signal?

Erik Hvatum ice.rikh at gmail.com
Tue Feb 23 15:17:12 GMT 2016


With PyQt's input hook, is it expected that sending \n to stdin dismisses a
modal dialog created in response to a signal?  Looking at
qtcore_input_hook() in qcoreapplication.sip, it's easy to see why this
happens, and it seems like a reasonable compromise between permitting modal
dialogs and avoiding blocking the Python prompt.  Still, google doesn't
reveal a definitive answer, and I'd like to be sure that I understand the
situation.

On OS X:

> python3
Python 3.5.1 (default, Dec 14 2015, 16:26:43)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.1.76)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyQt5 import Qt
>>> import sys
>>> app = Qt.QApplication(sys.argv)
>>> def show_file_dlg():
...     Qt.QFileDialog.getSaveFileName(None, 'test',filter='tests (*.test
*.tst)')
...
>>> t = Qt.QTimer()
>>> t.setSingleShot(True)
>>> t.timeout.connect(show_file_dlg)
>>> t.start(1000) # wait a second, file dialog appears
>>> # press enter in terminal, file dialog is dismissed and we get a new
prompt
>>>

The behavior on Linux is the same.

Thanks,
Erik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20160223/d3f31a8e/attachment.html>


More information about the PyQt mailing list