Problem
- If the default value of the string argument is "A"
- Type "B" and press Enter, reset button shown
- Press reset, value fallback to default "A"
- Type "B" again, reset button not shown
Is this an expected behavior ?
I found that it's because the self._previous attribute is holding the previous input from user, but not fallback to default when reset pressed.
|
def onEditingFinished(self): |
|
current = self._read() |
|
|
|
if current != self._previous: |
|
self.changed.emit() |
|
self._previous = current |
|
|
So it's actually :
| Steps |
_previous |
| Default value of the string argument is "A" |
_previous == "A" |
| Type "B" and press Enter, reset button shown |
_previous == "B", thanks to String.onEditingFinished |
| Press reset, value fallback to default "A" |
_previous == "B", because String.write triggered by reset did not update it |
| Type "B" again, reset button not shown |
current == self._previous, changed signal not emit |
Problem
Is this an expected behavior ?
I found that it's because the
self._previousattribute is holding the previous input from user, but not fallback to default when reset pressed.qargparse.py/qargparse.py
Lines 464 to 470 in 2dcdc17
So it's actually :
_previous_previous== "A"_previous== "B", thanks toString.onEditingFinished_previous== "B", becauseString.writetriggered by reset did not update itcurrent==self._previous, changed signal not emit