[pitivi] elements: Fix backtrace when showing tooltip
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] elements: Fix backtrace when showing tooltip
- Date: Thu, 24 Mar 2016 14:40:04 +0000 (UTC)
commit 673910407a20fb4be925095c06033efd091c34e5
Author: Alexandru Băluț <alexandru balut gmail com>
Date: Sun Mar 13 09:17:52 2016 +0100
elements: Fix backtrace when showing tooltip
When hovering the line at the very left, the assert res fails in edge
cases. You could also blame double numbers.
This can be easily avoided by making sure the x is in range.
Reviewed-by: Mathieu Duponchelle <mathieu duponchelle epitech eu>
Differential Revision: https://phabricator.freedesktop.org/D827
pitivi/timeline/elements.py | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/pitivi/timeline/elements.py b/pitivi/timeline/elements.py
index 85e8c94..079dbe4 100644
--- a/pitivi/timeline/elements.py
+++ b/pitivi/timeline/elements.py
@@ -329,14 +329,15 @@ class KeyframeCurve(FigureCanvas, Loggable):
def __setTooltip(self, event):
if event.xdata:
- res, value = self.__source.control_source_get_value(event.xdata)
+ xdata = max(self.__line_xs[0], min(event.xdata, self.__line_xs[-1]))
+ res, value = self.__source.control_source_get_value(xdata)
assert res
pmin = self.__paramspec.minimum
pmax = self.__paramspec.maximum
value = value * (pmax - pmin) + pmin
self.set_tooltip_markup(_("Property: %s\nTimestamp: %s\nValue: %s")
% (self.__propertyName,
- Gst.TIME_ARGS(event.xdata),
+ Gst.TIME_ARGS(xdata),
"{:.3f}".format(value)))
def __resetTooltip(self):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]