[pitivi] timeline: Fix opaque keyframe widget



commit d5f311034bc745a6fca57df6187362a2051a5833
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Sat Sep 11 09:57:50 2021 +0200

    timeline: Fix opaque keyframe widget
    
    Fixes #2577

 pitivi/timeline/elements.py | 13 ++++++++++---
 tests/test_medialibrary.py  |  2 +-
 2 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/pitivi/timeline/elements.py b/pitivi/timeline/elements.py
index 1d027143b..289902d8f 100644
--- a/pitivi/timeline/elements.py
+++ b/pitivi/timeline/elements.py
@@ -102,13 +102,20 @@ class KeyframeCurve(FigureCanvasGTK3Cairo, Loggable):
         FigureCanvasGTK3Cairo.__init__(self, figure)
         Loggable.__init__(self)
 
+        # Remove the "matplotlib-canvas" class which forces a white background.
+        # https://github.com/matplotlib/matplotlib/commit/3c832377fb4c4b32fcbdbc60fdfedb57296bc8c0
+        style_ctx = self.get_style_context()
+        for css_class in style_ctx.list_classes():
+            style_ctx.remove_class(css_class)
+
+        style_ctx.add_class("KeyframeCurve")
+
         self._ges_elem = ges_elem
         self._timeline = timeline
         self.__source = binding.props.control_source
         self._connect_sources()
         self.__property_name = binding.props.name
         self.__paramspec = binding.pspec
-        self.get_style_context().add_class("KeyframeCurve")
 
         self.__ylim_min, self.__ylim_max = KeyframeCurve.YLIM_OVERRIDES.get(
             binding.pspec, (0.0, 1.0))
@@ -119,8 +126,8 @@ class KeyframeCurve(FigureCanvasGTK3Cairo, Loggable):
         self._line_xs = []
         self._line_ys = []
 
-        # facecolor to None for transparency
-        self._ax: Axes = figure.add_axes([0, 0, 1, 1], facecolor='None')
+        transparent = (0, 0, 0, 0)
+        self._ax: Axes = figure.add_axes([0, 0, 1, 1], facecolor=transparent)
         # Clear the Axes object.
         self._ax.cla()
         self._ax.grid(False)
diff --git a/tests/test_medialibrary.py b/tests/test_medialibrary.py
index ed107a543..cd4d4b11a 100644
--- a/tests/test_medialibrary.py
+++ b/tests/test_medialibrary.py
@@ -110,7 +110,7 @@ class BaseTestMediaLibrary(common.TestCase):
             "notify::fraction", self._progress_bar_cb)
 
         self._create_assets(samples)
-        self.mainloop.run(timeout_seconds=15)
+        self.mainloop.run(timeout_seconds=20)
         self.assertFalse(self.medialibrary._progressbar.props.visible)
 
     def check_add_proxy(self, asset, scaled=False, w=160, h=120,


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