From 75013dc79356ba714d49027e81652e00fdb1afab Mon Sep 17 00:00:00 2001 From: hut Date: Fri, 1 Jan 2010 21:27:39 +0100 Subject: random cleanups/fixes --- TODO | 2 +- ranger/__main__.py | 6 +++++- ranger/container/bookmarks.py | 5 ++++- ranger/gui/ui.py | 12 ++++++------ ranger/gui/widgets/statusbar.py | 4 ---- 5 files changed, 16 insertions(+), 13 deletions(-) diff --git a/TODO b/TODO index 62d9478e..e7516f8a 100644 --- a/TODO +++ b/TODO @@ -25,7 +25,7 @@ General Bugs (X) #17 10/01/01 why do bookmarks disappear sometimes? - ( ) #18 10/01/01 fix notify widget (by adding a LogView?) + (X) #18 10/01/01 fix notify widget (by adding a LogView?) (X) #19 10/01/01 resizing after pressing g diff --git a/ranger/__main__.py b/ranger/__main__.py index 79e280f5..6f630111 100644 --- a/ranger/__main__.py +++ b/ranger/__main__.py @@ -13,7 +13,7 @@ def main(): from locale import setlocale, LC_ALL from optparse import OptionParser, SUPPRESS_HELP - from ranger import __version__, USAGE + from ranger import __version__, USAGE, CONFDIR from ranger.fm import FM from ranger.container.environment import Environment from ranger.shared.settings import SettingsAware @@ -23,6 +23,10 @@ def main(): setlocale(LC_ALL, 'en_US.utf8') os.stat_float_times(True) + if not os.path.exists(CONFDIR): + os.mkdir(CONFDIR) + + # Parse options parser = OptionParser( usage = USAGE, version = 'ranger ' + __version__ ) diff --git a/ranger/container/bookmarks.py b/ranger/container/bookmarks.py index 98fdc402..518050f7 100644 --- a/ranger/container/bookmarks.py +++ b/ranger/container/bookmarks.py @@ -144,7 +144,10 @@ class Bookmarks(object): import os dct = {} if not os.path.exists(self.path): - f = open(self.path, 'w') + try: + f = open(self.path, 'w') + except: + raise OSError('Cannot read the given path') f.close() if os.access(self.path, os.R_OK): diff --git a/ranger/gui/ui.py b/ranger/gui/ui.py index 31ddf61a..4e9629b8 100644 --- a/ranger/gui/ui.py +++ b/ranger/gui/ui.py @@ -11,7 +11,7 @@ class UI(DisplayableContainer): load_mode = False def __init__(self, commandlist=None, env=None, fm=None): import os - os.environ['ESCDELAY'] = '25' # don't know a cleaner way + os.environ['ESCDELAY'] = '25' # don't know a cleaner way if env is not None: self.env = env @@ -58,8 +58,8 @@ class UI(DisplayableContainer): def suspend(self): """Turn off curses""" - from ranger import log - log("suspending ui!") + # from ranger import log + # log("suspending ui!") self.win.keypad(0) curses.nocbreak() curses.echo() @@ -92,9 +92,9 @@ class UI(DisplayableContainer): except _curses.error: return -# from ranger import log -# log('{0:0>28b} ({0})'.format(event.bstate)) -# log('y: {0} x: {1}'.format(event.y, event.x)) + # from ranger import log + # log('{0:0>28b} ({0})'.format(event.bstate)) + # log('y: {0} x: {1}'.format(event.y, event.x)) DisplayableContainer.click(self, event) diff --git a/ranger/gui/widgets/statusbar.py b/ranger/gui/widgets/statusbar.py index fe32530b..720fa011 100644 --- a/ranger/gui/widgets/statusbar.py +++ b/ranger/gui/widgets/statusbar.py @@ -13,7 +13,6 @@ from os import getuid from time import strftime, localtime from ranger.gui.bar import Bar -from ranger import log class StatusBar(Widget): __doc__ = __doc__ @@ -38,8 +37,6 @@ class StatusBar(Widget): def draw(self): """Draw the statusbar""" - log("a") - if self.hint and isinstance(self.hint, str): if self.old_hint != self.hint: self.need_redraw = True @@ -53,7 +50,6 @@ class StatusBar(Widget): if self.msg: if self.msg.is_alive(): - log("b") self._draw_message() return else: -- cgit 1.4.1-2-gfad0