Revision: 4441
Author: pekka.klarck
Date: Tue Dec 7 11:34:35 2010
Log: Minor clean-up -- the API is so horrible that I gave up making the
code better than this. CI server should now have PyGTK installed so tests
may even pass there.
http://code.google.com/p/robotframework/source/detail?r=4441
Modified:
/trunk/src/robot/libraries/Screenshot.py
=======================================
--- /trunk/src/robot/libraries/Screenshot.py Tue Dec 7 07:17:50 2010
+++ /trunk/src/robot/libraries/Screenshot.py Tue Dec 7 11:34:35 2010
@@ -50,14 +50,12 @@
except ImportError:
pass
else:
- # Code below originally from
http://ubuntuforums.org/showpost.php?p=2681009&postcount=5
- # TODO: Cleanup
def take_screenshot(path):
window = gdk.get_default_root_window()
- size = window.get_size()
- pb = gdk.Pixbuf(gdk.COLORSPACE_RGB, False, 8, size[0], size[1])
+ width, height = window.get_size()
+ pb = gdk.Pixbuf(gdk.COLORSPACE_RGB, False, 8, width, height)
pb = pb.get_from_drawable(window, window.get_colormap(),
- 0, 0, 0, 0, size[0], size[1])
+ 0, 0, 0, 0, width, height)
if not pb:
raise RuntimeError('Taking screenshot failed')
pb.save(path, 'jpeg')