[pitivi: 73/94] Move the logic which calculates the size of a TrackControls object in a new method
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi: 73/94] Move the logic which calculates the size of a TrackControls object in a new method
- Date: Sun, 11 Sep 2011 16:18:34 +0000 (UTC)
commit ba52fae2822bbddbc21514fa78a463189ab35f46
Author: Alex BÄluÈ <alexandru balut gmail com>
Date: Mon Sep 5 06:13:46 2011 +0200
Move the logic which calculates the size of a TrackControls object in a new method
pitivi/ui/timelinecontrols.py | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/pitivi/ui/timelinecontrols.py b/pitivi/ui/timelinecontrols.py
index 78e33e7..69a4429 100644
--- a/pitivi/ui/timelinecontrols.py
+++ b/pitivi/ui/timelinecontrols.py
@@ -19,6 +19,8 @@ def track_name(track):
class TrackControls(gtk.Label):
+ """Contains a timeline track name."""
+
__gtype_name__ = 'TrackControls'
def __init__(self, track):
@@ -26,7 +28,7 @@ class TrackControls(gtk.Label):
self.set_alignment(0.5, 0.1)
self.set_markup(track_name(track))
self.track = track
- self.set_size_request(TRACK_CONTROL_WIDTH, LAYER_HEIGHT_EXPANDED)
+ self._setSize(layers_count=1)
def _setTrack(self):
if self.track:
@@ -36,12 +38,17 @@ class TrackControls(gtk.Label):
@handler(track, "max-priority-changed")
def _maxPriorityChanged(self, track, max_priority):
- self.set_size_request(TRACK_CONTROL_WIDTH, (1 +
- max_priority) * (LAYER_HEIGHT_EXPANDED +
- LAYER_SPACING))
+ self._setSize(max_priority + 1)
+
+ def _setSize(self, layers_count):
+ assert layers_count >= 1
+ height = layers_count * (LAYER_HEIGHT_EXPANDED + LAYER_SPACING)
+ self.set_size_request(TRACK_CONTROL_WIDTH, height)
class TimelineControls(gtk.VBox):
+ """Contains the timeline track names."""
+
def __init__(self):
gtk.VBox.__init__(self)
self._tracks = []
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]