dbusmock.templates.upower ========================= .. py:module:: dbusmock.templates.upower .. autoapi-nested-parse:: 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 ---------- .. autoapisummary:: dbusmock.templates.upower.__author__ dbusmock.templates.upower.__copyright__ dbusmock.templates.upower.BUS_NAME dbusmock.templates.upower.MAIN_OBJ dbusmock.templates.upower.MAIN_IFACE dbusmock.templates.upower.SYSTEM_BUS dbusmock.templates.upower.DEVICE_IFACE Functions --------- .. autoapisummary:: dbusmock.templates.upower.load dbusmock.templates.upower.AddAC dbusmock.templates.upower.AddDischargingBattery dbusmock.templates.upower.AddChargingBattery dbusmock.templates.upower.SetupDisplayDevice dbusmock.templates.upower.SetDeviceProperties dbusmock.templates.upower.RemoveDevice Module Contents --------------- .. py:data:: __author__ :value: 'Martin Pitt' .. py:data:: __copyright__ :value: Multiline-String .. raw:: html
Show Value .. code-block:: python """ (c) 2012, 2013 Canonical Ltd. (c) 2017 - 2022 Martin Pitt """ .. raw:: html
.. py:data:: BUS_NAME :value: 'org.freedesktop.UPower' .. py:data:: MAIN_OBJ :value: '/org/freedesktop/UPower' .. py:data:: MAIN_IFACE :value: 'org.freedesktop.UPower' .. py:data:: SYSTEM_BUS :value: True .. py:data:: DEVICE_IFACE :value: 'org.freedesktop.UPower.Device' .. py:function:: load(mock, parameters) .. py:function:: AddAC(self, device_name, model_name) 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. .. py:function:: AddDischargingBattery(self, device_name, model_name, percentage, seconds_to_empty) 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. .. py:function:: AddChargingBattery(self, device_name, model_name, percentage, seconds_to_full) 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. .. py:function:: SetupDisplayDevice(self, _type, state, percentage, energy, energy_full, energy_rate, time_to_empty, time_to_full, is_present, icon_name, warning_level) 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. .. py:function:: SetDeviceProperties(_self, object_path, properties) Convenience method to Set a device's properties. object_path: the device to update properties: dictionary of keys to dbus variants. Changing this property will trigger the device's PropertiesChanged signal. .. py:function:: RemoveDevice(self, device_path)