From 0ebabf81cbab14301a81de0a28ba7da6fe153c3d Mon Sep 17 00:00:00 2001 From: hut Date: Sun, 16 Jul 2017 07:11:47 +0200 Subject: widgets.statusbar: add visual indicator for "freeze_files" option --- ranger/colorschemes/default.py | 3 +++ ranger/gui/context.py | 2 +- ranger/gui/ui.py | 4 ++++ ranger/gui/widgets/statusbar.py | 5 +++++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ranger/colorschemes/default.py b/ranger/colorschemes/default.py index 7d2b124f..c88cdc7c 100644 --- a/ranger/colorschemes/default.py +++ b/ranger/colorschemes/default.py @@ -98,6 +98,9 @@ class Default(ColorScheme): if context.marked: attr |= bold | reverse fg = yellow + if context.frozen: + attr |= bold | reverse + fg = cyan if context.message: if context.bad: attr |= bold diff --git a/ranger/gui/context.py b/ranger/gui/context.py index 7c7f1727..d8d1957c 100644 --- a/ranger/gui/context.py +++ b/ranger/gui/context.py @@ -16,7 +16,7 @@ CONTEXT_KEYS = [ 'good', 'bad', 'space', 'permissions', 'owner', 'group', 'mtime', 'nlink', 'scroll', 'all', 'bot', 'top', 'percentage', 'filter', - 'flat', 'marked', 'tagged', 'tag_marker', 'cut', 'copied', + 'flat', 'marked', 'tagged', 'tag_marker', 'cut', 'copied', 'frozen', 'help_markup', # COMPAT 'seperator', 'key', 'special', 'border', # COMPAT 'title', 'text', 'highlight', 'bars', 'quotes', 'tab', 'loaded', diff --git a/ranger/gui/ui.py b/ranger/gui/ui.py index 5d53603f..5877e484 100644 --- a/ranger/gui/ui.py +++ b/ranger/gui/ui.py @@ -102,6 +102,7 @@ class UI( # pylint: disable=too-many-instance-attributes,too-many-public-method pass self.settings.signal_bind('setopt.mouse_enabled', _setup_mouse) + self.settings.signal_bind('setopt.freeze_files', self.redraw_statusbar) _setup_mouse(dict(value=self.settings.mouse_enabled)) if not self.is_set_up: @@ -452,6 +453,9 @@ class UI( # pylint: disable=too-many-instance-attributes,too-many-public-method def redraw_main_column(self): self.browser.main_column.need_redraw = True + def redraw_statusbar(self): + self.status.need_redraw = True + def close_taskview(self): self.taskview.visible = False self.browser.visible = True diff --git a/ranger/gui/widgets/statusbar.py b/ranger/gui/widgets/statusbar.py index 980945dc..266d48ca 100644 --- a/ranger/gui/widgets/statusbar.py +++ b/ranger/gui/widgets/statusbar.py @@ -302,6 +302,11 @@ class StatusBar(Widget): # pylint: disable=too-many-instance-attributes else: right.add('0/0 All', base, 'all') + if self.settings.freeze_files: + # Indicate that files are frozen and will not be loaded + right.add(" ", "space") + right.add('FROZEN', base, 'frozen') + def _print_result(self, result): self.win.move(0, 0) for part in result: -- cgit 1.4.1-2-gfad0