Gladeui.WidgetAdaptor

g GObject.Object GObject.Object Gladeui.WidgetAdaptor Gladeui.WidgetAdaptor GObject.Object->Gladeui.WidgetAdaptor

Subclasses:None

Methods

Inherited:GObject.Object (37)
Structs:GObject.ObjectClass (5)
class from_catalog (catalog, class_node, module)
class get_by_name (name)
class get_by_type (type)
class list_adaptors ()
  action_activate (object, action_path)
  action_add (action_path, label, stock, important)
  action_remove (action_path)
  action_submenu (object, action_path)
  actions_new ()
  add (container, child)
  add_verify (container, child, user_feedback)
  child_action_activate (container, object, action_path)
  child_get_property (container, child, property_name, value)
  child_set_property (container, child, property_name, value)
  child_verify_property (container, child, property_name, value)
  construct_object (n_parameters, parameters)
  create_editable (type)
  create_eprop (def_, use_command)
  create_eprop_by_name (property_id, packing, use_command)
  default_params (construct)
  depends (widget, another)
  destroy_object (object)
  from_pspec (pspec)
  get_book ()
  get_catalog ()
  get_children (container)
  get_display_name ()
  get_generic_name ()
  get_icon_name ()
  get_internal_child (object, internal_name)
  get_missing_icon ()
  get_name ()
  get_object_type ()
  get_pack_property_def (name)
  get_packing_default (container_adaptor, id)
  get_packing_props ()
  get_parent_adaptor ()
  get_properties ()
  get_property (object, property_name, value)
  get_property_def (name)
  get_signal_def (name)
  get_signals ()
  get_title ()
  get_type_func ()
  has_child (container, child)
  has_internal_children ()
  is_container ()
  pack_action_add (action_path, label, stock, important)
  pack_action_remove (action_path)
  pack_actions_new ()
  post_create (object, reason)
  query ()
  read_child (widget, node)
  read_widget (widget, node)
  register ()
  remove (container, child)
  replace_child (container, old_obj, new_obj)
  set_property (object, property_name, value)
  string_from_value (def_, value)
  verify_property (object, property_name, value)
  write_child (widget, context, node)
  write_widget (widget, context, node)
  write_widget_after (widget, context, node)

Virtual Methods

Inherited:GObject.Object (7)
  do_action_activate (object, action_path)
  do_action_submenu (object, action_path)
  do_add (container, child)
  do_add_verify (container, child, user_feedback)
  do_child_action_activate (container, object, action_path)
  do_child_get_property (container, child, property_name, value)
  do_child_set_property (container, child, property_name, value)
  do_child_verify_property (container, child, property_name, value)
  do_construct_object (n_parameters, parameters)
  do_create_editable (type)
  do_create_eprop (def_, use_command)
  do_deep_post_create (object, reason)
  do_depends (widget, another)
  do_destroy_object (object)
  do_get_children (container)
  do_get_internal_child (object, internal_name)
  do_get_property (object, property_name, value)
  do_post_create (object, reason)
  do_read_child (widget, node)
  do_read_widget (widget, node)
  do_remove (container, child)
  do_replace_child (container, old_obj, new_obj)
  do_set_property (object, property_name, value)
  do_string_from_value (def_, value)
  do_verify_property (object, property_name, value)
  do_write_child (widget, context, node)
  do_write_widget (widget, context, node)
  do_write_widget_after (widget, context, node)

Properties

Name Type Flags Short Description
book str r/w/co DevHelp search namespace for this widget class
catalog str r/w/co The name of the widget catalog this class was declared by
cursor int r A cursor for inserting widgets in the UI
generic-name str r/w/co Used to generate names of new widgets
icon-name str r/w/co The icon name
name str r/w/co Name of the class
query bool r/w Whether the adaptor should query the use or not
special-child-type str r/w/co Holds the name of the packing property to depict special children for this container class
title str r/w Translated title for the class used in the glade UI
type GObject.GType r/w/co GObject.GType of the class

Signals

Inherited:GObject.Object (1)

Fields

Inherited:GObject.Object (1)
Name Type Access Description
parent_instance GObject.Object r  

Class Details

class Gladeui.WidgetAdaptor(**kwargs)
Bases:GObject.Object
Abstract:No
Structure:Gladeui.WidgetAdaptorClass
classmethod from_catalog(catalog, class_node, module)
Parameters:
Returns:

a newly allocated Gladeui.WidgetAdaptor

Return type:

Gladeui.WidgetAdaptor

Dynamically creates a subclass of Gladeui.WidgetAdaptor and subclasses the closest parent adaptor (parent class adapters must be created/registered prior to child classes, otherwise inheritance wont work) and parses in the relevant catalog info.

classmethod get_by_name(name)
Parameters:name (str) – name of the widget class (for instance: Gtk.Button)
Returns:an existing Gladeui.WidgetAdaptor with the name equaling name, or None if such a class doesn’t exist
Return type:Gladeui.WidgetAdaptor or None
classmethod get_by_type(type)
Parameters:type (GObject.GType) – the GObject.GType of an object class
Returns:an existing Gladeui.WidgetAdaptor with the type equaling type, or None if such a class doesn’t exist
Return type:Gladeui.WidgetAdaptor or None
classmethod list_adaptors()
Returns:A newly allocated GLib.List which must be freed with g_list_free()
Return type:[Gladeui.WidgetAdaptor]

Compiles a list of all registered adaptors.

action_activate(object, action_path)
Parameters:

An adaptor function to be called on widget actions.

action_add(action_path, label, stock, important)
Parameters:
  • action_path (str) – The identifier of this action in the action tree
  • label (str) – A translated label to show in the UI for this action
  • stock (str) – If set, this stock item will be shown in the UI along side the label.
  • important (bool) – if this action is important.
Returns:

whether or not the action was added/updated.

Return type:

bool

Add an action to self. If the action is present then it overrides label and stock

action_remove(action_path)
Parameters:action_path (str) – The identifier of this action in the action tree
Returns:whether or not the action was removed.
Return type:bool

Remove an self’s action.

action_submenu(object, action_path)
Parameters:
Returns:

A newly created Gtk.Menu or None

Return type:

Gtk.Widget or None

This delegate function is used to create dynamically customized submenus. Called only for actions that don’t have children.

actions_new()
Returns:a new list of Gladeui.WidgetAction.
Return type:[Gladeui.WidgetAction]

Create a list of actions.

add(container, child)
Parameters:

Adds child to container.

add_verify(container, child, user_feedback)
Parameters:
Returns:

whether child can be added to parent.

Return type:

bool

Checks whether child can be added to parent.

If user_feedback is True and child cannot be added then this shows a notification dialog to the user explaining why.

child_action_activate(container, object, action_path)
Parameters:

An adaptor function to be called on widget actions.

child_get_property(container, child, property_name, value)
Parameters:

Gets child’s packing property identified by property_name.

child_set_property(container, child, property_name, value)
Parameters:

Sets child’s packing property identified by property_name to value.

child_verify_property(container, child, property_name, value)
Parameters:
Returns:

whether or not its OK to set value on object, this function will silently return True if the class did not provide a verify function.

Return type:

bool

This delegate function is always called whenever setting any properties with the exception of load time, and copy/paste time (basically the two places where we recreate a hierarchy that we already know “works”) its basically an optional backend provided boundary checker for properties.

construct_object(n_parameters, parameters)
Parameters:
Returns:

A newly created GObject.Object

Return type:

GObject.Object

This function is called to construct a GObject.Object instance for a Gladeui.Widget of the said self. (provided for language bindings that may need to construct a wrapper object).

create_editable(type)
Parameters:type (Gladeui.EditorPageType) – The Gladeui.EditorPageType
Returns:A new Gladeui.Editable widget
Return type:Gladeui.Editable

This is used to allow the backend to override the way an editor page is layed out (note that editor widgets are created on demand and not at startup).

create_eprop(def_, use_command)
Parameters:
Returns:

A newly created Gladeui.EditorProperty

Return type:

Gladeui.EditorProperty

Creates a Gladeui.EditorProperty to edit def

create_eprop_by_name(property_id, packing, use_command)
Parameters:
  • property_id (str) – the string if of the corresponding Gladeui.PropertyDef to be edited
  • packing (bool) – whether this refers to a packing property
  • use_command (bool) – whether to use the Gladeui.Command interface to commit property changes
Returns:

A newly created Gladeui.EditorProperty

Return type:

Gladeui.EditorProperty

Creates a Gladeui.EditorProperty to edit Gladeui.PropertyDef name in self

default_params(construct)
Parameters:construct (bool) – whether to return construct params or not construct params
Returns:A list of params for use in GObject.Object.newv ()
Return type:[GObject.Parameter]
depends(widget, another)
Parameters:
Returns:

whether widget depends on another being parsed first in the resulting glade file.

Return type:

bool

Checks whether widget depends on another to be placed earlier in the glade file.

Deprecated since version 3.18.

destroy_object(object)
Parameters:object (GObject.Object) – The object to destroy

This function is called to destroy a GObject.Object instance.

from_pspec(pspec)
Parameters:pspec (GObject.ParamSpec) – a GObject.ParamSpec
Returns:the closest Gladeui.WidgetAdaptor in the ancestry to self which is responsable for introducing pspec.
Return type:Gladeui.WidgetAdaptor

Assumes pspec is a property in an object class wrapped by self, this function will search for the specific parent adaptor class which originally introduced pspec.

get_book()
Return type:str
get_catalog()
Return type:str
get_children(container)
Parameters:container (GObject.Object) – The GObject.Object container
Returns:A GLib.List of children
Return type:[GObject.Object]

Lists the children of container.

get_display_name()
Returns:the name of the adaptor without Gladeui.WIDGET_ADAPTOR_INSTANTIABLE_PREFIX
Return type:str
get_generic_name()
Return type:str
get_icon_name()
Return type:str
get_internal_child(object, internal_name)
Parameters:
Returns:

The internal GObject.Object

Return type:

GObject.Object or None

Retrieves the internal object internal_name from object

get_missing_icon()
Return type:str
get_name()
Return type:str
get_object_type()
Return type:GObject.GType
get_pack_property_def(name)
Parameters:name (str) – a string
Returns:A Gladeui.PropertyDef object
Return type:Gladeui.PropertyDef or None

Retrieves the Gladeui.PropertyDef for name in self’s child properties

get_packing_default(container_adaptor, id)
Parameters:
Returns:

a string representing the default value for property_id

Return type:

str

Gets the default value for property_id on a widget governed by self when parented in a widget governed by parent_adaptor

get_packing_props()
Returns:a list of Gladeui.PropertyDef
Return type:[Gladeui.PropertyDef]
get_parent_adaptor()
Returns:the parent Gladeui.WidgetAdaptor according to self type
Return type:Gladeui.WidgetAdaptor
get_properties()
Returns:a list of Gladeui.PropertyDef
Return type:[Gladeui.PropertyDef]
get_property(object, property_name, value)
Parameters:

Gets value of property_name on object.

get_property_def(name)
Parameters:name (str) – a string
Returns:A Gladeui.PropertyDef object
Return type:Gladeui.PropertyDef or None

Retrieves the Gladeui.PropertyDef for name in self

get_signal_def(name)
Parameters:name (str) – the name of the signal class.
Returns:a Gladeui.SignalDef or None
Return type:Gladeui.SignalDef or None

Looks up signal class name on self.

get_signals()
Returns:a list of Gladeui.SignalDef
Return type:[Gladeui.SignalDef]
get_title()
Return type:str
get_type_func()
Returns:The _get_type () function name or None if none is set
Return type:str or None

Get the _get_type () function name if it is set, a None value means that the default heuristic for getting the GObject.GType is enough for both Glade and Gtk.Builder.

has_child(container, child)
Parameters:
Returns:

whether child is infact inside container.

Return type:

bool

has_internal_children()
Return type:bool
is_container()
Returns:whether or not self is a container
Return type:bool

Checks whether or not this adaptor has support to interface with child objects.

pack_action_add(action_path, label, stock, important)
Parameters:
  • action_path (str) – The identifier of this action in the action tree
  • label (str) – A translated label to show in the UI for this action
  • stock (str) – If set, this stock item will be shown in the UI along side the label.
  • important (bool) – if this action is important.
Returns:

whether or not the action was added/updated.

Return type:

bool

Add a packing action to self. If the action is present then it overrides label and stock

pack_action_remove(action_path)
Parameters:action_path (str) – The identifier of this action in the action tree
Returns:whether or not the action was removed.
Return type:bool

Remove an self’s packing action.

pack_actions_new()
Returns:a new list of Gladeui.WidgetAction.
Return type:[Gladeui.WidgetAction]

Create a list of packing actions.

post_create(object, reason)
Parameters:

An adaptor function to be called after the object is created

query()
Returns:whether the user needs to be queried for certain properties upon creation of this class.
Return type:bool
read_child(widget, node)
Parameters:

This function is called to update load a child widget from node when loading xml files (will recurse into Gladeui.Widget.read())

read_widget(widget, node)
Parameters:

This function is called to update widget from node when loading xml files.

register()

Registers self into the Glade core (every supported object type must have a registered adaptor).

remove(container, child)
Parameters:

Removes child from container.

replace_child(container, old_obj, new_obj)
Parameters:

Replaces old_obj with new_obj in container while positioning new_obj where old_obj was and assigning it appropriate packing property values.

set_property(object, property_name, value)
Parameters:

This delegate function is used to apply the property value on the runtime object.

string_from_value(def_, value)
Parameters:
Returns:

A newly allocated string representation of value

Return type:

str

For normal properties this is used to serialize property values, for custom properties its still needed to update the UI for undo/redo items etc.

verify_property(object, property_name, value)
Parameters:
Returns:

whether or not its OK to set value on object, this function will silently return True if the class did not provide a verify function.

Return type:

bool

This delegate function is always called whenever setting any properties with the exception of load time, and copy/paste time (basically the two places where we recreate a hierarchy that we already know “works”) its basically an optional backend provided boundary checker for properties.

write_child(widget, context, node)
Parameters:

This function is called to write the child widget to node when writing xml files (takes care of packing and recurses into Gladeui.Widget.write())

write_widget(widget, context, node)
Parameters:

This function is called to write widget to node when writing xml files.

write_widget_after(widget, context, node)
Parameters:

This function is called to write widget to node when writing xml files (after writing children)

do_action_activate(object, action_path) virtual
Parameters:

An adaptor function to be called on widget actions.

do_action_submenu(object, action_path) virtual
Parameters:
Returns:

A newly created Gtk.Menu or None

Return type:

Gtk.Widget or None

This delegate function is used to create dynamically customized submenus. Called only for actions that don’t have children.

do_add(container, child) virtual
Parameters:

Adds child to container.

do_add_verify(container, child, user_feedback) virtual
Parameters:
Returns:

whether child can be added to parent.

Return type:

bool

Checks whether child can be added to parent.

If user_feedback is True and child cannot be added then this shows a notification dialog to the user explaining why.

do_child_action_activate(container, object, action_path) virtual
Parameters:

An adaptor function to be called on widget actions.

do_child_get_property(container, child, property_name, value) virtual
Parameters:

Gets child’s packing property identified by property_name.

do_child_set_property(container, child, property_name, value) virtual
Parameters:

Sets child’s packing property identified by property_name to value.

do_child_verify_property(container, child, property_name, value) virtual
Parameters:
Returns:

whether or not its OK to set value on object, this function will silently return True if the class did not provide a verify function.

Return type:

bool

This delegate function is always called whenever setting any properties with the exception of load time, and copy/paste time (basically the two places where we recreate a hierarchy that we already know “works”) its basically an optional backend provided boundary checker for properties.

do_construct_object(n_parameters, parameters) virtual
Parameters:
Returns:

A newly created GObject.Object

Return type:

GObject.Object

This function is called to construct a GObject.Object instance for a Gladeui.Widget of the said adaptor. (provided for language bindings that may need to construct a wrapper object).

do_create_editable(type) virtual
Parameters:type (Gladeui.EditorPageType) – The Gladeui.EditorPageType
Returns:A new Gladeui.Editable widget
Return type:Gladeui.Editable

This is used to allow the backend to override the way an editor page is layed out (note that editor widgets are created on demand and not at startup).

do_create_eprop(def_, use_command) virtual
Parameters:
Returns:

A newly created Gladeui.EditorProperty

Return type:

Gladeui.EditorProperty

Creates a Gladeui.EditorProperty to edit def

do_deep_post_create(object, reason) virtual
Parameters:
do_depends(widget, another) virtual
Parameters:
Returns:

whether widget depends on another being parsed first in the resulting glade file.

Return type:

bool

Checks whether widget depends on another to be placed earlier in the glade file.

Deprecated since version 3.18.

do_destroy_object(object) virtual
Parameters:object (GObject.Object) – The object to destroy

This function is called to destroy a GObject.Object instance.

do_get_children(container) virtual
Parameters:container (GObject.Object) – The GObject.Object container
Returns:A GLib.List of children
Return type:[GObject.Object]

Lists the children of container.

do_get_internal_child(object, internal_name) virtual
Parameters:
Returns:

The internal GObject.Object

Return type:

GObject.Object or None

Retrieves the internal object internal_name from object

do_get_property(object, property_name, value) virtual
Parameters:

Gets value of property_name on object.

do_post_create(object, reason) virtual
Parameters:

An adaptor function to be called after the object is created

do_read_child(widget, node) virtual
Parameters:

This function is called to update load a child widget from node when loading xml files (will recurse into Gladeui.Widget.read())

do_read_widget(widget, node) virtual
Parameters:

This function is called to update widget from node when loading xml files.

do_remove(container, child) virtual
Parameters:

Removes child from container.

do_replace_child(container, old_obj, new_obj) virtual
Parameters:

Replaces old_obj with new_obj in container while positioning new_obj where old_obj was and assigning it appropriate packing property values.

do_set_property(object, property_name, value) virtual
Parameters:

This delegate function is used to apply the property value on the runtime object.

do_string_from_value(def_, value) virtual
Parameters:
Returns:

A newly allocated string representation of value

Return type:

str

For normal properties this is used to serialize property values, for custom properties its still needed to update the UI for undo/redo items etc.

do_verify_property(object, property_name, value) virtual
Parameters:
Returns:

whether or not its OK to set value on object, this function will silently return True if the class did not provide a verify function.

Return type:

bool

This delegate function is always called whenever setting any properties with the exception of load time, and copy/paste time (basically the two places where we recreate a hierarchy that we already know “works”) its basically an optional backend provided boundary checker for properties.

do_write_child(widget, context, node) virtual
Parameters:

This function is called to write the child widget to node when writing xml files (takes care of packing and recurses into Gladeui.Widget.write())

do_write_widget(widget, context, node) virtual
Parameters:

This function is called to write widget to node when writing xml files.

do_write_widget_after(widget, context, node) virtual
Parameters:

This function is called to write widget to node when writing xml files (after writing children)

Property Details

Gladeui.WidgetAdaptor.props.book
Name:book
Type:str
Default Value:None
Flags:READABLE, WRITABLE, CONSTRUCT_ONLY

DevHelp search namespace for this widget class

Gladeui.WidgetAdaptor.props.catalog
Name:catalog
Type:str
Default Value:None
Flags:READABLE, WRITABLE, CONSTRUCT_ONLY

The name of the widget catalog this class was declared by

Gladeui.WidgetAdaptor.props.cursor
Name:cursor
Type:int
Default Value:None
Flags:READABLE

A cursor for inserting widgets in the UI

Gladeui.WidgetAdaptor.props.generic_name
Name:generic-name
Type:str
Default Value:None
Flags:READABLE, WRITABLE, CONSTRUCT_ONLY

Used to generate names of new widgets

Gladeui.WidgetAdaptor.props.icon_name
Name:icon-name
Type:str
Default Value:'widget-gtk-frame'
Flags:READABLE, WRITABLE, CONSTRUCT_ONLY

The icon name

Gladeui.WidgetAdaptor.props.name
Name:name
Type:str
Default Value:None
Flags:READABLE, WRITABLE, CONSTRUCT_ONLY

Name of the class

Gladeui.WidgetAdaptor.props.query
Name:query
Type:bool
Default Value:False
Flags:READABLE, WRITABLE

Whether the adaptor should query the use or not

Gladeui.WidgetAdaptor.props.special_child_type
Name:special-child-type
Type:str
Default Value:None
Flags:READABLE, WRITABLE, CONSTRUCT_ONLY

Holds the name of the packing property to depict special children for this container class

Gladeui.WidgetAdaptor.props.title
Name:title
Type:str
Default Value:None
Flags:READABLE, WRITABLE

Translated title for the class used in the glade UI

Gladeui.WidgetAdaptor.props.type
Name:type
Type:GObject.GType
Default Value:<GType void>
Flags:READABLE, WRITABLE, CONSTRUCT_ONLY

GObject.GType of the class