diff options
author | hut <hut@lavabit.com> | 2010-04-06 02:49:47 +0200 |
---|---|---|
committer | hut <hut@lavabit.com> | 2010-04-06 02:49:47 +0200 |
commit | 319c55cb0e336d83cbfea03fa94b61bfd91895a2 (patch) | |
tree | 761d4bb6977d8bfa037d02df1df3ac22607c4f08 /ranger | |
parent | c2e158e43c569d2e44806c55f5394d8e202a4edf (diff) | |
download | ranger-319c55cb0e336d83cbfea03fa94b61bfd91895a2.tar.gz |
core.fm: Handle system keys directly in the main loop
Diffstat (limited to 'ranger')
-rw-r--r-- | ranger/core/actions.py | 13 | ||||
-rw-r--r-- | ranger/core/fm.py | 16 | ||||
-rw-r--r-- | ranger/defaults/keys.py | 3 |
3 files changed, 16 insertions, 16 deletions
diff --git a/ranger/core/actions.py b/ranger/core/actions.py index 480200d5..877c300e 100644 --- a/ranger/core/actions.py +++ b/ranger/core/actions.py @@ -27,6 +27,11 @@ class Actions(EnvironmentAware, SettingsAware): search_method = 'ctime' search_forward = False + def dummy(self, *args, **keywords): + """For backwards compatibility only.""" + + handle_mouse = resize = dummy + def search(self, order=None, forward=True): original_order = order if self.search_forward: @@ -74,10 +79,6 @@ class Actions(EnvironmentAware, SettingsAware): self.search_method = order self.search_forward = forward - def resize(self): - """Update the size of the UI""" - self.ui.update_size() - def exit(self): """Exit the program""" raise SystemExit() @@ -172,10 +173,6 @@ class Actions(EnvironmentAware, SettingsAware): """Move back and forth in the history""" self.env.history_go(relative) - def handle_mouse(self): - """Handle mouse-buttons if one was pressed""" - self.ui.handle_mouse() - def display_command_help(self, console_widget): if not hasattr(self.ui, 'open_pager'): return diff --git a/ranger/core/fm.py b/ranger/core/fm.py index a38b9147..8337ba9b 100644 --- a/ranger/core/fm.py +++ b/ranger/core/fm.py @@ -19,6 +19,7 @@ The File Manager, putting the pieces together from time import time from collections import deque +from curses import KEY_MOUSE, KEY_RESIZE import os import sys @@ -143,11 +144,16 @@ class FM(Actions, SignalDispatcher): key = ui.get_next_key() if key > 0: - if self.input_blocked and \ - time() > self.input_blocked_until: - self.input_blocked = False - if not self.input_blocked: - ui.handle_key(key) + if key == KEY_MOUSE: + ui.handle_mouse() + elif key == KEY_RESIZE: + ui.update_size() + else: + if self.input_blocked and \ + time() > self.input_blocked_until: + self.input_blocked = False + if not self.input_blocked: + ui.handle_key(key) gc_tick += 1 if gc_tick > TICKS_BEFORE_COLLECTING_GARBAGE: diff --git a/ranger/defaults/keys.py b/ranger/defaults/keys.py index 63e09dfd..96491633 100644 --- a/ranger/defaults/keys.py +++ b/ranger/defaults/keys.py @@ -311,9 +311,6 @@ def _base_pager_commands(map): def _system_functions(map): - # Each commandlist should have this bindings - map(KEY_RESIZE, fm.resize()) - map(KEY_MOUSE, fm.handle_mouse()) map('Q', fm.exit()) map(ctrl('L'), fm.redraw_window()) |