[pitivi] viewer: Add an overlay stack only to the main viewer
- From: Alexandru Băluț <alexbalut src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] viewer: Add an overlay stack only to the main viewer
- Date: Fri, 22 Apr 2016 04:24:30 +0000 (UTC)
commit a16ddd1aacc847a79133e34fc567a0a93d8b552c
Author: Alexandru Băluț <alexandru balut gmail com>
Date: Thu Apr 21 01:26:34 2016 +0200
viewer: Add an overlay stack only to the main viewer
Changed ViewerWidget to not be aware of the pipeline and simply display
a Gtk.Widget. The ViewerContainer now wraps the pipeline's sink widget
into an OverlayStack to provide the added functionality.
Previously the OverlayStack was always creted, even when the viewer was
used only to preview an asset.
Fixes https://phabricator.freedesktop.org/T7401
Differential Revision: https://phabricator.freedesktop.org/D945
pitivi/clipproperties.py | 4 ++--
pitivi/mediafilespreviewer.py | 2 +-
pitivi/timeline/timeline.py | 2 +-
pitivi/viewer/viewer.py | 18 +++++++-----------
4 files changed, 11 insertions(+), 15 deletions(-)
---
diff --git a/pitivi/clipproperties.py b/pitivi/clipproperties.py
index 8bc7188..72cf05b 100644
--- a/pitivi/clipproperties.py
+++ b/pitivi/clipproperties.py
@@ -626,7 +626,7 @@ class TransformationProperties(Gtk.Expander, Loggable):
with self.app.action_log.started("Transformation property change"):
self.source.set_child_property(prop, value)
self._project.pipeline.commit_timeline()
- self.app.gui.viewer.target.overlay_stack.update(self.source)
+ self.app.gui.viewer.overlay_stack.update(self.source)
def __setSource(self, source):
if self.source:
@@ -646,7 +646,7 @@ class TransformationProperties(Gtk.Expander, Loggable):
if source:
self._selected_clip = clip
self.__setSource(source)
- self.app.gui.viewer.target.overlay_stack.select(source)
+ self.app.gui.viewer.overlay_stack.select(source)
self.show()
return
diff --git a/pitivi/mediafilespreviewer.py b/pitivi/mediafilespreviewer.py
index 7a72eb5..9f56f8e 100644
--- a/pitivi/mediafilespreviewer.py
+++ b/pitivi/mediafilespreviewer.py
@@ -110,7 +110,7 @@ class PreviewWidget(Gtk.Grid, Loggable):
# Gui elements:
# Drawing area for video output
- self.preview_video = ViewerWidget(self.player)
+ self.preview_video = ViewerWidget(self.player.sink_widget)
self.preview_video.props.hexpand = minimal
self.preview_video.props.vexpand = minimal
self.preview_video.show_all()
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index f5b6f0e..a685bdd 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -607,7 +607,7 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
def update_visible_overlays(self):
sources = self.get_sources_at_position(self.__last_position)
- self.app.gui.viewer.target.overlay_stack.set_current_sources(sources)
+ self.app.gui.viewer.overlay_stack.set_current_sources(sources)
def __buttonPressEventCb(self, unused_widget, event):
self.debug("PRESSED %s", event)
diff --git a/pitivi/viewer/viewer.py b/pitivi/viewer/viewer.py
index 7413a0c..a16862c 100644
--- a/pitivi/viewer/viewer.py
+++ b/pitivi/viewer/viewer.py
@@ -139,7 +139,8 @@ class ViewerContainer(Gtk.Box, Loggable):
def __createNewViewer(self):
self.pipeline.create_sink()
- self.target = ViewerWidget(self.pipeline, self.app)
+ self.overlay_stack = OverlayStack(self.app, self.pipeline.sink_widget)
+ self.target = ViewerWidget(self.overlay_stack)
if self.docked:
self.pack_start(self.target, True, True, 0)
@@ -484,29 +485,24 @@ class ViewerContainer(Gtk.Box, Loggable):
class ViewerWidget(Gtk.AspectFrame, Loggable):
"""
- Widget for displaying a GStreamer video sink.
+ Widget for displaying a video sink.
- @type _pipeline: L{pitivi.utils.pipeline.SimplePipeline}
+ Args:
+ sink_widget (Gtk.Widget): The widget doing the real work.
"""
- def __init__(self, pipeline, app=None):
+ def __init__(self, sink_widget):
# Prevent black frames and flickering while resizing or changing focus:
# The aspect ratio gets overridden by setDisplayAspectRatio.
Gtk.AspectFrame.__init__(self, xalign=0.5, yalign=0.5,
ratio=4.0 / 3.0, obey_child=False)
Loggable.__init__(self)
- self._pipeline = pipeline
-
- pipeline.sink_widget.show()
+ self.add(sink_widget)
# We keep the ViewerWidget hidden initially, or the desktop wallpaper
# would show through the non-double-buffered widget!
- # Assign Viewer Overlay via Gtk.Overlay
- self.overlay_stack = OverlayStack(app, pipeline.sink_widget)
- self.add(self.overlay_stack)
-
def setDisplayAspectRatio(self, ratio):
self.set_property("ratio", float(ratio))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]