[pitivi] Clean up a bit the drag and drop logic
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] Clean up a bit the drag and drop logic
- Date: Wed, 24 Sep 2014 17:07:37 +0000 (UTC)
commit 1ab959ee4951ede232d703083989ddcc359a1244
Author: Alexandru Băluț <alexandru balut gmail com>
Date: Sat Jun 7 03:22:20 2014 +0200
Clean up a bit the drag and drop logic
pitivi/medialibrary.py | 8 +++-----
pitivi/timeline/timeline.py | 8 ++------
pitivi/utils/ui.py | 19 +++++--------------
3 files changed, 10 insertions(+), 25 deletions(-)
---
diff --git a/pitivi/medialibrary.py b/pitivi/medialibrary.py
index 8d00936..fb87a37 100644
--- a/pitivi/medialibrary.py
+++ b/pitivi/medialibrary.py
@@ -52,9 +52,7 @@ from pitivi.utils.ui import beautify_length
from pitivi.utils.misc import PathWalker, quote_uri, path_from_uri
from pitivi.utils.loggable import Loggable
import pitivi.utils.ui as dnd
-from pitivi.utils.ui import beautify_info, info_name, SPACING
-
-from pitivi.utils.ui import TYPE_PITIVI_FILESOURCE
+from pitivi.utils.ui import beautify_info, info_name, FILESOURCE_TARGET_ENTRY, SPACING
# Values used in the settings file.
SHOW_TREEVIEW = 1
@@ -262,8 +260,8 @@ class MediaLibraryWidget(Gtk.VBox, Loggable):
self.drag_dest_add_uri_targets()
self.connect("drag_data_received", self._dndDataReceivedCb)
- self._setup_view_for_drag_and_drop(self.treeview, [("pitivi/file-source", 0,
TYPE_PITIVI_FILESOURCE)])
- self._setup_view_for_drag_and_drop(self.iconview, [Gtk.TargetEntry.new("pitivi/file-source", 0,
TYPE_PITIVI_FILESOURCE)])
+ self._setup_view_for_drag_and_drop(self.treeview, [FILESOURCE_TARGET_ENTRY])
+ self._setup_view_for_drag_and_drop(self.iconview, [FILESOURCE_TARGET_ENTRY])
# Hack so that the views have the same method as self
self.treeview.getSelectedItems = self.getSelectedItems
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index 75eddea..4d47356 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -32,7 +32,7 @@ from pitivi.dialogs.prefs import PreferencesDialog
from pitivi.settings import GlobalSettings
from pitivi.utils.loggable import Loggable
from pitivi.utils.timeline import Zoomable, Selection, SELECT, TimelineError
-from pitivi.utils.ui import alter_style_class, EXPANDED_SIZE, SPACING, PLAYHEAD_COLOR, PLAYHEAD_WIDTH,
CONTROL_WIDTH
+from pitivi.utils.ui import alter_style_class, EXPANDED_SIZE, SPACING, PLAYHEAD_COLOR, PLAYHEAD_WIDTH,
CONTROL_WIDTH, URI_TARGET_ENTRY
from pitivi.utils.widgets import ZoomBox
from .ruler import ScaleRuler
@@ -66,8 +66,6 @@ PreferencesDialog.addNumericPreference('imageClipLength',
description=_("Default clip length (in miliseconds) of images when inserting on the timeline."),
lower=1)
-TARGET_TYPE_URI_LIST = 80
-
# Colors
TIMELINE_BACKGROUND_COLOR = Clutter.Color.new(31, 30, 33, 255)
SELECTION_MARQUEE_COLOR = Clutter.Color.new(100, 100, 100, 200)
@@ -912,9 +910,7 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
return True
def _setUpDragAndDrop(self):
- dnd_list = [Gtk.TargetEntry.new('text/uri-list', Gtk.TargetFlags.OTHER_APP, TARGET_TYPE_URI_LIST)]
-
- self.drag_dest_set(0, dnd_list, Gdk.DragAction.COPY)
+ self.drag_dest_set(0, [URI_TARGET_ENTRY], Gdk.DragAction.COPY)
self.drag_dest_add_uri_targets()
self.connect('drag-motion', self._dragMotionCb)
diff --git a/pitivi/utils/ui.py b/pitivi/utils/ui.py
index dc239ff..90e98b3 100644
--- a/pitivi/utils/ui.py
+++ b/pitivi/utils/ui.py
@@ -67,20 +67,11 @@ PLAYHEAD_COLOR = Clutter.Color.new(200, 0, 0, 255)
LAYER_CREATION_BLOCK_TIME = 0.2
# Drag and drop
-TYPE_TEXT_PLAIN = 24
-TYPE_URI_LIST = 25
-
-# FileSourceFactory (or subclasses)
-TYPE_PITIVI_FILESOURCE = 26
-
-TYPE_PITIVI_EFFECT = 27
-TYPE_PITIVI_LAYER_CONTROL = 32
-
-FILE_TARGET_ENTRY = Gtk.TargetEntry.new("text/plain", Gtk.TargetFlags.OTHER_APP, TYPE_TEXT_PLAIN)
-URI_TARGET_ENTRY = Gtk.TargetEntry.new("text/uri-list", 0, TYPE_URI_LIST)
-FILESOURCE_TARGET_ENTRY = Gtk.TargetEntry.new("pitivi/file-source", 0, TYPE_PITIVI_FILESOURCE)
-EFFECT_TARGET_ENTRY = Gtk.TargetEntry.new("pitivi/effect", 0, TYPE_PITIVI_EFFECT)
-LAYER_CONTROL_TARGET_ENTRY = Gtk.TargetEntry.new("pitivi/layer-control", 0, TYPE_PITIVI_LAYER_CONTROL)
+FILE_TARGET_ENTRY = Gtk.TargetEntry.new("text/plain", 0, 0)
+URI_TARGET_ENTRY = Gtk.TargetEntry.new("text/uri-list", 0, 0)
+FILESOURCE_TARGET_ENTRY = Gtk.TargetEntry.new("pitivi/file-source", 0, 0)
+EFFECT_TARGET_ENTRY = Gtk.TargetEntry.new("pitivi/effect", 0, 0)
+LAYER_CONTROL_TARGET_ENTRY = Gtk.TargetEntry.new("pitivi/layer-control", 0, 0)
def _get_settings(schema):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]