[pitivi] Improve debugging for drag & drop in media/effects library and clip properties



commit 1c54d1502ccee8ecf05f4ee8ea00cc3e0203f515
Author: Jean-François Fortin Tam <nekohayo gmail com>
Date:   Wed Mar 20 14:25:33 2013 -0400

    Improve debugging for drag & drop in media/effects library and clip properties

 pitivi/clipproperties.py |   10 +++++++---
 pitivi/effects.py        |    8 ++++++--
 pitivi/medialibrary.py   |   16 +++++++---------
 3 files changed, 20 insertions(+), 14 deletions(-)
---
diff --git a/pitivi/clipproperties.py b/pitivi/clipproperties.py
index e14cfba..559aaf1 100644
--- a/pitivi/clipproperties.py
+++ b/pitivi/clipproperties.py
@@ -131,7 +131,7 @@ class ClipProperties(Gtk.ScrolledWindow, Loggable):
     timeline = property(_getTimeline, _setTimeline)
 
 
-class EffectProperties(Gtk.Expander):
+class EffectProperties(Gtk.Expander, Loggable):
     """
     Widget for viewing and configuring effects
     """
@@ -143,6 +143,7 @@ class EffectProperties(Gtk.Expander):
         Gtk.Expander.__init__(self)
         self.set_expanded(True)
         self.set_label(_("Effects"))
+        Loggable.__init__(self)
 
         # Global variables related to effects
         self.app = instance
@@ -286,13 +287,13 @@ class EffectProperties(Gtk.Expander):
             self.hide()
         self.updateAll()
 
-    def  _TrackElementAddedCb(self, unused_clip, track_element):
+    def _TrackElementAddedCb(self, unused_clip, track_element):
         if isinstance(track_element, GES.BaseEffect):
             selec = self.timeline.selection.getSelectedEffects()
             self.selected_effects = selec
             self.updateAll()
 
-    def  _trackElementRemovedCb(self, unused_clip, track_element):
+    def _trackElementRemovedCb(self, unused_clip, track_element):
         if isinstance(track_element, GES.BaseEffect):
             selec = self.timeline.selection.getSelectedEffects()
             self.selected_effects = selec
@@ -347,12 +348,15 @@ class EffectProperties(Gtk.Expander):
                     break
 
     def _dragDropCb(self, *unused_arguments):
+        self.info("An item has been dropped onto the clip properties' effects list")
         self.addEffectToCurrentSelection(self.app.gui.effectlist.getSelectedItems())
 
     def _dragLeaveCb(self, unused_layout, unused_context, unused_tstamp):
+        self.info("The item being dragged has left the clip properties' effects list")
         self.drag_unhighlight()
 
     def _dragMotionCb(self, unused, context, x, y, timestamp):
+        self.debug("Something is being dragged in the clip properties' effects list")
         self.drag_highlight()
 
     def _effectActiveToggleCb(self, cellrenderertoggle, path):
diff --git a/pitivi/effects.py b/pitivi/effects.py
index d9d8dde..94534a9 100644
--- a/pitivi/effects.py
+++ b/pitivi/effects.py
@@ -428,6 +428,7 @@ class EffectListWidget(Gtk.VBox, Loggable):
         self.view.connect("button-press-event", self._buttonPressEventCb)
         self.view.connect("select-cursor-row", self._enterPressEventCb)
         self.view.connect("drag_begin", self._dndDragBeginCb)
+        self.view.connect("drag_end", self._dndDragEndCb)
 
         scrollwin = Gtk.ScrolledWindow()
         scrollwin.props.hscrollbar_policy = Gtk.PolicyType.NEVER
@@ -487,8 +488,8 @@ class EffectListWidget(Gtk.VBox, Loggable):
 
         self.categoriesWidget.set_active(0)
 
-    def _dndDragBeginCb(self, view, context):
-        self.info("tree drag_begin")
+    def _dndDragBeginCb(self, unused_view, context):
+        self.info("Drag operation begun")
         model, paths = self.view.get_selection().get_selected_rows()
 
         if not paths:
@@ -500,6 +501,9 @@ class EffectListWidget(Gtk.VBox, Loggable):
         if pixbuf:
             Gtk.drag_set_icon_pixbuf(context, pixbuf, 0, 0)
 
+    def _dndDragEndCb(self, unused_view, context):
+        self.info("Drag operation ended")
+
     def _rowUnderMouseSelected(self, view, event):
         result = view.get_path_at_pos(int(event.x), int(event.y))
         if result:
diff --git a/pitivi/medialibrary.py b/pitivi/medialibrary.py
index c353b3e..d023d3e 100644
--- a/pitivi/medialibrary.py
+++ b/pitivi/medialibrary.py
@@ -313,7 +313,6 @@ class MediaLibraryWidget(Gtk.VBox, Loggable):
         view.drag_source_set_target_list(None)
         view.drag_source_add_uri_targets()
         view.drag_source_add_text_targets()
-
         view.connect("drag_begin", self._dndDragBeginCb)
         view.connect("drag-end", self._dndDragEndCb)
 
@@ -909,8 +908,7 @@ class MediaLibraryWidget(Gtk.VBox, Loggable):
                 self.iconview.select_path(path)
 
         self._ignoreRelease = chain_up
-        self.iconview_cursor_pos = self.iconview.get_path_at_pos(event.x,
-                event.y)
+        self.iconview_cursor_pos = self.iconview.get_path_at_pos(event.x, event.y)
 
         return True
 
@@ -979,17 +977,16 @@ class MediaLibraryWidget(Gtk.VBox, Loggable):
 
         if len(directories):
             # Recursively import from folders that were dragged into the library
-            self.app.threads.addThread(PathWalker, directories,
-                                    self._addUris)
+            self.app.threads.addThread(PathWalker, directories, self._addUris)
         if len(remote_files):
             #TODO waiting for remote files downloader support to be implemented
-            pass
+            self.fixme("Importing remote files is not implemented")
         if len(filenames):
             self.app.current.addUris(filenames)
 
     #used with TreeView and IconView
-    def _dndDragBeginCb(self, view, context):
-        self.info("tree drag_begin")
+    def _dndDragBeginCb(self, unused_view, context):
+        self.info("Drag operation begun")
         self.dragged = True
         paths = self.getSelectedPaths()
 
@@ -999,7 +996,8 @@ class MediaLibraryWidget(Gtk.VBox, Loggable):
             row = self.modelFilter[paths[0]]
             Gtk.drag_set_icon_pixbuf(context, row[COL_ICON], 0, 0)
 
-    def _dndDragEndCb(self, view, context):
+    def _dndDragEndCb(self, unused_view, context):
+        self.info("Drag operation ended")
         self.dragged = False
 
     def getSelectedPaths(self):


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]