diff options
-rw-r--r-- | ranger/defaults/keys.py | 6 | ||||
-rw-r--r-- | ranger/gui/displayable.py | 7 | ||||
-rw-r--r-- | ranger/gui/ui.py | 3 | ||||
-rw-r--r-- | test/tc_ui.py | 11 |
4 files changed, 9 insertions, 18 deletions
diff --git a/ranger/defaults/keys.py b/ranger/defaults/keys.py index 958f3744..652e7c42 100644 --- a/ranger/defaults/keys.py +++ b/ranger/defaults/keys.py @@ -86,10 +86,10 @@ def initialize_commands(command_list): hint('o', 'O', "//s//ize //b//ase//n//ame //m//time //t//ype //r//everse") - def edit_name(fm, n): - cf = fm.env.cf + def edit_name(arg): + cf = arg.fm.env.cf if cf: - fm.open_console(cmode.COMMAND, 'rename ' + cf.basename) + arg.fm.open_console(cmode.COMMAND, 'rename ' + cf.basename) bind('i', fm.display_file()) diff --git a/ranger/gui/displayable.py b/ranger/gui/displayable.py index a9c297b5..41ed9ae4 100644 --- a/ranger/gui/displayable.py +++ b/ranger/gui/displayable.py @@ -1,5 +1,6 @@ from ranger.shared import FileManagerAware, EnvironmentAware, SettingsAware from ranger import log +import _curses class Displayable(EnvironmentAware, FileManagerAware, SettingsAware): focused = False @@ -50,7 +51,7 @@ class Displayable(EnvironmentAware, FileManagerAware, SettingsAware): def addstr(self, *args): try: self.win.addstr(*args) - except: + except _curses.error: pass def color(self, keylist = None, *keys): @@ -59,7 +60,7 @@ class Displayable(EnvironmentAware, FileManagerAware, SettingsAware): attr = self.colorscheme.get_attr(*keys) try: self.win.attrset(attr) - except: + except _curses.error: pass def color_at(self, y, x, wid, keylist = None, *keys): @@ -68,7 +69,7 @@ class Displayable(EnvironmentAware, FileManagerAware, SettingsAware): attr = self.colorscheme.get_attr(*keys) try: self.win.chgat(y, x, wid, attr) - except: + except _curses.error: pass def color_reset(self): diff --git a/ranger/gui/ui.py b/ranger/gui/ui.py index 254b7eab..e609b72d 100644 --- a/ranger/gui/ui.py +++ b/ranger/gui/ui.py @@ -1,4 +1,5 @@ import curses +import _curses from .displayable import DisplayableContainer from .mouse_event import MouseEvent @@ -88,7 +89,7 @@ class UI(DisplayableContainer): """Handles mouse input""" try: event = MouseEvent(curses.getmouse()) - except: + except _curses.error: return # from ranger import log diff --git a/test/tc_ui.py b/test/tc_ui.py index fbe51f64..f509ff36 100644 --- a/test/tc_ui.py +++ b/test/tc_ui.py @@ -25,17 +25,6 @@ class Test(unittest.TestCase): def tearDown(self): self.ui.destroy() - def test_scrolling(self): - # test whether scrolling works - self.fm.scroll = raise_ok - self.ui.get_focused_obj = lambda: False - - ui.curses.getmouse = lambda: (0, 0, 0, 0, curses.BUTTON2_PRESSED) - self.assertRaises(OK, self.ui.handle_mouse) - - ui.curses.getmouse = lambda: (0, 0, 0, 0, curses.BUTTON4_PRESSED) - self.assertRaises(OK, self.ui.handle_mouse) - def test_passing(self): # Test whether certain method calls are passed to widgets widget = self.ui.widget |