diff options
Diffstat (limited to 'ranger/gui/widgets/filelistcontainer.py')
-rw-r--r-- | ranger/gui/widgets/filelistcontainer.py | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/ranger/gui/widgets/filelistcontainer.py b/ranger/gui/widgets/filelistcontainer.py index 6e925f83..53cbf064 100644 --- a/ranger/gui/widgets/filelistcontainer.py +++ b/ranger/gui/widgets/filelistcontainer.py @@ -1,6 +1,7 @@ """The FileListContainer manages a set of FileLists.""" from . import Widget from .filelist import FileList +from .pager import Pager from ..displayable import DisplayableContainer from ranger import log @@ -39,6 +40,9 @@ class FileListContainer(Widget, DisplayableContainer): else: self.main_filelist.display_infostring = True self.main_filelist.main_display = True + + self.pager = Pager(win, embedded=True) + self.add_obj(self.pager) def resize(self, y, x, hei, wid): """Resize all the filelists according to the given ratio""" @@ -53,12 +57,17 @@ class FileListContainer(Widget, DisplayableContainer): else: generator = zip(self.ratios, range(len(self.ratios))) + last_i = len(self.ratios) - 1 + for ratio, i in generator: wid = int(ratio * self.wid) - if i == len(self.ratios) - 1: + if i == last_i: wid = int(self.wid - left + 1) + if i == last_i - 1: + self.pager.resize(self.y, left, hei, max(1, self.wid - left)) + try: self.container[i].resize(self.y, left, hei, max(1, wid-1)) except KeyError: @@ -66,10 +75,28 @@ class FileListContainer(Widget, DisplayableContainer): left += wid + def open_pager(self): + self.pager.activate(True) + self.pager.open() + try: + self.container[-2].show(False) + self.container[-3].show(False) + except IndexError: + pass + + def close_pager(self): + self.pager.activate(False) + self.pager.close() + try: + self.container[-2].show(True) + self.container[-3].show(True) + except IndexError: + pass + def poke(self): DisplayableContainer.poke(self) if self.settings.collapse_preview and self.preview: - has_preview = self.container[-1].has_preview() + has_preview = self.container[-2].has_preview() if self.preview_available != has_preview: self.preview_available = has_preview self.resize(self.y, self.x, self.hei, self.wid) |