def delete_list(todo_file): if not todo_file.startswith('action.'): (path, todo_filename) = os.path.split(todo_file) if store.Store().get_store(todo_file).delete_list(): print "Removed list '" + friendly_file(todo_filename) + "'" lists, active = get_todo_lists() if todo_file==config.get(ck.KEY_TODO): config.put(ck.KEY_TODO, os.path.join(path, lists[0])) alfred.show('list ')
def action(query): if query.startswith("action."): # custom actions from list view # for now, its all todo with Remember the Milk action_options = { 'action.rtm.init_auth': lambda: action_rtm_init_auth(), 'action.rtm.end_auth': lambda: action_rtm_end_auth(), 'action.rtm.refresh': lambda: action_rtm_refresh() } action_options[query]() alfred.show('list ') else: todo_file = query if todo_file!=config.get(ck.KEY_TODO): if not os.path.exists(todo_file): store.Store().get_store(todo_file).clear_all_todos() config.put(ck.KEY_TODO, todo_file) alfred.show('todo ')
def delete_list(todo_file): if not todo_file.startswith('action.'): (path, todo_filename) = os.path.split(todo_file) # rtm special if todo_filename.endswith('.rtm-todolist'): if todo_filename.startswith("Inbox"): print "Cannot delete Inbox" todo_file = '' else: print "Deleting an RTM list is currently not allowed" todo_file = '' else: if os.path.exists(todo_file): os.remove(todo_file) print "Removed list '" + friendly_file(todo_filename) + "'" # if we removed the active one, switch to a new active list lists, active = get_todo_lists() if todo_file==config.get(ck.KEY_TODO): config.put(ck.KEY_TODO, os.path.join(path, lists[0])) alfred.show('list ')
def reset(): """Resets the cache""" show_state('Resetting...') alfred.cache.delete('workflow.update') alfred.show('mp ')