示例#1
0
def states(acc):
    stateSet = acc.getState()
    states = stateSet.getStates()
    state_strings = []
    for state in states:
        state_strings.append(pyatspi.stateToString(state))
    state_string = ' '.join(state_strings)
    return state_string
示例#2
0
def states(acc):
	stateSet = acc.getState()
	states = stateSet.getStates()
	state_strings = []
	for state in states:
		state_strings.append(pyatspi.stateToString(state))
	state_string = ' '.join(state_strings)
	return state_string
示例#3
0
def getAccessibleDetails(level, acc, indent="", includeApp=True):
    """Returns a string, suitable for printing, that describes the
    given accessible.

    Arguments:
    - indent: A string to prefix the output with
    - includeApp: If True, include information about the app
                  for this accessible.
    """

    if level < debugLevel:
        return ""

    if includeApp:
        app = acc.getApplication()
        if app:
            try:
                string = indent + "app.name='%s' " % app.name
            except (LookupError, RuntimeError):
                string = indent + "app.name='<error getting name>' "
        else:
            string = indent + "app=None "
    else:
        string = indent

    # create the States string
    try:
        stateSet = acc.getState()
    except:
        string += "(exception getting state set)"
    try:
        states = stateSet.getStates()
    except:
        string += "(exception getting states)"
        states = []
    state_strings = []
    for state in states:
        state_strings.append(pyatspi.stateToString(state))
    state_string = ' '.join(state_strings)

    # create the relations string
    try:
        relations = acc.getRelationSet()
    except:
        string += "(exception getting relation set)"
        relations = None
    if relations:
        relation_strings = []
        for relation in relations:
            relation_strings.append( \
                          pyatspi.relationToString(relation.getRelationType()))
        rel_string = ' '.join(relation_strings)
    else:
        rel_string = ''

    try:
        string += "name='%s' role='%s' state='%s' relations='%s'" \
                  % (acc.name or 'None', acc.getRoleName(),
                     state_string, rel_string)
    except:
        string += "(exception fetching data)"

    return string
示例#4
0
文件: debug.py 项目: GNOME/orca
def getAccessibleDetails(level, acc, indent="", includeApp=True):
    """Returns a string, suitable for printing, that describes the
    given accessible.

    Arguments:
    - indent: A string to prefix the output with
    - includeApp: If True, include information about the app
                  for this accessible.
    """

    if level < debugLevel:
        return ""

    if includeApp:
        try:
            app = acc.getApplication()
        except:
            string = indent + "app=(exception getting app) "
            app = None
        else:
            if app:
                try:
                    string = indent + "app.name='%s' " % app.name
                except (LookupError, RuntimeError):
                    string = indent + "app.name='(exception getting name)' "
            else:
                string = indent + "app=None "
    else:
        string = indent

    # create the States string
    try:
        stateSet = acc.getState()
    except:
        string += "(exception getting state set)"
    try:
        states = stateSet.getStates()
    except:
        string += "(exception getting states)"
        states = []
    state_strings = []
    for state in states:
        state_strings.append(pyatspi.stateToString(state))
    state_string = ' '.join(state_strings)

    # create the relations string
    try:
        relations = acc.getRelationSet()
    except:
        string += "(exception getting relation set)"
        relations = None
    if relations:
        relation_strings = []
        for relation in relations:
            relation_strings.append( \
                          pyatspi.relationToString(relation.getRelationType()))
        rel_string = ' '.join(relation_strings)
    else:
        rel_string = ''

    try:
        iface_string = " ".join(pyatspi.utils.listInterfaces(acc))
    except:
        iface_string = "(exception calling listInterfaces)"

    try:
        string += "name='%s' role='%s' state='%s' \n%srelations='%s' interfaces='%s'" \
                  % (acc.name or 'None', acc.getRoleName(),
                     state_string, indent, rel_string, iface_string)
    except:
        string += "(exception fetching data)"

    return string
示例#5
0
def getAccessibleDetails(level, acc, indent="", includeApp=True):
    """Returns a string, suitable for printing, that describes the
    given accessible.

    Arguments:
    - indent: A string to prefix the output with
    - includeApp: If True, include information about the app
                  for this accessible.
    """

    if level < debugLevel:
        return ""

    if includeApp:
        app = acc.getApplication()
        if app:
            string = indent + "app.name='%s' " % app.name
        else:
            string = indent + "app=None "
    else:
        string = indent

    # create the States string
    try:
        stateSet = acc.getState()
    except:
        string += "(exception getting state set)"
    try:
        states = stateSet.getStates()
    except:
        string += "(exception getting states)"
        states = []
    state_strings = []
    for state in states:
        state_strings.append(pyatspi.stateToString(state))
    state_string = " ".join(state_strings)

    # create the relations string
    try:
        relations = acc.getRelationSet()
    except:
        string += "(exception getting relation set)"
        relations = None
    if relations:
        relation_strings = []
        for relation in relations:
            relation_strings.append(pyatspi.relationToString(relation.getRelationType()))
        rel_string = " ".join(relation_strings)
    else:
        rel_string = ""

    try:
        string += "name='%s' role='%s' state='%s' relations='%s'" % (
            acc.name or "None",
            acc.getRoleName(),
            state_string,
            rel_string,
        )
    except:
        string += "(exception fetching data)"

    return string