You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have found a problem of recursivity in the guidata code (version '1.7.6') when using DataSet instances with two or more ChoiceItem instances that have associated callbacks. This is due to the call to self.index_changed within self.get in the class ChoiceWidget(AbstractDataSetWidget). It is easily corrected by interverting the two following lines in qtitemwidgets.py, lines 743-744:
self.index_changed(idx)
self._first_call = False
in the present code, self.index_changed for a first ChoiceWidget leads to a change to a second ChoiceWidget that induces a change to the first ChoiceWidget before self._first_call has been set to False.
the whole function should be rewritten as:
def get(self):
"""Override AbstractDataSetWidget method"""
self.initialize_widget()
value = self.item.get()
if value is not None:
idx = 0
_choices = self.item.get_prop_value("data", "choices")
for key, _val, _img in _choices:
if key == value:
break
idx += 1
self.set_widget_value(idx)
if self._first_call:
self._first_call = False
self.index_changed(idx)
The text was updated successfully, but these errors were encountered:
I have found a problem of recursivity in the guidata code (version '1.7.6') when using DataSet instances with two or more ChoiceItem instances that have associated callbacks. This is due to the call to self.index_changed within self.get in the class ChoiceWidget(AbstractDataSetWidget). It is easily corrected by interverting the two following lines in qtitemwidgets.py, lines 743-744:
self.index_changed(idx)
self._first_call = False
in the present code, self.index_changed for a first ChoiceWidget leads to a change to a second ChoiceWidget that induces a change to the first ChoiceWidget before self._first_call has been set to False.
the whole function should be rewritten as:
def get(self):
"""Override AbstractDataSetWidget method"""
self.initialize_widget()
value = self.item.get()
if value is not None:
idx = 0
_choices = self.item.get_prop_value("data", "choices")
for key, _val, _img in _choices:
if key == value:
break
idx += 1
self.set_widget_value(idx)
if self._first_call:
self._first_call = False
self.index_changed(idx)
The text was updated successfully, but these errors were encountered: