PlotPyStack / guidata

Python library generating graphical user interfaces for easy dataset editing and display
https://pypi.python.org/pypi/guidata
BSD 3-Clause "New" or "Revised" License
61 stars 19 forks source link

Is this a bug in ChoiceWidget ? #75

Open picca opened 3 months ago

picca commented 3 months ago

Hello, I am trying to make some code written by a scientific releasable.

I find this in the code

#these lines are needed to correct an error in guidata
import inspect
from guidata.dataset.qtitemwidgets import ChoiceWidget
string = inspect.getsource(ChoiceWidget.get)
ind0 = string.index('self._first_call = False')
ind1 = string.index('self.index_changed(idx)')
txt = "error not corrected in python module guidata.dataset.qtitemwidgets\n"
txt += "in ChoiceWidget.get(self):"
txt +=  "inverting lines 'self._first_call = False' and 'self.index_changed(idx)' is needed"
assert (ind0 < ind1),txt

do you have an opinion about this ???

Cheers

Fred

PierreRaybaut commented 3 months ago

Hello Fred, Thanks for the feedback!

The fact it's needed to inverse those two lines as a workaround does not ring a bell, unfortunately. I'm not comfortable with changing this without a test case failure.

Could you provide a simple example that reproduce the bug reported by your colleague?

Maybe he/she is using a callback on a ChoiceItem, but I would really need to be able to reproduce it in order to fix it.

Now is a good time for a fix as I'm planning a maintenance release in the next days or so.