
    g
f	                     x   d Z dZdZdZdZdZddlZ ej                  dd	       dd
lm	Z	  ej                  dd       ddlm
Z
 ddlZddlZddlZddlZddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ 	 ddl m!Z" ddZ%dZ& G d d      Z'y# e#$ r ddl$Z"Y w xY w)zASuperclass of classes used to generate presentations for objects.z$Id:$z$Revision:$z$Date:$zLCopyright (c) 2009 Sun Microsystems Inc.Copyright (c) 2015-2016 Igalia, S.L.LGPL    NAtspiz2.0)r   Atkz1.0)r      )braille)debug)messages)object_properties)settings)settings_manager)AXHypertext)AXObject)AXTable)AXUtilities)AXValuec                     t        j                         \  }}}|j                  }	 |j                  }t        j                  ||       }|||fS # t        $ r d}Y (w xY w)Nz	<no args>)sysexc_info__name__argsKeyError	traceback	format_tb)
maxTBlevelclaexctrbkexcNameexcArgsexcTbs          0/usr/lib/python3/dist-packages/orca/generator.py_formatExceptionInfor"   <   sa    \\^NCdllG(( j1EWe$$  s   A AA	_generatec                      e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	 ZdSd
Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Z d Z!d  Z"d! Z#d" Z$d# Z%d$ Z&d% Z'd& Z(d' Z)d( Z*d) Z+d* Z,d+ Z-d, Z.d- Z/d. Z0d/ Z1d0 Z2d1 Z3d2 Z4d3 Z5d4 Z6d5 Z7d6 Z8d7 Z9d8 Z:d9 Z;d: Z<d; Z=d< Z>d= Z?d> Z@d? ZAd@ ZBdA ZCdB ZDdC ZEdD ZFdE ZGdF ZHdG ZIdH ZJdI ZKdJ ZLdK ZMdL ZNdTdNZOdO ZPdP ZQdQ ZRdR ZSyM)U	GeneratorzTakes accessible objects and generates a presentation for those
    objects.  See the generate method, which is the primary entry
    point.c                    || _         || _        i | _        i | _        t	        |       D cg c]  }|j                  t              s| c}D cg c](  }t        | |      j                  | | j                        * c}D cg c]  }t        |t        j                        r|  c}D ]F  }|j                  t        t              d  }|d   j                         |dd  z   }|| j                  |<   H | j!                          y c c}w c c}w c c}w )Nr   r   )_mode_script_activeProgressBars_methodsDictdir
startswithMETHOD_PREFIXgetattr__get__	__class__
isinstancecollections_abcCallabler   lenlower_verifyFormatting)selfscriptmodexyzmethodnames           r!   __init__zGenerator.__init__T   s    
#%  /2$i"W1<<;V1"WY !q)11$G Y H1)!_-E-EF  H	-F ??3}#5#67D7==?T!"X-D&,Dd#	- 	  #XY Hs   D D -D #D
c                     d|d<   d|d<   y)zCOther things to make available from the formatting string.
        Nobjrole )r7   globalsDicts     r!   _addGlobalszGenerator._addGlobalsb   s     "E"F    c                    i }| j                   j                         D ]  }g ||<   	 | j                  |       | j                  j                  | j
                     D ]D  }dD ]=  }	 | j                  j                  | j
                     |   |   }|s0	 	 t        ||       ? F y # t        $ ro t               }|d   d   }|j                  dd      }|j                  dd      }|| j                   vr#t        j                  t        j                         g ||<   Y n1t        $ r& t        j                  t        j                         Y w xY w# t        $ r Y w xY w)N)focused	unfocusedr   r   name ' ' is not defined)r*   keysrE   r(   
formattingr'   eval	NameErrorr"   replacer   printExceptionLEVEL_SEVERE	Exception)r7   rD   keyroleKey
evalStringinfoargs          r!   r6   zGenerator._verifyFormattingh   sd    $$))+ 	"C!K	"%||..tzz: 	"G/ ""//

;GDSI 
 & !" [9!"	"   ) 2#7#9D"&q'!*C"%++h";C"%++.@""EC"$*;*;; % 4 4U5G5G H/1K,( "!001C1CD!"  ! s+   $)EB##A5E+EE	EEc                 4    |j                  dd      }||d<   |S )zConvenience method to allow you to temporarily override the role in
        the args dictionary.  This changes the role in args ags
        returns the old role so you can pass it back to _restoreRole.
        rB   Nget)r7   newRoler   oldRoles       r!   _overrideRolezGenerator._overrideRole   s"    
 ((64(VrF   c                     |r||d<   y|d= y)zConvenience method to restore the old role back in the args
        dictionary.  The oldRole should have been obtained from
        _overrideRole.  If oldRole is None, then the 'role' key/value
        pair will be deleted from args.
        rB   NrC   )r7   r^   r   s      r!   _restoreRolezGenerator._restoreRole   s     "DLVrF   c                     g S NrC   )r7   contentsr   s      r!   generateContentszGenerator.generateContents       	rF   c                     g S rc   rC   r7   rA   r   s      r!   generateContextzGenerator.generateContext   rf   rF   c                     t        j                  |      r)d}t        j                  t        j                  |d       g S t        j
                         }g }i } j                  |       ||d<   	 |j                  dt        j                  |            |d<   	 |d   |d<    j                  |d<   |j                  d	d      s|j                  d
d      rd|d	<   nd|d	<     j                  j                  j                  d(i |}	|j                  dd      sm|j                  dd      rV  j                  j                  j                  d(i |}
  j                  j                  j                   d(i |}|
 d|	 d| }	d|d<    j                  j#                         d|j                  d	      d|d|j                  d      dg}t        j                  t        j                  |d       d j                  j$                  d<   d j                  j$                  d<   d j                  j$                  d<    fd}|	sJ 	 t        j
                         }	 t'        |	|      }	 t        j
                         |z
  d}t        j                  t        j>                  d! d&|         jA                  |       |j                  d'      r|r|d   r jC                  |       |S # t        $ r7}d|d|g}t        j                  t        j                  |d       |cY d}~S d}~ww xY w# t(        $ r g }t+               }|d   d   }|j-                  dd      }|j-                  dd      }| j.                  vr&t        j0                  t        j2                         Y 7  j.                  |   |fi |||<   t        j
                         |z
  d}t5        ||   t6              rYdj9                  t;        d  t=        |||                     }t        j                  t        j>                  d! d"| d#| d$| d%       Y nw xY w# t        $ r) t        j0                  t        j2                         g }Y w xY w))a4  Returns an array of strings (and possibly voice and audio
        specifications) that represent the complete presentation for the
        object.  The presentation to be generated depends highly upon the
        formatting strings in formatting.py.

        args is a dictionary that may contain any of the following:
        - alreadyFocused: if True, we're getting an object
          that previously had focus
        - priorObj: if set, represents the object that had focus before
          this object
        - includeContext: boolean (default=True) which says whether
          the context for an object should be included as a prefix
          and suffix
        - role: a role to override the object's role
        - formatType: the type of formatting, such as
          'focused', 'basicWhereAmI', etc.
        - forceMnemonic: boolean (default=False) which says if we
          should ignore the settings.enableMnemonicSpeaking setting
        - forceTutorial: boolean (default=False) which says if we
          should force a tutorial to be spoken or not
        z4GENERATOR: Cannot generate presentation for dead objTrA   rB   z+GENERATOR: Cannot generate presentation for:Nr9   
formatTypealreadyFocusedFrH   rI   	recursingincludeContextz + zGENERATOR: Startingzgeneration forz(using role:)usedDescriptionForName!usedDescriptionForUnrelatedLabelsusedDescriptionForAlertc                 (    j                  | d      S )NF)_resultElementToString)r:   r7   s    r!   	debuginfoz%Generator.generate.<locals>.debuginfo   s    221e<<rF   r   r   rJ   rK   rL   z.4f c                     | S rc   rC   r:   s    r!   <lambda>z$Generator.generate.<locals>.<lambda>  s     rF                     zGENERATION TIME: z ----> z=[]zCOMPLETION TIME: isProgressBarUpdaterC   )"r   is_deadr   printMessage
LEVEL_INFOtimerE   r\   get_rolerT   printTokensr'   r(   rN   	getFormat	getPrefix	getSuffixupperpointOfReferencerO   rP   r"   rQ   r*   rR   rS   r1   listjoinfiltermap	LEVEL_ALL_debugResultInfo setProgressBarUpdateTimeAndValue)r7   rA   r   msg	startTimeresultrD   errortokensrN   prefixsuffixrv   currentTimerX   rY   durationstringResults   `                 r!   generatezGenerator.generate   s2   . C HCu//d;IIIK	% E	"&((683D3DS3I"JK
F	 'v.DL  ::DL88L$/88,e4)2D&)4D&:00::BTBJ
 88K/88,d3>T\\44>>FFF>T\\44>>FFF$*83zl#fX!FJ$([!jj&&(*?,AW&^TXXf=MsTFe..= GLDLL))*BCQVDLL))*MNGLDLL))*CD= :"iikc!*k:F. iikI-c25??xj8I(,TUf%88)*v&)11#6e  	CS#uUFe..=M	l ! cF/1Dq'!*C++h3C++&8"=C$"3"33,,U-?-?@'=t'8'8'=c'JT'JK$"&))+";C!@H!+c"2D9'*xx{8;I{SVGW8X1Z ([**!OO'j(9(73%rR^Q__`acc .  	  !3!34F	sc   /(K F9P< L  P< 	L&,LLL A3P7P< BP74P< 6P77P< <.Q.-Q.c                 N    |st        |      j                  dd      S dd d| dS )N
z\nr{   ')strrQ   )r7   element
includeAlls      r!   ru   z Generator._resultElementToString%  s1    w<''e44H:Qwiq))rF   c                     t         j                  t         j                  k  ry d | j                  j	                          d}|dj                  t        | j                  |             z  }t        j                  t         j                  |       y )Nr{   z GENERATOR: Results: rw   )	r   r   
debugLevelr'   r   r   r   ru   r   )r7   r   rX   s      r!   r   zGenerator._debugResultInfo+  sm    ??U---DJJ,,.//DE388C ; ;VDEFG5??D1rF   c                     g S )a   Returns the role name for the object in an array of strings, with
        the exception that the Atspi.Role.UNKNOWN role will yield an
        empty array.  Note that a 'role' attribute in args will
        override the accessible role of the obj.
        rC   rh   s      r!   _generateRoleNamezGenerator._generateRoleName9  s	     	rF   c                     |j                  dt        j                  |            }|t        j                  j
                  k(  ryy)NrB   FT)r\   r   r   r   RoleLABELr7   rA   r   rB   s       r!   _fallBackOnDescriptionForNamez'Generator._fallBackOnDescriptionForNameB  s5    xx 1 1# 675::###rF   c                     g }d| j                   j                  d<   t        j                  |      }|j	                  dt        j
                  |            }t        j                  |      }|r|j                  |       n | j                  |fi |rt        j                  |      }|r+|j                  |       d| j                   j                  d<   ned}|t        j                  j                  k(  r|}nt        j                  |      r|}|r*t        j                   |d      }	|	r|j                  |	       |sC|t        j                  j"                  k(  r&t        j$                  |      r| j'                  |      S |S )a   Returns an array of strings for use by speech and braille that
        represent the name of the object.  If the object is directly
        displaying any text, that text will be treated as the name.
        Otherwise, the accessible name of the object will be used.  If
        there is no accessible name, then the description of the
        object will be used.  This method will return an empty array
        if nothing can be found.  [[[WDW - I wonder if we should just
        have _generateName, _generateDescription,
        _generateDisplayedText, etc., that don't do any fallback.
        Then, we can allow the formatting to do the fallback (e.g.,
        'displayedText or name or description'). [[[JD to WDW - I
        needed a _generateDescription for whereAmI. :-) See below.
        Frq   rB   TN)remove_extension)r(   r   r   get_namer\   r   
get_parentappendr   get_descriptionr   r   LINKr   is_linkr   get_link_basenameICONis_panel_generateName)
r7   rA   r   r   r>   rB   parentdescriptionlinkbasenames
             r!   r   zGenerator._generateNameI  s8    BG%%&>?  %xx 1 1# 67$$S)MM$/T//<t<"2237Kk*JN--.FG5::??*D ((0!D*<<TTXYHh/$%**//1k6J6J66R%%f--rF   c                     t        j                  |      }|j                  d      }|r|t        j                  |      k7  r|gS |j                  d      }|r|t        j                  |      k7  r|gS g S )a  Returns an array of strings for use by speech and braille that
        represent the 'placeholder' text. This is typically text that
        serves as a functional label and is found in a text widget until
        that widget is given focus at which point the text is removed,
        the assumption being that the user was able to see the text prior
        to giving the widget focus.
        zplaceholder-textplaceholder)r   get_attributes_dictr\   r   )r7   rA   r   attrsr   s        r!   _generatePlaceholderTextz"Generator._generatePlaceholderTexts  sp     ,,S1ii 23;(*;*;C*@@= ii.;(*;*;C*@@= 	rF   c                    g } | j                   |fi |} | j                  |fi |}|j                  dt        j                  |            }|sU|sS|t
        j                  j                  k(  r6| j                  j                  j                  |      }| j                  |      }|s|S |j                  |       |s|S t        j                  dd|d         j                         }t        j                  dd|d         j                         }	t        |      j!                  t        |	            r4d|d   d|d   dg}
t#        j$                  t"        j&                  |
d       |S |j                  |       |S )	zReturns the label and the name as an array of strings for speech
        and braille.  The name will only be present if the name is
        different from the label.
        rB   z[\W_]rw   r   zGENERATOR: name 'z' is redundant to label 'r   T)_generateLabelr   r\   r   r   r   r   
TABLE_CELLr(   	utilitiesrealActiveDescendantextendresubsplitsetissubsetr   r   r   )r7   rA   r   r   labelr>   rB   
descendant	nameWords
labelWordsr   s              r!   _generateLabelAndNamezGenerator._generateLabelAndName  sS   
 ###C040!t!!#..xx 1 1# 6745::+@+@#@//DDSIJ%%j1D KeM FF8S$q'288:	VVHc584::<
 y>""3z?3)474OQVWXQY[^_Fe..=MdrF   c                 V     | j                   |fi |}|s | j                  |fi |}|S )zReturns the label as an array of strings for speech and braille.
        If the label cannot be found, the name will be used instead.
        If the name cannot be found, an empty array will be returned.
        )r   r   r7   rA   r   r   s       r!   _generateLabelOrNamezGenerator._generateLabelOrName  s:    
 %$$S1D1'T''4t4FrF   c                      | j                   |fi |}|rd| j                  j                  d<   |S  | j                  |fi |}|rd| j                  j                  d<   |S )NFrr   T)_generateUnrelatedLabelsr(   r   _generateDescriptionr   s       r!   %_generateUnrelatedLabelsOrDescriptionz/Generator._generateUnrelatedLabelsOrDescription  sj    ...s;d;QVDLL))*MNM***37$7QUDLL))*MNrF   c                 \   | j                   j                  j                  d      rg S | j                   j                  j                  d      rg S | j                   j                  j                  d      rg S t        j                  |      xs) | j                   j
                  j                  |      xs d}|sg S t        j                  |      }|j                  dt        j                  |            }	 | j                   j                  | j                     |   |j                  d         j                         }d|v }d|v }d
}	| j                   j
                  j                  |      xs d}
|rQ| j                   j
                  j                  ||       xr' | j                   j
                  j                  |
|       }	nS|r*|
r(| j                   j
                  j                  |
|       }	n'| j                   j
                  j                  ||       }	|	sg S |gS # t        $ r d	}d	}Y w xY w)zReturns an array of strings fo use by speech and braille that
        represent the description of the object, if that description
        is different from that of the name and label.
        rq   rs   rr   rK   rB   rl   labelAndNamelabelOrNameFT)r(   r   r\   r   r   r   displayedDescriptionr   r   rN   r'   r   rT   displayedLabelstringsAreRedundant)r7   rA   r   r   r>   rB   r   isLabelAndNameisLabelOrNamecanUser   s              r!   r   zGenerator._generateDescription  s    <<((,,-EFI<<((,,-FGI<<((,,-PQI..s3 F||%%::3?FCE 	I  %xx 1 1# 67	"\\,,TZZ8>txx?UV\\^F+v5N)V3M
 &&55c:@b//CCD+VV \!\\33GG{[[ u//CCE;WWF//CCD+VVFI}#  	""N!M	"s   5AH H+*H+c                 z    g }| j                   j                  j                  |      }|r|j                  |       |S )a  Returns the label for an object as an array of strings for use by
        speech and braille.  The label is determined by the displayedLabel
        method of the script utility, and an empty array will be returned if
        no label can be found.
        )r(   r   r   r   )r7   rA   r   r   r   s        r!   r   zGenerator._generateLabel  s7     &&55c:MM% rF   c                     g S )z8Returns an array of strings that represent a status bar.rC   rh   s      r!   _generateStatusBarzGenerator._generateStatusBar  s	     	rF   c                     g S rc   rC   rh   s      r!   _generateTermValueCountz!Generator._generateTermValueCount  rf   rF   c                 :    t        j                  |      }|r|gS g S )zReturns an array of strings for use by speech and braille that
        represent the description of the image on the object, if it
        exists.  Otherwise, an empty array is returned.
        )r   get_image_descriptionr7   rA   r   r   s       r!   _generateImageDescriptionz#Generator._generateImageDescription  s$     44S9= 	rF   c                     g S rc   rC   rh   s      r!   _generateClickablezGenerator._generateClickable  rf   rF   c                     g S rc   rC   rh   s      r!   _generateHasLongDesczGenerator._generateHasLongDesc  rf   rF   c                     g S rc   rC   rh   s      r!   _generateHasDetailszGenerator._generateHasDetails  rf   rF   c                     g S rc   rC   rh   s      r!   _generateDetailsForzGenerator._generateDetailsFor"  rf   rF   c                     g S rc   rC   rh   s      r!   _generateAllDetailszGenerator._generateAllDetails%  rf   rF   c                     g S rc   rC   rh   s      r!   _generateHasPopupzGenerator._generateHasPopup(  rf   rF   c                     g }|j                  dd      s| j                  |d<   d|d<   t        j                  |      s5|j	                   | j
                  j                  j                  di |       |S )a  Returns an array of strings for use by speech and braille that
        represent the grayed/sensitivity/availability state of the
        object, but only if it is insensitive (i.e., grayed out and
        inactive).  Otherwise, and empty array will be returned.
        r9   Ninsensitive
stringTyperC   )r\   r'   r   is_sensitiver   r(   rN   	getStringr   s       r!   _generateAvailabilityzGenerator._generateAvailability+  sh     xx%::DL*\'',MM;$,,11;;CdCDrF   c                    | j                   j                  j                  |      }|sg S g }|j                  dd       s| j                  |d<   d|d<    | j                   j
                  j                  d
i |}|dk(  r|d   }n|dk(  r|d   }n|d   }| j                   j                  j                  |      }|r|j                  | d	|        |S |j                  |       |S )Nr9   invalidr   spellingr   grammar   r   z: rC   )	r(   r   getErrorr\   r'   rN   r   getErrorMessager   )r7   rA   r   r   r   
indicators	indicatorerrorMessages           r!   _generateInvalidzGenerator._generateInvalid9  s    &&//4Ixx%::DL&\6T\\,,66>>
J"1Ii"1I"1I||--==cBMMYKr,89  MM)$rF   c                 p   g }|j                  dd      s| j                  |d<   d|d<   t        j                  |      }|s?t        j                  |      r*t        j                  |      }t        j                  |      }|r5|j                   | j                  j                  j                  di |       |S )a*  Returns an array of strings for use by speech and braille that
        represent the required state of the object, but only if it is
        required (i.e., it is in a dialog requesting input and the
        user must give it a value).  Otherwise, and empty array will
        be returned.
        r9   Nrequiredr   rC   )r\   r'   r   is_requiredis_radio_buttonr   r   r   r(   rN   r   )r7   rA   r   r   
isRequiredr   s         r!   _generateRequiredzGenerator._generateRequiredS  s     xx%::DL'\ ,,S1
k99#>((-F$008JMM;$,,11;;CdCDrF   c                 4   g }|j                  dd      s| j                  |d<   d|d<   t        j                  |      s%| j                  j
                  j                  |      r5|j                   | j                  j                  j                  di |       |S )zReturns an array of strings for use by speech and braille that
        represent the read only state of this object, but only if it
        is read only (i.e., it is a text area that cannot be edited).
        r9   Nreadonlyr   rC   )
r\   r'   r   is_read_onlyr(   r   isReadOnlyTextArear   rN   r   r   s       r!   _generateReadOnlyzGenerator._generateReadOnlyf  s    
 xx%::DL'\##C(ll$$77<MM;$,,11;;CdCDrF   c                    g }| j                   j                  j                  |      r^| j                  t        j
                  j                  |      }|j                   | j                  |fi |       | j                  ||       |S )a  Returns an array of strings for use by speech and braille that
        represent the checked state of the object.  This is typically
        for check boxes that are in a table. An empty array will be
        returned if this is not a checkable cell.
        )
r(   r   hasMeaningfulToggleActionr_   r   r   	CHECK_BOXr   r   ra   r7   rA   r   r   r^   s        r!   _generateCellCheckedStatez#Generator._generateCellCheckedStatet  sn     <<!!;;C@(()=)=tDGMM-$--4t45gt,rF   c                 v   g }|j                  dd      s| j                  |d<   d|d<    | j                  j                  j                  di |}t        j                  |      r|j                  |d          |S t        j                  |      r|j                  |d          |S |j                  |d          |S )	  Returns an array of strings for use by speech and braille that
        represent the checked state of the object.  This is typically
        for check boxes. [[[WDW - should we return an empty array if
        we can guarantee we know this thing is not checkable?]]]
        r9   Ncheckboxr   r   r   r   rC   )	r\   r'   r(   rN   r   r   
is_checkedr   is_indeterminater7   rA   r   r   r  s        r!   _generateCheckedStatezGenerator._generateCheckedState  s     xx%::DL'\6T\\,,66>>
!!#&MM*Q-(
 	 ))#.MM*Q-(  MM*Q-(rF   c                     g }|j                  dd      s| j                  |d<   d|d<    | j                  j                  j                  di |}t        j                  |      r|j                  |d          |S |j                  |d          |S )r  r9   Nradiobuttonr   r   r   rC   r\   r'   r(   rN   r   r   r  r   r  s        r!   _generateRadioStatezGenerator._generateRadioState  s     xx%::DL*\6T\\,,66>>
!!#&MM*Q-(  MM*Q-(rF   c                    t         j                  j                  t         j                  j                  t         j                  j                  t         j                  j
                  t         j                  j                  t         j                  j                  gfd}t        j                  t        j                  |            r+t        j                  ||      }|r| j                  |d      S g S )Nc                 2    t        j                  |       v S rc   )r   r   )r:   widgetRoless    r!   isWidgetz0Generator._generateChildWidget.<locals>.isWidget  s    $$Q';66rF   F)ro   )r   r   r  	COMBO_BOXPUSH_BUTTONRADIO_BUTTONSLIDERTOGGLE_BUTTONr   is_list_boxr   r   find_descendantr   )r7   rA   r   r#  widgetr"  s        @r!   _generateChildWidgetzGenerator._generateChildWidget  s    zz++zz++zz--zz..zz((zz//1	7 ""8#6#6s#;<--c8<F}}VE}BB	rF   c                 J   g }|j                  dd       s| j                  |d<   d|d<    | j                  j                  j                  di |}t        j                  |      st        j                  |      r|j                  |d          |S |j                  |d          |S )Nr9   switchr   r   r   rC   	r\   r'   r(   rN   r   r   r  
is_pressedr   r  s        r!   _generateSwitchStatezGenerator._generateSwitchState  s    xx%::DL%\6T\\,,66>>
!!#&+*@*@*EMM*Q-(  MM*Q-(rF   c                 J   g }|j                  dd      s| j                  |d<   d|d<    | j                  j                  j                  di |}t        j                  |      st        j                  |      r|j                  |d          |S |j                  |d          |S )r  r9   Ntogglebuttonr   r   r   rC   r/  r  s        r!   _generateToggleStatezGenerator._generateToggleState  s     xx%::DL+\6T\\,,66>>
!!#&+*@*@*EMM*Q-(  MM*Q-(rF   c                     t        j                  |      st        j                  |      r | j                  |fi |S t        j                  |      r | j                  |fi |S g S rc   )r   is_checkableis_check_menu_itemr  r  rh   s      r!    _generateCheckedStateIfCheckablez*Generator._generateCheckedStateIfCheckable  s`    ##C(K,J,J3,O-4--c:T::!!#&-4--c:T::	rF   c                     g }|j                  dd      s| j                  |d<   d|d<    | j                  j                  j                  di |}t        j                  |      r|j                  |d          |S )zReturns an array of strings for use by speech and braille that
        represent the checked state of the menu item, only if it is
        checked. Otherwise, and empty array will be returned.
        r9   Nr  r   r   rC   r  r  s        r!   _generateMenuItemCheckedStatez'Generator._generateMenuItemCheckedState  sp    
 xx%::DL'\6T\\,,66>>
!!#&MM*Q-(rF   c                    g }|j                  dd      s| j                  |d<   d|d<    | j                  j                  j                  di |}t        j                  |      r|j                  |d          |S t        j                  |      r|j                  |d          |S t        j                  |      r|j                  |d          |S )zReturns an array of strings for use by speech and braille that
        represent the expanded/collapsed state of an object, such as a
        tree node. If the object is not expandable, an empty array
        will be returned.
        r9   N	expansionr   r   r   rC   )
r\   r'   r(   rN   r   r   is_collapsedr   is_expandedis_expandabler  s        r!   _generateExpandableStatez"Generator._generateExpandableState  s     xx%::DL(\6T\\,,66>>
##C(MM*Q-(  $$S)MM*Q-(  &&s+MM*Q-(rF   c                    g }|j                  dd      s| j                  |d<   d|d<   t        j                  |      rJt	        j
                  |      r5|j                   | j                  j                  j                  di |       |S )a  Returns an array of strings (and possibly voice and audio
        specifications) that represent the multiselectable state of
        the object.  This is typically for list boxes. If the object
        is not multiselectable, an empty array will be returned.
        r9   Nmultiselectr   rC   )
r\   r'   r   is_multiselectabler   get_child_countr   r(   rN   r   r   s       r!   _generateMultiselectableStatez'Generator._generateMultiselectableState  su     xx%::DL*\))#.83K3KC3PMM;$,,11;;CdCDrF   c                    |j                  d      rg S g }|j                  d      r&t        j                  ||j                  d            }nt        j                  |      }g }|D ]Z  }| j                  j
                  j                  |      }|s+|j                         s<|j                  |j                                \ |s|S dj                  |      }| j                  |t        j                  j                        }	|j                  d      dk(  r<t        j                  t        j                   k(  r6|j                  d      d	vr#| d
|	 }n|j                  d      dk(  r| d
|	 }|j                  |       |S )zReturns an array of strings to be used in speech and braille that
        represent the row header for an object that is in a table, if
        it exists.  Otherwise, an empty array is returned.
        
readingRownewOnlypriorObj. rB   r9   speechrl   basicWhereAmIdetailedWhereAmIrw   r   )r\   r   get_new_row_headersget_row_headersr(   r   displayedTextstripr   r   getLocalizedRoleNamer   r   
ROW_HEADERr   speechVerbosityLevelVERBOSITY_LEVEL_VERBOSE
r7   rA   r   r   headersr   headertokentext
roleStrings
             r!   _generateRowHeaderzGenerator._generateRowHeader  sL    88L!I88I11#txx
7KLG--c2G 	-FLL**88@Eekkm,	-
 Myy //%**:O:O/P
88Fx',,0P0PP88L)1VVq-XXf*V1ZL)DdrF   c                    g }|j                  d      r&t        j                  ||j                  d            }nt        j                  |      }g }|D ]Z  }| j                  j
                  j                  |      }|s+|j                         s<|j                  |j                                \ |s|S dj                  |      }| j                  |t        j                  j                        }	|j                  d      dk(  r<t        j                  t        j                   k(  r6|j                  d      dvr#| d	|	 }n|j                  d      d
k(  r| d	|	 }|j                  |       |S )zReturns an array of strings (and possibly voice and audio
        specifications) that represent the column header for an object
        that is in a table, if it exists.  Otherwise, an empty array
        is returned.
        rH  rI  rJ  rK  r9   rL  rl   rM  rw   r   )r\   r   get_new_column_headersget_column_headersr(   r   rR  rS  r   r   rT  r   r   COLUMN_HEADERr   rV  rW  rX  s
             r!   _generateColumnHeaderzGenerator._generateColumnHeader:  s;    88I44S$((::NOG005G 	-FLL**88@Eekkm,	-
 Myy //%**:R:R/S
88Fx',,0P0PP88L)1VVq-XXf*V1ZL)DdrF   c                 Z    | j                   j                  j                  |      }|sg S |gS rc   )r(   r   getSortOrderDescriptionr   s       r!   _generateSortOrderzGenerator._generateSortOrder[  s,    ll,,DDSII}rF   c           	         g }t        j                  |      dk(  rg }ddg}t        t        j                  |            D ]1  \  }}| j                  j
                  j                  |      s,d||<    n |d   r
|d   sddg}n|d   s	|d   rddg}|rC|D ]>  }||   r	|j                   | j                  t        j                  ||      fi |       @ |S )zReturns an array of strings for use by speech and braille for the
        label of a toggle in a table cell that has a special 2 child
        pattern that we run into.  Otherwise, an empty array is
        returned.
        r   FTr   r   
r   rD  	enumerateiter_childrenr(   r   r  r   r   	get_childr7   rA   r   r   	cellOrder	hasToggleichilds           r!   _generateTableCell2ChildLabelz'Generator._generateTableCell2ChildLabelb  s      ##C(A-II%h&<&<S&AB 5<<))CCEJ#'IaL |IaLH	q\ilH	" YA$Q<mdmmH4F4FsA4N&WRV&WXY rF   c           	         g }t        j                  |      dk(  rg }ddg}t        t        j                  |            D ]1  \  }}| j                  j
                  j                  |      s,d||<    n |d   r
|d   sddg}n|d   s	|d   rddg}|rC|D ]>  }||   s	|j                   | j                  t        j                  ||      fi |       @ |S )zReturns an array of strings for use by speech and braille for the
        toggle value of a toggle in a table cell that has a special 2
        child pattern that we run into.  Otherwise, an empty array is
        returned.
        r   FTr   r   rh  rl  s           r!   _generateTableCell2ChildTogglez(Generator._generateTableCell2ChildToggle  s      ##C(A-II%h&<&<S&AB 5<<))CCEJ#'IaL |IaLH	q\ilH	" YA |mdmmH4F4FsA4N&WRV&WXY rF   c                    |d   dk(  r|j                  dd      sg S g }| j                  j                  j                  |      }| j                  j                  j	                  |      }|sc| j                  j                  j                  |      r>t        j                  |      }|r'|j                  t        j                  |d                |S )zIf this table cell has a "toggle" action, and doesn't have any
        label associated with it then also speak the table column
        header.  See Orca bug #455230 for more details.
        r9   rL  rG  Fr   )r\   r(   r   r   rR  r  r   ra  r   r   r   )r7   rA   r   r   r   r   rY  s          r!   &_generateColumnHeaderIfToggleAndNoTextz0Generator._generateColumnHeaderIfToggleAndNoText  s     <8#DHH\5,II\\++@@E
&&44Z@//II#N2237gh//
;<rF   c                     g }| j                  d|      }|j                   | j                  |fi |       | j                  ||       |S )a`  Orca has a feature to automatically read an entire row of a table
        as the user arrows up/down the roles.  This leads to
        complexity in the code.  This method is used to return an
        array of strings for use by speech and braille for a single
        table cell itself.  The string, 'blank', is added for empty
        cells.
        REAL_ROLE_TABLE_CELL)r_   r   r   ra   r  s        r!   _generateRealTableCellz Generator._generateRealTableCell  sM     $$%;TBmdmmC0401'4(rF   c                    | j                   j                  j                  |      rg S | j                   j                  j                  |      rg S t	        j
                  |      }t	        j                  |      }|dk  s|dk  r'| j                   j                  j                  |      sg S |dk(  r|dk(  r | j                  |fi |S t        j                  ||      gS )zaReturns an array of strings for use by speech and braille to present
        the size of a table.r   )r(   r   isLayoutOnlyisSpreadSheetTabler   get_row_countget_column_countrowOrColumnCountUnknownr   r	   	tableSize)r7   rA   r   rowscolss        r!   _generateTablezGenerator._generateTable  s     <<!!..s3I<<!!44S9I$$S)'', 1Hq<<))AA#FI
 19)4))#666""4.//rF   c                    |j                  d      du xs\ |j                  d      dk(  xsF | j                  dk(  xs5 | j                  j                  j	                  ||j                  d            }|s | j
                  |fi |S d|d<   g }| j                  j                  j                  |d      }g d}|j                         }|D ]  }|j                  |d	        |D ]  }	|	|k(  r | j
                  |	fi |}
n | j
                  |	fi |}
|
rC|rA| j                  dk(  r2|j                  t        j                  t        j                               |j                  |
        |j                   | j                  |fi |       |S )
a  Orca has a feature to automatically read an entire row of a table
        as the user arrows up/down the roles.  This leads to complexity in
        the code.  This method is used to return an array of strings
        (and possibly voice and audio specifications) for an entire row
        in a table if that's what the user has requested and if the row
        has changed.  Otherwise, it will return an array for just the
        current cell.
        rG  Trl   rO  r   rI  )forceFullRow)startOffset	endOffsetstringN)r\   r'   r(   r   shouldReadFullRowrx  getShowingCellsInSameRowcopypopr   r   Regionr
   TABLE_CELL_DELIMITER_BRAILLEr   _generatePositionInList)r7   rA   r   
presentAllr   cellsdoNotIncludeotherCellArgsrY   cell
cellResults              r!   _generateTableCellRowzGenerator._generateTableCellRow  s    XXl+t3 Sxx%);;SzzY&S ||%%77TXXj=QR 	
 .4..s;d;;!\&&??RV?W >		 	)Cc4(	)  	&Ds{8T88FF
8T88OO
fy)@gnn->-[-[\]MM*%	& 	2d223?$?@rF   c                     g S )z>Returns the expanded embedded object characters for an object.rC   rh   s      r!   _generateExpandedEOCszGenerator._generateExpandedEOCs  s    	rF   c                     |j                  d      }|j                  d      }||g S |j                  d| j                  j                  j                  |||            }|r| j                  j                  |vr|gS g S )Nr  r  r  )r\   r(   r   	substringEMBEDDED_OBJECT_CHARACTER)r7   rA   r   startendr  s         r!   _generateSubstringzGenerator._generateSubstring  sw    'hh{#=CKIHHXt||'='='G'GUTW'XY	??yP;	rF   c                 $    |j                  d      S )Nr  r[   rh   s      r!   _generateStartOffsetzGenerator._generateStartOffset  s    xx&&rF   c                 $    |j                  d      S )Nr  r[   rh   s      r!   _generateEndOffsetzGenerator._generateEndOffset  s    xx$$rF   c                      | j                   |fi |}|r|S | j                  j                  |      \  }}}|r| j                  j                  |vr|gS g S )zReturns an array of strings for use by speech and braille
        that represents the current line of text, if
        this is a text object.  [[[WDW - consider returning an empty
        array if this is not a text object.]]]
        )r  r(   getTextLineAtCaretr  )r7   rA   r   r   r\  caretOffsetr  s          r!   _generateCurrentLineTextz"Generator._generateCurrentLineText"  s^     )((55M+/<<+J+J3+O({KDLL::$F6M	rF   c                      | j                   |fi |}|r|S | j                  j                  j                  |      }|sg S |gS )zReturns an array of strings for use by speech and braille that
        represents all the text being displayed by the object.
        )r  r(   r   rR  )r7   rA   r   r   rR  s        r!   _generateDisplayedTextz Generator._generateDisplayedText2  sM     )((55M..<<SAIrF   c                     g }|j                  dd      s| j                  |d<   d|d<   | j                  j                  j	                  |      }|dk\  r;|j                   | j                  j                  j                  di ||dz   z         |S )zReturns an array of strings for use by speech and braille that
        represents the tree node level of the object, or an empty
        array if the object is not a tree node.
        r9   N	nodelevelr   r   r   rC   )r\   r'   r(   r   	nodeLevelr   rN   r   )r7   rA   r   r   levels        r!   _generateNodeLevelzGenerator._generateNodeLevelF  s    
 xx%::DL(\&&005A:MM;$,,11;;CdC"QY( )rF   c                 v   |j                  dt        j                  |            }|t        j                  j
                  k(  r(| j                  j                  j                  |      }|gS |t        j                  j                  k(  rt        j                  |      sg S t        j                  |      }|r|gS g S )aM  Returns an array of strings for use by speech and braille that
        represents the value of the object.  This is typically the
        numerical value, but may also be the text of the 'value'
        attribute if it exists on the object.  [[[WDW - we should
        consider returning an empty array if there is no value.
        rB   )r\   r   r   r   r   r$  r(   r   getComboBoxValue	SEPARATORr   
is_focusedr   get_current_value_text)r7   rA   r   rB   valuer   s         r!   _generateValuezGenerator._generateValue[  s     xx 1 1# 675::'''LL**;;C@E7N5::'''0F0Fs0KI//48O	rF   c                     g }t        j                  t        j                  |            }|r|j                  |       |S )zReturns an array of strings for use by speech and braille that
        represents the name of the application for the object.
        )r   r   get_applicationr   )r7   rA   r   r   r>   s        r!   _generateApplicationNamez"Generator._generateApplicationNamev  s8       !9!9#!>?MM$rF   c                 d   |j                  d      }|j                  d      }||g S g }|j                  dd      s| j                  |d<   d|d<   | j                  j                  j	                  |      }|r8|j                   | j                  j                  j                  di ||z         |S )zReturns an array of strings for use by speech and braille that
        represent the nesting level of an object in a list.
        r  r  Nr9   nestinglevelr   rC   )r\   r'   r(   r   nestingLevelr   rN   r   )r7   rA   r   r  r  r   r  s          r!   _generateNestingLevelzGenerator._generateNestingLevel  s     'hh{#Ixx%::DL+\||--::3?MM;$,,11;;CdC() *rF   c                    t        j                  |      sg S d}t        j                  |t        j
                  j                        }|r|j                  d      }|r&| j                  j                  j                  |      gS t        j                  |      }|rWt        j                  |      st        j                  |      r| j                  |      }|r|S t        j                  |      }|rWg S )zReturns an array of strings for use by speech and braille that
        represents the radio button group label for the object, or an
        empty array if the object has no such label.
        Nr   )r   r  r   get_relationr   RelationTypeLABELLED_BY
get_targetr(   r   rR  get_parent_checkedr   	is_fillerr   )r7   rA   r   radioGroupLabelrelationr   r   s          r!   _generateRadioButtonGroupz#Generator._generateRadioButtonGroup  s    
 **3/I((e.@.@.L.LM&11!4OLL**88IJJ,,S1##F+{/D/DV/L226: L008F  	rF   c                    | j                   j                  j                  |      }t        j                  |      rt        j                  |      s | j                  |fi |S t        t        j                  |      D cg c]5  }| j                   j                  j                  |      j                         7 c}      }dj                  t        d |            }|s | j                  |fi |S |gS c c}w )aN  Objects, such as tables and trees, can represent individual cells
        via a complicated nested hierarchy.  This method returns an
        array of strings for use by speech and braille that represents
        the text actually being painted in the cell, if it can be
        found.  Otherwise, an empty array is returned.
        rw   c                     | S rc   rC   ry   s    r!   rz   zFGenerator._generateRealActiveDescendantDisplayedText.<locals>.<lambda>  s    q rF   )r(   r   r   r   is_table_cellr   rD  r  r   rj  rR  rS  r   r   )r7   rA   r   radr:   contentrvs          r!   *_generateRealActiveDescendantDisplayedTextz4Generator._generateRealActiveDescendantDisplayedText  s     ll$$99#>))#.83K3KC3P.4..s;d;;++C02 ||--;;A>DDF 2 3XXf['23.4..s;d;;t2s   ?:C4c                     | j                   j                  j                  |      }t        j                  |      |d<    | j
                  |fi |S )a  Objects, such as tables and trees, can represent individual cells
        via a complicated nested hierarchy.  This method returns an
        array of strings for use by speech and braille that represents
        the role of the object actually being painted in the cell.
        rB   )r(   r   r   r   r   r   )r7   rA   r   r  s       r!   %_generateRealActiveDescendantRoleNamez/Generator._generateRealActiveDescendantRoleName  sJ     ll$$99#>((-V%t%%c2T22rF   c                     g }t        j                  |      }|rTt        j                  |      r'| j	                  |      }|r|j                  |       	 |S t        j                  |      }|rT|S )zReturns an array of strings for use by speech and braille that
        represents the nearest ancestor of an object which is a named panel.
        )r   r  r   r   r   r   )r7   rA   r   r   r   r   s         r!   _generateNamedContainingPanelz'Generator._generateNamedContainingPanel  so     ,,S1##F+226:MM%( 008F  rF   c                     g S rc   rC   rh   s      r!   _generatePageSummaryzGenerator._generatePageSummary  rf   rF   c                     g S rc   rC   rh   s      r!   r  z!Generator._generatePositionInList  rf   rF   c                     g S rc   rC   rh   s      r!   _generateProgressBarIndexz#Generator._generateProgressBarIndex  rf   rF   c                     g S rc   rC   rh   s      r!   _generateProgressBarValuez#Generator._generateProgressBarValue  rf   rF   c                 Z    t        t        j                         j                  d            S )NprogressBarUpdateInterval)intr   
getManager
getSetting)r7   s    r!   _getProgressBarUpdateIntervalz'Generator._getProgressBarUpdateInterval  s#    #..0;;<WXYYrF   c                 ,   t        j                  |      }| j                  ||       \  }}||k(  r,d|d|g}t        j                  t        j
                  |d       y|dk(  ryt        t        j                         |z
        }|| j                         k\  S )N)typez$GENERATOR: Not presenting update forz. Value stillTFd   )	r   get_value_as_percent getProgressBarUpdateTimeAndValuer   r   r   r  r   r  )r7   rA   r   percentlastTime	lastValuer   intervals           r!   _shouldPresentProgressBarUpdatez)Generator._shouldPresentProgressBarUpdate  s    ..s3"CCCdCS)i<c?T[\Fe..=c>tyy{X-.4==???rF   c                     t        t        t        j                  | j                              }|D ci c]  }|| j                  j                  |        c}| _        y c c}w rc   )r   r   r   is_validr)   r\   )r7   barsr:   s      r!   _cleanUpCachedProgressBarsz$Generator._cleanUpCachedProgressBars  sK    F8,,d.F.FGHOS#T!Ad&>&>&B&B1&E$E#T #Ts   #Ac                    | j                          | j                  j                         syt        | j                  j                         d       }|d   \  }}t	        | j                  j                               d   ||fS )N)N        Nc                     | d   S )Nr   rC   ry   s    r!   rz   z;Generator._getMostRecentProgressBarUpdate.<locals>.<lambda>  s    qQRt rF   )rU   )r  r)   valuessortedr   rM   )r7   sortedValuesprevTime	prevValues       r!   _getMostRecentProgressBarUpdatez)Generator._getMostRecentProgressBarUpdate  ss    '')''..0"d66==?^T*2.)D,,1134R8(IMMrF   c                    | j                          || j                  vrd| j                  |<   | j                  |      }t        | j                  j	                               j                  |      }|dz   t        | j                        fS )Nr  Nr   )r  r)   r  r   r  indexr4   )r7   rA   	thisValuer  s       r!   getProgressBarNumberAndCountz&Generator.getProgressBarNumberAndCount  sz    '')d...,5D$$S)99#>	T--4467==iHqy#d66777rF   c                 r    || j                   vrd| j                   |<   | j                   j                  |      S )Nr  )r)   r\   rh   s      r!   r  z*Generator.getProgressBarUpdateTimeAndValue
  s7    d...,5D$$S)''++C00rF   Nc                     |xs t        j                          }|xs t        j                  |      }||f| j                  |<   y rc   )r   r   r  r)   )r7   rA   r  r  s       r!   r   z*Generator.setProgressBarUpdateTimeAndValue  s<    *tyy{B!=!=c!B	(0)(;  %rF   c                 
   | j                   j                  j                  |      r
| j                   j                  j                  |      ry| j                   j                  j	                  |      ry| j                   j                  j                  |      ry| j                   j                  j                  |      ry| j                   j                  j                  |      ry| j                   j                  j                  |      ry| j                   j                  j                  |      ry| j                   j                  j                  |      r<| j                   j                  j                  |      ryt        j                  |      ry	| j                   j                  j                  |      ry
| j                   j                  j                  |      rt         j"                  j$                  S | j                   j                  j'                  |      rt         j"                  j(                  S | j                   j                  j+                  |      rt         j"                  j,                  S | j                   j                  j/                  |      ry| j                   j                  j1                  |      ry| j                   j                  j3                  |      ry| j                   j                  j5                  |      ry| j                   j                  j7                  |      ry| j                   j                  j9                  |      rt         j"                  j:                  S | j                   j                  j=                  |      rt         j"                  j>                  S | j                   j                  jA                  |      rt         j"                  jB                  S | j                   j                  jE                  |      ry| j                   j                  jG                  |      ry| j                   j                  j                  |      r@| j                   j                  jI                  |      ryt         j"                  jJ                  S | j                   j                  jM                  |      rt         j"                  jN                  S | j                   j                  jQ                  |      r/tS        jT                  |      rt         j"                  jV                  S |jY                  dtS        jZ                  |            S )NROLE_MATH_SCRIPT_SUBSUPERROLE_MATH_SCRIPT_UNDEROVERROLE_MATH_MULTISCRIPTROLE_MATH_ENCLOSEDROLE_MATH_FENCEDROLE_MATH_TABLEROLE_MATH_TABLE_ROWROLE_DPUB_LANDMARKROLE_DPUB_SECTIONROLE_SWITCHROLE_CONTENT_DELETIONROLE_CONTENT_ERRORROLE_CONTENT_INSERTIONROLE_CONTENT_MARKROLE_CONTENT_SUGGESTIONROLE_ARTICLE_IN_FEED	ROLE_FEEDROLE_REGIONrB   ).r(   r   isMathisMathSubOrSuperScriptisMathUnderOrOverScriptisMathMultiScriptisMathEncloseisMathFencedisMathTableisMathTableRowisDPub
isLandmarkr   
is_sectionisSwitchisAnchorr   r   STATICisBlockquoteBLOCK_QUOTE	isCommentCOMMENTisContentDeletionisContentErrorisContentInsertionisContentMarkedisContentSuggestionisDescriptionListDESCRIPTION_LISTisDescriptionListTermDESCRIPTION_TERMisDescriptionListDescriptionDESCRIPTION_VALUEisFeedArticleisFeedisLandmarkRegionLANDMARKisFocusableLabel	LIST_ITEM
isDocumentr   supports_imageIMAGEr\   r   rh   s      r!   _getAlternativeRolezGenerator._getAlternativeRole  s   <<!!((-||%%<<SA2||%%==cB3||%%77<.||%%33C8+||%%2237)||%%11#6(||%%44S9,<<!!((-||%%005+%%c**<<!!**3/ <<!!**3/::$$$<<!!..s3::)))<<!!++C0::%%%<<!!33C8*<<!!005'<<!!44S9+<<!!11#6&<<!!55c:,<<!!33C8::...<<!!77<::...<<!!>>sC::///<<!!//4)<<!!((-<<!!,,S1||%%66s;$::&&&<<!!2237::'''<<!!,,S1h6M6Mc6R::###xx 1 1# 677rF   c                    |j                  dt        j                  |            }t        j                  |      rdt	        j
                  |      rt        j                  S t	        j                  |      rt        j                  S t	        j                  |      rt        j                  S t	        j                  |      rt        j                  S t	        j                  |      rt        j                  S t	        j                   |      rt        j"                  S t	        j$                  |      rqt	        j&                  |      s|j                  dd      rJt	        j(                  |      rt        j"                  S t	        j*                  |      rt        j                  S | j,                  j.                  j1                  |      rt        j2                  S | j,                  j.                  j5                  |      rt        j6                  S | j,                  j.                  j9                  |      rt        j:                  S | j,                  j.                  j=                  |      rt        j>                  S | j,                  j.                  jA                  |      rt        jB                  S | j,                  j.                  jE                  |      r| j,                  j.                  jG                  |      r| j,                  j.                  jI                  |      rt        jJ                  S | j,                  j.                  jM                  |      rt        jN                  S | j,                  j.                  jQ                  |      rt        jR                  S | j,                  j.                  jU                  |      rt        jV                  S | j,                  j.                  jY                  |      rt        jZ                  S | j,                  j.                  j]                  |      rt        j^                  S | j,                  j.                  ja                  |      rt        jb                  S | j,                  j.                  je                  |      rt        jf                  S | j,                  j.                  ji                  |      rt        jj                  S | j,                  j.                  jm                  |      rt        jn                  S | j,                  j.                  jq                  |      rt        jr                  S | j,                  j.                  ju                  |      rt        jv                  S | j,                  j.                  jy                  |      rt        jz                  S | j,                  j.                  j}                  |      rt        j~                  S | j,                  j.                  j                  |      rt        j                  S | j,                  j.                  j                  |      rt        j                  S | j,                  j.                  j                  |      rt        j                  S | j,                  j.                  j                  |      rt        j                  S | j,                  j.                  j                  |      rt        j                  S |dk(  r| j,                  j.                  j                  |      rt        j                  S | j,                  j.                  j                  |      rt        j                  S | j,                  j.                  j                  |      rt        j                  S | j,                  j.                  j                  |      rt        j                  S | j,                  j.                  j                  |      rt        j                  S | j,                  j.                  j                  |      rt        j                  S | j,                  j.                  j                  |      rt        j                  S | j,                  j.                  j                  |      r6t        j                  S |t        j                  j                  k(  rj| j,                  j.                  j                  |      rt        j                  S | j,                  j.                  j                  |      rt        j                  S | j,                  j.                  j                  |      rt        j                  S | j,                  j.                  j                  |      rt        j                  S | j,                  j.                  j                  |      rt        j                  S | j,                  j.                  jG                  |      r| j,                  j.                  j                  |      ry| j,                  j.                  j                  |      rt        j                  S | j,                  j.                  j                  |      rt        j                  S | j,                  j.                  j                  |      rt        j                  S | j,                  j.                  j                  |      rt        j                  S | j,                  j.                  j                  |      rt        j                  S | j,                  j.                  j                  |      rt        j                  S | j,                  j.                  j                  |      rt        j                  S | j,                  j.                  j                  |      rZt        j                  j                  }n?| j,                  j.                  j                  |      rt        j                  j                  }t        |t        j                        s	 |j                         S t        j                  |      }t        j                  |      }|t        j                  j                   k(  r3|t        j                  j                  k(  rt        j                  d      }t        j                  |      S # t        $ r Y yw xY w)NrB   rm   Fr  rK   	statusbar)r\   r   r   supports_valuer   is_horizontal_sliderr
   ROLE_SLIDER_HORIZONTALis_vertical_sliderROLE_SLIDER_VERTICALis_horizontal_scrollbarROLE_SCROLL_BAR_HORIZONTALis_vertical_scrollbarROLE_SCROLL_BAR_VERTICALis_horizontal_separatorROLE_SPLITTER_HORIZONTALis_vertical_separatorROLE_SPLITTER_VERTICALis_split_paner  is_horizontalis_verticalr(   r   r%  r  r-  r  isFigureROLE_FIGUREisMenuButtonROLE_MENU_BUTTONr  r  r  r  isDPubAcknowledgmentsROLE_ACKNOWLEDGMENTSisDPubAfterwordROLE_AFTERWORDisDPubAppendixROLE_APPENDIXisDPubBibliographyROLE_BIBLIOGRAPHYisDPubChapterROLE_CHAPTERisDPubConclusionROLE_CONCLUSIONisDPubCreditsROLE_CREDITSisDPubEndnotesROLE_ENDNOTESisDPubEpilogueROLE_EPILOGUEisDPubErrataROLE_ERRATAisDPubForewordROLE_FOREWORDisDPubGlossaryROLE_GLOSSARYisDPubIndex
ROLE_INDEXisDPubIntroductionROLE_INTRODUCTIONisDPubPagelistROLE_PAGELIST
isDPubPart	ROLE_PARTisDPubPrefaceROLE_PREFACEisDPubPrologueROLE_PROLOGUE	isDPubTocROLE_TOCisDPubAbstractROLE_ABSTRACTisDPubColophonROLE_COLOPHONisDPubCreditROLE_CREDITisDPubDedicationROLE_DEDICATIONisDPubEpigraphROLE_EPIGRAPHisDPubExampleROLE_EXAMPLEisDPubPullquoteROLE_PULLQUOTE	isDPubQnaROLE_QNAr   r   r1  isDPubBiblioentryROLE_BIBLIOENTRYisDPubEndnoteROLE_ENDNOTEisDPubCover
ROLE_COVERisDPubPagebreakROLE_PAGEBREAKisDPubSubtitleROLE_SUBTITLEisLandmarkWithoutTypeisLandmarkBannerROLE_LANDMARK_BANNERisLandmarkComplementaryROLE_LANDMARK_COMPLEMENTARYisLandmarkContentInfoROLE_LANDMARK_CONTENTINFOisLandmarkMainROLE_LANDMARK_MAINisLandmarkNavigationROLE_LANDMARK_NAVIGATIONr.  ROLE_LANDMARK_REGIONisLandmarkSearchROLE_LANDMARK_SEARCHisLandmarkFormFORMr  r   r1   rT  rT   role_get_namer   role_for_nameINVALID
STATUS_BARrole_get_localized_name)r7   rA   r   rB   nonlocalizedatkRoles         r!   rT  zGenerator.getLocalizedRoleNameQ  s   xx 1 1# 67""3'//4(???--c2(===2237(CCC005(AAA2237(AAA005(???((-**3/488<Le3T,,S1,CCC**3/,EEE<<!!55c:$<<<<<!!((-$...<<!!**3/$000<<!!..s3$555<<!!**3/$000<<!!((-||%%005<<))??D,AAA<<))99#>,;;;<<))88=,:::<<))<<SA,>>><<))77<,999<<))::3?,<<<<<))77<,999<<))88=,:::<<))88=,:::<<))66s;,888<<))88=,:::<<))88=,:::<<))55c:,777<<))<<SA,>>><<))88=,:::<<))44S9,666<<))77<,999<<))88=,:::<<))33C8,555,,<<))88=,:::<<))88=,:::<<))66s;,888<<))::3?,<<<<<))88=,:::<<))77<,999<<))99#>,;;;<<))33C8,555---<<));;C@,===<<))77<,999<<))55c:,777<<))99#>,;;;<<))88=,:::<<!!,,S1||%%;;C@||%%66s;(===||%%==cB(DDD||%%;;C@(BBB||%%44S9(;;;||%%::3?(AAA||%%66s;(===||%%66s;(===||%%44S9zz\\##--c2::%%D$

+//11 **40##L1chh&&&45::3H3H+H''4G**733  s   r4 4	s ?s c                    | j                   j                  j                  |      r | j                  |fi |S |j	                  dt        j                  |            }|t        j                  j                  k(  r | j                  |fi |S |t        j                  j                  t        j                  j                  fv r | j                  |fi |S |t        j                  j                  t        j                  j                  fv r | j                   |fi |S |t        j                  j"                  k(  r | j$                  |fi |S |t        j                  j&                  k(  r | j(                  |fi |S g S NrB   )r(   r   r  r1  r\   r   r   r   r   	MENU_ITEMr:  r&  RADIO_MENU_ITEMr  r  CHECK_MENU_ITEMr  r(  r4  r   r  r   s       r!   getStateIndicatorzGenerator.getStateIndicator  sB   <<!!**3/,4,,S9D99xx 1 1# 675::'''5455cBTBBEJJ++UZZ-G-GHH+4++C8488EJJ((%***D*DEE-4--c:T::5::+++,4,,S9D995::(((1411#>>>	rF   c                 B   |j                  dt        j                  |            }|t        j                  j
                  k(  r | j                  |fi |S |t        j                  j                  t        j                  j                  fv r | j                  |fi |S g S r  )
r\   r   r   r   r   PROGRESS_BARr  
SCROLL_BARr'  _generatePercentager   s       r!   getValuezGenerator.getValue  s    xx 1 1# 675::***1411#>>>EJJ))5::+<+<==+4++C8488	rF   )T)NN)Tr   
__module____qualname____doc__r?   rE   r6   r_   ra   re   ri   r   ru   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r
  r  r  r  r  r,  r1  r4  r8  r:  r@  rE  r^  rc  rf  rq  rs  ru  rx  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r5  rT  r  r  rC   rF   r!   r%   r%   O   s   !#*"X	un*2(T&!F	
,\

	"4&&"&
"(*"HB@@(04&\
'% (*6&0&3Z@UN81<
:8xN4`.	rF   r%   )   )(r  __id____version____date____copyright____license__girequire_versiongi.repositoryr   r   r   r   r   r   rK   r   r   r	   r
   r   r   ax_hypertextr   	ax_objectr   ax_tabler   ax_utilitiesr   ax_valuer   collections.abcabcr2   ImportErrorcollectionsr"   r-   r%   rC   rF   r!   <module>r     s   * H7 	   7E "    5%    	 
         %   % *-%" r r-  *)*s   B- -	B98B9