Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Boolean values always retrieved as True from QSettings #18

Open
luipugs opened this issue Sep 7, 2016 · 0 comments
Open

Boolean values always retrieved as True from QSettings #18

luipugs opened this issue Sep 7, 2016 · 0 comments
Assignees

Comments

@luipugs
Copy link

luipugs commented Sep 7, 2016

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
@mfitzp mfitzp self-assigned this Oct 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants