Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
vmdriver
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
2
Merge Requests
0
Wiki
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
Commit
78e6644b
authored
Jul 24, 2013
by
Guba Sándor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
screenshot test app
parent
5ad8163b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
0 deletions
+30
-0
screenshot.py
+30
-0
No files found.
screenshot.py
0 → 100755
View file @
78e6644b
#!/usr/bin/env python
import
libvirt
import
os
# pip install pillow
from
PIL
import
Image
def
handler
(
stream
,
buf
,
opaque
):
fd
=
opaque
os
.
write
(
fd
,
buf
)
uri
=
"qemu:///system"
vmname
=
"ubuntu"
filename
=
"screenshot.ppm"
connection
=
libvirt
.
open
(
uri
)
domain
=
connection
.
lookupByName
(
vmname
)
# Sendkey
# Keys described in /usr/include/linux/input.h
domain
.
sendKey
(
libvirt
.
VIR_KEYCODE_SET_LINUX
,
100
,
[
97
],
1
,
0
)
stream
=
connection
.
newStream
(
0
)
mimetype
=
domain
.
screenshot
(
stream
,
0
,
0
)
print
"mimetype:"
,
mimetype
fd
=
os
.
open
(
filename
,
os
.
O_WRONLY
|
os
.
O_TRUNC
|
os
.
O_CREAT
,
0
o644
)
stream
.
recvAll
(
handler
,
fd
)
Image
.
open
(
"screenshot.ppm"
)
.
save
(
"screenshot.png"
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment