| 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 : /lib/python3/dist-packages/orca/__pycache__/ |
Upload File : |
o
S�b3 � @ sr d Z dZdZdZdZdZddlZddlZdd lm Z dd
lm
Z
ddlmZ ddlmZ G d
d� d�Z
dd� ZdS )z(Provides support for a flat review find.z$Id$z
$Revision$z$Date$z-Copyright (c) 2005-2008 Sun Microsystems Inc.�LGPL� N� )�debug)�flat_review)�messages)�
orca_statec @ s0 e Zd ZdZdd� Zdd� Zdd� Zdd � Zd
S )�SearchQueryz3Represents a search that the user wants to perform.c C s0 d| _ d| _d| _d| _d| _d| _tj| _dS )a� Creates a new SearchQuery. A searchQuery has the following
properties:
searchString - the string to find
searchBackwards - if true, search upward for matches
caseSensitive - if true, case counts
matchEntireWord - if true, only match on the entire string
startAtTop - if true, begin the search from the top of
the window, rather than at the current
location
windowWrap - if true, when the top/bottom edge of the
window is reached wrap to the bottom/top
and continue searching
� FN) �searchString�searchBackwards�
caseSensitive�matchEntireWord�
windowWrap�
startAtTopr �LEVEL_FINEST�
debugLevel)�self� r �+/usr/lib/python3/dist-packages/orca/find.py�__init__( s zSearchQuery.__init__c C s� t �| jd� t �| jd||j|j|j|jf � t �| jdt|j� � t �| jdt|j|j j � � t �| jdt|j|j j |j j
� � t �| jd� dS )z:Prints out the context and the string to find to debug.outz<------------------------------------------------------------z-findQuery: %s line=%d zone=%d word=%d char=%dzNumber of lines: %dz#Number of zones in current line: %dz#Number of words in current zone: %dz<==========================================================
N)r �printlnr � lineIndex� zoneIndex� wordIndex� charIndex�len�lines�zones�words)r �context�stringr r r �debugContextA s4 �
���������zSearchQuery.debugContextc
C s� t d� tdt|j��D ]L}t d| � tdt|j| j��D ]8}t d| � tdt|j| j| j��D ]!}t d||j| j| j| jt|j| j| j| j�f � q5qqdS )z+Debug utility which prints out the context.�DUMPr z Line %dz Zone: %dz" Word %d = `%s` len(word): %dN)�print�ranger r r r r )r r �i�j�kr r r �dumpContextV s �����zSearchQuery.dumpContextc C st |j }|j}|j}|j}t�| jd||||f � tj}| j s$|tj
B }| jr/d| j d }n| j}t�
||�} t�| jd| j|f � | jrT|�tjj� | �|d� d}
d}d}d}
|�s|�tjj�\}}}}}t�| jd|||||f � t�| |��r�|
�s�|�s|�tjj�\}}}}}t�| jd|||f � t�| jd ||f � t�| |��rB|j|j j|j }||j ko�||jk}z|j�� W n Y nqt�| |�}g }|D ]
}|�|�d
�� q�| jr�|� � d
}|�sB|t!|�k �rB|�"|| �\}}|�r8|j#|j }| j�r|d
k �s| j�s'|d
k�r'|j#|_d
|_d}n|�s3|�r0|�r3d}n|d7 }nn |�sB|t!|�k s�|�s}| j�rg|�$tjjtjj%�}| �|d
� |�&tjj� | �|d� n|�'tjjtjj%�}| �|d� |�s}d}
n|r�n�| j�r�|�$tjjtjj%�}| �|d� n|�'tjjtjj%�}| �|d� |�r�| j�r�|�&tjj�}| �|d� nL| j(�r|�st)j*}d}
d}| j�r�|�+t,j-� |�$tjjtjj.�}| �|d� n|�+t,j/� |�'tjjtjj.�}| �|d� |�st�| jd� nnn|r_|�rt0�0|�}
| �|d� |�1||||� | �|d� |
�r8t�| jd|
j |
j|
j|
jf � |
S )a9 Performs a search on the string specified in searchQuery.
Arguments:
- context: The context from active script
- justEnteredFlatReview: If true, we began the search in focus
tracking mode.
Returns:
- The context of the match, if found
z;findQuery: original context line=%d zone=%d word=%d char=%dz\bz'findQuery: startAtTop: %d regexp: `%s`zgo beginNFz9findQuery: current line=`%s` x=%d y=%d width=%d height=%dz'findQuery: current zone=`%s` x=%d y=%d zwidth=%d height=%dr Tr z[1] go previousz
[1] go endz[1] go nextz[2] go previousz[2] go nextz
[2] go endz[3] go previousz[3] go nextzfindQuery: cannot wrapzbefore setting originalzafter setting originalz4findQuery: returning line=%d zone=%d word=%d char=%d)2r r r r r r r �re�LOCALEr �
IGNORECASEr
r
�compiler �goBeginr �Context�WINDOWr! �
getCurrent�LINE�search�ZONEr r �
accessible� queryText�finditer�append�startr �reverser �getWordAtOffset�index�
goPrevious� WRAP_LINE�goEnd�goNextr r �activeScript�presentMessager �WRAPPING_TO_BOTTOM�WRAP_ALL�WRAPPING_TO_TOP�copy�
setCurrent)r r �justEnteredFlatReview�originalLineIndex�originalZoneIndex�originalWordIndex�originalCharIndex�flags�regexp�pattern�location�found�
wrappedYet�doneWithLine�currentLine�x�y�width�height�currentZone�theZone�startedInThisZone�
allMatches�offsets�mr% �nextInstance�offset�
offsetDiff�moved�scriptr r r � findQueryb sL ���
��������
�
�
��
�
�
��
�����O
�
�������
����zSearchQuery.findQueryN)�__name__�
__module__�__qualname__�__doc__r r! r( rc r r r r r % s r c C s t � tj�} | S )z�Grabs the last search query performed from orca_state.
Returns:
- A copy of the last search query, if it exists
)rE r �searchQuery)� lastQueryr r r �getLastQuery! s rj )rg �__id__�__version__�__date__�
__copyright__�__license__rE r) r r r r r r rj r r r r �<module> s }