From c99957ad389b3e383b9155cb528000bfa197a077 Mon Sep 17 00:00:00 2001 From: Sylvain Pineau Date: Mon, 13 Jul 2020 11:59:39 +0200 Subject: bin:lock_screen_watcher -> lock_screen_watcher.py --- bin/lock_screen_watcher | 51 ---------------------------------------------- bin/lock_screen_watcher.py | 51 ++++++++++++++++++++++++++++++++++++++++++++++ units/keys/jobs.pxu | 2 +- 3 files changed, 52 insertions(+), 52 deletions(-) delete mode 100755 bin/lock_screen_watcher create mode 100755 bin/lock_screen_watcher.py diff --git a/bin/lock_screen_watcher b/bin/lock_screen_watcher deleted file mode 100755 index 1c30270..0000000 --- a/bin/lock_screen_watcher +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env python3 -# This file is part of Checkbox. -# -# Copyright 2018 Canonical Ltd. -# Written by: Sylvain Pineau -# -# Checkbox is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 3, -# as published by the Free Software Foundation. -# -# Checkbox is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Checkbox. If not, see . - -import dbus -import gi -from dbus.mainloop.glib import DBusGMainLoop -gi.require_version('GLib', '2.0') -from gi.repository import GObject -from gi.repository import GLib - - -def filter_cb(bus, message): - if message.get_member() == "EventEmitted": - args = message.get_args_list() - if args[0] == "desktop-lock": - print("Lock Screen detected") - mainloop.quit() - elif message.get_member() == "ActiveChanged": - args = message.get_args_list() - if args[0] == True: # noqa: E712 - print("Lock Screen detected") - mainloop.quit() - - -def on_timeout_expired(): - print("You have failed to perform the required manipulation in time") - raise SystemExit(1) - -DBusGMainLoop(set_as_default=True) -bus = dbus.SessionBus() -bus.add_match_string("type='signal',interface='com.ubuntu.Upstart0_6'") -bus.add_match_string("type='signal',interface='org.gnome.ScreenSaver'") -bus.add_message_filter(filter_cb) -mainloop = GLib.MainLoop() -GObject.timeout_add_seconds(30, on_timeout_expired) -mainloop.run() diff --git a/bin/lock_screen_watcher.py b/bin/lock_screen_watcher.py new file mode 100755 index 0000000..1c30270 --- /dev/null +++ b/bin/lock_screen_watcher.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python3 +# This file is part of Checkbox. +# +# Copyright 2018 Canonical Ltd. +# Written by: Sylvain Pineau +# +# Checkbox is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 3, +# as published by the Free Software Foundation. +# +# Checkbox is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Checkbox. If not, see . + +import dbus +import gi +from dbus.mainloop.glib import DBusGMainLoop +gi.require_version('GLib', '2.0') +from gi.repository import GObject +from gi.repository import GLib + + +def filter_cb(bus, message): + if message.get_member() == "EventEmitted": + args = message.get_args_list() + if args[0] == "desktop-lock": + print("Lock Screen detected") + mainloop.quit() + elif message.get_member() == "ActiveChanged": + args = message.get_args_list() + if args[0] == True: # noqa: E712 + print("Lock Screen detected") + mainloop.quit() + + +def on_timeout_expired(): + print("You have failed to perform the required manipulation in time") + raise SystemExit(1) + +DBusGMainLoop(set_as_default=True) +bus = dbus.SessionBus() +bus.add_match_string("type='signal',interface='com.ubuntu.Upstart0_6'") +bus.add_match_string("type='signal',interface='org.gnome.ScreenSaver'") +bus.add_message_filter(filter_cb) +mainloop = GLib.MainLoop() +GObject.timeout_add_seconds(30, on_timeout_expired) +mainloop.run() diff --git a/units/keys/jobs.pxu b/units/keys/jobs.pxu index 9dc3450..6eec1d4 100644 --- a/units/keys/jobs.pxu +++ b/units/keys/jobs.pxu @@ -5,7 +5,7 @@ estimated_duration: 30.0 imports: from com.canonical.plainbox import manifest requires: manifest.has_special_keys == 'True' flags: also-after-suspend-manual -command: lock_screen_watcher +command: lock_screen_watcher.py _description: PURPOSE: This test will test the screen lock key -- cgit v1.2.3