Dbusmenu.Client

g Dbusmenu.Client Dbusmenu.Client GObject.Object GObject.Object GObject.Object->Dbusmenu.Client

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new (name, object)

add_type_handler (type, newfunc)

add_type_handler_full (type, newfunc, *user_data)

get_icon_paths ()

get_root ()

get_status ()

get_text_direction ()

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

dbus-name

str

r/w/co

Name of the DBus client we’re connecting to.

dbus-object

str

r/w/co

The Object on the client that we’re getting our data from.

group-events

bool

r/w

Event grouping lowers the number of messages on DBus and will be set automatically based on the version to optimize traffic. It can be disabled for testing or other purposes.

Signals

Inherited:

GObject.Object (1)

Name

Short Description

event-result

icon-theme-dirs-changed

Signaled when the theme directories are changed by the server.

item-activate

Signaled when the server wants to activate an item in order to display the menu.

layout-updated

new-menuitem

Signaled when the client creates a new menuitem.

root-changed

The layout has changed in a way that can not be represented by the individual items changing as the root of this client has changed.

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GObject.Object

r

Class Details

class Dbusmenu.Client(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Dbusmenu.ClientClass

The client for a Dbusmenu.Server creating a shared object set of Dbusmenu.Menuitem objects.

classmethod new(name, object)
Parameters:
  • name (str) – The DBus name for the server to connect to

  • object (str) – The object on the server to monitor

Returns:

A brand new Dbusmenu.Client

Return type:

Dbusmenu.Client

This function creates a new client that connects to a specific server on DBus. That server is at a specific location sharing a known object. The interface is assumed by the code to be the DBus menu interface. The newly created client will start sending out events as it syncs up with the server.

add_type_handler(type, newfunc)
Parameters:
  • type (str) – A text string that will be matched with the ‘type’ property on incoming menu items

  • newfunc (Dbusmenu.ClientTypeHandler) – The function that will be executed with those new items when they come in.

Returns:

If registering the new type was successful.

Return type:

bool

This function connects into the type handling of the Dbusmenu.Client. Every new menuitem that comes in immediately gets asked for its properties. When we get those properties we check the ‘type’ property and look to see if it matches a handler that is known by the client. If so, the newfunc function is executed on that Dbusmenu.Menuitem. If not, then the Dbusmenu.Client ::new-menuitem signal is sent.

In the future the known types will be sent to the server so that it can make choices about the menu item types availble.

add_type_handler_full(type, newfunc, *user_data)
Parameters:
  • type (str) – A text string that will be matched with the ‘type’ property on incoming menu items

  • newfunc (Dbusmenu.ClientTypeHandler) – The function that will be executed with those new items when they come in.

  • user_data (object or None) – Data passed to newfunc when it is called

Returns:

If registering the new type was successful.

Return type:

bool

This function connects into the type handling of the Dbusmenu.Client. Every new menuitem that comes in immediately gets asked for its properties. When we get those properties we check the ‘type’ property and look to see if it matches a handler that is known by the client. If so, the newfunc function is executed on that Dbusmenu.Menuitem. If not, then the Dbusmenu.Client ::new-menuitem signal is sent.

In the future the known types will be sent to the server so that it can make choices about the menu item types availble.

get_icon_paths()
Returns:

A None-terminated list of icon paths with memory managed by the client. Duplicate if you want to keep them.

Return type:

[str]

Gets the stored and exported icon paths from the client.

get_root()
Returns:

A Dbusmenu.Menuitem representing the root of menu on the server. If there is no server or there is an error receiving its layout it’ll return None.

Return type:

Dbusmenu.Menuitem

Grabs the root node for the specified client self. This function may block. It will block if there is currently a call to update the layout, it will block on that layout updated and then return the newly updated layout. Chances are that this update is in the queue for the mainloop as it would have been requested some time ago, but in theory it could block longer.

get_status()
Return type:

Dbusmenu.Status

Gets the recommended current status that the server is exporting for the menus. In situtations where the value is Dbusmenu.Status.NOTICE it is recommended that the client show the menus to the user an a more noticible way.

Return value: Status being exported.

get_text_direction()
Return type:

Dbusmenu.TextDirection

Gets the text direction that the server is exporting. If the server is not exporting a direction then the value Dbusmenu.TextDirection.NONE will be returned.

Return value: Text direction being exported.

Signal Details

Dbusmenu.Client.signals.event_result(client, object, p0, p1, p2, p3)
Signal Name:

event-result

Flags:

RUN_LAST

Parameters:
Dbusmenu.Client.signals.icon_theme_dirs_changed(client, arg1)
Signal Name:

icon-theme-dirs-changed

Flags:

RUN_LAST

Parameters:

Signaled when the theme directories are changed by the server.

Dbusmenu.Client.signals.item_activate(client, arg1, arg2)
Signal Name:

item-activate

Flags:

RUN_LAST

Parameters:

Signaled when the server wants to activate an item in order to display the menu.

Dbusmenu.Client.signals.layout_updated(client)
Signal Name:

layout-updated

Flags:

RUN_LAST

Parameters:

client (Dbusmenu.Client) – The object which received the signal

Dbusmenu.Client.signals.new_menuitem(client, arg1)
Signal Name:

new-menuitem

Flags:

RUN_LAST

Parameters:

Signaled when the client creates a new menuitem. This doesn’t mean that it’s placed anywhere. The parent that it’s applied to will signal Dbusmenu.Menuitem ::child-added when it gets parented.

Dbusmenu.Client.signals.root_changed(client, arg1)
Signal Name:

root-changed

Flags:

RUN_LAST

Parameters:

The layout has changed in a way that can not be represented by the individual items changing as the root of this client has changed.

Property Details

Dbusmenu.Client.props.dbus_name
Name:

dbus-name

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

Name of the DBus client we’re connecting to.

Dbusmenu.Client.props.dbus_object
Name:

dbus-object

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The Object on the client that we’re getting our data from.

Dbusmenu.Client.props.group_events
Name:

group-events

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Event grouping lowers the number of messages on DBus and will be set automatically based on the version to optimize traffic. It can be disabled for testing or other purposes.