Mini Shell
3
�p5[�� � @ s� d Z dZdZdZdZdZddlZdd lmZ dd
lm Z ddlm
Z
ddlmZ dd
lmZ ddlm
Z
ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ej� ZG dd� d�ZG dd� d�ZG dd� d�ZdS )z!Implements structural navigation.z$Id$z
$Revision$z$Date$zRCopyright (c) 2005-2009 Sun Microsystems Inc.Copyright (c) 2010-2013 The Orca TeamZLGPL� N� )�cmdnames)�debug)� guilabels)�input_event)�keybindings)�messages)�object_properties)�orca)�orca_gui_navlist)�
orca_state)�settings)�settings_manager)�speechc
@ s. e Zd ZdZg dg dg dddddf
dd�ZdS )�
MatchCriteriaa� Contains the criteria which will be used to generate a collection
matchRule. We don't want to create the rule until we need it and
are ready to use it. In addition, the creation of an AT-SPI match
rule requires you specify quite a few things (see the __init__),
most of which are irrelevant to the search at hand. This class
makes it possible for the StructuralNavigationObject creator to just
specify the few criteria that actually matter.
N� Fc
C s| || _ |p|j| _|| _|p |j| _|| _|p2|j| _|| _| pD|j| _ |
| _
|| _tj
� | _x|D ]}| jj|� qdW dS )a� Creates a new match criteria object.
Arguments:
- collection: the collection interface for the document in
which the accessible objects can be found.
- states: a list of pyatspi states of interest
- matchStates: whether an object must have all of the states
in the states list, any of the states in the list, or none
of the states in the list. Must be one of the collection
interface MatchTypes if provided.
- objAttrs: a list of object attributes (not text attributes)
- matchObjAttrs: whether an object must have all of the
attributes in the objAttrs list, any of the attributes in
the list, or none of the attributes in the list. Must be
one of the collection interface MatchTypes if provided.
- interfaces: (We aren't using this. According to the at-spi
idl, it is a string.)
- matchInterfaces: The collection MatchType for matching by
interface.
- invert: If true the match rule will find objects that don't
match. We always use False.
- applyPredicate: whether or not a predicate should be applied
as an additional check to see if an item is indeed a match.
This is necessary, for instance, when one of the things we
care about is a text attribute, something the collection
interface doesn't include in its criteria.
N)�
collection� MATCH_ANY�matchStates�objAttrs�
matchObjAttrs�roles�
matchRoles�
interfaces� MATCH_ALL�matchInterfaces�invert�applyPredicate�pyatspiZStateSet�states�add)
�selfr r r r r r r r r r r �state� r# �+/usr/lib/python3.6/structural_navigation.py�__init__? s )
zMatchCriteria.__init__)�__name__�
__module__�__qualname__�__doc__r% r# r# r# r$ r 5 s r c @ s` e Zd ZdZdd� Zdd� Zdd� Zdd � Zd
d� Zdd
� Z dd� Z
dd� Zdd� Zdd� Z
dS )�StructuralNavigationObjectat Represents a document object which has identifiable characteristics
which can be used for the purpose of navigation to and among instances
of that object. These characteristics may be something as simple as a
role and/or a state of interest. Or they may be something more complex
such as character counts, text attributes, and other object attributes.
c C sL || _ || _|| _|| _|| _|| _|| _i | _tj � | _
g | _| j� dS )a Creates a new structural navigation object.
Arguments:
- structuralNavigation: the StructuralNavigation class associated
with this object.
- objType: the type (e.g. BLOCKQUOTE) associated with this object.
- bindings: a dictionary of all of the possible bindings for this
object. In the case of all but the "atLevel" bindings, each
binding takes the form of [keysymstring, modifiers, description].
The goPreviousAtLevel and goNextAtLevel bindings are each a list
of bindings in that form.
- predicate: the predicate to use to determine if a given accessible
matches this structural navigation object. Used when a search via
collection is not possible or practical.
- criteria: a method which returns a MatchCriteria object which
can in turn be used to locate the next/previous matching accessible
via collection.
- presentation: the method which should be called after performing
the search for the structural navigation object.
- dialogData: the method which returns the title, column headers,
and row data which should be included in the "list of" dialog for
the structural navigation object.
N)
�structuralNavigation�objType�bindings� predicate�criteria�present�_dialogData�inputEventHandlersr �KeyBindings�keyBindings� functions�_setUpHandlersAndBindings)r! r+ r, r- r. r/ �presentation�
dialogDatar# r# r$ r% � s
z#StructuralNavigationObject.__init__c C s� | j jd�}|rf|\}}}d| j }tj| j|�| j|<