forked from openlp/openlp
don't overwrite build-ins
This commit is contained in:
parent
6cecfe0fb7
commit
c58a6c801d
@ -82,7 +82,7 @@ class SettingsManager(object):
|
||||
Settings().setValue(section + u'/' + name, directory)
|
||||
|
||||
@staticmethod
|
||||
def set_list(section, name, list):
|
||||
def set_list(section, name, list_to_save):
|
||||
"""
|
||||
Save a list to application settings.
|
||||
|
||||
@ -92,16 +92,16 @@ class SettingsManager(object):
|
||||
``name``
|
||||
The name of the list to save.
|
||||
|
||||
``list``
|
||||
``list_to_save``
|
||||
The list of values to save.
|
||||
"""
|
||||
settings = Settings()
|
||||
settings.beginGroup(section)
|
||||
old_count = settings.value(u'%s count' % name, 0)
|
||||
new_count = len(list)
|
||||
new_count = len(list_to_save)
|
||||
settings.setValue(u'%s count' % name, new_count)
|
||||
for counter in range(new_count):
|
||||
settings.setValue(u'%s %d' % (name, counter), list[counter - 1])
|
||||
settings.setValue(u'%s %d' % (name, counter), list_to_save[counter - 1])
|
||||
if old_count > new_count:
|
||||
# Tidy up any old list items
|
||||
for counter in range(new_count, old_count):
|
||||
@ -122,14 +122,14 @@ class SettingsManager(object):
|
||||
settings = Settings()
|
||||
settings.beginGroup(section)
|
||||
list_count = settings.value(u'%s count' % name, 0)
|
||||
list = []
|
||||
loaded_list = []
|
||||
if list_count:
|
||||
for counter in range(list_count):
|
||||
item = settings.value(u'%s %d' % (name, counter), u'')
|
||||
if item:
|
||||
list.append(item)
|
||||
loaded_list.append(item)
|
||||
settings.endGroup()
|
||||
return list
|
||||
return loaded_list
|
||||
|
||||
@staticmethod
|
||||
def get_files(section=None, extension=None):
|
||||
|
Loading…
Reference in New Issue
Block a user