[pitivi] Rename bLayer to ges_layer
- From: Alexandru Băluț <alexbalut src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] Rename bLayer to ges_layer
- Date: Sun, 20 Mar 2016 23:58:39 +0000 (UTC)
commit 795fe95fa375d7afe98b24a364e9347cad28cca3
Author: Alexandru Băluț <alexandru balut gmail com>
Date: Sun Feb 14 05:04:25 2016 +0100
Rename bLayer to ges_layer
Differential Revision: https://phabricator.freedesktop.org/D779
pitivi/timeline/layer.py | 66 +++++++-------
pitivi/timeline/timeline.py | 178 +++++++++++++++++++-------------------
tests/test_timeline_layer.py | 24 +++---
tests/test_timeline_timeline.py | 50 ++++++------
4 files changed, 159 insertions(+), 159 deletions(-)
---
diff --git a/pitivi/timeline/layer.py b/pitivi/timeline/layer.py
index 99c4067..4eeeae6 100644
--- a/pitivi/timeline/layer.py
+++ b/pitivi/timeline/layer.py
@@ -109,12 +109,12 @@ class LayerControls(Gtk.EventBox, Loggable):
__gtype_name__ = 'PitiviLayerControls'
- def __init__(self, bLayer, app):
+ def __init__(self, ges_layer, app):
Gtk.EventBox.__init__(self)
Loggable.__init__(self)
- self.bLayer = bLayer
- self.ges_timeline = self.bLayer.get_timeline()
+ self.ges_layer = ges_layer
+ self.ges_timeline = self.ges_layer.get_timeline()
self.app = app
self.props.width_request = ui.CONTROL_WIDTH
@@ -172,7 +172,7 @@ class LayerControls(Gtk.EventBox, Loggable):
self.after_sep.props.vexpand = False
vbox.pack_start(self.after_sep, False, False, 0)
- self.bLayer.connect("notify::priority", self.__layerPriorityChangedCb)
+ self.ges_layer.connect("notify::priority", self.__layerPriorityChangedCb)
self.ges_timeline.connect("layer-added", self.__timelineLayerAddedCb)
self.ges_timeline.connect("layer-removed", self.__timelineLayerRemovedCb)
self.__updateActions()
@@ -185,27 +185,27 @@ class LayerControls(Gtk.EventBox, Loggable):
def __del__(self):
self.name_entry.disconnect_by_func(self.__nameChangedCb)
- self.bLayer.disconnect_by_func(self.__layerPriorityChangedCb)
+ self.ges_layer.disconnect_by_func(self.__layerPriorityChangedCb)
self.ges_timeline.disconnect_by_func(self.__timelineLayerAddedCb)
self.ges_timeline.disconnect_by_func(self.__timelineLayerRemovedCb)
super(LayerControls, self).__del__()
def __nameChangedCb(self, unused_widget, unused_event):
- self.bLayer.ui.setName(self.name_entry.get_text())
+ self.ges_layer.ui.setName(self.name_entry.get_text())
self.app.project_manager.current_project.setModificationState(True)
- def __layerPriorityChangedCb(self, unused_bLayer, unused_pspec):
+ def __layerPriorityChangedCb(self, unused_ges_layer, unused_pspec):
self.__updateActions()
self.__updateName()
- def __timelineLayerAddedCb(self, unused_timeline, unused_bLayer):
+ def __timelineLayerAddedCb(self, unused_timeline, unused_ges_layer):
self.__updateActions()
- def __timelineLayerRemovedCb(self, unused_timeline, unused_bLayer):
+ def __timelineLayerRemovedCb(self, unused_timeline, unused_ges_layer):
self.__updateActions()
def __updateActions(self):
- priority = self.bLayer.get_priority()
+ priority = self.ges_layer.get_priority()
first = priority == 0
self.__move_layer_up_action.props.enabled = not first
self.__move_layer_top_action.props.enabled = not first
@@ -216,7 +216,7 @@ class LayerControls(Gtk.EventBox, Loggable):
self.__delete_layer_action.props.enabled = layers_count > 1
def __updateName(self):
- self.name_entry.set_text(self.bLayer.ui.getName())
+ self.name_entry.set_text(self.ges_layer.ui.getName())
def __createMenuModel(self):
action_group = Gio.SimpleActionGroup()
@@ -256,23 +256,23 @@ class LayerControls(Gtk.EventBox, Loggable):
def _deleteLayerCb(self, unused_action, unused_parametter):
self.app.action_log.begin("delete layer")
- self.ges_timeline.remove_layer(self.bLayer)
+ self.ges_timeline.remove_layer(self.ges_layer)
self.ges_timeline.get_asset().pipeline.commit_timeline()
self.app.action_log.commit()
def _moveLayerCb(self, unused_simple_action, unused_parametter, step):
- index = self.bLayer.get_priority()
+ index = self.ges_layer.get_priority()
if abs(step) == 1:
index += step
elif step == -2:
index = 0
else:
index = len(self.ges_timeline.get_layers()) - 1
- self.ges_timeline.ui.moveLayer(self.bLayer, index)
+ self.ges_timeline.ui.moveLayer(self.ges_layer, index)
self.app.project_manager.current_project.pipeline.commit_timeline()
def update(self, media_types):
- self.props.height_request = self.bLayer.ui.props.height_request + ui.PADDING * 3
+ self.props.height_request = self.ges_layer.ui.props.height_request + ui.PADDING * 3
if media_types & GES.TrackType.VIDEO:
icon = "video-x-generic"
@@ -352,17 +352,17 @@ class Layer(Gtk.EventBox, timelineUtils.Zoomable, Loggable):
"remove-me": (GObject.SignalFlags.RUN_LAST, None, (),)
}
- def __init__(self, bLayer, timeline):
+ def __init__(self, ges_layer, timeline):
super(Layer, self).__init__()
Loggable.__init__(self)
- self.bLayer = bLayer
- self.bLayer.ui = self
+ self.ges_layer = ges_layer
+ self.ges_layer.ui = self
self.timeline = timeline
self.app = timeline.app
- self.bLayer.connect("clip-added", self._clipAddedCb)
- self.bLayer.connect("clip-removed", self._clipRemovedCb)
+ self.ges_layer.connect("clip-added", self._clipAddedCb)
+ self.ges_layer.connect("clip-removed", self._clipRemovedCb)
# FIXME Make the layer height user setable with 'Paned'
self.props.height_request = ui.LAYER_HEIGHT / 2
@@ -373,19 +373,19 @@ class Layer(Gtk.EventBox, timelineUtils.Zoomable, Loggable):
self.add(self._layout)
self.media_types = GES.TrackType(0)
- for clip in bLayer.get_clips():
+ for clip in ges_layer.get_clips():
self._addClip(clip)
self.before_sep = SpacedSeparator(Gtk.PositionType.TOP)
self.after_sep = SpacedSeparator(Gtk.PositionType.BOTTOM)
def setName(self, name):
- self.bLayer.set_meta("video::name", name)
+ self.ges_layer.set_meta("video::name", name)
def __nameIfSet(self):
- name = self.bLayer.get_meta("video::name")
+ name = self.ges_layer.get_meta("video::name")
if not name:
- name = self.bLayer.get_meta("audio::name")
+ name = self.ges_layer.get_meta("audio::name")
return name
def __nameIfMeaningful(self):
@@ -399,14 +399,14 @@ class Layer(Gtk.EventBox, timelineUtils.Zoomable, Loggable):
def getName(self):
name = self.__nameIfMeaningful()
if not name:
- name = _('Layer %d') % self.bLayer.get_priority()
+ name = _('Layer %d') % self.ges_layer.get_priority()
return name
def release(self):
- for clip in self.bLayer.get_clips():
+ for clip in self.ges_layer.get_clips():
self._removeClip(clip)
- self.bLayer.disconnect_by_func(self._clipAddedCb)
- self.bLayer.disconnect_by_func(self._clipRemovedCb)
+ self.ges_layer.disconnect_by_func(self._clipAddedCb)
+ self.ges_layer.disconnect_by_func(self._clipRemovedCb)
def checkMediaTypes(self):
if self.timeline.editing_context:
@@ -415,7 +415,7 @@ class Layer(Gtk.EventBox, timelineUtils.Zoomable, Loggable):
return
old_media_types = self.media_types
self.media_types = GES.TrackType(0)
- ges_clips = self.bLayer.get_clips()
+ ges_clips = self.ges_layer.get_clips()
for ges_clip in ges_clips:
for child in ges_clip.get_children(False):
track = child.get_track()
@@ -437,8 +437,8 @@ class Layer(Gtk.EventBox, timelineUtils.Zoomable, Loggable):
height += ui.LAYER_HEIGHT / 2
self.props.height_request = height
- if hasattr(self.bLayer, "control_ui") and self.bLayer.control_ui:
- self.bLayer.control_ui.update(self.media_types)
+ if hasattr(self.ges_layer, "control_ui") and self.ges_layer.control_ui:
+ self.ges_layer.control_ui.update(self.media_types)
if old_media_types != self.media_types:
self.updatePosition()
@@ -469,7 +469,7 @@ class Layer(Gtk.EventBox, timelineUtils.Zoomable, Loggable):
ges_clip.connect_after("child-removed", self._childRemovedFromClipCb)
self.checkMediaTypes()
- def _clipRemovedCb(self, bLayer, ges_clip):
+ def _clipRemovedCb(self, ges_layer, ges_clip):
self._removeClip(ges_clip)
def _removeClip(self, ges_clip):
@@ -496,7 +496,7 @@ class Layer(Gtk.EventBox, timelineUtils.Zoomable, Loggable):
self.checkMediaTypes()
def updatePosition(self):
- for ges_clip in self.bLayer.get_clips():
+ for ges_clip in self.ges_layer.get_clips():
if hasattr(ges_clip, "ui"):
ges_clip.ui.updatePosition()
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index ae1858d..5c869f8 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -359,8 +359,8 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
self.ges_timeline.disconnect_by_func(self._layerRemovedCb)
self.ges_timeline.disconnect_by_func(self._snapCb)
self.ges_timeline.disconnect_by_func(self._snapEndedCb)
- for bLayer in self.ges_timeline.get_layers():
- self._removeLayer(bLayer)
+ for ges_layer in self.ges_timeline.get_layers():
+ self._removeLayer(ges_layer)
self.ges_timeline.ui = None
self.ges_timeline = None
@@ -375,8 +375,8 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
self.ges_timeline.ui = self
- for bLayer in self.ges_timeline.get_layers():
- self._addLayer(bLayer)
+ for ges_layer in self.ges_timeline.get_layers():
+ self._addLayer(ges_layer)
self.ges_timeline.connect("notify::duration", self._durationChangedCb)
self.ges_timeline.connect("layer-added", self._layerAddedCb)
@@ -601,11 +601,11 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
if self.draggingElement is not None:
self.__drag_start_x = event.x
- self._on_layer = self.draggingElement.layer.bLayer
+ self._on_layer = self.draggingElement.layer.ges_layer
else:
layer_controls = self._getParentOfType(event_widget, LayerControls)
if layer_controls:
- self.__moving_layer = layer_controls.bLayer
+ self.__moving_layer = layer_controls.ges_layer
else:
self.__marquee.setStartPosition(event)
@@ -667,7 +667,7 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
event_widget = self.get_event_widget(event)
unused_x, y = event_widget.translate_coordinates(self, event.x, event.y)
layer, unused_on_sep = self._getLayerAt(
- y, prefer_bLayer=self.__moving_layer,
+ y, prefer_ges_layer=self.__moving_layer,
past_middle_when_adjacent=True)
if layer != self.__moving_layer:
priority = layer.get_priority()
@@ -735,7 +735,7 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
else:
clip_duration = asset.get_duration()
- bLayer, unused_on_sep = self._getLayerAt(y)
+ ges_layer, unused_on_sep = self._getLayerAt(y)
if not placement:
placement = self.pixelToNs(x)
placement = max(0, placement)
@@ -743,11 +743,11 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
self.debug("Creating %s at %s", asset.props.id, Gst.TIME_ARGS(placement))
self.app.action_log.begin("add clip")
- ges_clip = bLayer.add_asset(asset,
- placement,
- 0,
- clip_duration,
- asset.get_supported_formats())
+ ges_clip = ges_layer.add_asset(asset,
+ placement,
+ 0,
+ clip_duration,
+ asset.get_supported_formats())
placement += clip_duration
self.current_group.add(ges_clip.get_toplevel_parent())
self.selection.setSelection([], SELECT_ADD)
@@ -756,7 +756,7 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
if not self.draggingElement:
self.draggingElement = ges_clip.ui
- self._on_layer = bLayer
+ self._on_layer = ges_layer
self._createdClips = True
@@ -855,12 +855,12 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
self.dropDataReady = True
# Handle layers
- def _layerAddedCb(self, timeline, bLayer):
- self._addLayer(bLayer)
+ def _layerAddedCb(self, timeline, ges_layer):
+ self._addLayer(ges_layer)
- def moveLayer(self, bLayer, index):
+ def moveLayer(self, ges_layer, index):
layers = self.ges_timeline.get_layers()
- layer = layers.pop(bLayer.get_priority())
+ layer = layers.pop(ges_layer.get_priority())
layers.insert(index, layer)
for i, layer in enumerate(layers):
@@ -868,16 +868,16 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
self._project.setModificationState(True)
- def _addLayer(self, bLayer):
- layer = Layer(bLayer, self)
- bLayer.ui = layer
+ def _addLayer(self, ges_layer):
+ layer = Layer(ges_layer, self)
+ ges_layer.ui = layer
self._layers.append(layer)
layer.connect("remove-me", self._removeLayerCb)
- control = LayerControls(bLayer, self.app)
+ control = LayerControls(ges_layer, self.app)
control.show_all()
self.__layers_controls_vbox.pack_start(control, False, False, 0)
- bLayer.control_ui = control
+ ges_layer.control_ui = control
# Check the media types so the controls are set up properly.
layer.checkMediaTypes()
@@ -888,44 +888,44 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
layer_widget.show_all()
self.__layers_vbox.pack_start(layer_widget, True, True, 0)
- bLayer.connect("notify::priority", self.__layerPriorityChangedCb)
+ ges_layer.connect("notify::priority", self.__layerPriorityChangedCb)
def _removeLayerCb(self, layer):
- self.ges_timeline.remove_layer(layer.bLayer)
+ self.ges_timeline.remove_layer(layer.ges_layer)
- def __layerPriorityChangedCb(self, bLayer, pspec):
+ def __layerPriorityChangedCb(self, ges_layer, pspec):
self.__resetLayersByPriority()
def __resetLayersByPriority(self, reset=False):
- self._layers.sort(key=lambda layer: layer.bLayer.props.priority)
+ self._layers.sort(key=lambda layer: layer.ges_layer.props.priority)
self.debug("Reseting layers priorities")
for i, layer in enumerate(self._layers):
if reset:
- layer.bLayer.props.priority = i
+ layer.ges_layer.props.priority = i
self.__layers_vbox.child_set_property(layer.get_parent(),
"position",
- layer.bLayer.props.priority)
+ layer.ges_layer.props.priority)
- self.__layers_controls_vbox.child_set_property(layer.bLayer.control_ui,
+ self.__layers_controls_vbox.child_set_property(layer.ges_layer.control_ui,
"position",
- layer.bLayer.props.priority)
+ layer.ges_layer.props.priority)
- def _removeLayer(self, bLayer):
- self.info("Removing layer: %s", bLayer.props.priority)
- self.__layers_vbox.remove(bLayer.ui.get_parent())
- self.__layers_controls_vbox.remove(bLayer.control_ui)
- bLayer.disconnect_by_func(self.__layerPriorityChangedCb)
+ def _removeLayer(self, ges_layer):
+ self.info("Removing layer: %s", ges_layer.props.priority)
+ self.__layers_vbox.remove(ges_layer.ui.get_parent())
+ self.__layers_controls_vbox.remove(ges_layer.control_ui)
+ ges_layer.disconnect_by_func(self.__layerPriorityChangedCb)
- self._layers.remove(bLayer.ui)
- bLayer.ui.release()
- bLayer.ui = None
- bLayer.control_ui = None
+ self._layers.remove(ges_layer.ui)
+ ges_layer.ui.release()
+ ges_layer.ui = None
+ ges_layer.control_ui = None
self.__resetLayersByPriority(True)
- def _layerRemovedCb(self, unused_ges_timeline, bLayer):
- self._removeLayer(bLayer)
+ def _layerRemovedCb(self, unused_ges_timeline, ges_layer):
+ self._removeLayer(ges_layer)
# Interface Zoomable
def zoomChanged(self):
@@ -949,63 +949,63 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
return GES.EditMode.EDIT_TRIM
return GES.EditMode.EDIT_NORMAL
- def __layerGetSeps(self, bLayer, sep_name):
- return [getattr(bLayer.ui, sep_name), getattr(bLayer.control_ui, sep_name)]
+ def __layerGetSeps(self, ges_layer, sep_name):
+ return [getattr(ges_layer.ui, sep_name), getattr(ges_layer.control_ui, sep_name)]
- def _getLayerAt(self, y, prefer_bLayer=None, past_middle_when_adjacent=False):
+ def _getLayerAt(self, y, prefer_ges_layer=None, past_middle_when_adjacent=False):
""" Used in the testsuite """
- bLayers = self.ges_timeline.get_layers()
+ ges_layers = self.ges_timeline.get_layers()
if y < 20:
# The cursor is at the top, above the first layer.
self.debug("Returning very first layer")
- bLayer = bLayers[0]
- return bLayer, self.__layerGetSeps(bLayer, "before_sep")
+ ges_layer = ges_layers[0]
+ return ges_layer, self.__layerGetSeps(ges_layer, "before_sep")
# This means if an asset is dragged directly on a separator,
# it will prefer the layer below the separator, if any.
- # Otherwise, it helps choosing a layer as close to prefer_bLayer
+ # Otherwise, it helps choosing a layer as close to prefer_ges_layer
# as possible when having an option (y is between two layers).
prefer_after = True
if past_middle_when_adjacent:
- index_preferred = prefer_bLayer.get_priority()
- height_preferred = prefer_bLayer.ui.get_allocation().height
+ index_preferred = prefer_ges_layer.get_priority()
+ height_preferred = prefer_ges_layer.ui.get_allocation().height
- for i, bLayer in enumerate(bLayers):
- layer_rect = bLayer.ui.get_allocation()
+ for i, ges_layer in enumerate(ges_layers):
+ layer_rect = ges_layer.ui.get_allocation()
layer_y = layer_rect.y
layer_height = layer_rect.height
if layer_y <= y < layer_y + layer_height:
- # The cursor is exactly on bLayer.
+ # The cursor is exactly on ges_layer.
if past_middle_when_adjacent:
- # Check if far enough from prefer_bLayer.
- delta = index_preferred - bLayer.get_priority()
+ # Check if far enough from prefer_ges_layer.
+ delta = index_preferred - ges_layer.get_priority()
if (delta == 1 and y >= layer_y + height_preferred) or \
(delta == -1 and y < layer_y + layer_height - height_preferred):
- # bLayer is adjacent to prefer_bLayer, but the cursor
+ # ges_layer is adjacent to prefer_ges_layer, but the cursor
# is not far enough to warrant a change.
- return prefer_bLayer, []
- return bLayer, []
+ return prefer_ges_layer, []
+ return ges_layer, []
- separators = self.__layerGetSeps(bLayer, "after_sep")
+ separators = self.__layerGetSeps(ges_layer, "after_sep")
try:
- next_bLayer = bLayers[i + 1]
+ next_ges_layer = ges_layers[i + 1]
except IndexError:
# The cursor is below the last layer.
self.debug("Returning very last layer")
- return bLayer, separators
+ return ges_layer, separators
- if bLayer == prefer_bLayer:
- # Choose a layer as close to prefer_bLayer as possible.
+ if ges_layer == prefer_ges_layer:
+ # Choose a layer as close to prefer_ges_layer as possible.
prefer_after = False
- if layer_y + layer_height <= y < next_bLayer.ui.get_allocation().y:
+ if layer_y + layer_height <= y < next_ges_layer.ui.get_allocation().y:
# The cursor is between this layer and the one below.
- separators.extend(self.__layerGetSeps(next_bLayer, "before_sep"))
+ separators.extend(self.__layerGetSeps(next_ges_layer, "before_sep"))
if prefer_after:
- bLayer = next_bLayer
- self.debug("Returning layer %s, separators: %s", bLayer, separators)
- return bLayer, separators
+ ges_layer = next_ges_layer
+ self.debug("Returning layer %s, separators: %s", ges_layer, separators)
+ return ges_layer, separators
def _setSeparatorsPrelight(self, light):
""" Used in the testsuite """
@@ -1049,7 +1049,7 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
position = self.pixelToNs(x - self.__drag_start_x)
self._setSeparatorsPrelight(False)
- res = self._getLayerAt(y, prefer_bLayer=self._on_layer)
+ res = self._getLayerAt(y, prefer_ges_layer=self._on_layer)
self._on_layer, self.__on_separators = res
if (mode != GES.EditMode.EDIT_NORMAL or
self.current_group.props.height > 1):
@@ -1062,35 +1062,35 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
self.editing_context.editTo(position, priority)
def createLayer(self, priority):
- new_bLayer = GES.Layer.new()
- new_bLayer.props.priority = priority
- self.ges_timeline.add_layer(new_bLayer)
-
- bLayers = self.ges_timeline.get_layers()
- if priority < len(bLayers):
- for bLayer in bLayers:
- if bLayer == new_bLayer:
+ new_ges_layer = GES.Layer.new()
+ new_ges_layer.props.priority = priority
+ self.ges_timeline.add_layer(new_ges_layer)
+
+ ges_layers = self.ges_timeline.get_layers()
+ if priority < len(ges_layers):
+ for ges_layer in ges_layers:
+ if ges_layer == new_ges_layer:
continue
- if bLayer.get_priority() >= priority:
- bLayer.props.priority += 1
- self.__layers_vbox.child_set_property(bLayer.ui.get_parent(),
+ if ges_layer.get_priority() >= priority:
+ ges_layer.props.priority += 1
+ self.__layers_vbox.child_set_property(ges_layer.ui.get_parent(),
"position",
- bLayer.props.priority)
+ ges_layer.props.priority)
- self.__layers_controls_vbox.child_set_property(bLayer.control_ui,
+ self.__layers_controls_vbox.child_set_property(ges_layer.control_ui,
"position",
- bLayer.props.priority)
+ ges_layer.props.priority)
- self.__layers_vbox.child_set_property(new_bLayer.ui.get_parent(),
+ self.__layers_vbox.child_set_property(new_ges_layer.ui.get_parent(),
"position",
- new_bLayer.props.priority)
+ new_ges_layer.props.priority)
- self.__layers_controls_vbox.child_set_property(new_bLayer.control_ui,
+ self.__layers_controls_vbox.child_set_property(new_ges_layer.control_ui,
"position",
- new_bLayer.props.priority)
+ new_ges_layer.props.priority)
- return new_bLayer
+ return new_ges_layer
def __getDroppedLayer(self):
"""
diff --git a/tests/test_timeline_layer.py b/tests/test_timeline_layer.py
index 7e560c1..ebca9f5 100644
--- a/tests/test_timeline_layer.py
+++ b/tests/test_timeline_layer.py
@@ -31,24 +31,24 @@ class TestLayerControl(common.TestCase):
def testName(self):
timeline = mock.MagicMock()
- bLayer = GES.Layer()
- layer = Layer(bLayer, timeline)
- self.assertEqual("Layer 0", layer.getName(), "Default name generation failed")
- bLayer.set_meta("audio::name", "a")
- self.assertEqual("a", layer.getName(), "Cannot use old audio name")
- bLayer.set_meta("video::name", "v")
- self.assertEqual("v", layer.getName(), "Cannot use old video name")
+ ges_layer = GES.Layer()
+ layer = Layer(ges_layer, timeline)
+ self.assertEqual(layer.getName(), "Layer 0", "Default name generation failed")
+ ges_layer.set_meta("audio::name", "a")
+ self.assertEqual(layer.getName(), "a", "Cannot use old audio name")
+ ges_layer.set_meta("video::name", "v")
+ self.assertEqual(layer.getName(), "v", "Cannot use old video name")
layer.setName("vv")
- self.assertEqual("vv", layer.getName())
+ self.assertEqual(layer.getName(), "vv")
class TestLayer(common.TestCase):
def testCheckMediaTypesWhenNoUI(self):
- bLayer = GES.Layer()
+ ges_layer = GES.Layer()
png = common.getSampleUri("flat_colour1_640x480.png")
video_clip = GES.UriClipAsset.request_sync(png).extract()
- self.assertTrue(bLayer.add_clip(video_clip))
- self.assertEqual(1, len(bLayer.get_clips()))
+ self.assertTrue(ges_layer.add_clip(video_clip))
+ self.assertEqual(len(ges_layer.get_clips()), 1)
timeline = Timeline(container=None, app=None)
- layer = Layer(bLayer, timeline)
+ layer = Layer(ges_layer, timeline)
diff --git a/tests/test_timeline_timeline.py b/tests/test_timeline_timeline.py
index 99b6b38..e0ff83d 100644
--- a/tests/test_timeline_timeline.py
+++ b/tests/test_timeline_timeline.py
@@ -102,56 +102,56 @@ class TestLayers(BaseTestTimeline):
y = 0
for priority, height in enumerate(heights):
- bLayer = timeline.createLayer(priority=priority)
+ ges_layer = timeline.createLayer(priority=priority)
rect = Gdk.Rectangle()
rect.y = y
rect.height = height
- bLayer.ui.set_allocation(rect)
+ ges_layer.ui.set_allocation(rect)
y += height + SEPARATOR_HEIGHT
- bLayers = [layer.bLayer for layer in timeline._layers]
+ ges_layers = [layer.ges_layer for layer in timeline._layers]
if preferred is None:
- preferred_bLayer = None
+ preferred_ges_layer = None
else:
- preferred_bLayer = bLayers[preferred]
+ preferred_ges_layer = ges_layers[preferred]
h = [layer.get_allocation().height for layer in timeline._layers]
s = SEPARATOR_HEIGHT
- def assertLayerAt(bLayer, y):
+ def assertLayerAt(ges_layer, y):
result = timeline._getLayerAt(
int(y),
- prefer_bLayer=preferred_bLayer,
+ prefer_ges_layer=preferred_ges_layer,
past_middle_when_adjacent=past_middle_when_adjacent)
self.assertEqual(
- bLayer,
+ ges_layer,
result[0],
- "Expected %d, got %d at %d" % (bLayers.index(bLayer), bLayers.index(result[0]), y))
+ "Expected %d, got %d at %d" % (ges_layers.index(ges_layer), ges_layers.index(result[0]), y))
# y on the top layer.
- assertLayerAt(bLayers[expectations[0]], 0)
- assertLayerAt(bLayers[expectations[1]], h[0] / 2 - 1)
- assertLayerAt(bLayers[expectations[2]], h[0] / 2)
- assertLayerAt(bLayers[expectations[3]], h[0] - 1)
+ assertLayerAt(ges_layers[expectations[0]], 0)
+ assertLayerAt(ges_layers[expectations[1]], h[0] / 2 - 1)
+ assertLayerAt(ges_layers[expectations[2]], h[0] / 2)
+ assertLayerAt(ges_layers[expectations[3]], h[0] - 1)
# y on the separator.
- assertLayerAt(bLayers[expectations[4]], h[0])
- assertLayerAt(bLayers[expectations[5]], h[0] + s - 1)
+ assertLayerAt(ges_layers[expectations[4]], h[0])
+ assertLayerAt(ges_layers[expectations[5]], h[0] + s - 1)
# y on the middle layer.
- assertLayerAt(bLayers[expectations[6]], h[0] + s)
- assertLayerAt(bLayers[expectations[7]], h[0] + s + h[1] / 2 - 1)
- assertLayerAt(bLayers[expectations[8]], h[0] + s + h[1] / 2)
- assertLayerAt(bLayers[expectations[9]], h[0] + s + h[1] - 1)
+ assertLayerAt(ges_layers[expectations[6]], h[0] + s)
+ assertLayerAt(ges_layers[expectations[7]], h[0] + s + h[1] / 2 - 1)
+ assertLayerAt(ges_layers[expectations[8]], h[0] + s + h[1] / 2)
+ assertLayerAt(ges_layers[expectations[9]], h[0] + s + h[1] - 1)
# y on the separator.
- assertLayerAt(bLayers[expectations[10]], h[0] + s + h[1])
- assertLayerAt(bLayers[expectations[11]], h[0] + s + h[1] + s - 1)
+ assertLayerAt(ges_layers[expectations[10]], h[0] + s + h[1])
+ assertLayerAt(ges_layers[expectations[11]], h[0] + s + h[1] + s - 1)
# y on the bottom layer.
- assertLayerAt(bLayers[expectations[12]], h[0] + s + h[1] + s)
- assertLayerAt(bLayers[expectations[13]], h[0] + s + h[1] + s + h[2] / 2 - 1)
- assertLayerAt(bLayers[expectations[14]], h[0] + s + h[1] + s + h[2] / 2)
- assertLayerAt(bLayers[expectations[15]], h[0] + s + h[1] + s + h[2] - 1)
+ assertLayerAt(ges_layers[expectations[12]], h[0] + s + h[1] + s)
+ assertLayerAt(ges_layers[expectations[13]], h[0] + s + h[1] + s + h[2] / 2 - 1)
+ assertLayerAt(ges_layers[expectations[14]], h[0] + s + h[1] + s + h[2] / 2)
+ assertLayerAt(ges_layers[expectations[15]], h[0] + s + h[1] + s + h[2] - 1)
def testSetSeparatorsPrelight(self):
timeline = self.createTimeline()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]