Source code for dbusmock.templates.low_memory_monitor

"""low-memory-monitor mock template

This creates the expected methods and properties of the main
org.freedesktop.LowMemoryMonitor object.

This provides only the 2.0 D-Bus API of low-memory-monitor.
"""

# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 3 of the License, or (at your option) any
# later version.  See http://www.gnu.org/copyleft/lgpl.html for the full text
# of the license.

[docs] __author__ = "Bastien Nocera"
import dbus from dbusmock import MOCK_IFACE
[docs] BUS_NAME = "org.freedesktop.LowMemoryMonitor"
[docs] MAIN_OBJ = "/org/freedesktop/LowMemoryMonitor"
[docs] MAIN_IFACE = "org.freedesktop.LowMemoryMonitor"
[docs] SYSTEM_BUS = True
[docs] def load(mock, _parameters): # Loaded! mock.loaded = True
@dbus.service.method(MOCK_IFACE, in_signature="y", out_signature="")
[docs] def EmitWarning(self, state): self.EmitSignal(MAIN_IFACE, "LowMemoryWarning", "y", [dbus.Byte(state)])