diff options
author | hut <hut@lavabit.com> | 2010-04-15 17:20:44 +0200 |
---|---|---|
committer | hut <hut@lavabit.com> | 2010-04-15 17:20:44 +0200 |
commit | c2f737e0b343667bacd3edf6be37ec94e834fd65 (patch) | |
tree | cee281d3831dc2878631abfbec435978a14a4096 | |
parent | 353820f392ee88ed02643e7bce79dadc3933d4c9 (diff) | |
download | ranger-c2f737e0b343667bacd3edf6be37ec94e834fd65.tar.gz |
widgets.console: added "prompt" keyword argument for console.open()
-rw-r--r-- | ranger/core/actions.py | 4 | ||||
-rw-r--r-- | ranger/gui/defaultui.py | 4 | ||||
-rw-r--r-- | ranger/gui/widgets/console.py | 7 |
3 files changed, 10 insertions, 5 deletions
diff --git a/ranger/core/actions.py b/ranger/core/actions.py index 2fd7d46d..4b4fc032 100644 --- a/ranger/core/actions.py +++ b/ranger/core/actions.py @@ -105,10 +105,10 @@ class Actions(FileManagerAware, EnvironmentAware, SettingsAware): """Redraw the window""" self.ui.redraw_window() - def open_console(self, mode=':', string=''): + def open_console(self, mode=':', string='', prompt=None): """Open the console if the current UI supports that""" if hasattr(self.ui, 'open_console'): - self.ui.open_console(mode, string) + self.ui.open_console(mode, string, prompt=prompt) def execute_file(self, files, **kw): """Execute a file. diff --git a/ranger/gui/defaultui.py b/ranger/gui/defaultui.py index 08e0b204..a0a5da4e 100644 --- a/ranger/gui/defaultui.py +++ b/ranger/gui/defaultui.py @@ -93,8 +93,8 @@ class DefaultUI(UI): def close_embedded_pager(self): self.browser.close_pager() - def open_console(self, mode, string=''): - if self.console.open(mode, string): + def open_console(self, mode, string='', prompt=None): + if self.console.open(mode, string, prompt=prompt): self.status.msg = None self.console.on_close = self.close_console self.console.visible = True diff --git a/ranger/gui/widgets/console.py b/ranger/gui/widgets/console.py index c93a4f38..9bd37c01 100644 --- a/ranger/gui/widgets/console.py +++ b/ranger/gui/widgets/console.py @@ -112,9 +112,14 @@ class Console(Widget): except: pass - def open(self, mode, string=''): + def open(self, mode, string='', prompt=None): if not is_valid_mode(mode): return False + if prompt is not None: + assert isinstance(prompt, str) + self.prompt = prompt + elif hasattr(self, 'prompt'): + del self.prompt cls = mode_to_class(mode) |