From d61c31fc8904368d6fcdc7fdc6eed5db54b45bb0 Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Tue, 6 Oct 2015 00:13:35 +0200 Subject: work around cairo context exceptions --- voctogui/lib/warningoverlay.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'voctogui') diff --git a/voctogui/lib/warningoverlay.py b/voctogui/lib/warningoverlay.py index 6df932e..3cbe13c 100644 --- a/voctogui/lib/warningoverlay.py +++ b/voctogui/lib/warningoverlay.py @@ -1,5 +1,5 @@ import logging -from gi.repository import GLib, Gst +from gi.repository import GLib, Gst, cairo from lib.config import Config @@ -46,6 +46,12 @@ class VideoWarningOverlay(object): w = self.width h = self.height / 20 + # during startup, cr is sometimes another kind of context, + # which does not expose set_source_rgba and other methods. + # this check avoids the exceptions that would be thrown then. + if isinstance(cr, cairo.Context): + return + if self.blink_state: cr.set_source_rgba(1.0, 0.0, 0.0, 0.8) else: -- cgit v1.2.3