diff options
author | hut <hut@lepus.uberspace.de> | 2016-08-22 01:20:41 +0200 |
---|---|---|
committer | hut <hut@lepus.uberspace.de> | 2016-08-22 01:20:41 +0200 |
commit | aaae1e0861bb85259f1a888f56685666317cae9d (patch) | |
tree | 139b8ba6f73ce68ba0b3bdd397a3fddac3bd2c37 | |
parent | 8132885c2fbddc9e686f2285b307e28a1f29f2a7 (diff) | |
download | ranger-aaae1e0861bb85259f1a888f56685666317cae9d.tar.gz |
Revert "gui.displayable: more safe DisplayableContainer.replace_child"
This reverts commit 8132885c2fbddc9e686f2285b307e28a1f29f2a7.
-rw-r--r-- | ranger/gui/displayable.py | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/ranger/gui/displayable.py b/ranger/gui/displayable.py index 4a5bcde6..62eb5300 100644 --- a/ranger/gui/displayable.py +++ b/ranger/gui/displayable.py @@ -292,19 +292,9 @@ class DisplayableContainer(Displayable): obj.parent = self def replace_child(self, old_obj, new_obj): - """ - Replace the old object with the new instance in the container. - - The new object will have the same position in the list as old_obj. - If old_obj is not in the list, new_obj will simply be appended. - """ - try: - index = self.container.index(old_obj) - except ValueError: - self.add_child(new_obj) - else: - self.container[index] = new_obj - new_obj.parent = self + """Replace the old object with the new instance in the container.""" + self.container[self.container.index(old_obj)] = new_obj + new_obj.parent = self def remove_child(self, obj): """Remove the object from the container.""" |