pitivi r1369 - in trunk/pitivi: timeline ui
- From: edwardrv svn gnome org
- To: svn-commits-list gnome org
- Subject: pitivi r1369 - in trunk/pitivi: timeline ui
- Date: Fri, 28 Nov 2008 17:03:46 +0000 (UTC)
Author: edwardrv
Date: Fri Nov 28 17:03:46 2008
New Revision: 1369
URL: http://svn.gnome.org/viewvc/pitivi?rev=1369&view=rev
Log:
re-activate edge snapping for dragging
Modified:
trunk/pitivi/timeline/objects.py
trunk/pitivi/ui/complextimeline.py
Modified: trunk/pitivi/timeline/objects.py
==============================================================================
--- trunk/pitivi/timeline/objects.py (original)
+++ trunk/pitivi/timeline/objects.py Fri Nov 28 17:03:46 2008
@@ -29,6 +29,7 @@
from pitivi.serializable import Serializable
from pitivi.objectfactory import ObjectFactory
from pitivi.signalinterface import Signallable
+from pitivi.utils import closest_item
(MEDIA_TYPE_NONE,
MEDIA_TYPE_AUDIO,
@@ -547,10 +548,12 @@
def setDeadband(cls, db):
cls.__deadband = db
+ @classmethod
def enableEdgeUpdates(cls):
cls.__do_updates = True
cls.updateEdges()
+ @classmethod
def disableEdgeUpdates(cls):
cls.__do_updates = False
@@ -561,7 +564,7 @@
#FIXME: this might be more efficient if we used a binary sort tree,
# filter out duplicate edges in linear time
edges = {}
- for obj in cls. __instances__:
+ for obj in cls.__instances__.itervalues():
# start/end of object both considered "edit points"
edges[obj.start] = None
edges[obj.start + obj.duration] = None
@@ -574,14 +577,13 @@
@classmethod
def snapTimeToEdge(cls, time):
"""Returns the input time or the nearest edge"""
-
res, diff = closest_item(cls.__edges, time)
if diff <= cls.__deadband:
return res
return time
@classmethod
- def snapObjToEdit(cls, obj, time):
+ def snapObjToEdge(cls, obj, time):
"""Returns the input time or the edge which is closest to either the
start or finish time. The input time is interpreted as the start time
of obj."""
Modified: trunk/pitivi/ui/complextimeline.py
==============================================================================
--- trunk/pitivi/ui/complextimeline.py (original)
+++ trunk/pitivi/ui/complextimeline.py Fri Nov 28 17:03:46 2008
@@ -38,7 +38,6 @@
import os.path
from urllib import unquote
from pitivi.timeline.objects import MEDIA_TYPE_VIDEO
-from pitivi.utils import closest_item
from gettext import gettext as _
@@ -256,13 +255,15 @@
def _start_drag(self, item):
item.raise_(None)
self._draging = True
+ objects.TimelineObject.disableEdgeUpdates()
def _end_drag(self, unused_item):
self.canvas.block_size_request(False)
+ objects.TimelineObject.enableEdgeUpdates()
def _move_source_cb(self, item, pos):
element = item.element
- element.setStartDurationTime(max(self.pixelToNs(pos[0]), 0))
+ element.snapStartDurationTime(max(self.pixelToNs(pos[0]), 0))
# FIXME: these two methods should be in the ComplexTimelineObject class at least, or in
# their own class possibly. But they're here because they do
@@ -624,7 +625,7 @@
## Zoomable Override
def zoomChanged(self):
- self._deadband = self.pixelToNs(DEADBAND)
+ objects.TimelineObject.setDeadband(self.pixelToNs(DEADBAND))
def setChildZoomAdjustment(self, adj):
for layer in self.layers:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]