'Copy text to clipboard'

@Slot()
def copy(self):

    clipboard = QApplication.clipboard()
    clipl = []
    for idx in self.selectedIndexes():
        if (not idx.isValid()):
            continue
        obj = self.delegate.get_value(idx)
        if (isinstance(obj, (ndarray, MaskedArray)) and (ndarray is not FakeObject)):
            if PY3:
                output = io.BytesIO()
            else:
                output = io.StringIO()
            try:
                np_savetxt(output, obj, delimiter=' DCTB ')
            except:
                QMessageBox.warning(self, _('Warning'), _('It    was    not    possible    to    copy    this    array'))
                return
            obj = output.getvalue().decode('utf-8')
            output.close()
        elif (isinstance(obj, (DataFrame, Series)) and (DataFrame is not FakeObject)):
            output = io.StringIO()
            obj.to_csv(output, sep=' DCTB ', index=True, header=True)
            if PY3:
                obj = output.getvalue()
            else:
                obj = output.getvalue().decode('utf-8')
            output.close()
        elif is_binary_string(obj):
            obj = to_text_string(obj, 'utf8')
        else:
            obj = to_text_string(obj)
        clipl.append(obj)
    clipboard.setText('\n'.join(clipl))
