~ubuntu-branches/ubuntu/vivid/mago/vivid

« back to all changes in this revision

Viewing changes to gnome-screenshot/take_screenshot.py

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt
  • Date: 2011-02-08 13:32:13 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20110208133213-m1og7ey0m990chg6
Tags: 0.3+bzr20-0ubuntu1
* debian/rules:
  - updated to debhelper 7
  - use dh_python2 instead of python-central
* debian/pycompat:
  - removed, no longer needed
* debian/control:
  - dropped cdbs and python-central dependencies
* bzr snapshot of the current trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
import os
2
 
from mago.test_suite.gnome_screenshot import GnomeScreenshotTestSuite
3
 
 
4
 
class TakeScreenshot(GnomeScreenshotTestSuite):
5
 
    def grab_desktop(self, delay=5, filename='baz.png'):
6
 
        self.application.open()
7
 
        self.application.take_whole_desktop_screenshot(delay)
8
 
 
9
 
        self.application.save_to_file(filename)
10
 
 
11
 
        file_path = os.getenv('HOME') + '/' + filename
12
 
        
13
 
        if os.access(file_path, os.F_OK):
14
 
            os.remove(file_path) 
15
 
        else:
16
 
            raise AssertionError('Screenshot ' + file_path + ' was not created')
17
 
 
18
 
    def grab_window(self, delay=5, filename='baz.png'):
19
 
        self.application.open()
20
 
 
21
 
        self.application.take_current_window_screenshot(delay)
22
 
 
23
 
        self.application.save_to_file(filename)
24
 
 
25
 
        file_path = os.getenv('HOME') + '/' + filename
26
 
        
27
 
        if os.access(file_path, os.F_OK):
28
 
            os.remove(file_path) 
29
 
        else:
30
 
            raise AssertionError('Screenshot ' + file_path + ' was not created')
31
 
 
32
 
    def grab_area(self, delay=5, filename='baz.png'):
33
 
        self.application.open()
34
 
 
35
 
        self.application.grab_selected_area(delay)
36
 
 
37
 
        self.application.save_to_file(filename)
38
 
 
39
 
        file_path = os.getenv('HOME') + '/' + filename
40
 
        
41
 
        if os.access(file_path, os.F_OK):
42
 
            os.remove(file_path) 
43
 
        else:
44
 
            raise AssertionError('Screenshot ' + file_path + ' was not created')
45
 
 
46
 
if __name__ == "__main__":
47
 
    test = TakeScreenshot()
48
 
    test.run()