[pitivi] medialibrary: Update drag icon
- From: Alexandru Băluț <alexbalut src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] medialibrary: Update drag icon
- Date: Wed, 27 Feb 2019 22:54:37 +0000 (UTC)
commit 79325d64e294a679b5a63ba238268dc6b5871749
Author: yatinmaan <yatinmaan1 gmail com>
Date: Wed Feb 27 01:24:25 2019 +0530
medialibrary: Update drag icon
pitivi/medialibrary.py | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
---
diff --git a/pitivi/medialibrary.py b/pitivi/medialibrary.py
index 715e6f12..78fb7499 100644
--- a/pitivi/medialibrary.py
+++ b/pitivi/medialibrary.py
@@ -24,6 +24,7 @@ from gettext import gettext as _
from gettext import ngettext
from hashlib import md5
+import cairo
from gi.repository import Gdk
from gi.repository import GdkPixbuf
from gi.repository import GES
@@ -1456,7 +1457,21 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
context.drag_abort(int(time.time()))
else:
row = self.modelFilter[paths[0]]
- Gtk.drag_set_icon_pixbuf(context, row[COL_ICON_64], 0, 0)
+
+ icon = row[COL_ICON_128]
+ icon_height = icon.get_height()
+ icon_width = icon.get_width()
+
+ surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, icon_width, icon_height)
+ ctx = cairo.Context(surface)
+ # Center the icon around the cursor.
+ ctx.translate(icon_width / 2, icon_height / 2)
+ surface.set_device_offset(-icon_width / 2, -icon_height / 2)
+
+ Gdk.cairo_set_source_pixbuf(ctx, icon, 0, 0)
+ ctx.paint_with_alpha(0.35)
+
+ Gtk.drag_set_icon_surface(context, surface)
def _dndDragEndCb(self, unused_view, unused_context):
self.info("Drag operation ended")
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]