pyqtconfig icon indicating copy to clipboard operation
pyqtconfig copied to clipboard

Boolean values always retrieved as True from QSettings

Open luipugs opened this issue 7 years ago • 0 comments

A Boolean value is retrieved as unicode from QSettings' storage. The line https://github.com/mfitzp/pyqtconfig/blob/master/pyqtconfig/config.py#L983 compares the type to basestring, which then returns False so the type is not munged, which causes https://github.com/mfitzp/pyqtconfig/blob/master/pyqtconfig/config.py#L994 to become bool(u'value') and always return True. Changing the comparison to issubclass(vt, basestring) worked in my case.

$ python
Python 2.7.12 (default, Jul  1 2016, 15:12:24) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyQt5.QtCore import QT_VERSION_STR
>>> print QT_VERSION_STR
5.5.1
>>> from PyQt5.Qt import PYQT_VERSION_STR
>>> print PYQT_VERSION_STR
5.5.1
>>> from sip import SIP_VERSION_STR
>>> print SIP_VERSION_STR
4.17

$ lsb_release -a
LSB Version:    core-9.20160110ubuntu0.2-amd64:core-9.20160110ubuntu0.2-noarch:printing-9.20160110ubuntu0.2-amd64:printing-9.20160110ubuntu0.2-noarch:security-9.20160110ubuntu0.2-amd64:security-9.20160110ubuntu0.2-noarch
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.1 LTS
Release:        16.04
Codename:       xenial

luipugs avatar Sep 07 '16 08:09 luipugs