diff options
author | Delisa Mason <iskanamagus@gmail.com> | 2015-03-08 16:09:42 -0700 |
---|---|---|
committer | Delisa Mason <iskanamagus@gmail.com> | 2015-03-08 16:39:30 -0700 |
commit | 30e73031874b6fcf63459a2e658893823a3e5a21 (patch) | |
tree | 95823d7333987c73294100e782c11f50ba3d97b8 /ranger | |
parent | 0d16709f82a2f15c43eb875c3f4c92a110600541 (diff) | |
download | ranger-30e73031874b6fcf63459a2e658893823a3e5a21.tar.gz |
Switch image displayers based on preferences
Diffstat (limited to 'ranger')
-rw-r--r-- | ranger/core/fm.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/ranger/core/fm.py b/ranger/core/fm.py index 22908f46..2d5d3c1e 100644 --- a/ranger/core/fm.py +++ b/ranger/core/fm.py @@ -19,7 +19,7 @@ from ranger.container.tags import Tags from ranger.gui.ui import UI from ranger.container.bookmarks import Bookmarks from ranger.core.runner import Runner -from ranger.ext.img_display import ImageDisplayer +from ranger.ext.img_display import * from ranger.core.metadata import MetadataManager from ranger.ext.rifle import Rifle from ranger.container.directory import Directory @@ -49,7 +49,6 @@ class FM(Actions, SignalDispatcher): self.start_paths = paths self.directories = dict() self.log = deque(maxlen=20) - self.image_displayer = ImageDisplayer() self.bookmarks = bookmarks self.current_tab = 1 self.tabs = {} @@ -97,6 +96,7 @@ class FM(Actions, SignalDispatcher): rifleconf = self.relpath('config/rifle.conf') self.rifle = Rifle(rifleconf) self.rifle.reload_config() + self.image_displayer = self._get_image_displayer() if not ranger.arg.clean and self.tags is None: self.tags = Tags(self.confpath('tagged')) @@ -184,6 +184,14 @@ class FM(Actions, SignalDispatcher): if debug: raise + def _get_image_displayer(self): + if self.settings.use_w3m_image_preview: + return W3MImageDisplayer() + elif self.settings.use_iterm2_image_preview: + return ITerm2ImageDisplayer() + else: + return ImageDisplayer() + def _get_thisfile(self): return self.thistab.thisfile |