On Fri, Aug 24, 2018 at 1:24 PM kiteh <[email protected]> wrote:
> Got it, thanks! Had thought that there may not be a need to perform
> another `setText()
> I have got another question.. sorry for the mass spam.
>
> I tried following what you have mentioned and do the same for my other
> widgets - checkbox and radiobuttons..
> eg. *self.checkbox01.setChecked(settings.value('check_value', False))*
>
> As soon as I tried relaunching my tool in a new session (no previous saved
> states), it errors out and I was presented with the error
> self.checkbox01.setChecked(settings.value('checking', False))
> # TypeError: 'PySide2.QtWidgets.QAbstractButton.setChecked' called with
> wrong argument types:
> # PySide2.QtWidgets.QAbstractButton.setChecked(unicode)
> # Supported signatures:
> # PySide2.QtWidgets.QAbstractButton.setChecked(bool) #
>
> Going by the error, I have tried using `bool(0)`, `bool(False)` etc, but
> the error persists.
> Is PyQt handling this differently?
>
PyQt has always had a 'bug' in how it serialized bool values. It writes
them as a string and reads them back that way. PySide seems to do it
correctly. What you should do is:
s.setValue('field', int(val))
bool(s.value('field', False))
If you coerce them to and from int, you will be fine.
> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/c1504128-9c76-4f1a-87db-7a7bb9c66978%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/c1504128-9c76-4f1a-87db-7a7bb9c66978%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA3HS0BHqoLZw7-U3i86hwwbcs-Wjk5wQGX8Ewe4xEz%2Bdw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.