xpra icon
Bug tracker and wiki

Ticket #907: gobject_subclassing2.py

File gobject_subclassing2.py, 1.4 KB (added by Antoine Martin, 4 years ago)

another example triggering the centos 7 warning

Line 
1# This file is part of Xpra.
2# Copyright (C) 2015 Antoine Martin <antoine@devloop.org.uk>
3# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
4# later version. See the file COPYING for details.
5
6import gobject
7
8
9class BaseClass(gobject.GObject):
10    __gproperties__ = {
11        "foo": (gobject.TYPE_PYOBJECT,
12                "Foo thing", "",
13                gobject.PARAM_READABLE),
14           }
15    __gsignals__ = {
16        "bar"             : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (), ),
17        }
18
19    def __init__(self):
20        gobject.GObject.__init__(self)
21gobject.type_register(BaseClass)
22
23
24class ActualClass(BaseClass):
25    __gproperties__ = {
26        "foo2": (gobject.TYPE_PYOBJECT,
27                  "Foo2 thing", "",
28                  gobject.PARAM_READABLE),
29                            }
30    __gsignals__ = {
31        "bar2"           : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (), ),
32        }
33gobject.type_register(ActualClass)
34
35
36class OtherClass(BaseClass):
37    __gproperties__ = {
38        "foo3": (gobject.TYPE_PYOBJECT,
39                  "Foo3 thing", "",
40                  gobject.PARAM_READABLE),
41                            }
42    __gsignals__ = {
43        "bar3"           : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (), ),
44        }
45gobject.type_register(OtherClass)
46
47
48def main():
49    a = ActualClass()
50    b = OtherClass()
51    assert b!=a
52
53
54if __name__ == "__main__":
55    main()