def drag_get_signal(self, widget, drag_context, selection_data, info, timestamp): ''' callback triggered to set the selection_data payload (viewer is the source of the drop) ''' if self.drag_item == None: return if info == self.TARGET_TYPE_IMAGE: selection_data.set('image-filename', 8, self.drag_item.uid) if info == self.TARGET_TYPE_XDS: #drag save is currently disabled (unnecessary?) if self.XDS_ATOM in drag_context.targets: typ, fmt, dest = drag_context.source_window.property_get( self.XDS_ATOM, self.TEXT_ATOM) success = True code = self.XDS_SUCCESS if success else self.XDS_ERROR selection_data.set(selection_data.target, 8, code) self.drag_item = None if info == self.TARGET_TYPE_URI_LIST: size = None if settings.dragdrop_resize > 0: size = (settings.dragdrop_max_size, settings.dragdrop_max_size) if not self.drag_item.selected: path = imagemanip.get_jpeg_or_png_image_file( self.drag_item, self.active_collection, size, settings.dragdrop_strip_metadata, settings.dragdrop_apply_edits) print 'path', path if path is None: return uri = io.get_uri( path ) #I don't know why, but nautilius expects uris enclosed in quotes selection_data.set_uris([uri]) else: uris = [] i = 0 while i < len(self.active_view): item = self.active_view(i) if item.selected: path = imagemanip.get_jpeg_or_png_image_file( item, self.active_collection, size, settings.dragdrop_strip_metadata, settings.dragdrop_apply_edits) if path is None: continue uri = io.get_uri(path) uris.append(uri) i += 1 print 'uris', uris selection_data.set_uris(uris)
def drag_get_signal(self, widget, drag_context, selection_data, info, timestamp): ''' callback triggered to set the selection_data payload (viewer is the source of the drop) ''' if self.item is None: return if info == self.TARGET_TYPE_IMAGE: selection_data.set('image-filename', 8, self.item.uid) if info == self.TARGET_TYPE_URI_LIST: #TODO: this doesn't work because protocal isn't local # if drag_context.protocol == gtk.gdk.DRAG_PROTO_LOCAL: # self.collection.get_path(self.item) # uri=io.get_uri(path) # selection_data.set_uris([uri]) # print 'Internal Drag Drop from viewer using uri',uri # print 'Protocol',drag_context.protocol, gtk.gdk.DRAG_PROTO_LOCAL # return size = None if settings.dragdrop_resize: size = (settings.dragdrop_max_size, settings.dragdrop_max_size) path = imagemanip.get_jpeg_or_png_image_file( self.item, self.collection, size, settings.dragdrop_strip_metadata, settings.dragdrop_apply_edits) if path is None: return uri = io.get_uri(path) selection_data.set_uris([uri]) print 'Drag Drop from viewer using uri', uri
def drag_get_signal(self, widget, drag_context, selection_data, info, timestamp): ''' callback triggered to set the selection_data payload (viewer is the source of the drop) ''' if self.item is None: return if info == self.TARGET_TYPE_IMAGE: selection_data.set('image-filename', 8, self.item.uid) if info == self.TARGET_TYPE_URI_LIST: #TODO: this doesn't work because protocal isn't local # if drag_context.protocol == gtk.gdk.DRAG_PROTO_LOCAL: # self.collection.get_path(self.item) # uri=io.get_uri(path) # selection_data.set_uris([uri]) # print 'Internal Drag Drop from viewer using uri',uri # print 'Protocol',drag_context.protocol, gtk.gdk.DRAG_PROTO_LOCAL # return size=None if settings.dragdrop_resize: size=(settings.dragdrop_max_size,settings.dragdrop_max_size) path = imagemanip.get_jpeg_or_png_image_file(self.item,self.collection,size,settings.dragdrop_strip_metadata,settings.dragdrop_apply_edits) if path is None: return uri=io.get_uri(path) selection_data.set_uris([uri]) print 'Drag Drop from viewer using uri',uri
def drag_get_signal(self, widget, drag_context, selection_data, info, timestamp): ''' callback triggered to set the selection_data payload (viewer is the source of the drop) ''' if self.drag_item==None: return if info == self.TARGET_TYPE_IMAGE: selection_data.set('image-filename', 8, self.drag_item.uid) if info == self.TARGET_TYPE_XDS: #drag save is currently disabled (unnecessary?) if self.XDS_ATOM in drag_context.targets: typ, fmt, dest = drag_context.source_window.property_get(self.XDS_ATOM,self.TEXT_ATOM) success=True code = self.XDS_SUCCESS if success else self.XDS_ERROR selection_data.set(selection_data.target, 8, code) self.drag_item=None if info == self.TARGET_TYPE_URI_LIST: size=None if settings.dragdrop_resize>0: size=(settings.dragdrop_max_size,settings.dragdrop_max_size) if not self.drag_item.selected: path = imagemanip.get_jpeg_or_png_image_file(self.drag_item,self.active_collection,size,settings.dragdrop_strip_metadata,settings.dragdrop_apply_edits) print 'path',path if path is None: return uri=io.get_uri(path) #I don't know why, but nautilius expects uris enclosed in quotes selection_data.set_uris([uri]) else: uris=[] i=0 while i<len(self.active_view): item=self.active_view(i) if item.selected: path = imagemanip.get_jpeg_or_png_image_file(item,self.active_collection,size,settings.dragdrop_strip_metadata,settings.dragdrop_apply_edits) if path is None: continue uri=io.get_uri(path) uris.append(uri) i+=1 print 'uris',uris selection_data.set_uris(uris)