Amtk.Factory

g Amtk.Factory Amtk.Factory GObject.Object GObject.Object GObject.Object->Amtk.Factory

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new (application)

class

new_with_default_application ()

create_check_menu_item (action_name)

create_check_menu_item_full (action_name, flags)

create_gmenu_item (action_name)

create_gmenu_item_full (action_name, flags)

create_menu_item (action_name)

create_menu_item_full (action_name, flags)

create_menu_tool_button (action_name)

create_menu_tool_button_full (action_name, flags)

create_shortcut (action_name)

create_shortcut_full (action_name, flags)

create_simple_menu (entries)

create_simple_menu_full (entries, flags)

create_tool_button (action_name)

create_tool_button_full (action_name, flags)

get_application ()

get_default_flags ()

set_default_flags (default_flags)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

application

Gtk.Application

r/w/co

default-flags

Amtk.FactoryFlags

r/w

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GObject.Object

r

Class Details

class Amtk.Factory(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Amtk.FactoryClass

classmethod new(application)
Parameters:

application (Gtk.Application or None) – a Gtk.Application, or None.

Returns:

a new Amtk.Factory.

Return type:

Amtk.Factory

Creates a new Amtk.Factory object. Associating a Gtk.Application is optional, if it is None Gtk.Application.set_accels_for_action() won’t be called.

New in version 3.0.

classmethod new_with_default_application()
Returns:

a new Amtk.Factory with the default Gtk.Application.

Return type:

Amtk.Factory

Calls Amtk.Factory.new() with Gio.Application.get_default() (it must be a Gtk.Application).

New in version 3.0.

create_check_menu_item(action_name)
Parameters:

action_name (str) – an action name.

Returns:

a new Gtk.CheckMenuItem for action_name.

Return type:

Gtk.Widget

Creates a new Gtk.CheckMenuItem for action_name with the Amtk.Factory :default-flags.

See the documentation of Amtk.Factory.create_check_menu_item_full() for more information.

New in version 3.0.

create_check_menu_item_full(action_name, flags)
Parameters:
Returns:

a new Gtk.CheckMenuItem for action_name.

Return type:

Gtk.Widget

This function ignores the Amtk.Factory :default-flags property and takes the flags argument instead.

Note that since it is a Gtk.CheckMenuItem the icon is not set, even if it would be possible with Amtk.menu_item_set_icon_name().

If the action controls a boolean property, think about using Gio.PropertyAction.

New in version 3.0.

create_gmenu_item(action_name)
Parameters:

action_name (str) – an action name.

Returns:

a new Gio.MenuItem for action_name.

Return type:

Gio.MenuItem

Calls Amtk.Factory.create_gmenu_item_full() with the Amtk.Factory :default-flags.

New in version 5.0.

create_gmenu_item_full(action_name, flags)
Parameters:
Returns:

a new Gio.MenuItem for action_name.

Return type:

Gio.MenuItem

This function ignores the Amtk.Factory :default-flags property and takes the flags argument instead.

Creates a new Gio.MenuItem for action_name. It ignores the tooltip, i.e. the return value of Amtk.ActionInfo.get_tooltip().

New in version 5.0.

create_menu_item(action_name)
Parameters:

action_name (str) – an action name.

Returns:

a new Gtk.MenuItem for action_name.

Return type:

Gtk.Widget

Creates a new Gtk.MenuItem for action_name with the Amtk.Factory :default-flags.

New in version 3.0.

create_menu_item_full(action_name, flags)
Parameters:
Returns:

a new Gtk.MenuItem for action_name.

Return type:

Gtk.Widget

This function ignores the Amtk.Factory :default-flags property and takes the flags argument instead.

New in version 3.0.

create_menu_tool_button(action_name)
Parameters:

action_name (str) – an action name.

Returns:

a new Gtk.MenuToolButton for action_name.

Return type:

Gtk.MenuToolButton

Creates a new Gtk.MenuToolButton for action_name with the Amtk.Factory :default-flags.

See the documentation of Amtk.Factory.create_menu_tool_button_full() for more information.

New in version 3.0.

create_menu_tool_button_full(action_name, flags)
Parameters:
Returns:

a new Gtk.MenuToolButton for action_name.

Return type:

Gtk.MenuToolButton

This function ignores the Amtk.Factory :default-flags property and takes the flags argument instead.

After calling this function, you need to use the Gtk.MenuToolButton API to set the menu and also possibly set a tooltip to the arrow.

New in version 3.0.

create_shortcut(action_name)
Parameters:

action_name (str) – an action name.

Returns:

a new Gtk.ShortcutsShortcut for action_name.

Return type:

Gtk.Widget

Calls Amtk.Factory.create_shortcut_full() with the Amtk.Factory :default-flags.

New in version 5.0.

create_shortcut_full(action_name, flags)
Parameters:
Returns:

a new Gtk.ShortcutsShortcut for action_name.

Return type:

Gtk.Widget

This function ignores the Amtk.Factory :default-flags property and takes the flags argument instead.

This function creates a new Gtk.ShortcutsShortcut for action_name.

For the Gtk.ShortcutsShortcut :title, the tooltip has the priorioty, with the label as fallback if the tooltip is None (the mnemonic is removed from the label with Amtk.utils_remove_mnemonic()). This can be controlled with the Amtk.FactoryFlags.IGNORE_TOOLTIP and Amtk.FactoryFlags.IGNORE_LABEL flags.

The Gtk.ShortcutsShortcut :accelerator property is set with only the *first* accel returned by Amtk.ActionInfo.get_accels(). This step can be ignored with Amtk.FactoryFlags.IGNORE_ACCELS or Amtk.FactoryFlags.IGNORE_ACCELS_FOR_DOC.

The Gtk.ShortcutsShortcut :action-name property is set to action_name if the Amtk.FactoryFlags.IGNORE_GACTION flag isn’t set. Note that with Gtk.ShortcutsShortcut :action-name all accelerators are displayed (if set to the Gtk.Application).

So depending on whether you want to show only the first accelerator or all accelerators, you need to set flags appropriately.

New in version 5.0.

create_simple_menu(entries)
Parameters:

entries ([Amtk.ActionInfoEntry]) – a pointer to the first item in an array of Amtk.ActionInfoEntry structs.

Returns:

a new simple Gtk.Menu for entries.

Return type:

Gtk.Widget

Calls Amtk.Factory.create_simple_menu_full() with the Amtk.Factory :default-flags.

New in version 5.0.

create_simple_menu_full(entries, flags)
Parameters:
Returns:

a new simple Gtk.Menu for entries.

Return type:

Gtk.Widget

This function ignores the Amtk.Factory :default-flags property and takes the flags argument instead.

This function:

So this function is useful only if the Gtk.Menu contains only simple Gtk.MenuItem's, not Gtk.CheckMenuItem's nor Gtk.RadioMenuItem's.

New in version 5.0.

create_tool_button(action_name)
Parameters:

action_name (str) – an action name.

Returns:

a new Gtk.ToolButton for action_name.

Return type:

Gtk.ToolItem

Creates a new Gtk.ToolButton for action_name with the Amtk.Factory :default-flags.

New in version 3.0.

create_tool_button_full(action_name, flags)
Parameters:
Returns:

a new Gtk.ToolButton for action_name.

Return type:

Gtk.ToolItem

This function ignores the Amtk.Factory :default-flags property and takes the flags argument instead.

New in version 3.0.

get_application()
Returns:

the Amtk.Factory :application.

Return type:

Gtk.Application or None

New in version 3.0.

get_default_flags()
Returns:

the Amtk.Factory :default-flags.

Return type:

Amtk.FactoryFlags

New in version 3.0.

set_default_flags(default_flags)
Parameters:

default_flags (Amtk.FactoryFlags) – the new value.

Sets the Amtk.Factory :default-flags property.

New in version 3.0.

Property Details

Amtk.Factory.props.application
Name:

application

Type:

Gtk.Application

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The associated Gtk.Application (it is optional, it can be None). Amtk.Factory has a weak reference to the Gtk.Application.

New in version 3.0.

Amtk.Factory.props.default_flags
Name:

default-flags

Type:

Amtk.FactoryFlags

Default Value:

Amtk.FactoryFlags.FLAGS_NONE

Flags:

READABLE, WRITABLE

The default Amtk.FactoryFlags.

New in version 3.0.