mirror of
https://github.com/arsenetar/dupeguru.git
synced 2025-03-10 05:34:36 +00:00
base qt: Fixed an incompatibility with PyQt 4.5.1 (lists of non Q values couldn't be sent directly to QVariant anymore).
--HG-- extra : convert_revision : svn%3Ac306627e-7827-47d3-bdf0-9a457c9553a1/trunk%4070
This commit is contained in:
parent
cda0cdf542
commit
ede178b3ff
@ -30,9 +30,14 @@ def variant_to_py(v):
|
||||
elif t in (QVariant.List, QVariant.StringList):
|
||||
value, ok = map(variant_to_py, v.toList()), True
|
||||
if not ok:
|
||||
raise TypeError()
|
||||
raise TypeError(u"Can't convert {0} of type {1}".format(repr(v), v.type()))
|
||||
return value
|
||||
|
||||
def py_to_variant(v):
|
||||
if isinstance(v, (list, tuple)):
|
||||
return QVariant(map(py_to_variant, v))
|
||||
return QVariant(v)
|
||||
|
||||
class Preferences(object):
|
||||
# (width, is_visible)
|
||||
COLUMNS_DEFAULT_ATTRS = []
|
||||
@ -94,7 +99,7 @@ class Preferences(object):
|
||||
def save(self):
|
||||
settings = QSettings()
|
||||
def set_(name, value):
|
||||
settings.setValue(name, QVariant(value))
|
||||
settings.setValue(name, py_to_variant(value))
|
||||
|
||||
set_('FilterHardness', self.filter_hardness)
|
||||
set_('MixFileKind', self.mix_file_kind)
|
||||
|
Loading…
x
Reference in New Issue
Block a user