Blob Blame History Raw
From 738877356b8c06ed1a8cce6a2018186b631a2b2b Mon Sep 17 00:00:00 2001
From: Gergely Polonkai <gergely@polonkai.eu>
Date: Thu, 8 Oct 2015 15:18:32 +0200
Subject: [PATCH 1/2] Get rid of PyGIWarnings

Due to missing `require_version` calls, apx threw some `PyGIWarning`s

    PyGIWarning: Gdk was imported without specifying a version first. Use gi.require_version('Gdk', '3.0') before import to ensure that the right version gets loaded.
---
 apx/lib/graphics.py | 3 +++
 bin/apx             | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/apx/lib/graphics.py b/apx/lib/graphics.py
index 6a5d0e6..94f0f5d 100644
--- a/apx/lib/graphics.py
+++ b/apx/lib/graphics.py
@@ -9,6 +9,9 @@
 import math
 import datetime as dt
 
+import gi
+gi.require_version('Gtk', '3.0')
+gi.require_version('PangoCairo', '1.0')
 
 from gi.repository import Gtk as gtk
 from gi.repository import Gdk as gdk
diff --git a/bin/apx b/bin/apx
index 4cf9277..fa13fe0 100755
--- a/bin/apx
+++ b/bin/apx
@@ -10,6 +10,8 @@ import os, sys
 
 from collections import defaultdict
 
+import gi
+gi.require_version('Gtk', '3.0')
 from gi.repository import Gtk as gtk
 from gi.repository import Gdk as gdk
 from gi.repository import GObject as gobject

From 588289bc8e71d69b66eefd8f26ee231989d3e6ce Mon Sep 17 00:00:00 2001
From: Gergely Polonkai <gergely@polonkai.eu>
Date: Thu, 8 Oct 2015 15:20:50 +0200
Subject: [PATCH 2/2] Fix Rectangle.union() call

`gdk.rectangle_union()` is invalid, `union()` is a method on `GdkRectangle`
---
 apx/lib/graphics.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/apx/lib/graphics.py b/apx/lib/graphics.py
index 94f0f5d..3613fd0 100644
--- a/apx/lib/graphics.py
+++ b/apx/lib/graphics.py
@@ -589,7 +589,7 @@ def _draw_as_bitmap(self, context, opacity):
                 exts = get_gdk_rectangle(int(exts[0]), int(exts[1]),
                                          int(exts[2]-exts[0]), int(exts[3]-exts[1]))
                 if extents.width and extents.height:
-                    extents = gdk.rectangle_union(extents, exts)
+                    extents = extents.union(exts)
                 else:
                     extents = exts
             elif instruction in ("save", "restore", "translate", "scale", "rotate"):