pitivi r1400 - in trunk/pitivi: . timeline ui
- From: edwardrv svn gnome org
- To: svn-commits-list gnome org
- Subject: pitivi r1400 - in trunk/pitivi: . timeline ui
- Date: Fri, 28 Nov 2008 17:35:22 +0000 (UTC)
Author: edwardrv
Date: Fri Nov 28 17:35:22 2008
New Revision: 1400
URL: http://svn.gnome.org/viewvc/pitivi?rev=1400&view=rev
Log:
fixed bugs in receiver. added 'tracks' property to timeline, in ui Timeline and TimelineCanvas no longer use layerInfoList
Modified:
trunk/pitivi/receiver.py
trunk/pitivi/timeline/timeline.py
trunk/pitivi/ui/timeline.py
trunk/pitivi/ui/timelinecanvas.py
Modified: trunk/pitivi/receiver.py
==============================================================================
--- trunk/pitivi/receiver.py (original)
+++ trunk/pitivi/receiver.py Fri Nov 28 17:35:22 2008
@@ -29,6 +29,7 @@
instance._receiver_data = {}
if not instance._receiver_data.has_key(self):
instance._receiver_data[self] = _receiver_data()
+ instance._receiver_data[self].sigids = {}
rd = instance._receiver_data[self]
# explicitly check for None, because sometimes valid instances have a
@@ -37,12 +38,12 @@
# instance of, say, an empty container.
if rd.sender != None:
for id in rd.sigids.itervalues():
- instance._receiver_data[self].disconnect(id)
+ instance._receiver_data[self].sender.disconnect(id)
rd.sender = None
rd.sigids = {}
if value != None:
for sig, hdlr in self.handlers.iteritems():
- rd.sigids = value.connect(sig, MethodType(hdlr,
+ rd.sigids[sig] = value.connect(sig, MethodType(hdlr,
instance))
rd.sender = value
if self.setter:
Modified: trunk/pitivi/timeline/timeline.py
==============================================================================
--- trunk/pitivi/timeline/timeline.py (original)
+++ trunk/pitivi/timeline/timeline.py Fri Nov 28 17:35:22 2008
@@ -43,7 +43,7 @@
__signals__ = {
"track-added" : ("track"),
"track-removed" : ("track"),
- "start-durtation-changed" : ("start", "duration"),
+ "start-duration-changed" : ("start", "duration"),
}
# TODO make the compositions more versatile
@@ -51,11 +51,15 @@
@property
def start(self):
- return min(self.audiocomp.start, self.videocomp.start)
+ return min((track.start for track in self.tracks))
@property
def duration(self):
- return max(self.audiocomp.duration, self.videocomp.duration)
+ return max((track.duration for track in self.tracks))
+
+ @property
+ def tracks(self):
+ return (self.audiocomp, self.videocomp)
def __init__(self, project=None, **unused_kw):
gst.log("new Timeline for project %s" % project)
Modified: trunk/pitivi/ui/timeline.py
==============================================================================
--- trunk/pitivi/ui/timeline.py (original)
+++ trunk/pitivi/ui/timeline.py Fri Nov 28 17:35:22 2008
@@ -30,7 +30,6 @@
from pitivi.bin import SmartTimelineBin
from pitivi.timeline.source import TimelineFileSource
from pitivi.timeline import objects
-from complexlayer import LayerInfoList
import ruler
from complexinterface import Zoomable
import dnd
@@ -103,14 +102,11 @@
self._cur_zoom = 2
self._zoom_adj.set_value(self._computeZoomRatio(self._cur_zoom))
- self.layerInfoList = LayerInfoList()
+ self.timeline = instance.PiTiVi.current.timeline
self.instance = instance.PiTiVi
self.playground = instance.PiTiVi.playground
self._createUI()
- # force update of UI
- self.layerInfoList.setTimeline(instance.PiTiVi.current.timeline)
-
def _createUI(self):
self.leftSizeGroup = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL)
self.hadj = gtk.Adjustment()
@@ -121,7 +117,7 @@
self.pack_start(self.ruler, expand=False, fill=True)
# List of TimelineCanvas
- self.__canvas = TimelineCanvas(self.layerInfoList)
+ self.__canvas = TimelineCanvas(self.timeline)
self.__canvas.setZoomAdjustment(self._zoom_adj)
self.scrolledWindow = gtk.ScrolledWindow(self.hadj)
@@ -193,7 +189,8 @@
@handler(instance, "new-project-loading")
def _newProjectLoadingCb(self, unused_inst, project):
- self.layerInfoList.setTimeline(project.timeline)
+ self.timeline = project.timeline
+ self.__canvas.timeline = self.timeline
@handler(instance, "new-project-loaded")
def _newProjectLoadedCb(self, unused_inst, unused_project):
@@ -202,14 +199,15 @@
@handler(instance, "new-project-failed")
def _newProjectFailedCb(self, unused_inst, unused_reason, unused_uri):
- self.layerInfoList.setTimeline(None)
+ self.timeline = None
+ self.__canvas.timeline = None
-## layer callbacks
+## Timeline callbacks
- layerInfoList = receiver()
+ timeline = receiver()
- @handler(layerInfoList, "start-duration-changed")
- def _layerStartDurationChanged(self, unused_layer):
+ @handler(timeline, "start-duration-changed")
+ def _timelineStartDurationChanged(self, unused_timeline, start, duration):
self.ruler.startDurationChanged()
## ToolBar callbacks
Modified: trunk/pitivi/ui/timelinecanvas.py
==============================================================================
--- trunk/pitivi/ui/timelinecanvas.py (original)
+++ trunk/pitivi/ui/timelinecanvas.py Fri Nov 28 17:35:22 2008
@@ -22,19 +22,19 @@
class TimelineCanvas(goocanvas.Canvas, Zoomable):
- __layers = None
+ __tracks = None
- def __init__(self, layerinfolist):
+ def __init__(self, timeline):
goocanvas.Canvas.__init__(self)
self._selected_sources = []
- self.__layers = []
+ self.__tracks = []
self._block_size_request = False
self.props.integer_layout = True
self.props.automatic_bounds = False
- self.layerInfoList = layerinfolist
self._createUI()
+ self.timeline = timeline
def _createUI(self):
self._cursor = ARROW
@@ -169,15 +169,22 @@
instance.PiTiVi.current.timeline.setDeadband(self.pixelToNs(DEADBAND))
def setChildZoomAdjustment(self, adj):
- for layer in self.__layers:
- layer.setZoomAdjustment(adj)
+ for track in self.__tracks:
+ track.setZoomAdjustment(adj)
-## LayerInfoList callbacks
+## Timeline callbacks
- layerInfoList = receiver()
+ def __set_timeline(self):
+ while self.__tracks:
+ self._trackRemoved(None, 0)
+ if self.timeline:
+ for track in self.timeline.tracks:
+ self._trackAdded(None, track, -1)
- @handler(layerInfoList, "start-duration-changed")
- def _request_size(self, unused_item):
+ timeline = receiver(__set_timeline)
+
+ @handler(timeline, "start-duration-changed")
+ def _request_size(self, unused_item, start, duration):
tl, br = Point.from_widget_bounds(self)
pw, ph = br - tl
tl, br = Point.from_item_bounds(self.tracks)
@@ -185,26 +192,25 @@
if (w > pw) or (h > ph):
self.set_bounds(0, 0, w + 200, h)
- @handler(layerInfoList, "layer-added")
- def _layerAddedCb(self, unused_infolist, layer, position):
- track = Track(comp=layer.composition)
- self.__layers.append(track)
+ @handler(timeline, "track-added")
+ def _trackAdded(self, unused_timeline, comp, position):
+ track = Track(comp=comp)
+ self.__tracks.append(track)
track.setZoomAdjustment(self.getZoomAdjustment())
track.set_canvas(self)
self.tracks.add_child(track)
self._regroup_tracks()
- @handler(layerInfoList, "layer-removed")
- def _layerRemovedCb(self, unused_layerInfoList, position):
- track = self.__layers[position]
- del self.__layers[position]
+ @handler(timeline, "track-removed")
+ def _trackRemoved(self, unused_timeline, position):
+ track = self.__tracks[position]
+ del self.__tracks[position]
track.remove()
self._regroup_tracks()
def _regroup_tracks(self):
- for i, track in enumerate(self.__layers):
- height = Point.__sub__(*Point.from_item_bounds(track))[1]
- # FIXME: hard-coding track height, because goocanvas is kinda
- # ghetto
+ for i, track in enumerate(self.__tracks):
+ # FIXME: hard-coding track height, because this won't be updated
+ # later
height = 50
track.set_simple_transform(0, i * (height + 10), 1, 0)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]