[pitivi] timeline: Respect the `allow_zoom_in` parameter in set_best_zoom_ratio
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] timeline: Respect the `allow_zoom_in` parameter in set_best_zoom_ratio
- Date: Sat, 11 Feb 2017 20:46:47 +0000 (UTC)
commit 943cc4aac6b7919e5f2aa09baf74baaaf59f4eae
Author: Thibault Saunier <thibault saunier osg samsung com>
Date: Sat Feb 11 10:05:01 2017 -0300
timeline: Respect the `allow_zoom_in` parameter in set_best_zoom_ratio
We used to not take in into account at all.
And make sure to allow zoom in in the following cases:
- The user clicked the 'zoom fit button'
- We start rendering, the progress bar being the playhead it is better
to be zoom fitted to have the best overview.
Fixes T7684
Reviewed-by: Alex Băluț <alexandru balut gmail com>
Differential Revision: https://phabricator.freedesktop.org/D1656
pitivi/render.py | 2 +-
pitivi/timeline/timeline.py | 16 ++++++++--------
pitivi/utils/widgets.py | 2 +-
3 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/pitivi/render.py b/pitivi/render.py
index 50eb150..153348b 100644
--- a/pitivi/render.py
+++ b/pitivi/render.py
@@ -988,7 +988,7 @@ class RenderDialog(Loggable):
self._factory_formats[encoder_string] = fmt
break
- self.app.gui.timeline_ui.timeline.set_best_zoom_ratio()
+ self.app.gui.timeline_ui.timeline.set_best_zoom_ratio(allow_zoom_in=True)
self.project.set_rendering(True)
self._pipeline.set_render_settings(
self.outfile, self.project.container_profile)
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index 51e9e36..18c9a92 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -1054,7 +1054,7 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
zoom_ratio = self.layout.get_allocation().width / timeline_duration_s
nearest_zoom_level = Zoomable.computeZoomLevel(zoom_ratio)
- if nearest_zoom_level >= Zoomable.getCurrentZoomLevel():
+ if nearest_zoom_level >= Zoomable.getCurrentZoomLevel() and not allow_zoom_in:
# This means if we continue we'll zoom in.
if not allow_zoom_in:
# For example when the user zoomed out and is adding clips
@@ -1538,20 +1538,20 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
self.app.shortcuts.register_group("navigation", _("Timeline Navigation"), position=40)
self.zoom_in_action = Gio.SimpleAction.new("zoom-in", None)
- self.zoom_in_action.connect("activate", self._zoomInCb)
+ self.zoom_in_action.connect("activate", self._zoom_in_cb)
navigation_group.add_action(self.zoom_in_action)
self.app.shortcuts.add("navigation.zoom-in",
["<Primary>plus", "<Primary>equal"],
_("Zoom in"))
self.zoom_out_action = Gio.SimpleAction.new("zoom-out", None)
- self.zoom_out_action.connect("activate", self._zoomOutCb)
+ self.zoom_out_action.connect("activate", self._zoom_out_cb)
navigation_group.add_action(self.zoom_out_action)
self.app.shortcuts.add("navigation.zoom-out", ["<Primary>minus"],
_("Zoom out"))
self.zoom_fit_action = Gio.SimpleAction.new("zoom-fit", None)
- self.zoom_fit_action.connect("activate", self._zoomFitCb)
+ self.zoom_fit_action.connect("activate", self._zoom_fit_cb)
navigation_group.add_action(self.zoom_fit_action)
self.app.shortcuts.add("navigation.zoom-fit", ["<Primary>0"],
_("Adjust zoom to fit the project to the window"))
@@ -1829,16 +1829,16 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
self.ruler.zoomChanged()
self._renderingSettingsChangedCb(project, None, None)
- self.timeline.set_best_zoom_ratio()
+ self.timeline.set_best_zoom_ratio(allow_zoom_in=True)
self.timeline.update_snapping_distance()
- def _zoomInCb(self, unused_action, unused_parameter):
+ def _zoom_in_cb(self, unused_action, unused_parameter):
Zoomable.zoomIn()
- def _zoomOutCb(self, unused_action, unused_parameter):
+ def _zoom_out_cb(self, unused_action, unused_parameter):
Zoomable.zoomOut()
- def _zoomFitCb(self, unused_action, unused_parameter):
+ def _zoom_fit_cb(self, unused_action, unused_parameter):
self.app.write_action("zoom-fit", optional_action_type=True)
self.timeline.set_best_zoom_ratio(allow_zoom_in=True)
diff --git a/pitivi/utils/widgets.py b/pitivi/utils/widgets.py
index 3c16bf8..cf56bc1 100644
--- a/pitivi/utils/widgets.py
+++ b/pitivi/utils/widgets.py
@@ -1088,7 +1088,7 @@ class ZoomBox(Gtk.Grid, Zoomable):
self.timeline.timeline.scrollToPlayhead()
def _zoomFitCb(self, unused_button):
- self.timeline.timeline.set_best_zoom_ratio()
+ self.timeline.timeline.set_best_zoom_ratio(allow_zoom_in=True)
def _zoomSliderScrollCb(self, unused, event):
delta = 0
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]