File: dogtail-logout

package info (click to toggle)
dogtail 1.0.7-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,240 kB
  • sloc: python: 6,124; makefile: 56; sh: 7
file content (30 lines) | stat: -rwxr-xr-x 936 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals

import getpass
from time import sleep
from dogtail.tree import root
from dogtail.logging import debug_message


debug_message(message="Executing dogtail-logout script.")


debug_message(message="Saving the gnome-shell Accessibility object.")
shell = root.application("gnome-shell")

debug_message(message="Open the System menu.")
shell.child(name="System", roleName="menu").click()

debug_message(message="Open the user menu.")
shell.child(name=getpass.getuser(), roleName="label").click()

debug_message(message="Click Log Out.")
shell.child(name="Log Out", roleName="label").click()

debug_message(message="Confirm logging out.")
shell.findChild(lambda x: x.name == "Log Out" and x.roleName in ("button", "push button")).click()


debug_message(message="Some sleep that wont get to the end as the session will end.")
sleep(5)