403Webshell
Server IP : 93.86.61.54  /  Your IP : 216.73.216.156
Web Server : Apache/2.4.62 (Ubuntu)
System : Linux rasin.ddns.net 6.8.0-124-generic #124~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 21:05:19 UTC x86_64
User : www-data ( 33)
PHP Version : 8.4.22
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3/dist-packages/orca/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3/dist-packages/orca/__pycache__/braille_generator.cpython-310.pyc
o

S�b�S�@s�dZdZdZdZdZdZddlZdd	lmZdd
lm	Z	ddlm
Z
ddlmZdd
lmZddlm
Z
ddlmZddlmZddlmZe��ZGdd�d�Ze�gZGdd�de
j�ZdS)z:Utilities for obtaining braille presentations for objects.z$Id$z
$Revision$z$Date$z-Copyright (c) 2005-2009 Sun Microsystems Inc.�LGPL�N�)�braille)�debug)�	generator)�messages)�object_properties)�
orca_state)�settings)�settings_manager)�shortRoleNamesc@seZdZdZddd�ZdS)�SpacezxA dummy class to indicate we want to insert a space into an
    utterance, but only if there is text prior to the space.� cCs
||_dS�N)�	delimiter��selfr�r�8/usr/lib/python3/dist-packages/orca/braille_generator.py�__init__-s
zSpace.__init__N�r)�__name__�
__module__�__qualname__�__doc__rrrrrr
*sr
cs�eZdZdZejejejejej	ej
fZdd�Zdd�Z
dd�Zdd	�Zd
d�Z�fdd
�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Z�fd"d#�Z�fd$d%�Zd&d'�Zd(d)�Zd*d+�Z d1d-d.�Z!d1d/d0�Z"�Z#S)2�BrailleGeneratoraTakes accessible objects and produces a list of braille Regions
    for those objects.  See the generateBraille method, which is the
    primary entry point.  Subclasses can feel free to override/extend
    the brailleGenerators instance field as they see fit.cCstj�||d�dS)Nr)r�	Generatorr)r�scriptrrrr?szBrailleGenerator.__init__cCsNtj�||�|j|d<tj|d<tj|d<tj|d<tj|d<|j	|d<dS)zCOther things to make available from the formatting string.
        �space�	Component�Region�Text�Link�asStringN)
rr�_addGlobalsrrrr r!r"r#)r�globalsDictrrrr$Bs




zBrailleGenerator._addGlobalscCslt|tjtjf�sdSz|��|j��k}|j|jjk}Wnd||jf}t�tj	|�YdS|o5|S)NFz,ERROR: Could not get names, roles for %s, %s)
�
isinstancerrr!�getRole�
accessible�namer�println�
LEVEL_INFO)r�obj�region�sameRole�sameName�msgrrr�_isCandidateFocusedRegionMsz*BrailleGenerator._isCandidateFocusedRegionc	szt�d�st�d�st�tjd�gdgS�tjkr$|�dd�s$d|d<�j�fi|��}z|d}Wnd}Yz��	�}Wnd}Y|D]L}t
|tjtj
f�re�jj�|j�d�re|}||gSt
|tj
�r}|tjkr}|jj�kr}|}||gSt
|tj�r�|tjkr�|jj�kr�|}||gSqItt��fdd	�|��}d
t|�}t�tj|�t|�dkr�|d}||gS)N�
enableBraille�enableBrailleMonitorzBRAILLE: generation disabled�
formatType�focusedrTcs���|�Sr)r1��x�r,rrr�<lambda>�sz2BrailleGenerator.generateBraille.<locals>.<lambda>z8INFO: Could not determine focused region. Candidates: %ir)�_settingsManager�
getSettingrr*r+r	�locusOfFocus�get�generater'r&rrr!�_script�	utilities�isSameObjectr(�pyatspi�ROLE_COMBO_BOX�parent�ROLE_TABLE_CELL�list�filter�len)	rr,�args�result�
focusedRegion�roler-�
candidatesr0rr8r�generateBraille[sX
�

���

�
��z BrailleGenerator.generateBraillecKs�|�d�rt�d�sgSg}|�d|���}t�d�}tjtjtjtjtj	g}|j
r9|j
��tjkr9|�|���|t
jkrG|�tjtjg�|tjkr]|jj�|�}|�tj|�|S|t
jkrx|�dd�sx||vrx|�|j|fi|���|S)aReturns the role name for the object in an array of strings, with
        the exception that the pyatspi.ROLE_UNKNOWN role will yield an
        empty array.  Note that a 'role' attribute in args will
        override the accessible role of the obj.
        �isProgressBarUpdate�brailleProgressBarUpdatesrL�brailleVerbosityLevel�
readingRowF)r=r:r;r'rB�ROLE_UNKNOWN�ROLE_REDUNDANT_OBJECT�ROLE_FILLER�
ROLE_EXTENDED�	ROLE_LINKrD�
ROLE_LIST_BOX�appendr
�VERBOSITY_LEVEL_BRIEF�extend�	ROLE_ICON�ROLE_CANVAS�ROLE_HEADINGr?r@�headingLevelr�ROLE_HEADING_LEVEL_BRAILLE�VERBOSITY_LEVEL_VERBOSE�getLocalizedRoleName)rr,rIrJrL�verbosityLevel�doNotPresent�levelrrr�_generateRoleName�s6
�
�


�
�z"BrailleGenerator._generateRoleNamecsFt�d�tjkr|�d|���}t�|�}|r|St�j|fi|��S)z�Returns the localized name of the given Accessible object; the name
        is suitable to be brailled.

        Arguments:
        - obj: an Accessible object
        �brailleRolenameStylerL)	r:r;r
�BRAILLE_ROLENAME_STYLE_SHORTr=r'r�superrb)rr,rIrL�rv��	__class__rrrb�s�
z%BrailleGenerator.getLocalizedRoleNamecKs<g}|jj�|�}|D]}|j|fi|��}|�|�q|Sr)r?r@�unrelatedLabels�
_generateNamer[)rr,rIrJ�labels�labelr)rrr�_generateUnrelatedLabels�sz)BrailleGenerator._generateUnrelatedLabelscKsJt�d�}|tjkrgSg}|jj�|�\}}}|r#|�d|d�|S)z�Returns an array of strings (and possibly voice and audio
        specifications) that represent the accelerator for the object,
        or an empty array if no accelerator can be found.
        rQ�(�))r:r;r
rZr?r@�mnemonicShortcutAcceleratorrY)rr,rIrcrJ�mnemonic�shortcut�acceleratorrrr�_generateAccelerator�s

�z%BrailleGenerator._generateAcceleratorcKs@g}z	|jj�|�}Wnd}Y|dkr|�t�|��|S)z�Returns an array of strings that says how many alerts and dialogs
        are associated with the application for this object.  [[[WDW -
        I wonder if this string should be moved to settings.py.]]]
        r)r?r@�unfocusedAlertAndDialogCountrYr�dialogCountBraille)rr,rIrJ�alertAndDialogCountrrr�_generateAlertAndDialogCount�s�z-BrailleGenerator._generateAlertAndDialogCountc	Kszg}t�d�s	|Sd|d<|�d|���}|tjk}|j}|r)|��|jvr)|j}|r�|j|kr�g}z|��}Wnd}Y|ri|tjkri|tj	kri|tj
kri|tjkri|jj
�|�si||d<|j|fi|��}|tjtjfvr�|jj
�|�}|r�t|�r�|��s�|s�|��|d<|j|fi|��}nd}|r�|r�|�t�d��|�|�|tjkr�n
|j}|r�|j|ks0|��|S)aEReturns an array of strings (and possibly voice and audio
        specifications) that represent the text of the ancestors for
        the object.  This is typically used to present the context for
        an object (e.g., the names of the window, the panels, etc.,
        that the object is contained in).  If the 'priorObj' attribute
        of the args dictionary is set, only the differences in
        ancestry between the 'priorObj' and the current obj will be
        computed.  The 'priorObj' is typically set by Orca to be the
        previous object with focus.
        �enableBrailleContextF�includeContextrLNr)r:r;r=r'rB�ROLE_RADIO_BUTTONrD�SKIP_CONTEXT_ROLESrU�ROLE_SECTION�ROLE_SPLIT_PANE�ROLE_DESKTOP_FRAMEr?r@�isLayoutOnlyr>�
ROLE_PANEL�displayedLabelrH�isspacerYrr r[�
ROLE_EMBEDDED�reverse)	rr,rIrJrL�excludeRadioButtonGrouprD�parentResultrprrr�_generateAncestorssN
	



�	

�)z#BrailleGenerator._generateAncestorscKs�g}|�d|���}|tjtjfvr|Sdt�|�vr#|jj�|�}n|jj�	|�g}|r1|ds3|St
|j|�D]}|�|�q9|S)NrL�	Selectionr)
r=r'rB�	ROLE_LISTrX�listInterfacesr?r@�selectedChildren�focusedChild�maprnr[)rr,rIrJrL�items�itemrrr�_generateFocusedItemJsz%BrailleGenerator._generateFocusedItemcKst|jj�|�}|sgS|jj�|�}|r||gkrgSg}|D]}|j|dd�}|r7|�|�|�t�d��q|S)NF�r~r)	r?r@�	statusBar�statusBarItemsr>r[rYrr )rr,rIr�r�rJ�child�childResultrrr�_generateStatusBar\s
�z#BrailleGenerator._generateStatusBarcs�tjtjtjtjtjtjg��fdd�}g}|jr@|j��tj	kr@|j
j�||�}|D]}|�
|j|dd��|�t�d��q+|S)Ncs|o|���vSr)r'r6��widgetRolesrrr9usz>BrailleGenerator._generateListBoxItemWidgets.<locals>.<lambda>Fr�r)rB�ROLE_CHECK_BOXrC�ROLE_PUSH_BUTTONr�ROLE_SLIDER�ROLE_TOGGLE_BUTTONrDr'rXr?r@�findAllDescendantsr[r>rYrr )rr,rI�isWidgetrJ�widgets�widgetrr�r�_generateListBoxItemWidgetsns�z,BrailleGenerator._generateListBoxItemWidgetscKsR|�d�r|j|fi|��sgS|��\}}}||kr'|�|�\}}d|gSgS)NrOz%s)r=�_shouldPresentProgressBarUpdate�_getMostRecentProgressBarUpdate�getProgressBarNumberAndCount)rr,rI�acc�
updateTime�updateValue�number�countrrr�_generateProgressBarIndexs
�
z*BrailleGenerator._generateProgressBarIndexcKsJ|�d�r|j|fi|��sgS|j|fi|��}|tjkr#|s#dgS|S)NrO�)r=r��_generatePercentager	r<�rr,rIrJrrr�_generateProgressBarValue�s
�z*BrailleGenerator._generateProgressBarValuecKs$|jj�|�}|durd|gSgS)Nz%s%%)r?r@�getValueAsPercent)rr,rI�percentrrrr��s
z$BrailleGenerator._generatePercentagecs$t�d�}|durt���St|�S)N�progressBarBrailleInterval)r:r;ri�_getProgressBarUpdateInterval�int)r�intervalrkrrr��s

z.BrailleGenerator._getProgressBarUpdateIntervalcs"t�d�sdSt�j|fi|��S)NrPF)r:r;rir�)rr,rIrkrrr��s
z0BrailleGenerator._shouldPresentProgressBarUpdatecKslg}|jj�|�}|D]}|�|j|fi|���|s4|�d|�}|�|j|fi|���|�||�|S)z�If this scroll pane is labelled by a page tab, then return the page
        tab information for the braille context instead. Thunderbird
        folder properties is such a case. See bug #507922 for more
        details.
        �REAL_ROLE_SCROLL_PANE)r?r@�labelsForObjectr[r>�
_overrideRole�_restoreRole)rr,rIrJrorp�oldRolerrr�_generateAsPageTabOrScrollPane�sz/BrailleGenerator._generateAsPageTabOrScrollPanec	Ks�|�d�rdSt�d�}|s|Sz|��}Wnty!d}Ynw|rg|jj�|�s3|��t	j
fvrgz
|�|jt	j
�\}}}Wn|YS|dk}|rg|��D]}|��t	jkrf|jj�|�d��}qR|S)z]Returns True or False to indicate whether context should be
        included or not.
        rOFr}Nr)r=r:r;�	queryText�NotImplementedErrorr?r@�
isTextArear'rB�
ROLE_LABEL�getTextAtOffset�caretOffset�TEXT_BOUNDARY_LINE_START�getRelationSet�getRelationType�RELATION_FLOWS_FROM�	getTarget)	rr,rI�include�text�
lineString�startOffset�	endOffset�relationrrr�_generateIncludeContext�s:

�����z(BrailleGenerator._generateIncludeContextcKsJg}t�d�s#|�dd�s|j|d<d|d<|�|jjjdi|���|S)N�disableBrailleEOL�mode�eol�
stringTyper)r:r;r=�_moderYr?�
formatting�	getStringr�rrr�_generateEol�s

zBrailleGenerator._generateEolrcCs|dkrtSt|�gS)Nr)�SPACEr
rrrrr�s
zBrailleGenerator.spacecCs�d}d}t|t�r
|}|S|rft|t�rf|r,t|dt�r,|dd�}|r,t|dt�s|rDt|dt�rD|dd�}|rDt|dt�s5|D]}t|t�rW|rW||j7}d}qF|�|�}|jj�|||�}qF|S)Nr�rr���)	r&�strrFr
rr#r?r@�appendString)r�contentr�combined�prior�elementrrrr#s*
���

�zBrailleGenerator.asStringr)$rrrrrB�	ROLE_MENU�
ROLE_MENU_BAR�ROLE_PAGE_TAB_LISTrTrSrCr�rr$r1rNrfrbrqrxr|r�r�r�r�r�r�r�r�r�r�r�r�rr#�
__classcell__rrrkrr2s@�:%I*
	r)r�__id__�__version__�__date__�
__copyright__�__license__rBr�rrrrrr	r
r�braille_rolenamesr�
getManagerr:r
r�rrrrrr�<module>s(

Youez - 2016 - github.com/yon3zu
LinuXploit