diff options
author | hut <hut@lavabit.com> | 2010-01-01 21:27:39 +0100 |
---|---|---|
committer | hut <hut@lavabit.com> | 2010-01-01 21:27:39 +0100 |
commit | 75013dc79356ba714d49027e81652e00fdb1afab (patch) | |
tree | b3464cef8d31c24bf30ab54e13e670f15b472c1e /ranger | |
parent | fa10678ef7dcc5fd8e8899ca04af3ae4b1a7b917 (diff) | |
download | ranger-75013dc79356ba714d49027e81652e00fdb1afab.tar.gz |
random cleanups/fixes
Diffstat (limited to 'ranger')
-rw-r--r-- | ranger/__main__.py | 6 | ||||
-rw-r--r-- | ranger/container/bookmarks.py | 5 | ||||
-rw-r--r-- | ranger/gui/ui.py | 12 | ||||
-rw-r--r-- | ranger/gui/widgets/statusbar.py | 4 |
4 files changed, 15 insertions, 12 deletions
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: |