[pitivi] Adjust heights from controls
- From: Jean-FranÃois Fortin Tam <jfft src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] Adjust heights from controls
- Date: Sat, 21 Jul 2012 19:58:01 +0000 (UTC)
commit 9d9ca6e753e6a95162c7513c3702e3f7b7b5fa82
Author: Paul Lange <palango gmx de>
Date: Thu May 17 18:24:58 2012 -0500
Adjust heights from controls
pitivi/timeline/layercontrols.py | 3 +++
pitivi/timeline/timeline.py | 21 +++++++++++++++++++++
pitivi/timeline/track.py | 9 +++++++--
3 files changed, 31 insertions(+), 2 deletions(-)
---
diff --git a/pitivi/timeline/layercontrols.py b/pitivi/timeline/layercontrols.py
index dff15e7..848e4d3 100644
--- a/pitivi/timeline/layercontrols.py
+++ b/pitivi/timeline/layercontrols.py
@@ -103,6 +103,9 @@ class BaseLayerControl(gtk.Table, Loggable):
else:
button.set_tooltip_text(_("Make layer visible"))
+ def getHeight(self):
+ return self.get_allocation().height
+
class VideoLayerControl(BaseLayerControl):
"""
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index 23c1ece..dbe4d54 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -479,6 +479,8 @@ class TimelineControls(gtk.VBox, Loggable):
self._track_controls = {}
self._timeline = None
self.set_spacing(LAYER_SPACING)
+ self.type_map = {ges.TRACK_TYPE_AUDIO: AudioLayerControl,
+ ges.TRACK_TYPE_VIDEO: VideoLayerControl}
## Timeline callbacks
@@ -543,6 +545,25 @@ class TimelineControls(gtk.VBox, Loggable):
del self._track_controls[layer]
+ def getYOfLayer(self, track_type, layer):
+ y = 0
+ print "start new calculation of y"
+ for child in self.get_children():
+ print type(child)
+ print isinstance(child, self.type_map[track_type])
+ print layer == child._layer
+ if layer == child._layer and \
+ isinstance(child, self.type_map[track_type]):
+ print "return y = %s" % y
+ return y
+
+ y += child.getHeight()
+ print "h %s of %s" % (child.getHeight(), child)
+ y += LAYER_SPACING
+ print "iter y = %s" % y
+
+ return 0
+
class InfoStub(gtk.HBox, Loggable):
"""
diff --git a/pitivi/timeline/track.py b/pitivi/timeline/track.py
index 965ef38..5bffe89 100644
--- a/pitivi/timeline/track.py
+++ b/pitivi/timeline/track.py
@@ -575,9 +575,14 @@ class TrackObject(View, goocanvas.Group, Zoomable, Loggable):
except Exception, e:
raise Exception(e)
+ layer = self.element.get_timeline_object().get_layer()
+ track_type = self.element.get_track().props.track_type
+
# calculate correct y-position, highest priority on top
- priority = self.element.get_timeline_object().get_layer().get_priority()
- y = (self.height + LAYER_SPACING) * priority
+ y = self.app.gui.timeline_ui._controls.getYOfLayer(track_type, layer)
+ #priority = self.element.get_timeline_object().get_layer().get_priority()
+ #y = (self.height + LAYER_SPACING) * priority
+ print y
# Setting new position
self.set_simple_transform(x, y, 1, 0)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]