Solid.Button

KDE 4.5 PyKDE API Reference

- KDE's Python API

# Button Class Reference

`from PyKDE4.solid import *`

Inherits: Solid.DeviceInterface → QObject
Namespace: Solid

## Detailed Description

This device interface is available on button devices.

A button is a device, like power button or lid switch, that can be pressed by user. Some buttons can have two states (Enabled/Disabled, On/Off ...), other buttons haven't state.

Author:
  Davide Bettio <davbet@aliceposta.it>

## Enumerations
ButtonType | { LidButton, PowerButton, SleepButton, UnknownButtonType, TabletButton }
## Signals
| pressed (Solid.Button.ButtonType type, QString udi)
## Methods
| __init__ (self, QObject backendObject)
bool | hasState (self)
bool | stateValue (self)
Solid.Button.ButtonType | type (self)
## Static Methods
Solid.DeviceInterface.Type | deviceInterfaceType ()

## Signal Documentation

pressed | ( | Solid.Button.ButtonType | type,
|  | QString | udi
| ) |  |  |

This signal is emitted when the button is pressed.

Parameters:

  | type | the type of button device, it's one of the type Solid.Button.ButtonType

See also:
  Solid.Button.ButtonType

Parameters:

  | udi | the UDI of the button

Signal syntax:
  `QObject.connect(source, SIGNAL("pressed(Solid::Button::ButtonType, const QString&)"), target_slot)`

## Method Documentation

__init__ | ( | self, |
|  | QObject | backendObject
| ) |  |  |

Creates a new Button object. You generally won't need this. It's created when necessary using Device.as().

Parameters:

  | backendObject | the device interface object provided by the backend

See also:
  Solid.Device.as()

bool hasState | ( |  | self ) |

Indicates if the button mantains state (Can toggled on/off).

Returns:
  true if the button maintains state, false otherwise.

See also:
  stateValue()

bool stateValue | ( |  | self ) |

Retrieves the state of the button. A button can have two states (Enabled/Disabled, On/Off ...). Available only if hasState is true.

Returns:
  true if the button is enabled, false otherwise.

See also:
  hasState()

Solid.Button.ButtonType type | ( |  | self ) |

Retrieves the type of button device.

Returns:
  the type of button device.

See also:
  Solid.Button.ButtonType

## Static Method Documentation

Solid.DeviceInterface.Type deviceInterfaceType | ( |  | ) |

Get the Solid.DeviceInterface.Type of the Button device interface.

Returns:
  the Button device interface type

See also:
  Solid.DeviceInterface.Type

## Enumeration Documentation

ButtonType

This enum type defines the type of button.

- LidButton : The switch on a laptop that senses whether the lid is open or closed. - PowerButton : The main power button on the computer. - SleepButton : The sleep button on a computer capable of putting the computer into a suspend state. - TabletButton : The tablet switch on a laptop that senses if the monitor is rotated or not. - UnknownButtonType : The type of the button is unknow.

Enumerator:

  LidButton |
  PowerButton |
  SleepButton |
  UnknownButtonType |
  TabletButton |