diff options
author | hut <hut@lavabit.com> | 2012-08-06 04:56:12 +0200 |
---|---|---|
committer | hut <hut@lavabit.com> | 2012-08-06 04:56:12 +0200 |
commit | 47e9517c8f7e870d01cf469faa94e72b1bc5d9b1 (patch) | |
tree | c74afe7790224bc1eb84b008e03007b87d5e4932 /ranger | |
parent | d892917f05d4826b4bfaa6011702176dbd9a0fa0 (diff) | |
download | ranger-47e9517c8f7e870d01cf469faa94e72b1bc5d9b1.tar.gz |
core.fm: fixed passing directory arguments
Diffstat (limited to 'ranger')
-rw-r--r-- | ranger/core/fm.py | 15 | ||||
-rw-r--r-- | ranger/core/main.py | 4 | ||||
-rw-r--r-- | ranger/gui/widgets/browserview.py | 5 |
3 files changed, 16 insertions, 8 deletions
diff --git a/ranger/core/fm.py b/ranger/core/fm.py index dda125d0..f554ab1b 100644 --- a/ranger/core/fm.py +++ b/ranger/core/fm.py @@ -39,7 +39,7 @@ class FM(Actions, SignalDispatcher): _visual_start = None _visual_start_pos = None - def __init__(self, ui=None, bookmarks=None, tags=None): + def __init__(self, ui=None, bookmarks=None, tags=None, paths=['.']): """Initialize FM.""" Actions.__init__(self) SignalDispatcher.__init__(self) @@ -47,6 +47,7 @@ class FM(Actions, SignalDispatcher): self.ui = UI() else: self.ui = ui + self.start_paths = paths self.directories = dict() self.log = deque(maxlen=20) self.bookmarks = bookmarks @@ -78,8 +79,16 @@ class FM(Actions, SignalDispatcher): def initialize(self): """If ui/bookmarks are None, they will be initialized here.""" - self.thistab = Tab(".") - self.tabs[self.current_tab] = self.thistab + self.tabs = dict((n+1, Tab(path)) for n, path in + enumerate(self.start_paths)) + tab_list = self._get_tab_list() + if tab_list: + self.current_tab = tab_list[0] + self.thistab = self.tabs[self.current_tab] + else: + self.current_tab = 1 + self.tabs[self.current_tab] = self.thistab = Tab('.') + if not ranger.arg.clean and os.path.isfile(self.confpath('rifle.conf')): rifleconf = self.confpath('rifle.conf') else: diff --git a/ranger/core/main.py b/ranger/core/main.py index b0ddc4d1..c3a3d76b 100644 --- a/ranger/core/main.py +++ b/ranger/core/main.py @@ -85,10 +85,8 @@ def main(): crash_traceback = None try: # Initialize objects - fm = FM() + fm = FM(paths=targets) FileManagerAware.fm = fm - fm.tabs = dict((n+1, os.path.abspath(path)) for n, path \ - in enumerate(targets[:9])) load_settings(fm, arg.clean) if arg.list_unused_keys: diff --git a/ranger/gui/widgets/browserview.py b/ranger/gui/widgets/browserview.py index 3c45b7ca..3bfaf3fd 100644 --- a/ranger/gui/widgets/browserview.py +++ b/ranger/gui/widgets/browserview.py @@ -89,8 +89,9 @@ class BrowserView(Widget, DisplayableContainer): self.need_clear = False for tab in self.fm.tabs.values(): directory = tab.thisdir - directory.load_content_if_outdated() - directory.use() + if directory: + directory.load_content_if_outdated() + directory.use() DisplayableContainer.draw(self) if self.settings.draw_borders: self._draw_borders() |