File Viewer

Download
a

�<�e��@srddlmZmZddd�ZiZGdd�de�ZGdd�de�ZGd	d�de�ZGd
d�de�ZGdd
�d
e�Z	dS)�)�Vector�	Rectangle�Text�Entry)ZTextAreaZTextBoxcs$eZdZ�fdd�Zdd�Z�ZS)�Buttoncs0t��||�||_||_|jt|j|jf<dS)N)�super�__init__�
image_path�id_�position_id_map�x�y)�self�node�framer	r
��	__class__��S/Users/pranavzagade/PycharmProjects/LuciaVision/tkdesigner/figma/custom_elements.pyrszButton.__init__cCsVd|j�d|j�d|j�d|j�d|j�d|j�d|j�d|j�d	|j�d
|j�d�S)Nz
button_image_�, = PhotoImage(
    file=relative_to_assets("z"))
button_z" = Button(
    image=button_image_zQ,
    borderwidth=0,
    highlightthickness=0,
    command=lambda: print("button_z' clicked"),
    relief="flat"
)
button_�.place(
    x=�,
    y=�,
    width=�
,
    height=�
)
)r
r	rr
�width�height�rrrr�to_codes*�����
���
��zButton.to_code��__name__�
__module__�__qualname__rr�
__classcell__rrrrr
srcs$eZdZ�fdd�Zdd�Z�ZS)�ButtonHovercsDt��||�||_|j|jftvr8t|j|jf|_ntd�dS)Nz�`ButtonHover` element must be placed on top of Button element with the same position.
`ButtonHover` element will not be rendered)rrr	rr
rr
�print)rrrr	rrrr&s�zButtonHover.__init__cCs~|j|jftvrvd|j�d|j�d|j�d|j�d|j�d|j�d|j�d|j�d	|j�d
|j�d|j�d|j�d
�SdSdS)Nz
button_image_hover_rz"))

def button_z_hover(e):
    button_z*.config(
        image=button_image_hover_z
    )
def button_z_leave(e):
    button_z$.config(
        image=button_image_z
    )

button_z.bind('<Enter>', button_z_hover)
button_z.bind('<Leave>', button_z	_leave)

�)rr
rr
r	rrrrr1s6������	�
�
�
���zButtonHover.to_coderrrrrr$%sr$csbeZdZ�fdd�Zeed�dd��Zedd��Zedd	��Zed
d��Z	dd
�Z
dd�Z�ZS)rcs\t��|�|�|�\|_|_|��\|_|_|��|_	|�
�\|_|_|j
�dd�|_dS)N�
z\n)rr�positionrr
�sizerr�color�
text_color�
font_property�font�	font_size�
characters�replace�text)rrrrrrrIs
z
Text.__init__)�returncCsR|j�d�}|j�dd�}|dkr,|��}n"|dkr>|��}n|dkrN|��}|S)Nr/ZtextCaseZORIGINALZUPPERZLOWERZTITLE)r�get�style�upper�lower�title)r�stringZ	text_caserrrr/Ss

zText.characterscCs|j�d�S)Nr4�rr3rrrrr4asz
Text.stylecCs|j�d�S)NZcharacterStyleOverridesr9rrrr�character_style_overridesfszText.character_style_overridescCs|j�d�S)NZstyleOverrideTabler9rrrr�style_override_tablejszText.style_override_tablecCsB|j�d�}|�d�}|dur&|d}|�dd�}|d}||fS)Nr4ZfontPostScriptNameZ
fontFamily�-� ZfontSize)rr3r0)rr4Z	font_namer.rrrr,os
zText.font_propertyc
Cs:d|j�d|j�d|j�d|j�d|j�dt|j��d�
S)Nz
canvas.create_text(
    �,
    z,
    anchor="nw",
    text="z
",
    fill="z",
    font=("z", z	 * -1)
)
)rr
r1r+r-�intr.rrrrrzs������zText.to_code)
r r!r"r�property�strr/r4r:r;r,rr#rrrrrHs




cs$eZdZ�fdd�Zdd�Z�ZS)�Imagecs^t��|�|�|�\|_|_|��\}}|j|d7_|j|d7_||_||_dS)N�)rrr(rr
r)r	r
)rrrr	r
rrrrrr�szImage.__init__c
Cs6d|j�d|j�d|j�d|j�d|j�d|j�d�
S)Nz
image_image_rz
"))
image_� = canvas.create_image(
    r>z,
    image=image_image_r)r
r	rr
rrrrr�s������z
Image.to_coderrrrrrB�srBcs$eZdZ�fdd�Zdd�Z�ZS)�	TextEntrycs�t��|�||_||_|�|�\|_|_|��\}}|j|d7_|j|d7_|��|_	|�
dd�}t||d�}||d|_|d|_
|�|�\|_|_|j|7_t�
|�
d��|_dS)NrC�cornerRadius��name)rrr
r	r(rr
r)r*�bg_colorr3�min�entry_width�entry_height�entry_x�entry_y�TEXT_INPUT_ELEMENT_TYPES�
entry_type)rrrr	r
rr�
corner_radiusrrrr�s

zTextEntry.__init__cCsvd|j�d|j�d|j�d|j�d|j�d|j�d|j�d|j�d	|j�d
|j�d|j�d|j�d
|j�d|j	�d�S)Nz
entry_image_rz
"))
entry_bg_rDr>z,
    image=entry_image_z	
)
entry_z = z(
    bd=0,
    bg="z6",
    fg="#000716",
    highlightthickness=0
)
entry_rrrrr)
r
r	rr
rPrIrMrNrKrLrrrrr�s:��������
������zTextEntry.to_coderrrrrrE�srEN)
�vector_elementsrrrOrrr$rrBrErrrr�<module>s�#?