~ubuntu-branches/ubuntu/utopic/dogtail/utopic

« back to all changes in this revision

Viewing changes to examples/gedit-test-utf8-tree-api.py

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2006-12-21 13:33:47 UTC
  • mfrom: (1.2.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 5.
  • Revision ID: james.westby@ubuntu.com-20061221133347-xo9jg11afp5plcka
Tags: upstream-0.6.1
ImportĀ upstreamĀ versionĀ 0.6.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 
12
12
# Remove the output file, if it's still there from a previous run
13
13
if path.isfile(path.join(path.expandvars("$HOME"), "Desktop", "UTF8demo.txt")):
14
 
        remove(path.join(path.expandvars("$HOME"), "Desktop", "UTF8demo.txt"))
 
14
    remove(path.join(path.expandvars("$HOME"), "Desktop", "UTF8demo.txt"))
15
15
 
16
16
# Start gedit.
17
17
run("gedit")
39
39
savebutton.click()
40
40
 
41
41
# Get a handle to gedit's Save As... dialog.
42
 
saveas = gedit.dialog('Save as...')
 
42
try:
 
43
    saveas = gedit.dialog(u'Save As\u2026')
 
44
except tree.SearchError:
 
45
    saveas = gedit.dialog('Save as...')
43
46
 
44
47
# We want to save to the file name 'UTF8demo.txt'.
45
48
saveas.child(roleName = 'text').text = 'UTF8demo.txt'
46
49
 
47
 
# Let's save it to the desktop.
48
 
saveas.menuItem('Desktop').click()
49
 
 
50
 
# Click the Save button.
 
50
# Save the file on the Desktop
 
51
 
 
52
# Don't make the mistake of only searching by name, there are multiple
 
53
# "Desktop" entires in the Save As dialog - you have to query for the
 
54
# roleName too - see the on-line help for the Dogtail "tree" class for
 
55
# details
 
56
desktop = saveas.child('Desktop', roleName='table cell')
 
57
desktop.doAction('activate')
 
58
 
 
59
#  Click the Save button.
51
60
saveas.button('Save').click()
52
61
 
53
62
# Let's quit now.
54
 
filemenu.menuItem('Quit').click() 
55
 
 
 
63
filemenu.menuItem('Quit').click()