From d65d3a6da55438a0b2c619d1218f8af50a0468aa Mon Sep 17 00:00:00 2001 From: hut Date: Wed, 10 Aug 2011 12:41:18 +0200 Subject: container.tags: replaced the word "mark" with "tag" this is not very important, but I think it helps avoiding confusion since this code has to do with tagging and not with the completely different feature called "marking" --- ranger/container/tags.py | 32 ++++++++++++++++---------------- ranger/core/actions.py | 6 +++--- ranger/defaults/keys.py | 2 +- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/ranger/container/tags.py b/ranger/container/tags.py index f375fcbd..c2fe3067 100644 --- a/ranger/container/tags.py +++ b/ranger/container/tags.py @@ -34,13 +34,13 @@ class Tags(object): return item in self.tags def add(self, *items, **others): - if 'mark' in others: - mark = others['mark'] + if 'tag' in others: + tag = others['tag'] else: - mark = self.default_tag + tag = self.defautag self.sync() for item in items: - self.tags[item] = mark + self.tags[item] = tag self.dump() def remove(self, *items): @@ -53,17 +53,17 @@ class Tags(object): self.dump() def toggle(self, *items, **others): - if 'mark' in others: - mark = others['mark'] + if 'tag' in others: + tag = others['tag'] else: - mark = self.default_tag + tag = self.default_tag self.sync() for item in items: try: - if item in self and mark in (self.tags[item], self.default_tag): + if item in self and tag in (self.tags[item], self.default_tag): del(self.tags[item]) else: - self.tags[item] = mark + self.tags[item] = tag except KeyError: pass self.dump() @@ -93,21 +93,21 @@ class Tags(object): f.close() def _compile(self, f): - for path, mark in self.tags.items(): - if mark == self.default_tag: + for path, tag in self.tags.items(): + if tag == self.default_tag: # COMPAT: keep the old format if the default tag is used f.write(path + '\n') - elif mark in ALLOWED_KEYS: - f.write('{0}:{1}\n'.format(mark, path)) + elif tag in ALLOWED_KEYS: + f.write('{0}:{1}\n'.format(tag, path)) def _parse(self, f): result = dict() for line in f: line = line.strip() if len(line) > 2 and line[1] == ':': - mark, path = line[0], line[2:] - if mark in ALLOWED_KEYS: - result[path] = mark + tag, path = line[0], line[2:] + if tag in ALLOWED_KEYS: + result[path] = tag else: result[line] = self.default_tag diff --git a/ranger/core/actions.py b/ranger/core/actions.py index 8cecf077..cb692d4c 100644 --- a/ranger/core/actions.py +++ b/ranger/core/actions.py @@ -430,7 +430,7 @@ class Actions(FileManagerAware, EnvironmentAware, SettingsAware): # Tags are saved in ~/.config/ranger/tagged and simply mark if a # file is important to you in any context. - def tag_toggle(self, paths=None, value=None, movedown=None, mark='*'): + def tag_toggle(self, paths=None, value=None, movedown=None, tag=None): if not self.tags: return if paths is None: @@ -438,11 +438,11 @@ class Actions(FileManagerAware, EnvironmentAware, SettingsAware): else: tags = [realpath(path) for path in paths] if value is True: - self.tags.add(*tags, mark=mark) + self.tags.add(*tags, tag=tag or self.tags.default_tag) elif value is False: self.tags.remove(*tags) else: - self.tags.toggle(*tags, mark=mark) + self.tags.toggle(*tags, tag=tag or self.tags.default_tag) if movedown is None: movedown = len(tags) == 1 and paths is None diff --git a/ranger/defaults/keys.py b/ranger/defaults/keys.py index 15aab318..cd1c5d07 100644 --- a/ranger/defaults/keys.py +++ b/ranger/defaults/keys.py @@ -160,7 +160,7 @@ map('L', fm.history_go(1)) map('t', fm.tag_toggle()) map('T', fm.tag_remove()) for key in ALLOWED_TAGS_KEYS: - map('"' + key, fm.tag_toggle(mark=key)) + map('"' + key, fm.tag_toggle(tag=key)) map(' ', fm.mark(toggle=True)) map('v', fm.mark(all=True, toggle=True)) -- cgit 1.4.1-2-gfad0