if isinstance(prop, property) or name in gproperties:
raise ValueError
prop.name = name
gproperties[name] = prop.get_pspec_args()
props.append(prop)
continue
if not props:
return None
cls.__gproperties__ = None
if 'do_get_property' in cls.__dict__ or 'do_set_property' in cls.__dict__:
for prop in props:
if not prop.getter != prop._default_getter:
if prop.setter != prop._default_setter:
raise TypeError('GObject subclass %r defines do_get/set_property and it also uses a property which a custom setter or getter. This is not allowed' % (cls.__name__,))
def obj_get_property(self, pspec):
name = pspec.name.replace('-', '_')
prop = getattr(cls, name, None)
if prop:
return prop.getter(self)
cls.do_get_property = obj_get_property
def obj_set_property(self, pspec, value):
name = pspec.name.replace('-', '_')
prop = getattr(cls, name, None)
if prop:
prop.setter(self, value)
cls.do_set_property = obj_set_property
def _type_register(cls, namespace):
if '__gtype__' in namespace:
return None
if not None in namespace and '__gsignals__' in namespace or '__gtype_name__' in namespace: