def do_prev_note(state): notes = state['cache']['notes'] current_note_id = state['ui_state']['current_note_id'] if current_note_id is None or not note_list.contains(notes, current_note_id): select_last() previous_note_id = note_list.previous_note_id(notes, current_note_id) if previous_note_id is not None: return load_note(previous_note_id)
def do_next_note(state): notes = state['cache']['notes'] current_note_id = state['ui_state']['current_note_id'] if current_note_id is None or not note_list.contains(notes, current_note_id): select_first() next_note_id = note_list.next_note_id(notes, current_note_id) if next_note_id: return load_note(next_note_id)