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__/tutorialgenerator.cpython-310.pyc
o

S�b�y�@sbdZdZdZdZdZdZddlZdd	lmZdd
lm	Z	ddlm
Z
ddlmZGd
d�d�Z
dS)a%Utilities for obtaining tutorial utterances for objects.  In general,
there probably should be a singleton instance of the TutorialGenerator
class.  For those wishing to override the generators, however,
one can create a new instance and replace/extend the tutorial generators
as they see fit.z$Id$z
$Revision$z$Date$z-Copyright (c) 2008-2009 Sun Microsystems Inc.�LGPL�N�)�debug)�
orca_state)�settings)�_c@s�eZdZdZdd�Zdd�Z	d2dd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd3d0d1�ZdS)4�TutorialGeneratoraTakes accessible objects and produces a tutorial string to speak
    for those objects.  See the getTutorialString method, which is the
    primary entry point.  Subclasses can feel free to override/extend
    the getTutorialGenerators instance field as they see fit.cCsP||_d|_d|_i|_|j|jtj<|j|jtj<|j	|jtj
<|j|jtj<|j
|jtj<|j|jtj<|j|jtj<|j|jtj<|j|jtj<|j|jtj<|j|jtj<|j|jtj<|j|jtj<|j|jtj<|j|jtj<|j|jtj <|j!|jtj"<|j#|jtj$<|j|jtj%<|j&|jtj'<|j|jtj(<|j)|jtj*<dS)N�)+�_script�lastTutorial�lastRole�tutorialGenerators�_getTutorialForCheckBox�pyatspi�ROLE_CHECK_BOX�_getTutorialForComboBox�ROLE_COMBO_BOX�_getTutorialForFrame�
ROLE_FRAME�_getTutorialForIcon�	ROLE_ICON�_getTutorialForLayeredPane�ROLE_LAYERED_PANE�_getTutorialForList�	ROLE_LIST�_getTutorialForListItem�ROLE_LIST_ITEM�_getTutorialForPageTab�
ROLE_PAGE_TAB�_getTutorialForText�ROLE_PARAGRAPH�ROLE_PASSWORD_TEXT�
ROLE_ENTRY�_getTutorialForPushButton�ROLE_PUSH_BUTTON�_getTutorialForSpinButton�ROLE_SPIN_BUTTON�_getTutorialForTableCellRow�ROLE_TABLE_CELL�	ROLE_TEXT�ROLE_TOGGLE_BUTTON�_getTutorialForRadioButton�ROLE_RADIO_BUTTON�_getTutorialForMenu�	ROLE_MENU�ROLE_CHECK_MENU_ITEM�_getTutorialForMenuItem�ROLE_MENU_ITEM�ROLE_RADIO_MENU_ITEM�_getTutorialForSlider�ROLE_SLIDER)�self�script�r7�8/usr/lib/python3/dist-packages/orca/tutorialgenerator.py�__init__-s`
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
��zTutorialGenerator.__init__cCs|t�tjd|�t�tjd|j�t�tjd|���t�tjd|�t�tjd�|D]}t�tjd|�q0dS)a/Prints debug.LEVEL_FINER information regarding
        the tutorial generator.

        Arguments:
        - generatorName: the name of the generator
        - obj: the object being presented
        - alreadyFocused: False if object just received focus
        - utterances: the generated text
        z
GENERATOR: %sz           obj             = %sz           role            = %sz           alreadyFocused  = %sz           utterances:z               (%s)N)r�println�LEVEL_FINER�name�getRoleName)r5�
generatorName�obj�alreadyFocused�
utterances�textr7r7r8�_debugGeneratoris(��
�����z!TutorialGenerator._debugGeneratorNcC�gS)a�The default tutorial generator returns the empty tutorial string
        because We have no associated tutorial function for the object.

        Arguments:
        - obj: an Accessible
        - alreadyFocused: False if object just received focus
        - forceTutorial: used for when whereAmI really needs the tutorial string
        - role: A role that should be used instead of the Accessible's
          possible role.

        Returns the empty list []
        r7)r5r?r@�
forceTutorial�roler7r7r8�_getDefaultTutorial�sz%TutorialGenerator._getDefaultTutorialcC�>g}td�}|s|j|gks|r|�|�|�d|||�|S)a>Get the  tutorial string for a check box.

        Arguments:
        - obj: the check box
        - alreadyFocused: False if object just received focus
        - forceTutorial: used for when whereAmI really needs the tutorial string

        Returns a list of tutorial utterances to be spoken for the object.
        zPress space to toggle.r�rr�appendrC�r5r?r@rErA�msgr7r7r8r���
�z)TutorialGenerator._getTutorialForCheckBoxcCrH)a=Get the  tutorial string for a combobox.

        Arguments:
        - obj: the combo box
        - alreadyFocused: False if object just received focus
        - forceTutorial: used for when whereAmI really needs the tutorial string

        Returns a list of tutorial utterances to be spoken for the object.
        z=Press space to expand, and use up and down to select an item.rrIrKr7r7r8r���
�z)TutorialGenerator._getTutorialForComboBoxcCspg}|jj�|�}|s|jr|j}td�}z	|jj�|�}Wnd}Y|dkr.|�|�|�d|||�|S)a6Get the  tutorial string for a frame.

        Arguments:
        - obj: the frame
        - alreadyFocused: False if object just received focus
        - forceTutorial: used for when whereAmI really needs the tutorial string

        Returns a list of tutorial utterances to be spoken for the object.
        z,Press alt+f6 to give focus to child windows.rr)r
�	utilities�
displayedText�descriptionr�unfocusedAlertAndDialogCountrJrC)r5r?r@rErAr<�childWindowsMsg�alertAndDialogCountr7r7r8r�s$
�
�z&TutorialGenerator._getTutorialForFramecCsD|j��tjkr|�|j||�}n|�|||�}|�d|||�|S)a5Get the  tutorial string for an icon.

        Arguments:
        - obj: the icon
        - alreadyFocused: False if object just received focus
        - forceTutorial: used for when whereAmI really needs the tutorial string

        Returns a list of tutorial utterances to be spoken for the object.
        r)�parent�getRolerrrrGrC)r5r?r@rErAr7r7r8r�s���z%TutorialGenerator._getTutorialForIconc
Cs�g}|jj�|�}|s|jr|j}td�}|�|�td�}|jj}z|j�d�}	Wnt	y5d}	Ynwd|vrC||	krC|�|�|sJ|j
|ksL|rMng}|�d|||�|S)aDGet the  tutorial string for a layered pane.

        Arguments:
        - obj: the layered pane
        - alreadyFocused: False if object just received focus
        - forceTutorial: used for when whereAmI really needs the tutorial string

        Returns a list of tutorial utterances to be spoken for the object.
        zDTo move to items, use either the arrow keys or type ahead searching.z0To get to the system menus press the alt+f1 key.rN�nautilusr)r
rOrPrQrrJr<rU�getChildAtIndex�AttributeErrorrrC)
r5r?r@rErAr<rL�
desktopMsg�
scriptName�siblingr7r7r8r	s4

�
��z,TutorialGenerator._getTutorialForLayeredPanecCrH)a4Get the  tutorial string for a list.

        Arguments:
        - obj: the list
        - alreadyFocused: False if object just received focus
        - forceTutorial: used for when whereAmI really needs the tutorial string

        Returns a list of tutorial utterances to be spoken for the object.
        z"Use up and down to select an item.rrIrKr7r7r8r8rNz%TutorialGenerator._getTutorialForListcCs~g}td�}td�}|��}|�tj�r5|�tj�r(|j|gks"|r'|�|�n
|j|gks0|r5|�|�|�d|||�|S)a<Get the  tutorial string for a listItem.

        Arguments:
        - obj: the listitem
        - alreadyFocused: False if object just received focus
        - forceTutorial: used for when whereAmI really needs the tutorial string

        Returns a list of tutorial utterances to be spoken for the object.
        �#To collapse, press shift plus left.�"To expand, press shift plus right.r)	r�getState�containsr�STATE_EXPANDABLE�STATE_EXPANDEDrrJrC)r5r?r@rErA�expandedMsg�collapsedMsg�stater7r7r8rSs"
�
�z)TutorialGenerator._getTutorialForListItemcCrH)a3Get the tutorial string for a menu item

        Arguments:
        - obj: the menu item
        - alreadyFocused: False if object just received focus
        - forceTutorial: used for when whereAmI really needs the tutorial string

        Returns a list of utterances to be spoken for the object.
        zTo activate press return.r0rIrKr7r7r8r0}rMz)TutorialGenerator._getTutorialForMenuItemcCsT|���tj�s
gSg}td�}|r|r |jj�|�s |�|�|�	d|||�|S)aDGet the tutorial string for a text object.

        Arguments:
        - obj: the text component
        - alreadyFocused: False if object just received focus
        - forceTutorial: used for when whereAmI really needs the tutorial string

        Returns a list of tutorial utterances to be spoken for the object.
        z
Type in text.r)
r_r`r�STATE_EDITABLErr
rO�isReadOnlyTextArearJrCrKr7r7r8r�s�
�z%TutorialGenerator._getTutorialForTextcCs:g}td�}|j|gks|r|�|�|�d|||�|S)a;Get the tutorial string for a page tab.

        Arguments:
        - obj: the page tab
        - alreadyFocused: False if object just received focus
        - forceTutorial: used for when whereAmI really needs the tutorial string

        Returns a list of tutorial utterances to be spoken for the object.
        z&Use left and right to view other tabs.�_getTutorialForPageTabListrIrKr7r7r8r�s
�z(TutorialGenerator._getTutorialForPageTabcCrH)a7Get the tutorial string for a push button

        Arguments:
        - obj: the push button
        - alreadyFocused: False if object just received focus
        - forceTutorial: used for when whereAmI really needs the tutorial string

        Returns a list of utterances to be spoken for the object.
        zTo activate press space.r#rIrKr7r7r8r#�rMz+TutorialGenerator._getTutorialForPushButtoncCrH)a}Get the tutorial string for a spin button.  If the object already has
        focus, then no tutorial is given.

        Arguments:
        - obj: the spin button
        - alreadyFocused: False if object just received focus
        - forceTutorial: used for when whereAmI really needs the tutorial string

        Returns a list of utterances to be spoken for the object.
        zMUse up or down arrow to select value. Or type in the desired numerical value.r%rIrKr7r7r8r%���
�z+TutorialGenerator._getTutorialForSpinButtoncCsFg}td�}td�}|jdkr`g}ddg}t|�D]\}	}
|jj�|
�r*d||	<nq|dr8|ds8ddg}n|dsD|drDddg}|r`|D]}	|rQ||	sQqH|�|�||	||��qH|S|jj�|�rn|�|||�}|�	�}|�
tj�r�|�
tj
�r�|j|gks�|r�|�|�n
|j|gks�|r�|�|�|�d|||�|S)	a;Get the tutorial utterances for a single table cell

        Arguments:
        - obj: the table
        - alreadyFocused: False if object just received focus
        - forceTutorial: used for when whereAmI really needs the tutorial string

        Returns a list of utterances to be spoken for the object.
        r]r^�FTrr�_getTutorialForTableCell)r�
childCount�	enumerater
rO�hasMeaningfulToggleAction�extendrkrr_r`rrarbrrJrC)r5r?r@rErArcrd�	cellOrder�	hasToggle�i�childrer7r7r8rksV
	�

���
�
�z*TutorialGenerator._getTutorialForTableCellc
Csg}|suz|j��}Wnd}Y|jj�|�}|rm|rm|jj�|j�sm|j}|jj�|�}|�|�}	|�|�}
d}d|jj	vrbd|jj	vrb|jj	}|d|	kpa|	dks\|	|j
dkoa|d|
k}|�|�|||��n|�|||�}n|�|||�}|�
d|||�|S)aKGet the tutorial string for the active table cell in the table row.

        Arguments:
        - obj: the table
        - alreadyFocused: False if object just received focus
        - forceTutorial: used for when whereAmI really needs the tutorial string

        Returns a list of utterances to be spoken for the object.
        NT�lastRow�
lastColumnrrr')rU�
queryTabler
rO�shouldReadFullRow�isLayoutOnly�	cellIndex�
getRowAtIndex�getColumnAtIndex�pointOfReference�nRowsrorkrC)
r5r?r@rErA�parent_table�readFullRowrU�index�row�column�speakAllr|r7r7r8r'XsJ�


�
����z-TutorialGenerator._getTutorialForTableCellRowcCrH)a:Get the tutorial string for a radio button.

        Arguments:
        - obj: the radio button
        - alreadyFocused: False if object just received focus
        - forceTutorial: used for when whereAmI really needs the tutorial string

        Returns a list of utterances to be spoken for the object.
        zUse arrow keys to change.r+rIrKr7r7r8r+�s�
�z,TutorialGenerator._getTutorialForRadioButtoncCsxg}td�}td�}|jjdkr%|jj|jkr%|j|gks|r$|�|�n
|j|gks-|r2|�|�|�d|||�|S)a*Get the tutorial string for a menu.

        Arguments:
        - obj: the menu
        - alreadyFocused: False if object just received focus
        - forceTutorial: used for when whereAmI really needs the tutorial string

        Returns a list of utterances to be spoken for the object.
        zUTo navigate, press left or right arrow. To move through items press up or down arrow.z%To enter sub menu, press right arrow.r	r-)rrUr<�	__class__rrJrC)r5r?r@rErA�mainMenuMsg�
subMenuMsgr7r7r8r-�s
�
�z%TutorialGenerator._getTutorialForMenucCrH)asGet the tutorial string for a slider.  If the object already has
        focus, then no tutorial is given.

        Arguments:
        - obj: the slider
        - alreadyFocused: False if object just received focus
        - forceTutorial: used for when whereAmI really needs the tutorial string

        Returns a list of utterances to be spoken for the object.
        ztTo decrease press left arrow, to increase press right arrow. To go to minimum press home, and for maximum press end.r3rIrKr7r7r8r3�riz'TutorialGenerator._getTutorialForSlidercCs<|jj�|�}|sdS|jj�|�}|sdS|d}|��S)Nr)r
�inputEventHandlers�get�keyBindings�getBindingsForHandler�asString)r5�handlerName�handler�bindings�bindingr7r7r8�_getBindingsForHandler�sz(TutorialGenerator._getBindingsForHandlercCrD�Nr7)r5r?r@rEr7r7r8�_getModeTutorial�sz"TutorialGenerator._getModeTutorialFcCs�tjsgS|r|tjksgS|jj�|�r#d|}t�tj	|d�gSg}|p*|�
�}|�|||�}|sH||jvr?|j|}n|j
}||||�}||jkrV||jkrV|sVg}|rdd�|�g}||_||_|rld|_d|_|�d|||�|S)a3Get the tutorial for an Accessible object.  This will look
        first to the specific tutorial generators and if this
        does not exist then return the empty tutorial.
        This method is the primary method
        that external callers of this class should use.

        Arguments:
        - obj: the object
        - alreadyFocused: False if object just received focus
        - forceTutorial: used for when whereAmI really needs the tutorial string
        - role: Alternative role to use

        Returns a list of utterances to be spoken.
        z5INFO: Not generating tutorial for document object %s.T� r	N�getTutorial)r�enableTutorialMessagesr�locusOfFocusr
rO�inDocumentContentrr:�
LEVEL_INFOrVr�r
rGrr�joinrC)r5r?r@rErFrLrA�	generatorr7r7r8r��sB
��zTutorialGenerator.getTutorialr�)FN)�__name__�
__module__�__qualname__�__doc__r9rCrGrrrrrrrr0rrr#r%rkr'r+r-r3r�r�r�r7r7r7r8r's4<
�%/*Q7#r)r��__id__�__version__�__date__�
__copyright__�__license__rr	rrr�	orca_i18nrrr7r7r7r8�<module>s

Youez - 2016 - github.com/yon3zu
LinuXploit