summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorJoseph Rice <mrwildrice@gmail.com>2019-10-09 22:09:23 -0400
committerJoseph Rice <mrwildrice@gmail.com>2019-10-11 03:13:10 -0400
commitdafcebf172d761e813308f72bee0f502550b130f (patch)
tree56a93235f1a2eae3c1e73645b6a7304a39e02568 /ranger
parentfc703385d542340311e62608f9d63d35b4c865c5 (diff)
downloadranger-dafcebf172d761e813308f72bee0f502550b130f.tar.gz
made variables in image displayer registry accessors less generic
Diffstat (limited to 'ranger')
-rw-r--r--ranger/ext/img_display.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/ranger/ext/img_display.py b/ranger/ext/img_display.py
index 939eacb5..7e911848 100644
--- a/ranger/ext/img_display.py
+++ b/ranger/ext/img_display.py
@@ -85,15 +85,19 @@ IMAGE_DISPLAYER_REGISTRY = defaultdict(fallback_image_displayer)
 def register_image_displayer(nickname=None):
     """Register an ImageDisplayer by nickname if available."""
 
-    def decorator(cls):
-        IMAGE_DISPLAYER_REGISTRY[nickname or cls.__name__] = cls
-        return cls
+    def decorator(image_displayer_class):
+        if nickname:
+            registry_key = nickname
+        else:
+            registry_key = image_displayer_class.__name__
+        IMAGE_DISPLAYER_REGISTRY[registry_key] = image_displayer_class
+        return image_displayer_class
     return decorator
 
 
-def get_image_displayer(key):
-    cls = IMAGE_DISPLAYER_REGISTRY[key]
-    return cls()
+def get_image_displayer(registry_key):
+    image_displayer_class = IMAGE_DISPLAYER_REGISTRY[registry_key]
+    return image_displayer_class()
 
 
 class ImageDisplayer(object):