aboutsummaryrefslogtreecommitdiff
path: root/voctogui
diff options
context:
space:
mode:
authorMaZderMind <git@mazdermind.de>2015-10-06 00:13:35 +0200
committerMaZderMind <git@mazdermind.de>2015-10-06 00:13:35 +0200
commitd61c31fc8904368d6fcdc7fdc6eed5db54b45bb0 (patch)
tree047d5fc4d52ef1de117c7aa930fec07b07e1129a /voctogui
parent8e58e2c810c3b1417575a9f13207558555adc582 (diff)
work around cairo context exceptions
Diffstat (limited to 'voctogui')
-rw-r--r--voctogui/lib/warningoverlay.py8
1 files changed, 7 insertions, 1 deletions
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: