Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/util/gtkcompat.py
diff options
context:
space:
mode:
Diffstat (limited to 'util/gtkcompat.py')
-rw-r--r--util/gtkcompat.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/util/gtkcompat.py b/util/gtkcompat.py
index fea0b6f..b55091a 100644
--- a/util/gtkcompat.py
+++ b/util/gtkcompat.py
@@ -138,3 +138,19 @@ except ValueError, ImportError:
def new_with_label(label):
return GtkMenuItem1(label)
Gtk.MenuItem = GtkMenuItem2
+
+ class PangoLayout2(Pango.Layout):
+ @staticmethod
+ def new(cr):
+ # call cr.create_layout(), but wrap the result so we can override
+ # set_text() below
+ return PangoLayout2(cr.create_layout().get_context())
+ def set_text(self, text, val):
+ if val != -1: text = text[:val]
+ super(PangoLayout2, self).set_text(text)
+
+ Pango.Layout = PangoLayout2
+
+ PangoCairo.create_context = lambda x: PangoCairo.CairoContext(x)
+ PangoCairo.update_layout = lambda cr, pl: cr.update_layout(pl)
+ PangoCairo.show_layout = lambda cr, pl: cr.show_layout(pl)