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

message_box example and factories(about, critical, questions, etc.) don't work #108

Open
blakejohnson opened this issue Dec 4, 2013 · 5 comments

Comments

@blakejohnson
Copy link

In trying to run the message_box example, if I click on any of the buttons I get the error message: AttributeError: 'NoneType' object has no attribute 'setWidget'. The call stack shows that this happens in the call to set_parent.

Possibly relevant: I am using PySide rather than PyQt.

@sccolbert
Copy link
Member

Sounds like a PySide bug. Can you test on PyQt and confirm?

@blakejohnson
Copy link
Author

Indeed, this does seem to work with PyQt.

@sccolbert
Copy link
Member

Thanks. Marking as PySide bug.

@kiwi0fruit
Copy link

kiwi0fruit commented Sep 4, 2018

Message box doesn't work with PySide2

Simply using message box leads to error with PySide2:

from enaml.stdlib.message_box import information
...
    triggered ::
        information(self, "Testing",
            ("If you see this then presumably PySide-Enaml bug was patched.\n" +
             "But it still can be broken if Python hangs after pressing OK.")
        )
...

Error:

Traceback (most recent call last):
  File "C:\Miniconda3\envs\enaml\lib\site-packages\enaml\qt\qt_action.py", line 79, in on_triggered
    self.declaration.triggered(checked)
  File "C:\Miniconda3\envs\enaml\lib\site-packages\enaml\core\declarative_meta.py", line 68, in declarative_change_handler
    engine.write(owner, change['name'], change)
  File "C:\Miniconda3\envs\enaml\lib\site-packages\enaml\core\expression_engine.py", line 217, in write
    pair.writer(owner, name, change)
  File "C:\Miniconda3\envs\enaml\lib\site-packages\enaml\core\standard_handlers.py", line 82, in __call__
    call_func(func, (), {}, scope)
  File "C:\PyCharmProjects\enaml_video\enaml_video_view.enaml", line 51, in f
    )
  File "C:\Miniconda3\envs\enaml\lib\site-packages\enaml\stdlib\message_box.enaml", line 148, in information
    return _exec_box(parent, title, text, buttons, 'information')
  File "C:\Miniconda3\envs\enaml\lib\site-packages\enaml\stdlib\message_box.enaml", line 305, in _exec_box
    box.set_parent(parent)
  File "C:\Miniconda3\envs\enaml\lib\site-packages\enaml\core\object.py", line 160, in set_parent
    parent.child_added(self)
  File "C:\Miniconda3\envs\enaml\lib\site-packages\enaml\widgets\toolkit_object.py", line 185, in child_added
    child.activate_proxy()
  File "C:\Miniconda3\envs\enaml\lib\site-packages\enaml\widgets\toolkit_object.py", line 210, in activate_proxy
    self.activate_top_down()
  File "C:\Miniconda3\envs\enaml\lib\site-packages\enaml\widgets\toolkit_object.py", line 226, in activate_top_down
    self.proxy.activate_top_down()
  File "C:\Miniconda3\envs\enaml\lib\site-packages\enaml\qt\qt_toolkit_object.py", line 75, in activate_top_down
    self.create_widget()
  File "C:\Miniconda3\envs\enaml\lib\site-packages\enaml\qt\qt_dialog.py", line 72, in create_widget
    self.widget = QWindowDialog(self, self.parent_widget(), flags)
  File "C:\Miniconda3\envs\enaml\lib\site-packages\enaml\qt\qt_dialog.py", line 41, in __init__
    super(QWindowDialog, self).__init__(parent, flags)
TypeError: 'PySide2.QtWidgets.QDialog' called with wrong argument types:
  PySide2.QtWidgets.QDialog(PySide2.QtWidgets.QAction, PySide2.QtCore.Qt.WindowType)
Supported signatures:
  PySide2.QtWidgets.QDialog(PySide2.QtWidgets.QWidget = nullptr, PySide2.QtCore.Qt.WindowFlags = Qt.WindowFlags())

Process finished with exit code 0

Presumably now it's worth investigations as PySide2 was added to pypi. I installed PySide2-5.11.1 from pip (pip install pyside2 + delete qt.conf if it's near python.exe).

Related issue about work arounds for this bug stopped working with PySide1. But I didn't test them with PySide2 because I'm more interested in upstream solution rather than a work around.

@MatthieuDartiailh
Copy link
Member

Indeed this is new I believe. I will try to investigate but I do not know when I will find time to do so.

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

No branches or pull requests

4 participants