fixed bug caused by merge

This commit is contained in:
Andreas Preikschat 2012-12-27 17:46:27 +01:00
parent f1bdcec79d
commit cbd22b7141
3 changed files with 13 additions and 8 deletions

View File

@ -136,6 +136,9 @@ class Settings(QtCore.QSettings):
**Note**, this method only converts a few types and might need to be
extended if a certain type is missing!
"""
# Check for none as u'' is passed as default and is valid!
if defaultValue is None and not super(Settings, self).contains(key):
return None
setting = super(Settings, self).value(key, defaultValue)
# An empty list saved to the settings results in a None type being
# returned.

View File

@ -1075,7 +1075,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
export_settings.endGroup()
# Write all the sections and keys.
for section_key in keys:
key_value = settings.value(section_key)
key_value = settings.value(section_key, None)
if key_value is not None:
export_settings.setValue(section_key, key_value)
export_settings.sync()
# Temp CONF file has been written. Blanks in keys are now '%20'.

View File

@ -594,6 +594,7 @@ def strip_rtf(text, default_encoding=None):
text = u''.join(out)
return text, default_encoding
def natcmp(a, b):
"""
Natural string comparison which mimics the behaviour of Python's internal
@ -604,9 +605,9 @@ def natcmp(a, b):
if isinstance(key, int) and isinstance(b[i], int):
result = cmp(key, b[i])
elif isinstance(key, int) and not isinstance(b[i], int):
result = locale_direct_compare(QtCore.QString(str(key)), b[i])
result = locale_direct_compare(str(key), b[i])
elif not isinstance(key, int) and isinstance(b[i], int):
result = locale_direct_compare(key, QtCore.QString(str(b[i])))
result = locale_direct_compare(key, str(b[i]))
else:
result = locale_direct_compare(key, b[i])
if result != 0:
@ -620,9 +621,9 @@ def natcmp(a, b):
if isinstance(a[i], int) and isinstance(key, int):
result = cmp(a[i], key)
elif isinstance(a[i], int) and not isinstance(key, int):
result = locale_direct_compare(QtCore.QString(str(a[i])), key)
result = locale_direct_compare(str(a[i]), key)
elif not isinstance(a[i], int) and isinstance(key, int):
result = locale_direct_compare(a[i], QtCore.QString(str(key)))
result = locale_direct_compare(a[i], str(key))
else:
result = locale_direct_compare(a[i], key)
if result != 0: