forked from schuellerf/xfce-test
/
make_screenshots.py
54 lines (40 loc) · 1.4 KB
/
make_screenshots.py
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env python
import ldtp as l
import os
import time
import sys
basePath="/screenshots"
if not os.path.exists(basePath):
os.mkdir(basePath)
def do_screenshot(app, app_name):
l.launchapp(app)
l.waittillguiexist(app_name)
l.imagecapture(app_name, os.path.join(basePath, app + ".png"))
l.generatekeyevent("<alt><f4>")
full_screen=l.imagecapture()
os.rename(full_screen, os.path.join(basePath, "xfce-desktop.png"))
# I/O error workaround
l.launchapp("xfce4-terminal")
time.sleep(1)
l.generatekeyevent("<alt><f4>")
# move the mouse away to avoid tool tips
l.generatemouseevent(800,600, "abs")
# appfinder crashes on imagecapture() - (has to window?)
l.launchapp("xfce4-appfinder")
l.waittillguiexist("ApplicationFinder")
full_screen=l.imagecapture()
os.rename(full_screen, os.path.join(basePath, "xfce4-appfinder-main.png"))
l.generatekeyevent("<alt><f4>")
do_screenshot("xfce4-terminal", "Terminal")
do_screenshot("xfce4-clipman-settings", "Clipman")
do_screenshot("xfce4-display-settings", "Display")
do_screenshot("xfce4-keyboard-settings", "Keyboard")
do_screenshot("xfce4-mime-settings", "MIME Type Editor")
do_screenshot("xfce4-mouse-settings", "Mouse and Touchpad")
do_screenshot("xfce4-settings-manager", "Settings")
import psutil
PROCNAME = "xfce4-appfinder"
for proc in psutil.process_iter():
# check whether the process name matches
if proc.name() == PROCNAME:
proc.kill()