HEX
Server: Apache
System: Linux opal14.opalstack.com 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64
User: curbgloabal_opal (1234)
PHP: 8.1.29
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //usr/share/inkscape/extensions/text_extract.pyc
�
��Yc@s�dZddlZddlmZddlZddlZddlZddlZy ddlm	Z	m
Z
eZWn
e
ZnXddlZdejfd��YZedkr�e�Zej�ndS(sm
Copyright (C) 2011 Nicolas Dufour (jazzynico)
Direction code from the Restack extension, by Rob Antonishen

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

i����N(tdeepcopy(tPopentPIPEtExtractcBs#eZd�Zd�Zd�ZRS(c
Cs�tjj|�|jjddddddddd	d
dd�|jjd
dddddddd	ddd�|jjddddddddd	ddd�dS(Ns-ds--directiontactiontstorettypetstringtdestt	directiontdefaultttbthelpsdirection to extract texts-xs	--xanchortxanchortmshorizontal point to compares-ys	--yanchortyanchorsvertical point to compare(tinkextEffectt__init__tOptionParsert
add_option(tself((s./usr/share/inkscape/extensions/text_extract.pyR*scCsPt|j�dkrTx<|jjddtj�D]}||j|jd�<q1Wnt|j�dkrLg}|jj�}|j}|j	d}t
r td|dtdt
d	t
�}|j}|j�d}ytj�j|�}	Wn"tj|jtj��}	nX|j�n5tjd|�\}
}}tj|�}	|j�t�}x>|	D]6}t|�dkrett|d
�||d<qeqeWt
s�|jn||jj�d\}
}}}|
}|}|
|}||}x�|jj�D]�\}}||\}
}}}|
|kr9|
}n|
||krV|
|}n||krk|}n|||kr||}qqW||d}||d}xe|jj�D]T\}}||\}
}}}|jjdkr�|
}n-|jjd
kr|
|}n|
|d}|jj dkr=|}n-|jj dkr\||}n||d}|jj!dkr�|j"||g�q�|jj!dkr�|j"||g�q�|jj!dkr�|j"||g�q�|jj!dkr�|j"||g�q�q�W|j#�x/|D]$}|j$t%|j|d
��q!WndS(Nis//svg:text | //svg:flowRoott
namespacestidi����sinkscape --query-all "%s"tshelltstdouttstderriitltrtttbRtbttlrtrl(&tlentselectedtdocumenttxpathRtNSStgettgetroott
current_layertargstbsubprocessRtTrueRRtcommunicatetcsvt	CSVParsertparse_stringtreadertsplittostlineseptclosetpopen3tdicttmaptfloattkeyst	iteritemstoptionsR
RR	tappendtsorttrecurseR(Rtnodetobjlisttsvgt
parentnodetfiletpterrtfR1t_tdimentlinetxtytwthtminxtminytmaxxtmaxyRtmidxtmidytcxtcytitem((s./usr/share/inkscape/extensions/text_extract.pyteffect9s�"	
"	

	
"
#

	
		
	


cCs�|jdkp*|jdkp*|jdk}|jdksK|jdkr�x)|D]!}|jd�rRd|_qRqRWtjtjj|dd�j	��nx|D]}|j
|�q�WdS(Ns${http://www.w3.org/2000/svg}flowParas#{http://www.w3.org/2000/svg}flowDivs {http://www.w3.org/2000/svg}texts8{http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd}roles
tmethodttext(ttagRZtNonettailR'RterrormsgtetreettostringtstripR?(RR@tistexttchild((s./usr/share/inkscape/extensions/text_extract.pyR?�s-
(
(t__name__t
__module__RRXR?(((s./usr/share/inkscape/extensions/text_extract.pyR)s		]t__main__(t__doc__tchardataeffecttcopyRR.tmathR3Rt
subprocessRRR,R+tFalseRRRRdtetaffect(((s./usr/share/inkscape/extensions/text_extract.pyt<module>s 

y