def link_data_changed(self, ignored):
        """respond to an update for project or link type"""
        # zero out the selected link
        self.gui.link_name.clear()
        project = int(self.gui.project.itemData(self.gui.project.currentIndex()).toInt()[0])
        link_type = str(self.gui.link_type.currentText())
        if not link_type:
            # can't do anything without link type selected
            return
        filters = project and [['project', 'is', {'type': 'Project', 'id': project}]] or []
        if link_type in ['Project']:
            filters = []
        # find possible matches, grabbing values that are useful for generating
        # a pretty name for the different entity types
        matches = self.__conn.find(link_type, filters, ['display_name', 'content', 'name', 'code', 'sg_sequence', 'sg_asset_type'])
        texts = ['']
        self.gui.link_name.addItem('', 0)
        if matches and ('sg_sequence' in matches[0]):
            # going to need sequences
            seqs = self.__conn.find('Sequence', filters, ['code'])
            seq_map = dict([(s['id'], s['code']) for s in seqs])
        for match in matches:
            # TODO: make the set of extra info included with a name richer
            # look for something that has a good name
            text = match.get('display_name', match.get('content', match.get('name', match.get('code', None))))
            if text is None:
                # just in case the entity type has no field we know about as a
                # useful name
                break
            if 'sg_sequence' in match:
                # display the sequence if we've got it
                text = text + " (%s)" % (match['sg_sequence'] and seq_map[match['sg_sequence']['id']] or 'None')
            elif 'sg_asset_type' in match:
                # display the asset type if we've got it
                text = text + " (%s)" % match['sg_asset_type']
            self.gui.link_name.addItem(text, match['id'])
            texts.append(text)
        # And setup the completer
        completer = QtGui.QCompleter(texts, self)
        completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
        self.gui.link_name.setCompleter(completer)
        self.gui.link_name.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp('|'.join(texts), QtCore.Qt.CaseInsensitive), self))
dataset/ETHPy150Open shotgunsoftware/pyqt-uploader/uploader.py/Uploader.link_data_changed/original