fixed setting import

This commit is contained in:
Andreas Preikschat 2012-12-27 18:00:40 +01:00
parent cbd22b7141
commit 0a57bed2f7
4 changed files with 12 additions and 11 deletions

View File

@ -136,7 +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!
# Check for none as u'' is passed as default and is valid! This is
# needed because the settings export does not know the default values,
# thus just passes None.
if defaultValue is None and not super(Settings, self).contains(key):
return None
setting = super(Settings, self).value(key, defaultValue)

View File

@ -1000,8 +1000,9 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
return
# We have a good file, import it.
for section_key in import_keys:
value = import_settings.value(section_key)
settings.setValue(u'%s' % (section_key), value)
value = import_settings.value(section_key, None)
if value is not None:
settings.setValue(u'%s' % (section_key), value)
now = datetime.now()
settings.beginGroup(self.headerSection)
settings.setValue(u'file_imported', import_file_name)

View File

@ -497,10 +497,8 @@ def locale_compare(string1, string2):
is equal to it. Comparison is case insensitive.
"""
# Function locale.strcoll() from standard Python library does not work
# properly on Windows and probably somewhere else.
# properly on Windows.
return locale.strcoll(string1.lower(), string2.lower())
# TODO: check code
#return QtCore.QString.localeAwareCompare(string1.lower(), string2.lower())
# For performance reasons provide direct reference to compare function

View File

@ -213,11 +213,11 @@ class ActionList(object):
empty ``objectName``.
``category``
The category this action belongs to. The category can be a QString
or python unicode string. **Note**, if the category is ``None``, the
category and its actions are being hidden in the shortcut dialog.
However, if they are added, it is possible to avoid assigning
shortcuts twice, which is important.
The category this action belongs to. The category has to be a python
string. . **Note**, if the category is ``None``, the category and
its actions are being hidden in the shortcut dialog. However, if
they are added, it is possible to avoid assigning shortcuts twice,
which is important.
``weight``
The weight specifies how important a category is. However, this only