:right-sidebar: True TypeModule =================================================================== .. currentmodule:: gi.repository.GObject .. class:: TypeModule(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.GObject.Object` Implemented Interfaces: :class:`~gi.repository.GObject.TypePlugin` :Constructors: :: TypeModule(**properties) Methods ------- .. rst-class:: interim-class .. class:: TypeModule :no-index: .. method:: add_interface(instance_type: type, interface_type: type, interface_info: ~gi.repository.GObject.InterfaceInfo) -> None Registers an additional interface for a type, whose interface lives in the given type plugin. If the interface was already registered for the type in this plugin, nothing will be done. As long as any instances of the type exist, the type plugin will not be unloaded. Since 2.56 if ``module`` is :const:`None` this will call :func:`~gi.repository.GObject.type_add_interface_static` instead. This can be used when making a static build of the module. :param instance_type: type to which to add the interface. :param interface_type: interface type to add :param interface_info: type information structure .. method:: register_enum(name: str, const_static_values: ~gi.repository.GObject.EnumValue) -> type Looks up or registers an enumeration that is implemented with a particular type plugin. If a type with name ``type_name`` was previously registered, the :obj:`~gi.repository.GObject.Type` identifier for the type is returned, otherwise the type is newly registered, and the resulting :obj:`~gi.repository.GObject.Type` identifier returned. As long as any instances of the type exist, the type plugin will not be unloaded. Since 2.56 if ``module`` is :const:`None` this will call :func:`~gi.repository.GObject.type_register_static` instead. This can be used when making a static build of the module. .. versionadded:: 2.6 :param name: name for the type :param const_static_values: an array of :obj:`~gi.repository.GObject.EnumValue` structs for the possible enumeration values. The array is terminated by a struct with all members being 0. .. method:: register_flags(name: str, const_static_values: ~gi.repository.GObject.FlagsValue) -> type Looks up or registers a flags type that is implemented with a particular type plugin. If a type with name ``type_name`` was previously registered, the :obj:`~gi.repository.GObject.Type` identifier for the type is returned, otherwise the type is newly registered, and the resulting :obj:`~gi.repository.GObject.Type` identifier returned. As long as any instances of the type exist, the type plugin will not be unloaded. Since 2.56 if ``module`` is :const:`None` this will call :func:`~gi.repository.GObject.type_register_static` instead. This can be used when making a static build of the module. .. versionadded:: 2.6 :param name: name for the type :param const_static_values: an array of :obj:`~gi.repository.GObject.FlagsValue` structs for the possible flags values. The array is terminated by a struct with all members being 0. .. method:: register_type(parent_type: type, type_name: str, type_info: ~gi.repository.GObject.TypeInfo, flags: ~gi.repository.GObject.TypeFlags) -> type Looks up or registers a type that is implemented with a particular type plugin. If a type with name ``type_name`` was previously registered, the :obj:`~gi.repository.GObject.Type` identifier for the type is returned, otherwise the type is newly registered, and the resulting :obj:`~gi.repository.GObject.Type` identifier returned. When reregistering a type (typically because a module is unloaded then reloaded, and reinitialized), ``module`` and ``parent_type`` must be the same as they were previously. As long as any instances of the type exist, the type plugin will not be unloaded. Since 2.56 if ``module`` is :const:`None` this will call :func:`~gi.repository.GObject.type_register_static` instead. This can be used when making a static build of the module. :param parent_type: the type for the parent class :param type_name: name for the type :param type_info: type information structure :param flags: flags field providing details about the type .. method:: set_name(name: str) -> None Sets the name for a :obj:`~gi.repository.GObject.TypeModule` :param name: a human-readable name to use in error messages. .. method:: unuse() -> None Decreases the use count of a :obj:`~gi.repository.GObject.TypeModule` by one. If the result is zero, the module will be unloaded. (However, the :obj:`~gi.repository.GObject.TypeModule` will not be freed, and types associated with the :obj:`~gi.repository.GObject.TypeModule` are not unregistered. Once a :obj:`~gi.repository.GObject.TypeModule` is initialized, it must exist forever.) .. method:: use() -> bool Increases the use count of a :obj:`~gi.repository.GObject.TypeModule` by one. If the use count was zero before, the plugin will be loaded. If loading the plugin fails, the use count is reset to its prior value. Virtual Methods --------------- .. rst-class:: interim-class .. class:: TypeModule :no-index: .. method:: do_load() -> bool loads the module and registers one or more types using :func:`~gi.repository.GObject.TypeModule.register_type`. .. method:: do_unload() -> None unloads the module Fields ------ .. rst-class:: interim-class .. class:: TypeModule :no-index: .. attribute:: interface_infos .. attribute:: name The name of the module .. attribute:: parent_instance .. attribute:: type_infos .. attribute:: use_count