[pitivi] Remove more uses of LAYER_HEIGHT_EXPANDED
- From: Jean-FranÃois Fortin Tam <jfft src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] Remove more uses of LAYER_HEIGHT_EXPANDED
- Date: Sat, 21 Jul 2012 19:58:22 +0000 (UTC)
commit abb6a5de6a491bed076cd06be5175553dcf4f691
Author: Paul Lange <palango gmx de>
Date: Thu May 17 21:48:32 2012 -0500
Remove more uses of LAYER_HEIGHT_EXPANDED
pitivi/timeline/layercontrols.py | 3 +--
pitivi/timeline/timeline.py | 20 +++++++++++++-------
pitivi/timeline/track.py | 8 ++------
3 files changed, 16 insertions(+), 15 deletions(-)
---
diff --git a/pitivi/timeline/layercontrols.py b/pitivi/timeline/layercontrols.py
index 848e4d3..a3821d5 100644
--- a/pitivi/timeline/layercontrols.py
+++ b/pitivi/timeline/layercontrols.py
@@ -26,8 +26,7 @@ import gobject
from gettext import gettext as _
from pitivi.utils.loggable import Loggable
-from pitivi.utils.ui import LAYER_HEIGHT_EXPANDED,\
- LAYER_HEIGHT_COLLAPSED, LAYER_SPACING
+from pitivi.utils.ui import LAYER_SPACING
# TODO add tooltips
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index 232bc87..277d8cf 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -470,7 +470,7 @@ class TimelineCanvas(goocanvas.Canvas, Zoomable, Loggable):
self._request_size()
def updateTracks(self):
- print("Updating all TrackObjects")
+ self.debug("Updating all TrackObjects")
for track in self._tracks:
track.updateTrackObjects()
@@ -582,6 +582,17 @@ class TimelineControls(gtk.VBox, Loggable):
return y
+ def getHeightOfTrack(self, track_type):
+ map = {ges.TRACK_TYPE_AUDIO: AudioLayerControl,
+ ges.TRACK_TYPE_VIDEO: VideoLayerControl}
+ y = 0
+ for child in self.get_children():
+ if isinstance(child, map[track_type]):
+ y += child.getHeight()
+ y += LAYER_SPACING
+
+ return y
+
class InfoStub(gtk.HBox, Loggable):
"""
@@ -1409,12 +1420,7 @@ class Timeline(gtk.Table, Loggable, Zoomable):
Recalculate the vertical scrollbar depending on the number of layer in
the timeline.
"""
- layers = self._timeline.get_layers()
- num_layers = len(layers)
-
- # Ensure height of the scrollbar
- self.vadj.props.upper = (LAYER_HEIGHT_EXPANDED + LAYER_SPACING
- + TRACK_SPACING) * 2 * num_layers
+ self.vadj.props.upper = self._controls.get_allocation().height + 50
def updateHScrollAdjustments(self):
"""
diff --git a/pitivi/timeline/track.py b/pitivi/timeline/track.py
index ae11ccc..a5afe32 100644
--- a/pitivi/timeline/track.py
+++ b/pitivi/timeline/track.py
@@ -583,7 +583,6 @@ class TrackObject(View, goocanvas.Group, Zoomable, Loggable):
# update height, compare with current height to not run into recursion
new_height = self.app.gui.timeline_ui._controls.getHeightOfLayer(track_type, layer)
if self.height != new_height:
- print "update heigth %s" % new_height
self.height = new_height
# get y position for layer
@@ -707,12 +706,9 @@ class Track(goocanvas.Group, Zoomable, Loggable):
self.get_canvas().regroupTracks()
def getHeight(self):
- # FIXME we have a refcount issue somewhere, the following makes sure
- # no to crash because of it
- #track_objects = self.track.get_objects()
if self._expanded:
- nb_layers = len(self.timeline.get_layers())
- return nb_layers * (LAYER_HEIGHT_EXPANDED + LAYER_SPACING)
+ track_type = self.track.props.track_type
+ return self.app.gui.timeline_ui._controls.getHeightOfTrack(track_type)
else:
return LAYER_HEIGHT_COLLAPSED + LAYER_SPACING
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]