Exemplo n.º 1
0
    def add_object_format(self, object_id, format_type, data, on_disk):
        logging.debug('Clipboard.add_object_format')
        cb_object = self._objects[object_id]

        if on_disk and cb_object.get_percent() == 100:
            new_uri = self._copy_file(data)
            cb_object.add_format(Format(format_type, new_uri, on_disk))
            logging.debug('Added format of type ' + format_type +
                          ' with path at ' + new_uri)
        else:
            cb_object.add_format(Format(format_type, data, on_disk))
            logging.debug('Added in-memory format of type %s.', format_type)

        self.emit('object-state-changed', cb_object)
Exemplo n.º 2
0
    def add_object_format(self, object_id, format_type, data, on_disk):
        logging.debug('Clipboard.add_object_format')
        cb_object = self._objects[object_id]

        if format_type == 'XdndDirectSave0':
            format_ = Format('text/uri-list', data + '\r\n', on_disk)
            format_.owns_disk_data = True
            cb_object.add_format(format_)
        elif on_disk and cb_object.get_percent() == 100:
            new_uri = self._copy_file(data)
            cb_object.add_format(Format(format_type, new_uri, on_disk))
            logging.debug('Added format of type ' + format_type
                          + ' with path at ' + new_uri)
        else:
            cb_object.add_format(Format(format_type, data, on_disk))
            logging.debug('Added in-memory format of type %s.', format_type)

        self.emit('object-state-changed', cb_object)