o
    W=g                     @   sP   d Z G dd dZddlmZ ddlZddlmZ ddlZG dd dejZ	dS )	z
This file is used to print colored text and create multiple terminals
Github: https://github.com/tylerebowers/Schwab-API-Python
c                   @   s   e Zd ZedddZedddZedddZedd	 Zedd
dZedddZ	edddZ
edddZedddZedddZedddZdS )
colorPrint
c                 C      t dd d|  |d d S )N[92mz[INFO]: [00mendprintstringr    r   1/var/www/html/xspChainOptions/modules/terminal.pyinfo      zcolorPrint.infoc                 C   r   )N[93mz[WARN]: r   r   r   r
   r   r   r   warning
   r   zcolorPrint.warningc                 C   r   )Nz[91mz	[ERROR]: r   r   r   r
   r   r   r   error   r   zcolorPrint.errorc                 C   s   t dd d|  S )N[94mz	[INPUT]: r   )input)r   r   r   r   r      s   zcolorPrint.inputc                 C   r   )Nz[1;31mz[USER]: r   r   r   r
   r   r   r   user   r   zcolorPrint.user c                 C   r   )Nr   z[SPX]: r   r   r   r
   r   r   r   spx   r   zcolorPrint.spxc                 C   r   )Nr   z[VIX]: r   r   r   r
   r   r   r   vix   r   zcolorPrint.vixc                 C   r   )Nz[95mz[IV]: r   r   r   r
   r   r   r   iv   r   zcolorPrint.ivc                 C   r   )Nr   z[EM]: r   r   r   r
   r   r   r   em   r   zcolorPrint.emc                 C   r   )Nr   z[XSP]: r   r   r   r
   r   r   r   xsp   r   zcolorPrint.xspc                 C   r   )Nr   z	[QUOTE]: r   r   r   r
   r   r   r   quote    r   zcolorPrint.quoteNr   )r   )__name__
__module____qualname__staticmethodr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r      s.    
r       )sleepN)ttkc                   @   s@   e Zd Zddd	Zd
d Zdd ZdddZdd Zdd ZdS )multiTerminalTerminal      zCourier New12gray5snowTc	           	      C   sl   || _ || _|| _|| _|| _|| _|| _|| _d | _d | _	d| _
d| _tjj| dd |   td d S )NFT)daemong      ?)titleheightwidthfontbackgroundColor	textColorallowClosingignoreClosedPrints_root_tbisOpen	_safeExit	threadingThread__init__startr#   )	selfr.   r/   r0   r1   r2   r3   r4   r5   r   r   r   r<   ,   s   zmultiTerminal.__init__c                 C   s8   | j r| jrd| _ | j  | j  d | _d S d S d S )NF)r8   r9   r6   quitupdate)r>   r   r   r   close?   s   


zmultiTerminal.closec                 C   s   t  | _| jr| jd| j n	| jddd  | j| j t j| j| j| j	d| j
d| _| jjdddd	 | jjd
| j| jd t| j}|jdd |d| j |d| j d| _d| _| j  d S )NWM_DELETE_WINDOWc                   S   s   d S Nr   r   r   r   r   <lambda>I   s    z#multiTerminal.run.<locals>.<lambda>none)r/   r0   wrapr1   leftbothT)sidefillexpanddisabled)statebgfgsizing)cursorz<1>z<B1-Motion>)tkTkr6   r4   protocolrA   r.   Textr/   r0   r1   r7   pack	configurer2   r3   r$   Sizegripbind_resize_start_resize_updater8   r9   mainloop)r>   sizegripr   r   r   runF   s   
zmultiTerminal.runr   c                 C   sz   | j d u s| js| jstd| j dS d S d| _| jjdd | jd | j	d| |  | jjdd d| _d S )	Nz
Terminal "z" is closedFnormal)rM   r   rL   T)
r6   r8   r5   r	   r.   r9   r7   rW   seeinsert)r>   toPrintr   r   r   r   r	   V   s   
zmultiTerminal.printc                 C   s   |j | _|j| _d S rC   )x_xy_y)r>   eventr   r   r   rZ   b   s   zmultiTerminal._resize_startc                 C   s@   |j | j }|j| j }| jj| j | | j | d d S )N)r0   r/   )rc   rd   re   rf   r7   place_configurewinfo_widthwinfo_height)r>   rg   delta_xdelta_yr   r   r   r[   f   s   (zmultiTerminal._resize_updateN)r&   r'   r(   r)   r+   r,   TTr   )	r   r   r    r<   rA   r^   r	   rZ   r[   r   r   r   r   r%   *   s    

r%   )
__doc__r   timer#   tkinterrR   r$   r:   r;   r%   r   r   r   r   <module>   s    