about summary refs log tree commit diff stats
path: root/ranger/gui
diff options
context:
space:
mode:
authorstepshal <nessento@openmailbox.org>2016-06-22 00:01:38 +0700
committerstepshal <nessento@openmailbox.org>2016-06-22 00:01:38 +0700
commitbedfed3db77ecaafdb86e9e4847c7bb6ddc2563d (patch)
tree274a6e10436c085ac8421b53d7930761b6a08f60 /ranger/gui
parent5348e120aa6d39604b2426577f84669b9ce0aa24 (diff)
downloadranger-bedfed3db77ecaafdb86e9e4847c7bb6ddc2563d.tar.gz
Use 'except Exception:' instead of 'except:'
Diffstat (limited to 'ranger/gui')
-rw-r--r--ranger/gui/ansi.py2
-rw-r--r--ranger/gui/color.py4
-rw-r--r--ranger/gui/colorscheme.py2
-rw-r--r--ranger/gui/curses_shortcuts.py10
-rw-r--r--ranger/gui/displayable.py6
-rw-r--r--ranger/gui/mouse_event.py2
-rw-r--r--ranger/gui/ui.py8
-rw-r--r--ranger/gui/widgets/browsercolumn.py4
-rw-r--r--ranger/gui/widgets/console.py14
-rw-r--r--ranger/gui/widgets/pager.py2
-rw-r--r--ranger/gui/widgets/statusbar.py8
-rw-r--r--ranger/gui/widgets/titlebar.py2
-rw-r--r--ranger/gui/widgets/view_base.py8
-rw-r--r--ranger/gui/widgets/view_miller.py4
14 files changed, 38 insertions, 38 deletions
diff --git a/ranger/gui/ansi.py b/ranger/gui/ansi.py
index ffa9425c..4a9fb248 100644
--- a/ranger/gui/ansi.py
+++ b/ranger/gui/ansi.py
@@ -45,7 +45,7 @@ def text_with_fg_bg_attr(ansi_text):
                         n = int(arg)
                     else:                         # empty code means reset
                         n = 0
-                except:
+                except Exception:
                     continue
 
                 if n == 0:                        # reset colors and attributes
diff --git a/ranger/gui/color.py b/ranger/gui/color.py
index 78f0ccda..aa3b931c 100644
--- a/ranger/gui/color.py
+++ b/ranger/gui/color.py
@@ -28,7 +28,7 @@ def get_color(fg, bg):
         size = len(COLOR_PAIRS)
         try:
             curses.init_pair(size, fg, bg)
-        except:
+        except Exception:
             # If curses.use_default_colors() failed during the initialization
             # of curses, then using -1 as fg or bg will fail as well, which
             # we need to handle with fallback-defaults:
@@ -39,7 +39,7 @@ def get_color(fg, bg):
 
             try:
                 curses.init_pair(size, fg, bg)
-            except:
+            except Exception:
                 # If this fails too, colors are probably not supported
                 pass
         COLOR_PAIRS[key] = size
diff --git a/ranger/gui/colorscheme.py b/ranger/gui/colorscheme.py
index 595f8d42..c861a8e8 100644
--- a/ranger/gui/colorscheme.py
+++ b/ranger/gui/colorscheme.py
@@ -94,7 +94,7 @@ def _colorscheme_name_to_class(signal):
     def is_scheme(x):
         try:
             return issubclass(x, ColorScheme)
-        except:
+        except Exception:
             return False
 
     # create ~/.config/ranger/colorschemes/__init__.py if it doesn't exist
diff --git a/ranger/gui/curses_shortcuts.py b/ranger/gui/curses_shortcuts.py
index 7078897a..8937fcb7 100644
--- a/ranger/gui/curses_shortcuts.py
+++ b/ranger/gui/curses_shortcuts.py
@@ -31,13 +31,13 @@ class CursesShortcuts(SettingsAware):
 
         try:
             self.win.addstr(*args)
-        except:
+        except Exception:
             if len(args) > 1:
                 self.win.move(y, x)
 
                 try:
                     self.win.addstr(*_fix_surrogates(args))
-                except:
+                except Exception:
                     pass
 
     def addnstr(self, *args):
@@ -45,13 +45,13 @@ class CursesShortcuts(SettingsAware):
 
         try:
             self.win.addnstr(*args)
-        except:
+        except Exception:
             if len(args) > 2:
                 self.win.move(y, x)
 
                 try:
                     self.win.addnstr(*_fix_surrogates(args))
-                except:
+                except Exception:
                     pass
 
     def addch(self, *args):
@@ -59,7 +59,7 @@ class CursesShortcuts(SettingsAware):
             args = [args[1], args[0]] + list(args[2:])
         try:
             self.win.addch(*args)
-        except:
+        except Exception:
             pass
 
     def color(self, *keys):
diff --git a/ranger/gui/displayable.py b/ranger/gui/displayable.py
index e8b627e8..9f2dbf0d 100644
--- a/ranger/gui/displayable.py
+++ b/ranger/gui/displayable.py
@@ -169,13 +169,13 @@ class Displayable(FileManagerAware, CursesShortcuts):
             window_is_cleared = True
             try:
                 self.win.resize(hei, wid)
-            except:
+            except Exception:
                 # Not enough space for resizing...
                 try:
                     self.win.mvderwin(0, 0)
                     do_move = True
                     self.win.resize(hei, wid)
-                except:
+                except Exception:
                     pass
                     #raise ValueError("Resizing Failed!")
 
@@ -188,7 +188,7 @@ class Displayable(FileManagerAware, CursesShortcuts):
             #log("moving " + str(self))
             try:
                 self.win.mvderwin(y, x)
-            except:
+            except Exception:
                 pass
 
             self.paryx = self.win.getparyx()
diff --git a/ranger/gui/mouse_event.py b/ranger/gui/mouse_event.py
index 6931648f..1d3ec970 100644
--- a/ranger/gui/mouse_event.py
+++ b/ranger/gui/mouse_event.py
@@ -28,7 +28,7 @@ class MouseEvent(object):
         """Returns whether the mouse key n is pressed"""
         try:
             return (self.bstate & MouseEvent.PRESSED[n]) != 0
-        except:
+        except Exception:
             return False
 
     def mouse_wheel_direction(self):
diff --git a/ranger/gui/ui.py b/ranger/gui/ui.py
index 7e873f4c..12bf3ddb 100644
--- a/ranger/gui/ui.py
+++ b/ranger/gui/ui.py
@@ -77,12 +77,12 @@ class UI(DisplayableContainer):
         curses.halfdelay(20)
         try:
             curses.curs_set(int(bool(self.settings.show_cursor)))
-        except:
+        except Exception:
             pass
         curses.start_color()
         try:
             curses.use_default_colors()
-        except:
+        except Exception:
             pass
 
         self.settings.signal_bind('setopt.mouse_enabled', _setup_mouse)
@@ -116,7 +116,7 @@ class UI(DisplayableContainer):
         curses.echo()
         try:
             curses.curs_set(1)
-        except:
+        except Exception:
             pass
         if self.settings.mouse_enabled:
             _setup_mouse(dict(value=False))
@@ -335,7 +335,7 @@ class UI(DisplayableContainer):
                         (curses.tigetstr('tsl').decode('latin-1'), fixed_cwd,
                          curses.tigetstr('fsl').decode('latin-1')))
                 sys.stdout.flush()
-            except:
+            except Exception:
                 pass
 
         self.win.refresh()
diff --git a/ranger/gui/widgets/browsercolumn.py b/ranger/gui/widgets/browsercolumn.py
index c7ef4780..829809c0 100644
--- a/ranger/gui/widgets/browsercolumn.py
+++ b/ranger/gui/widgets/browsercolumn.py
@@ -82,7 +82,7 @@ class BrowserColumn(Pager):
                         elif self.level == 0:
                             self.fm.thisdir.move_to_obj(clicked_file)
                             self.fm.execute_file(clicked_file)
-                    except:
+                    except Exception:
                         pass
 
         else:
@@ -103,7 +103,7 @@ class BrowserColumn(Pager):
         """
         try:
             self.win.move(line, 0)
-        except:
+        except Exception:
             return
         for entry in commands:
             text, attr = entry
diff --git a/ranger/gui/widgets/console.py b/ranger/gui/widgets/console.py
index 8bb37937..78b85580 100644
--- a/ranger/gui/widgets/console.py
+++ b/ranger/gui/widgets/console.py
@@ -39,7 +39,7 @@ class Console(Widget):
             self.historypath = self.fm.confpath('history')
             try:
                 f = open(self.historypath, 'r')
-            except:
+            except Exception:
                 pass
             else:
                 for line in f:
@@ -68,7 +68,7 @@ class Console(Widget):
         if self.historypath:
             try:
                 f = open(self.historypath, 'w')
-            except:
+            except Exception:
                 pass
             else:
                 for entry in self.history_backup:
@@ -100,13 +100,13 @@ class Console(Widget):
         if self.question_queue:
             try:
                 move(self.y, len(self.question_queue[0][0]))
-            except:
+            except Exception:
                 pass
         else:
             try:
                 pos = uwid(self.line[0:self.pos]) + len(self.prompt)
                 move(self.y, self.x + min(self.wid-1, pos))
-            except:
+            except Exception:
                 pass
 
     def open(self, string='', prompt=None, position=None):
@@ -119,7 +119,7 @@ class Console(Widget):
         if self.last_cursor_mode is None:
             try:
                 self.last_cursor_mode = curses.curs_set(1)
-            except:
+            except Exception:
                 pass
         self.allow_close = False
         self.tab_deque = None
@@ -155,7 +155,7 @@ class Console(Widget):
         if self.last_cursor_mode is not None:
             try:
                 curses.curs_set(self.last_cursor_mode)
-            except:
+            except Exception:
                 pass
             self.last_cursor_mode = None
         self.fm.hide_console_info()
@@ -442,7 +442,7 @@ class Console(Widget):
             if not quiet:
                 error = "Command not found: `%s'" % self.line.split()[0]
                 self.fm.notify(error, bad=True)
-        except:
+        except Exception:
             return None
         else:
             return command_class(self.line)
diff --git a/ranger/gui/widgets/pager.py b/ranger/gui/widgets/pager.py
index e950ebf9..58b791cd 100644
--- a/ranger/gui/widgets/pager.py
+++ b/ranger/gui/widgets/pager.py
@@ -108,7 +108,7 @@ class Pager(Widget):
         elif self.markup == 'ansi':
             try:
                 self.win.move(i, 0)
-            except:
+            except Exception:
                 pass
             else:
                 for chunk in ansi.text_with_fg_bg_attr(line):
diff --git a/ranger/gui/widgets/statusbar.py b/ranger/gui/widgets/statusbar.py
index c0c937de..4eb06692 100644
--- a/ranger/gui/widgets/statusbar.py
+++ b/ranger/gui/widgets/statusbar.py
@@ -74,7 +74,7 @@ class StatusBar(Widget):
             self.fm.thisfile.load_if_outdated()
             try:
                 ctime = self.fm.thisfile.stat.st_ctime
-            except:
+            except Exception:
                 ctime = -1
         else:
             ctime = -1
@@ -128,7 +128,7 @@ class StatusBar(Widget):
 
             try:
                 self.addnstr(0, starting_point, string, space_left)
-            except:
+            except Exception:
                 break
             space_left -= len(string)
             starting_point += len(string)
@@ -147,7 +147,7 @@ class StatusBar(Widget):
                 return
         try:
             stat = target.stat
-        except:
+        except Exception:
             return
         if stat is None:
             return
@@ -169,7 +169,7 @@ class StatusBar(Widget):
             how = target.exists and 'good' or 'bad'
             try:
                 dest = readlink(target.path)
-            except:
+            except Exception:
                 dest = '?'
             left.add(' -> ' + dest, 'link', how)
         else:
diff --git a/ranger/gui/widgets/titlebar.py b/ranger/gui/widgets/titlebar.py
index a4e091b2..af102539 100644
--- a/ranger/gui/widgets/titlebar.py
+++ b/ranger/gui/widgets/titlebar.py
@@ -75,7 +75,7 @@ class TitleBar(Widget):
                 else:
                     try:
                         self.fm.enter_dir(part.directory)
-                    except:
+                    except Exception:
                         pass
                 return True
         return False
diff --git a/ranger/gui/widgets/view_base.py b/ranger/gui/widgets/view_base.py
index f487d357..41a6bccf 100644
--- a/ranger/gui/widgets/view_base.py
+++ b/ranger/gui/widgets/view_base.py
@@ -46,7 +46,7 @@ class ViewBase(Widget, DisplayableContainer):
         if hasattr(self, 'pager') and self.pager.visible:
             try:
                 self.fm.ui.win.move(self.main_column.y, self.main_column.x)
-            except:
+            except Exception:
                 pass
         else:
             try:
@@ -54,7 +54,7 @@ class ViewBase(Widget, DisplayableContainer):
                 y = self.main_column.y + self.main_column.target.pointer\
                         - self.main_column.scroll_begin
                 self.fm.ui.win.move(y, x)
-            except:
+            except Exception:
                 pass
 
     def _draw_bookmarks(self):
@@ -117,7 +117,7 @@ class ViewBase(Widget, DisplayableContainer):
                 self.wid)
         try:
             self.win.chgat(ystart - 1, 0, curses.A_UNDERLINE)
-        except:
+        except Exception:
             pass
         whitespace = " " * self.wid
         i = ystart
@@ -139,7 +139,7 @@ class ViewBase(Widget, DisplayableContainer):
                     self.fm.settings.use_preview_script:
                 try:
                     result = not self.fm.previews[target.realpath]['foundpreview']
-                except:
+                except Exception:
                     return self.old_collapse
 
         self.old_collapse = result
diff --git a/ranger/gui/widgets/view_miller.py b/ranger/gui/widgets/view_miller.py
index b7cc07a6..7d0d26e1 100644
--- a/ranger/gui/widgets/view_miller.py
+++ b/ranger/gui/widgets/view_miller.py
@@ -148,7 +148,7 @@ class ViewMiller(ViewBase):
                 win.vline(1, x, curses.ACS_VLINE, y - 1)
                 self.addch(0, x, curses.ACS_TTEE, 0)
                 self.addch(y, x, curses.ACS_BTEE, 0)
-            except:
+            except Exception:
                 # in case it's off the boundaries
                 pass
 
@@ -175,7 +175,7 @@ class ViewMiller(ViewBase):
                     self.fm.settings.use_preview_script:
                 try:
                     result = not self.fm.previews[target.realpath]['foundpreview']
-                except:
+                except Exception:
                     return self.old_collapse
 
         self.old_collapse = result