[pitivi] elements: Fix Matplotlib warning



commit b3ac86b2bd6b0ff17e0a29e04b1c914d04af2f66
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Mon Jan 4 17:13:44 2016 +0100

    elements: Fix Matplotlib warning
    
    "UserWarning: Attempting to set identical left==right results" appears
    when calling set_xlim with equal parameters.
    
    Differential Revision: https://phabricator.freedesktop.org/D620

 pitivi/timeline/elements.py |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/pitivi/timeline/elements.py b/pitivi/timeline/elements.py
index aff8b3b..ab20bea 100644
--- a/pitivi/timeline/elements.py
+++ b/pitivi/timeline/elements.py
@@ -180,6 +180,9 @@ class KeyframeCurve(FigureCanvas, Loggable):
 
     def __updatePlots(self):
         values = self.__source.get_all()
+        if len(values) < 2:
+            # No plot for less than two points.
+            return
 
         self.__line_xs = []
         self.__line_ys = []
@@ -206,10 +209,10 @@ class KeyframeCurve(FigureCanvas, Loggable):
             self.__source.set(event.xdata, value)
 
     # Callbacks
-    def __controlSourceChangedCb(self, unused_control_source, timed_value):
+    def __controlSourceChangedCb(self, unused_control_source, unused_timed_value):
         self.__updatePlots()
 
-    def __gtkMotionEventCb(self, widget, event):
+    def __gtkMotionEventCb(self, unused_widget, unused_event):
         """
         We need to do that here, because mpl's callbacks can't stop
         signal propagation.
@@ -218,7 +221,7 @@ class KeyframeCurve(FigureCanvas, Loggable):
             return True
         return False
 
-    def _eventCb(self, element, event):
+    def _eventCb(self, unused_element, event):
         if event.type == Gdk.EventType.LEAVE_NOTIFY:
             cursor = NORMAL_CURSOR
             self.__timeline.get_window().set_cursor(cursor)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]