enthought/traitsui

traitsui/examples/demo/Advanced/Popup_Dialog_demo.py does not support the qt toolkit

Closed this issue · 3 comments

We have decided to close this issue without change due to the following reason:
After investigation, we found that the "gender" in the PersonHandler.info.object (https://github.com/enthought/traitsui/blob/main/traitsui/examples/demo/Advanced/Popup_Dialog_demo.py#L74) is decoupled from the value show up in the front end: when we change the gender value through edit_traits, the value showed up in the ui remains unchanged, this suggests the interaction between the qt ui and the object value is more complicated than we think and may involve substantial changes to the qt code. Thus we decided to leave this demo as a wx only demo.


Problem:
When running traitsui/examples/demo/Advanced/Popup_Dialog_demo.py, NotImplementedError: the 'qt' toolkit does not implement this method will be thrown when we change gender from male to female in the interface

Replication Steps:

python traitsui/examples/demo/Advanced/Popup_Dialog_demo.py

then change gender from male to female

Environment:
[MacOS, python3.11]

Package Version Editable project location


apptools 5.2.0
attrdict 2.0.1
attrdict3 2.0.2
blosc2 2.0.0
celiagg 2.1.3
certifi 2022.12.7
chaco 5.1.0 /Users/cyliu/Documents/3.11_test/chaco
charset-normalizer 3.1.0
configobj 5.0.8
cPython 0.0.6
Cython 0.29.34
dnspython 2.3.0
enable 5.4.0.dev45 /Users/cyliu/Documents/3.11_test/enable
fonttools 4.39.2
h5py 3.8.0
idna 3.4
joblib 1.2.0
msgpack 1.0.5
numexpr 2.8.4
numpy 1.24.2
packaging 23.1
pandas 1.5.3
Pillow 9.4.0
pip 23.1
py-cpuinfo 9.0.0
PyAudio 0.2.13
pyface 8.0.0
pygarrayimage 1.0
pyglet 2.0.5 /Users/cyliu/Documents/3.11_test/pyglet
Pygments 2.14.0
pymongo 4.3.3
pyparsing 3.0.9
PySide6 6.4.3
PySide6-Addons 6.4.3
PySide6-Essentials 6.4.3
python-dateutil 2.8.2
pythonw 3.0.3
pytz 2023.2
reportlab 3.6.12
requests 2.28.2
scikit-learn 1.2.2
scipy 1.10.1
setuptools 65.6.3
shiboken6 6.4.3
six 1.16.0
tables 3.8.0
threadpoolctl 3.1.0
traits 7.0.0.dev1854 /Users/cyliu/Documents/3.11_test/traits
traitsui 8.0.0.dev0 /Users/cyliu/Documents/3.11_test/traitsui
urllib3 1.26.15
wxPython 4.2.0

Although this demo is only supposed to be run with wx, we want to see whether there is a way to make it run on qt as well. Currently, I found that if I add the following function in the GUI toolkit (https://github.com/enthought/traitsui/blob/main/traitsui/qt/toolkit.py#L153 ):

    def ui_popup(self, ui, parent):
        from . import ui_live

        ui_live.ui_popup(ui, parent)

which is similar to what used by wx (https://github.com/enthought/traitsui/blob/main/traitsui/wx/toolkit.py#L136 ), the change of gender will not cause the program to crash, however it will cause the popup window to be unclosable (MacOS, python3.11) no matter what you click.

dpinte commented

For the record, here is the full traceback:

Traceback (most recent call last):
  File "/Users/dpinte/.edm/envs/ets38/lib/python3.8/site-packages/traits/trait_notifiers.py", line 524, in _dispatch_change_event
    self.dispatch(handler, *args)
  File "/Users/dpinte/.edm/envs/ets38/lib/python3.8/site-packages/traits/trait_notifiers.py", line 619, in dispatch
    handler(*args)
  File "/Users/dpinte/.edm/envs/ets38/lib/python3.8/site-packages/traitsui/ui.py", line 900, in dispatch
    self.method(self.info)
  File "traitsui/examples/demo/Advanced/Popup_Dialog_demo.py", line 70, in object_gender_changed
    self._ui = self.edit_traits(parent=info.gender.control)
  File "/Users/dpinte/.edm/envs/ets38/lib/python3.8/site-packages/traitsui/handler.py", line 427, in edit_traits
    return self.trait_view(view).ui(
  File "/Users/dpinte/.edm/envs/ets38/lib/python3.8/site-packages/traitsui/view.py", line 457, in ui
    ui.ui(parent, kind)
  File "/Users/dpinte/.edm/envs/ets38/lib/python3.8/site-packages/traitsui/ui.py", line 234, in ui
    self.rebuild(self, parent)
  File "/Users/dpinte/.edm/envs/ets38/lib/python3.8/site-packages/traitsui/toolkit.py", line 169, in ui_popup
    raise NotImplementedError(
NotImplementedError: the 'qt4' toolkit does not implement this method