dbusmock.templates.upower
upowerd mock template
This creates the expected methods and properties of the main org.freedesktop.UPower object, but no devices. You can specify any property such as ‘OnLowBattery’ or the return value of ‘SuspendAllowed’, ‘HibernateAllowed’, and ‘GetCriticalAction’ in “parameters”.
This provides the 1.0 D-Bus API of upower.
Attributes
Functions
|
|
|
Convenience method to add an AC object |
|
Convenience method to add a discharging battery object |
|
Convenience method to add a charging battery object |
|
Convenience method to configure DisplayDevice properties |
|
Convenience method to Set a device's properties. |
|
Module Contents
- dbusmock.templates.upower.__copyright__ = Multiline-String[source]
Show Value
""" (c) 2012, 2013 Canonical Ltd. (c) 2017 - 2022 Martin Pitt <martin@piware.de> """
- dbusmock.templates.upower.AddAC(self, device_name, model_name)[source]
Convenience method to add an AC object
You have to specify a device name which must be a valid part of an object path, e. g. “mock_ac”, and an arbitrary model name.
Please note that this does not set any global properties such as “on-battery”.
Returns the new object path.
- dbusmock.templates.upower.AddDischargingBattery(self, device_name, model_name, percentage, seconds_to_empty)[source]
Convenience method to add a discharging battery object
You have to specify a device name which must be a valid part of an object path, e. g. “mock_ac”, an arbitrary model name, the charge percentage, and the seconds until the battery is empty.
Please note that this does not set any global properties such as “on-battery”.
Returns the new object path.
- dbusmock.templates.upower.AddChargingBattery(self, device_name, model_name, percentage, seconds_to_full)[source]
Convenience method to add a charging battery object
You have to specify a device name which must be a valid part of an object path, e. g. “mock_ac”, an arbitrary model name, the charge percentage, and the seconds until the battery is full.
Please note that this does not set any global properties such as “on-battery”.
Returns the new object path.
- dbusmock.templates.upower.SetupDisplayDevice(self, _type, state, percentage, energy, energy_full, energy_rate, time_to_empty, time_to_full, is_present, icon_name, warning_level)[source]
Convenience method to configure DisplayDevice properties
This calls Set() for all properties that the DisplayDevice is defined to have, and is shorter if you have to completely set it up instead of changing just one or two properties.