class FavoritesMixin(object): def __init__(self, shortcuts_path): self.shortcuts = FavoritesIO(os.path.join(shortcuts_path, 'shortcuts')) self.capabilities.append('favorites') self.on_stop.append(self.save_shortcuts) def create_shortcut(self, favorite): return self.shortcuts.add_favorite(favorite) def remove_shortcut(self, favorite): return self.shortcuts.remove_favorite(favorite) def get_shortcuts(self): return self.shortcuts.get_favorites() def save_shortcuts(self): self.shortcuts.save()
class Favorites(object): def __init__(self, shortcuts_path): self.shortcuts = FavoritesIO(os.path.join(shortcuts_path, 'shortcuts')) self.capabilities.append('favorites') self.on_stop.append(self.save_shortcuts) def create_shortcut(self, favorite): return self.shortcuts.add_favorite(favorite) def remove_shortcut(self, favorite): return self.shortcuts.remove_favorite(favorite) def get_shortcuts(self): return self.shortcuts.get_favorites() def save_shortcuts(self): self.shortcuts.save()
def __init__(self, shortcuts_path): self.shortcuts = FavoritesIO(os.path.join(shortcuts_path, 'shortcuts')) self.capabilities.append('favorites') self.on_stop.append(self.save_shortcuts)