Uploaded image for project: 'Picard'
  1. Picard
  2. PICARD-3052

Support Pasting values from spreadsheets

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Normal Normal
    • None
    • None
    • None
    • None

      When copying cells from a spreadsheet, they are stored with the TSV/CSV mimetype. We could interpret that as key/value pairs for tags when pasted into Picard. Something like:

              # Probably map from mimetype to dialect
              MIMETYPE_LIBREOFFICE_TSVC = "application/x-libreoffice-tsvc"
              if mimedata.hasFormat(MIMETYPE_LIBREOFFICE_TSVC):
                  try:
                      import io
                      import csv
                      text =  mimedata.data(MIMETYPE_LIBREOFFICE_TSVC).data().decode('utf16')
                      rows = csv.reader(io.StringIO(text), dialect='excel-tab')
                      if rows:
                          data = {}
                          for row in rows:
                              try:
                                  tag, old, new = row
                                  if tag:
                                      data[tag] = {
                                          'old': old,
                                          'new': new,
                                      }
                              except ValueError as e:
                                  log.error(e)
                          log.debug(data)
                  except Exception as e:
                      log.error(e) 

      We could add multiple handlers for different source applications.

       

            Unassigned Unassigned
            StevilKnevil StevilKnevil
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                Version Package