Imported Upstream version 3.13.1
[platform/upstream/pygobject2.git] / gi / overrides / Pango.py
1 # -*- Mode: Python; py-indent-offset: 4 -*-
2 # vim: tabstop=4 shiftwidth=4 expandtab
3 #
4 # Copyright (C) 2010 Paolo Borelli <pborelli@gnome.org>
5 #
6 # This library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Lesser General Public
8 # License as published by the Free Software Foundation; either
9 # version 2.1 of the License, or (at your option) any later version.
10 #
11 # This library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 # Lesser General Public License for more details.
15 #
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with this library; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
19 # USA
20
21 from ..overrides import override
22 from ..module import get_introspection_module
23
24 Pango = get_introspection_module('Pango')
25
26 __all__ = []
27
28
29 class FontDescription(Pango.FontDescription):
30
31     def __new__(cls, string=None):
32         if string is not None:
33             return Pango.font_description_from_string(string)
34         else:
35             return Pango.FontDescription.__new__(cls)
36
37     def __init__(self, *args, **kwargs):
38         return super(FontDescription, self).__init__()
39
40 FontDescription = override(FontDescription)
41 __all__.append('FontDescription')
42
43
44 class Layout(Pango.Layout):
45
46     def __new__(cls, context):
47         return Pango.Layout.new(context)
48
49     def set_markup(self, text, length=-1):
50         super(Layout, self).set_markup(text, length)
51
52 Layout = override(Layout)
53 __all__.append('Layout')