pitivi r1162 - in branches/SOC_2008_BLEWIS: . pitivi/ui
- From: blewis svn gnome org
- To: svn-commits-list gnome org
- Subject: pitivi r1162 - in branches/SOC_2008_BLEWIS: . pitivi/ui
- Date: Thu, 10 Jul 2008 14:02:34 +0000 (UTC)
Author: blewis
Date: Thu Jul 10 14:02:33 2008
New Revision: 1162
URL: http://svn.gnome.org/viewvc/pitivi?rev=1162&view=rev
Log:
* pitivi/ui/timeline.py:
moved dnd code into TimelineWidget, thereby enabling dnd on both
timelines.
* pitivi/ui/timelineobjects.py:
moved dnd code out of the simple timeline
Modified:
branches/SOC_2008_BLEWIS/ChangeLog
branches/SOC_2008_BLEWIS/pitivi/ui/timeline.py
branches/SOC_2008_BLEWIS/pitivi/ui/timelineobjects.py
Modified: branches/SOC_2008_BLEWIS/pitivi/ui/timeline.py
==============================================================================
--- branches/SOC_2008_BLEWIS/pitivi/ui/timeline.py (original)
+++ branches/SOC_2008_BLEWIS/pitivi/ui/timeline.py Thu Jul 10 14:02:33 2008
@@ -33,6 +33,8 @@
import pitivi.instance as instance
import pitivi.dnd as dnd
+from pitivi.timeline.source import TimelineFileSource
+from pitivi.timeline.objects import MEDIA_TYPE_AUDIO, MEDIA_TYPE_VIDEO
from timelineobjects import SimpleTimelineWidget
from complextimeline import ComplexTimelineWidget
@@ -45,6 +47,16 @@
gtk.VBox.__init__(self)
self._createUi()
+ # drag and drop
+ self.drag_dest_set(gtk.DEST_DEFAULT_DROP | gtk.DEST_DEFAULT_MOTION,
+ [dnd.FILESOURCE_TUPLE],
+ gtk.gdk.ACTION_COPY)
+ self.connect("drag-data-received", self._dragDataReceivedCb)
+ self.connect("drag-leave", self._dragLeaveCb)
+ self.connect("drag-motion", self._dragMotionCb)
+ self.project = instance.PiTiVi.current
+ self.timeline = instance.PiTiVi.current.timeline
+
def _createUi(self):
""" draw the GUI """
self.simpleview = SimpleTimelineWidget()
@@ -70,3 +82,55 @@
gst.debug("state:%s" % event.state)
self.hscroll.emit("scroll-event", event)
+## Drag and Drop callbacks
+
+ def _gotFileFactory(self, filefactory, x, y):
+ """ got a filefactory at the given position """
+ # remove the slot
+ if not filefactory or not filefactory.is_video:
+ return
+ #pos_ = self.items.point_to_index(pixel_coords(self, (x, y)))
+ pos_ = 0
+ gst.debug("_got_filefactory pos : %d" % pos_)
+ # we just add it here, the drawing will be done in the condensed_list
+ # callback
+ source = TimelineFileSource(factory=filefactory,
+ media_type=MEDIA_TYPE_VIDEO,
+ name=filefactory.name)
+
+ # ONLY FOR SIMPLE TIMELINE : if video-only, we link a blank audio object
+ if not filefactory.is_audio:
+ audiobrother = TimelineBlankSource(factory=filefactory,
+ media_type=MEDIA_TYPE_AUDIO, name=filefactory.name)
+ source.setBrother(audiobrother)
+
+ if pos_ == -1:
+ self.timeline.videocomp.appendSource(source)
+ elif pos_:
+ self.timeline.videocomp.insertSourceAfter(source,
+ self.condensed[pos_ - 1])
+ else:
+ self.timeline.videocomp.prependSource(source)
+
+ def _dragMotionCb(self, unused_layout, unused_context, x, y, timestamp):
+ #TODO: temporarily add source to timeline, and put it in drag mode
+ # so user can see where it will go
+ gst.info("SimpleTimeline x:%d , source would go at %d" % (x, 0))
+
+ def _dragLeaveCb(self, unused_layout, unused_context, unused_tstamp):
+ gst.info("SimpleTimeline")
+ #TODO: remove temp source from timeline
+
+ def _dragDataReceivedCb(self, unused_layout, context, x, y,
+ selection, targetType, timestamp):
+ gst.log("SimpleTimeline, targetType:%d, selection.data:%s" %
+ (targetType, selection.data))
+ if targetType == dnd.TYPE_PITIVI_FILESOURCE:
+ uri = selection.data
+ else:
+ context.finish(False, False, timestamp)
+ self._gotFileFactory(instance.PiTiVi.current.sources[uri], x, y)
+ context.finish(True, False, timestamp)
+ instance.PiTiVi.playground.switchToTimeline()
+
+
Modified: branches/SOC_2008_BLEWIS/pitivi/ui/timelineobjects.py
==============================================================================
--- branches/SOC_2008_BLEWIS/pitivi/ui/timelineobjects.py (original)
+++ branches/SOC_2008_BLEWIS/pitivi/ui/timelineobjects.py Thu Jul 10 14:02:33 2008
@@ -302,14 +302,6 @@
instance.PiTiVi.connect("new-project-failed",
self._newProjectFailedCb)
- # drag and drop
- self.drag_dest_set(gtk.DEST_DEFAULT_DROP | gtk.DEST_DEFAULT_MOTION,
- [dnd.FILESOURCE_TUPLE],
- gtk.gdk.ACTION_COPY)
- self.connect("drag-data-received", self._dragDataReceivedCb)
- self.connect("drag-leave", self._dragLeaveCb)
- self.connect("drag-motion", self._dragMotionCb)
-
# set a reasonable minimum size which will avoid grahics glitch
self.set_bounds(0, 0, DEFAULT_SIMPLE_ELEMENT_WIDTH,
DEFAULT_SIMPLE_ELEMENT_HEIGHT)
@@ -353,59 +345,6 @@
def _projectClosedCb(self, unused_pitivi, unused_project):
self._clearTimeline()
-## Timeline callbacks
-
- def _gotFileFactory(self, filefactory, x, y):
- """ got a filefactory at the given position """
- # remove the slot
- if not filefactory or not filefactory.is_video:
- return
- #pos_ = self.items.point_to_index(pixel_coords(self, (x, y)))
- pos_ = 0
- gst.debug("_got_filefactory pos : %d" % pos_)
- # we just add it here, the drawing will be done in the condensed_list
- # callback
- source = TimelineFileSource(factory=filefactory,
- media_type=MEDIA_TYPE_VIDEO,
- name=filefactory.name)
-
- # ONLY FOR SIMPLE TIMELINE : if video-only, we link a blank audio object
- if not filefactory.is_audio:
- audiobrother = TimelineBlankSource(factory=filefactory,
- media_type=MEDIA_TYPE_AUDIO, name=filefactory.name)
- source.setBrother(audiobrother)
-
- if pos_ == -1:
- self.timeline.videocomp.appendSource(source)
- elif pos_:
- self.timeline.videocomp.insertSourceAfter(source,
- self.condensed[pos_ - 1])
- else:
- self.timeline.videocomp.prependSource(source)
-
-## Drag and Drop callbacks
-
- def _dragMotionCb(self, unused_layout, unused_context, x, y, timestamp):
- #TODO: temporarily add source to timeline, and put it in drag mode
- # so user can see where it will go
- gst.info("SimpleTimeline x:%d , source would go at %d" % (x, 0))
-
- def _dragLeaveCb(self, unused_layout, unused_context, unused_tstamp):
- gst.info("SimpleTimeline")
- #TODO: remove temp source from timeline
-
- def _dragDataReceivedCb(self, unused_layout, context, x, y,
- selection, targetType, timestamp):
- gst.log("SimpleTimeline, targetType:%d, selection.data:%s" %
- (targetType, selection.data))
- if targetType == dnd.TYPE_PITIVI_FILESOURCE:
- uri = selection.data
- else:
- context.finish(False, False, timestamp)
- self._gotFileFactory(instance.PiTiVi.current.sources[uri], x, y)
- context.finish(True, False, timestamp)
- instance.PiTiVi.playground.switchToTimeline()
-
## Editing mode
def _editMeCb(self, timeline, element):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]