diff options
author | Joseph Rice <mrwildrice@gmail.com> | 2019-10-09 22:02:35 -0400 |
---|---|---|
committer | Joseph Rice <mrwildrice@gmail.com> | 2019-10-11 03:13:08 -0400 |
commit | fc703385d542340311e62608f9d63d35b4c865c5 (patch) | |
tree | 1738bb5f6147ae454bd60aadb1f12f8dacf4f9ea /ranger | |
parent | b58954d4258bc204c38f635e5209e6c1e2bce743 (diff) | |
download | ranger-fc703385d542340311e62608f9d63d35b4c865c5.tar.gz |
moved image displayer registry getter logic into ext.img_display
Diffstat (limited to 'ranger')
-rw-r--r-- | ranger/core/fm.py | 9 | ||||
-rw-r--r-- | ranger/ext/img_display.py | 5 |
2 files changed, 7 insertions, 7 deletions
diff --git a/ranger/core/fm.py b/ranger/core/fm.py index e0a7b5df..7d23c9b6 100644 --- a/ranger/core/fm.py +++ b/ranger/core/fm.py @@ -22,7 +22,7 @@ from ranger.container.tags import Tags, TagsDummy from ranger.gui.ui import UI from ranger.container.bookmarks import Bookmarks from ranger.core.runner import Runner -from ranger.ext import img_display +from ranger.ext.img_display import get_image_displayer from ranger.core.metadata import MetadataManager from ranger.ext.rifle import Rifle from ranger.container.directory import Directory @@ -100,7 +100,7 @@ class FM(Actions, # pylint: disable=too-many-instance-attributes def set_image_displayer(): if self.image_displayer: self.image_displayer.quit() - self.image_displayer = self._get_image_displayer() + self.image_displayer = get_image_displayer(self.settings.preview_images_method) set_image_displayer() self.settings.signal_bind('setopt.preview_images_method', set_image_displayer, priority=settings.SIGNAL_PRIORITY_AFTER_SYNC) @@ -223,11 +223,6 @@ class FM(Actions, # pylint: disable=too-many-instance-attributes for line in entry.splitlines(): yield line - def _get_image_displayer(self): - registry = img_display.IMAGE_DISPLAYER_REGISTRY - cls = registry[self.settings.preview_images_method] - return cls() - def _get_thisfile(self): return self.thistab.thisfile diff --git a/ranger/ext/img_display.py b/ranger/ext/img_display.py index f9a83ffc..939eacb5 100644 --- a/ranger/ext/img_display.py +++ b/ranger/ext/img_display.py @@ -91,6 +91,11 @@ def register_image_displayer(nickname=None): return decorator +def get_image_displayer(key): + cls = IMAGE_DISPLAYER_REGISTRY[key] + return cls() + + class ImageDisplayer(object): """Image display provider functions for drawing images in the terminal""" |