ranger.container.bookmarks
index
/home/hut/ranger/ranger/container/bookmarks.py

# Copyright (C) 2009, 2010  Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

 
Modules
       
os
re
string

 
Classes
       
__builtin__.object
Bookmarks

 
class Bookmarks(__builtin__.object)
    Bookmarks is a container which associates keys with bookmarks.
 
A key is a string with: len(key) == 1 and key in ALLOWED_KEYS.
 
A bookmark is an object with: bookmark == bookmarktype(str(instance))
Which is true for str or FileSystemObject. This condition is required
so bookmark-objects can be saved to and loaded from a file.
 
Optionally, a bookmark.go() method is used for entering a bookmark.
 
  Methods defined here:
__contains__(self, key)
Test whether a bookmark-key is defined
__getitem__(self, key)
Get the bookmark associated with the key
__init__(self, bookmarkfile, bookmarktype=<type 'str'>, autosave=False)
<bookmarkfile> specifies the path to the file where
bookmarks are saved in.
__iter__(self)
__setitem__(self, key, value)
Bookmark <value> to the key <key>.
key is expected to be a 1-character string and element of ALLOWED_KEYS.
value is expected to be a filesystemobject.
delete(self, key)
Delete the bookmark with the given key
enter(self, key)
Enter the bookmark with the given key.
Requires the bookmark instance to have a go() method.
load(self)
Load the bookmarks from path/bookmarks
remember(self, value)
Bookmarks <value> to the key '
save(self)
Save the bookmarks to the bookmarkfile.
This is done automatically after every modification if autosave is True.
update(self)
Update the bookmarks from the bookmark file.
Useful if two instances are running which define different bookmarks.
update_if_outdated(self)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes defined here:
autosave = True
last_mtime = None
load_pattern = <_sre.SRE_Pattern object at 0x1be2db0>

 
Data
        ALLOWED_KEYS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789`'"