diff options
Diffstat (limited to 'ranger/container/bookmarks.py')
-rw-r--r-- | ranger/container/bookmarks.py | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/ranger/container/bookmarks.py b/ranger/container/bookmarks.py index fa4679b6..8fcda0b1 100644 --- a/ranger/container/bookmarks.py +++ b/ranger/container/bookmarks.py @@ -9,21 +9,23 @@ ALLOWED_KEYS = string.ascii_letters + string.digits + "`'" class Bookmarks(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 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. + 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. - """ + Optionally, a bookmark.go() method is used for entering a bookmark. + """ last_mtime = None autosave = True load_pattern = re.compile(r"^[\d\w']:.") def __init__(self, bookmarkfile, bookmarktype=str, autosave=False): - """<bookmarkfile> specifies the path to the file where + """Initializes Bookmarks. + + <bookmarkfile> specifies the path to the file where bookmarks are saved in. """ self.autosave = autosave @@ -50,6 +52,7 @@ class Bookmarks(object): def enter(self, key): """Enter the bookmark with the given key. + Requires the bookmark instance to have a go() method. """ @@ -81,6 +84,7 @@ class Bookmarks(object): def __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. """ @@ -96,6 +100,7 @@ class Bookmarks(object): def update(self): """Update the bookmarks from the bookmark file. + Useful if two instances are running which define different bookmarks. """ @@ -135,6 +140,7 @@ class Bookmarks(object): def save(self): """Save the bookmarks to the bookmarkfile. + This is done automatically after every modification if autosave is True.""" self.update() if self.path is None: |