Setting the pango.Language for a widget



Hallo list

I'm struggling to set the language for the pango context of a text view.
Things work well when I'm working with pango layouts

text_view.modify_font works as advertised, but I'm trying
text_view.get_pango_context().set_language(...), with no effect. The
widgets are inheriting correctly from their parents, but I want to set
different languages for widgets in my container.

I attach a minimal Python test case. Any help will be appreciated.

Friedel

--
Recently on my blog:
http://translate.org.za/blogs/friedel/en/content/vrot-mango
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import pygtk
pygtk.require('2.0')
import gtk
import pango

class Languages:

    def destroy(self, widget, data=None):
        gtk.main_quit()

    def __init__(self):
        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        self.window.connect("destroy", self.destroy)
        vbox = gtk.VBox(True, 0)
        self.window.add(vbox)

        ru = gtk.TextView()
        ru.get_buffer().set_text("ббббб")
        ru.get_pango_context().set_language(pango.Language("ru"))
        mk = gtk.TextView()
        mk.get_buffer().set_text("ббббб")
        ru.get_pango_context().set_language(pango.Language("mk"))

        vbox.add(ru)
        vbox.add(mk)
        self.window.show_all()

    def main(self):
        gtk.main()

if __name__ == "__main__":
    hello = Languages()
    hello.main()


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