~ubuntu-branches/ubuntu/karmic/ldtp/karmic

« back to all changes in this revision

Viewing changes to python/ldtplib/checkbox.py

  • Committer: Bazaar Package Importer
  • Author(s): Kartik Mistry
  • Date: 2008-12-04 16:44:34 UTC
  • mfrom: (1.1.5 upstream) (2.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20081204164434-6ez1x999y5bw0btb
Tags: 1.4.0-1
* New upstream release
* debian/rules:
  + Some scripts are no longer needed to make executable
* debian/watch:
  + Fixed for upstream location change, notified to upstream
* debian/*.1:
  + Fixed typo in my email address

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from ldtplibutils import *
 
2
 
 
3
global _ldtpDebug
 
4
 
 
5
class CheckBox:
 
6
    def isCheckBoxEnabled (self, accessible):
 
7
        # FIXME: Implement wait_till_object_state_contains
 
8
        return True
 
9
 
 
10
    def click (self, accessible):
 
11
        if self.isCheckBoxEnabled (accessible) == False:
 
12
            return LdtpErrorCode.INVALID_OBJECT_STATE
 
13
        _component = accessible.queryComponent ()
 
14
        _flag = False
 
15
        if _component:
 
16
            _flag = _component.grabFocus ()
 
17
            if _ldtpDebug:
 
18
                print 'Grab focus %s' % _flag
 
19
            _component.unref ()
 
20
        _action = accessible.queryAction ()
 
21
        _flag = False
 
22
        if _action:
 
23
            # FIXME: Do action based on event, instead of 0
 
24
            _flag = _action.doAction (0)
 
25
            _action.unref ()
 
26
        if _flag:
 
27
            return LdtpErrorCode.SUCCESS
 
28
        else:
 
29
            return LdtpErrorCode.CLICK_FAILED
 
30
 
 
31
def checkBoxMain (cctxt, cmd):
 
32
    checkBoxInst = CheckBox ()
 
33
    if cmd == command.CLICK:
 
34
        status = checkBoxInst.click (cctxt.guiHandle.handle)
 
35
        checkBoxInst = None
 
36
        return status
 
37
    elif cmd == command.GRABFOCUS:
 
38
        status = grabFocus (cctxt.guiHandle.handle)
 
39
        checkBoxInst = None
 
40
        return status
 
41
    else:
 
42
        checkBoxInst = None
 
43
        return LdtpErrorCode.COMMAND_NOT_IMPLEMENTED