def select_note(self, idx):
        """Called whenever user selects a different note via the UI.

        This sets all machinery in motion to put the now note's data in all
        the right places.

        @param idx:
        @return:
        """
        if idx >= 0:
            key = self.notes_list_model.list[idx].key
            note = self.notes_db.get_note(key)
            # valid note, so note editing should be enabled
            self.view.set_note_editing(True)

        else:
            key = None
            note = None
            idx = -1
            # no note selected, so we clear the UI (and display a clear
            # message that no note is selected) and we disable note
            # editing controls.
            self.view.clear_note_ui()
            self.view.set_note_editing(False)

        self.selected_note_idx = idx

        # when we do this, we don't want the change:{text,tags,pinned} events
        # because those should only fire when they are changed through the UI
        self.view.mute_note_data_changes()
        self.view.set_note_data(note)
        if key:
            self.view.set_note_status(self.notes_db.get_note_status(key))

        self.view.unmute_note_data_changes()
dataset/ETHPy150Open cpbotha/nvpy/nvpy/nvpy.py/Controller.select_note/original