yaq-project / qtypes

Build Python Qt graphical user interfaces out of simple type objects.
GNU Lesser General Public License v3.0
0 stars 2 forks source link

Widget signals are not updated when the tree is rebuilt, resulting in RuntimeErrors. #27

Open ksunden opened 2 years ago

ksunden commented 2 years ago

allowed_units refers to a non-existant self._widget (or at least changeable...)

Traceback (most recent call last):
  File "/home/kyle/venvs/pyenv/versions/3.10.0/envs/edge/lib/python3.10/site-packages/qtypes/_widgets/_float.py", line 39, in on_spin_box_editing_finished
    self.model.set({"value": self.spin_box.value()}, from_widget=True)
  File "/home/kyle/venvs/pyenv/versions/3.10.0/envs/edge/lib/python3.10/site-packages/qtypes/_float.py", line 42, in set
    cb(self._data)
  File "/home/kyle/venvs/pyenv/versions/3.10.0/envs/edge/lib/python3.10/site-packages/qtypes/_widgets/_float.py", line 47, in on_updated
    if data["units"] is not None and len(self.allowed_units) == 0:
  File "/home/kyle/venvs/pyenv/versions/3.10.0/envs/edge/lib/python3.10/site-packages/qtypes/_widgets/_float.py", line 30, in allowed_units
    for i in range(self.combo_box.count()):
RuntimeError: wrapped C/C++ object of type QComboBox has been deleted
ksunden commented 2 years ago

Similarly, buttons and other callbacks for widgets do not get updated automatically when the tree is rebuilt... I think some of this may be the same cause, though I think the particular lines I saw in qtypes/_float.py do still need to be addressed (though looks like it is not actually where it is raising)

ksunden commented 2 years ago

It is possible that the new signals are added but never processed due to the exceptions, but the key is that widget signals/slots are not maintained on restructure calls...