Use slicing for getlayers for SettingsValue

This commit is contained in:
Florian Bruhin 2014-04-13 21:48:51 +02:00
parent 65b99dab45
commit 313d6e3967

View File

@ -64,11 +64,8 @@ class SettingValue:
Args: Args:
startlayer: The first layer to include. startlayer: The first layer to include.
""" """
# FIXME this could be done more efficiently with a view.
idx = list(self._values.keys()).index(startlayer) idx = list(self._values.keys()).index(startlayer)
d = self._values.copy() d = OrderedDict(list(self._values.items())[idx:])
for _ in range(idx):
d.popitem(last=False)
return d return d
def get_first_value(self, startlayer=None): def get_first_value(self, startlayer=None):