o
    vaε                     @   s&  d Z ddlmZ ddlZddlmZmZmZmZm	Z	 ddl
mZmZ ddlmZ ddlmZ ddlmZmZ dd	lmZ zddlZddlZdd
lmZ W n eyf   ed er_ed ed Y nw G dd deZG dd deZG dd deZ G dd deeZ!G dd deeZ"dS )zCurses interface class.    )unicode_literalsN)	nativestru
itervaluesenabledisable)MACOSWINDOWS)logger)glances_events)glances_processessort_processes_key_list)Timer)TextboxzACurses module not found. Glances cannot start in standalone mode.zCFor Windows you can try installing windows-curses with pip install.   c                   @   s  e Zd ZdZi dddidddidddid	dd
idddidddidddidddidddidddidddidddidddidddid dd!id"dd#id$dd%ii d&dd'id(dd)id*dd+id,dd-id.dd/id0dd1id2dd3id4dd5id6dd7id8dd9id:dd;id<dd=id>dd?id@ddAidBddCidDddEidFddGiddHiddIiddJiddKiddLidMZeZg dNZdOZg dPZ	dQZ
dRZg dSZddUdVZdWdX ZdYdZ Zd[d\ Zd]d^ Zd_d` Zdadb Zdcdd ZddfdgZdhdi Zdjdk Zdldm Zdndo Zdpdq Zdrds Zdtdu Zdvdw Zdxdy Zdzd{ Zd|d} Z d~d Z!dddZ"dd Z#dd Z$dd Z%dd Z&	T				TdddZ'				dddZ(dd Z)dddZ*		T	edddZ+dddZ,dddZ-dd Z.dTS )_GlancesCurseszThis class manages the curses display (and key pressed).

    Note: It is a private class, use GlancesCursesClient or GlancesCursesBrowser.
    0switchZdisable_irix1percpu2disable_left_sidebar3disable_quicklook6Zmeangpu9Ztheme_white/Zprocess_short_nameasort_keyautoAZdisable_ampsbZbyteBZdiskio_iopscZcpu_percentCZdisable_clouddZdisable_diskioDZdisable_dockerFZfs_free_spaceggenerate_graphGZdisable_gpuhhelp_tagiZio_countersIZ
disable_ipKZdisable_connectionslZdisable_alertmZmemory_percentMreset_minmax_tagnZdisable_networkNZdisable_nowpnamePZdisable_portsQZ
enable_irqrZdisable_smartRZdisable_raidsZdisable_sensorsSZ	sparklineZ	cpu_timesZnetwork_sumZusernameZnetwork_cumulZdisable_wifi)tTr   UW)	quicklookcpur   gpumemmemswaploadD   )ZnetworkZconnectionsZwifiZportsZdiskioZfsZirqZfoldersZraidZsmartZsensorsZnow   "   )dockerprocesscountampsprocesslistalertNc                 C   s   || _ || _d| _d| _d| _d| _t | _| js$t	
d td ddi| _| | |   |   | jd	d	| _d
| _d
| _d
| j_d	| j_| jd | jd d| _|   d S )NP            z Cannot init the curses library.
r   r7   blackr   F)configargsZterm_wZterm_hspace_between_columnspace_between_linecursesZinitscrZscreenr
   criticalsysexitthemeload_config_init_cursor_init_colorsZsubwinterm_windowedit_filterkill_processr3   cursor_positionkeypadZnodelay
pressedkey_init_history)selfrV   rW    rj   @/usr/lib/python3/dist-packages/glances/outputs/glances_curses.py__init__}   s.   




z_GlancesCurses.__init__c                 C   sT   |dur&| dr(td |jdddd| jd< td| jd  dS dS dS )	z3Load the outputs section of the configuration file.NZoutputsz2Read the outputs section in the configuration fileZcurse_themerT   )defaultr7   z!Theme for the curse interface: {})Zhas_sectionr
   debugZ	get_valuer^   format)ri   rV   rj   rj   rk   r_      s
   
z_GlancesCurses.load_configc                 C   s   t | jd| p| jd |kS )z/Return True if the theme *name* should be used.Ztheme_r7   )getattrrW   r^   )ri   r7   rj   rj   rk   is_theme   s   z_GlancesCurses.is_themec                 C   s
   d| _ dS )zInit the history option.FN)Zreset_history_tagri   rj   rj   rk   rh      s   
z_GlancesCurses._init_historyc                 C   s2   t tdr	t  t tdrt  | d dS )zInit cursors.noechocbreakr   N)hasattrrZ   rs   rt   
set_cursorrr   rj   rj   rk   r`      s
   

z_GlancesCurses._init_cursorc              
   C   s:  zt tdrt  tdtj t tdrt  W n ty7 } zt	d| W Y d}~nd}~ww | j
jrCd}d| j
_ntj}|| _|tjB | _|| _t r| dretd	tjd
 ntd	tjd
 | j
jrtdtjd
 tdtjd
 tdtjd
 tdtjd
 n$tdtjtj tdtjtj tdtjtj tdtjtj tdtjd
 tdtjd
 tdtjd
 td	| _td|B | _td| _td| _td|B | _ td|B | _!td|B | _"td| _#td|B | _$td|B | _%td|B | _&|| _'|| _(tj)dkrtjtj*tj+g}t,ddD ]6}zt|d || d
 W q7 tym   | dr`t|d tjd
 n
t|d tjd
 Y q7w td| _td| _td|B | _%td|B | _'td|B | _(n.tj-| _tj-| _|| _|| _tj| _ || _!tj.| _"tj-| _#tj| _$|| _%tj.| _&|| _'|| _(i d| jdtjd|dtj|B d| j#d| j#|B d| j'd| jd| j#d| j#tjB d| j#d | jd!| jd"| j$d#| j%d$| j&d%| j| j | j!| j"tj/| j(d&| _0dS )'zInit the Curses color layout.start_colorz*Curses interface compatible with {} colorsuse_default_colorsz&Error initializing terminal color ({})Nr   TZwhiter   rU   rS   rR                  	   
      ZDEFAULTZ	UNDERLINEZBOLDZSORTZOKMAXFILTERZTITLEZPROCESSZPROCESS_SELECTEDZSTATUSZNICEZCPU_TIMEZCAREFULZWARNINGZCRITICALZOK_LOG)ZCAREFUL_LOGZWARNING_LOGZCRITICAL_LOGZPASSWORDZSELECTED)1ru   rZ   rw   r
   rn   ro   ZCOLORSrx   	ExceptionwarningrW   Zdisable_boldZ
disable_bgA_BOLDZtitle_colorZA_UNDERLINEZtitle_underline_colorZ
help_colorZ
has_colorsrq   Z	init_pairZCOLOR_BLACKZCOLOR_WHITEZ	COLOR_REDZCOLOR_GREENZ
COLOR_BLUEZCOLOR_MAGENTAZ
color_pairZno_colorZdefault_colorZ
nice_colorZcpu_time_colorZifCAREFUL_colorZifWARNING_colorZifCRITICAL_colorZdefault_color2ZifCAREFUL_color2ZifWARNING_color2ZifCRITICAL_color2Zfilter_colorZselected_colorZCOLOR_PAIRSZ
COLOR_CYANZCOLOR_YELLOWrangeZA_NORMALZ	A_REVERSEZ	A_PROTECTcolors_list)ri   er   r   r-   rj   rj   rk   ra      s   







	
z_GlancesCurses._init_colorsc                 C   s4   t tdrzt| W dS  ty   Y dS w dS )zoConfigure the curse cursor apparence.

        0: invisible
        1: visible
        2: very visible
        curs_setN)ru   rZ   r   r   )ri   valuerj   rj   rk   rv   F  s   
z_GlancesCurses.set_cursorc                 C   s   |  }|S N)Zgetch)ri   Zwindowretrj   rj   rk   get_keyS  s   z_GlancesCurses.get_keyFc                 C   s  |  | j| _| jdkrdS td| j | jD ]}| jt|krd| j| v rd| j| d 	ddd  }| j| d 
dr^t| j| j| d rWt| j| n@t| j| n9| j| d 
drt| j| j| d rzt| j| nt| j| nt| j| j| d t| j| j| d   | jt|krd| j| v rt| j| d | j| d d	k q| jtd
kr| j | _| jS | jtdkr| jj | j_| jjr|   | jS |   | jS | jtdkr	| jj | j_| jjr|   | jS |   | jS | jtdkr|   | jS | jtdkr:| jj | j_| jjs3t  | jS t  | jS | jtdkrHd t_| jS | jtdkra| jj | j_| jj | j_| jS | jtdkrq| j | _| jS | jtdkrt !  | jS | jtdkrt j!dd | jS | jtdkr| jj" | j_"| jj"rt  | jS t  | jS | jt#j$kr| % d t&| j' }t| j'| d | jS | jt#j(kr| % d t&| j' }t| j'| d | jS | jt#j)ks| jdkr| jj*dkr| j j*d8  _*| jS | jt#j+ks| jdkr.| jj*tj,k r+| j j*d7  _*| jS | jtdks>| jtdkrU|rIt-d | jS t-d| j | jS | jt#j.kr]	 | jS )NrU   zKeypressed (code: {})r   _r   disable_enable_r   r   
45r   r   EfkwxT)r[   zFA   r   B   qz-Stop Glances client and return to the browserzStop Glances (keypressed: {}))/r   rb   rg   r
   rn   ro   _hotkeysordjoinsplit
startswithrp   rW   r   r   setattrr   Zset_sort_keyrc   full_quicklookenable_fullquicklookdisable_fullquicklookdisable_top
enable_topra   enable_process_extendedZdisable_extendedZenable_extendedprocess_filterZ
disable_fsZdisable_foldersrd   r   ZcleanZdisable_processrZ   ZKEY_LEFTloop_positionlen
_sort_loopZ	KEY_RIGHTZKEY_UPre   ZKEY_DOWNZprocesses_countinfoKEY_F5)ri   return_to_browserZhotkeyoptionZ	next_sortrj   rj   rk   Z__catch_keyX  s   

"
MHF
A?<
752.
+(%
  
	
z_GlancesCurses.__catch_keyc                 C   s*   t | jD ]\}}|tjkr|  S qdS )z#Return the current sort in the loopr   )	enumerater   r   r   )ri   r-   vrj   rj   rk   r     s
   
z_GlancesCurses.loop_positionc                 C       dD ]}t | jd| d qdS )zDisable the top panelrB   rC   rD   rE   rF   rG   r   TNr   rW   ri   r6   rj   rj   rk   r        z_GlancesCurses.disable_topc                 C   r   )zEnable the top panelr   r   FNr   r   rj   rj   rk   r     r   z_GlancesCurses.enable_topc                 C   r   )Disable the full quicklook mode)rB   rC   rD   rE   rF   r   FNr   r   rj   rj   rk   r     r   z$_GlancesCurses.disable_fullquicklookc                 C   s(   d| j _dD ]}t| j d| d qdS )r   F)rC   rD   rE   rF   r   TN)rW   r   r   r   rj   rj   rk   r     s   z#_GlancesCurses.enable_fullquicklookc                 C   s\   t tdr	t  t tdrt  t tdr(ztd W n	 ty'   Y nw t  dS )zShutdown the curses window.echonocbreakr   r   N)ru   rZ   r   r   r   r   Zendwinrr   rj   rj   rk   end  s   


z_GlancesCurses.endc                 C   s   |    |   dS )z;Init the line and column position for the curses interface.N)	init_lineinit_columnrr   rj   rj   rk   init_line_column  s   z_GlancesCurses.init_line_columnc                 C      d| _ d| _dS )z0Init the line position for the curses interface.r   N)line	next_linerr   rj   rj   rk   r        
z_GlancesCurses.init_linec                 C   r   )z2Init the column position for the curses interface.r   N)columnnext_columnrr   rj   rj   rk   r     r   z_GlancesCurses.init_columnc                 C      | j | _dS )z!New line in the curses interface.N)r   r   rr   rj   rj   rk   new_line     z_GlancesCurses.new_linec                 C   r   )z#New column in the curses interface.N)r   r   rr   rj   rj   rk   
new_column  r   z_GlancesCurses.new_columnc                 C   sz   i }|j ddD ]2}|dks|dkrqd}|| jv r-t| j| j d d }t| j|}||j	| j
|d||< q|S )	a  Return a dict of dict with all the stats display.
        stats: Global stats dict
        layer: ~ cs_status
            "None": standalone or server mode
            "Connected": Client is connected to a Glances server
            "SNMP": Client is connected to a SNMP server
            "Disconnected": Client is disconnected from the server

        :returns: dict of dict
            * key: plugin name
            * value: dict returned by the get_stats_display Plugin method
        F)r   rB   rN   Nr   i   )rW   	max_width)ZgetPluginsList_left_sidebarmax_left_sidebar_min_widthrb   getmaxyxmin_left_sidebar_max_width
get_pluginget_stats_displayrW   )ri   statslayerr   r6   Zplugin_max_widthrj   rj   rk   Z__get_stat_display  s    
z!_GlancesCurses.__get_stat_displayc           
   
   C   s  |    || j_| j||d}| j d d d|vrdn| |d  d|vr*dn| |d  d|vr7dn| |d  d|vrDdn| |d  }z
| jjrU|d8 }W n	 ty_   Y nw |dk rfd}t	j
d	u spt	j
|kr{td
| |t	_
|dj| jd|d< | jjr| |dj| jd dS | | | || | | | | | jr|d	u r| jddt	jd}|t	_n| jr|d	ur| d d| _| jr1|d	u r1|d | jj }| jd|d |d dd}| dr0z	t	|d }W n t y$ }	 zt!d|d |	 W Y d	}	~	nd	}	~	ww t"d|d | n| jr?|d	ur?| d d| _| jj#rQ| d| jj$ dS )a  Display stats on the screen.

        stats: Stats database to display
        cs_status:
            "None": standalone or server mode
            "Connected": Client is connected to a Glances server
            "SNMP": Client is connected to a SNMP server
            "Disconnected": Client is disconnected from the server

        Return:
            True if the stats have been displayed
            False if the help have been displayed
        )r   r   r   rK   rL   rM   rO   ry   Nz'Set number of displayed processes to {}rN   )rW   helpFzProcess filter pattern: 

Examples:
- python
- .*python.*
- /usr/lib.*
- name:.*nautilus.*
- cmdline:.*glances.*
- username:nicolargo
- username:^root        input)
popup_typeinput_valuez0Process filter only available in standalone modez4Kill process: {} (pid: {}) ?

Confirm ([y]es/[n]o): r7   pidyesno)r   yzCan not kill process {} ({})z9Kill signal has been sent to process {} (return code: {})z.Kill process only available in standalone modezGenerate graph in {}T)%r   rW   	cs_status _GlancesCurses__get_stat_displayrb   r   get_stats_display_heightr   AttributeErrorr   Zmax_processesr
   rn   ro   r   r   r,   display_plugin_GlancesCurses__display_header_GlancesCurses__display_top_GlancesCurses__display_left_GlancesCurses__display_rightrc   display_popupZprocess_filter_inputr   rd   Zget_rawre   lowerr   killr   errorr   r)   Zexport_graph_path)
ri   r   r   Z_GlancesCurses__stat_displayZmax_processes_displayedZ
new_filterZselected_process_rawZconfirmZret_killr   rj   rj   rk   display3  s   




	

z_GlancesCurses.displayc                 C   s   |    d| _d}dD ]}||v r|| || 7 }q| j|d | j d |kd d| _d|v r=|   | |d  |   | j|d | |d	 dk d
 |   |    | |d	  dS )zqDisplay the firsts lines (header) in the Curses interface.

        system + ip + uptime
        (cloud)
        r   r   )systemipuptimer   display_optionalrR   r   r   Zcloud)	add_spaceN)r   rX   get_stats_display_widthr   rb   r   r   r   )ri   stat_displayZl_uptimer-   rj   rj   rk   Z__display_header  s.   z_GlancesCurses.__display_headerc           
   
      s         dg id< i } jD ]}t jd| r& |dnd||< qtt|}t fdd jD } jj	s jj
rW j d |d | j   }nt j d |d | j    jd	 }z|dj| jd
d< W n ty } ztd|  W Y d}~nd}~ww  d |d< tt|d }d _ d     i }	 jD ]}d|	|< q|dkrtdt j d | |d   _dD ]<} jdk rd|	|< t jd| r j| ddnd||< tt|d }tdt j d | |d   _qnd _ jD ]#}|dkr(q|v r8 j| |	| d |dkrA   qd _ j _dS )zwDisplay the second line in the Curses interface.

        <QUICKLOOK> + CPU|PERCPU + <GPU> + MEM + SWAP + LOAD
        msgdictrB   r   r   c                    s0   g | ]}t  jd | st| d g kqS )r   r   )rp   rW   int).0r6   ri   r   rj   rk   
<listcomp>  s   0 z0_GlancesCurses.__display_top.<locals>.<listcomp>r   r}   rz   )r   rW   z#Quicklook plugin not available (%s)NT)rE   rC   rR   F)without_optionr   rG   )r   r   _topru   rW   r   getsumr   r   r   rb   r   rX   r   _quicklook_max_widthr   r   r   r
   rn   r   r   r   r   r   
saved_line)
ri   r   r   Zplugin_widthsr6   Zstats_widthZstats_numberZquicklook_widthr   Zplugin_display_optionalrj   r   rk   Z__display_top  sn   
," 


&*&




z_GlancesCurses.__display_topc                 C   sb   |    | jjr
dS | jD ]!}t| jd| st| jd| r.||v r.|   | ||  qdS )z1Display the left sidebar in the Curses interface.Nr   r   )r   rW   r   r   ru   r   r   ri   r   r6   rj   rj   rk   Z__display_left&  s   
z_GlancesCurses.__display_leftc              
   C   s   | j  d | jk rdS | j| _|   | jD ]L}t| jd| s)t| jd| rc||v rc||vr2q| 	  |dkr\| j
|d | j  d dkt | j  d | |d  d	 d
 q| 
||  qdS )zwDisplay the right sidebar in the Curses interface.

        docker + processcount + amps + processlist + alert
        r   Nr   r   rN   f   r   rO   rS   )r   display_additionalmax_y)rb   r   r   r   r   r   _right_sidebarru   rW   r   r   r   r   r   rj   rj   rk   Z__display_right3  s,   

z_GlancesCurses.__display_rightrR   r      c                 C   sd  | d}|du rtt|tdd }|dkr||7 }|du r%t|d }| j d }	| j d }
||	ks;||
kr=dS t|	| d	 }t|
| d	 }t||||}|  t	|D ]\}}|
d	| d	|t| q]|d
kr|  | |d  dS |dkr|d|d	d	t| }|| jd  |dur|
dd|t| |  |  | d	 | jd t|dd}|  | d | dkrtd|   | dd S td dS |dkr0|dd	t|d t|d	 }|| jd  |
dddd |  |  | d	 | jd t|dd}|  | d | S dS )a'  
        Display a centered popup.

        popup_type='info'
         Just an infotmation popup, no user interaction
         Display a centered popup with the given message during duration seconds
         If size_x and size_y: set the popup size
         else set it automatically
         Return True if the popup could be displayed

        popup_type='input'
         Display a centered popup with the given message and a input field
         If size_x and size_y: set the popup size
         else set it automatically
         Return the input string or None if the field is empty

        popup_type='yesno'
         Display a centered popup with the given message
         If size_x and size_y: set the popup size
         else set it automatically
         Return True (yes) or False (no)
        r   Nkeyry   r   r   r   FrS   r     Tr   )Zinsert_mode z$User enters the following string: %srU   zUser centers an empty stringr   )r   r   r   rb   r   r   rZ   ZnewwinZborderr   addnstrZrefreshwaitZderwinZattronr   rv   rf   GlancesTextboxZeditZgatherr
   rn   GlancesTextboxYesNo)ri   messageZsize_xZsize_ydurationr   Z
input_sizer   Zsentence_listscreen_xscreen_yZpos_xZpos_yZpopupr   r1   ZsubpopZtextboxrj   rj   rk   r   P  sj   





 

z_GlancesCurses.display_popupT  r   c              
   C   s  |du s|d r|d sdS | j  d }| j  d }|d dkr*|| | }n| j}|d dkr;|| | }	n| j}	|}
|
}|	}|d D ]}z|d	 d
rZ|d7 }|}
W qHW n   Y |
dk reqH|d st|
t|d	  |krtqH|dk s|d |ks||kr nJ|s|d rqH|s|d rqHz| j ||
|d	 ||
 | j	|d   W n	 t
y   Y qHw z|
tt|d	 7 }
W n	 ty   Y nw |
|kr|
}qHt| j|| j | _t| j|| j | _|  j|7  _dS )a  Display the plugin_stats on the screen.

        If display_optional=True display the optional stats
        If display_additional=True display additionnal stats
        max_y: do not display line > max_y
        add_space: add x space (line) after the plugin
        Nr   r   r   r   ZalignrightZbottommsgr   Z
splittableoptional
additionalZ
decoration)rb   r   r   r   r   r   r   r   r  r   r   r   UnicodeDecodeErrorr   r   rX   r   rY   )ri   Zplugin_statsr   r   r  r   r  r  Z	display_xZ	display_yr   Zx_maxr   r1   rj   rj   rk   r     sl   
z_GlancesCurses.display_pluginc                 C   s   | j   dS )z Erase the content of the screen.N)rb   eraserr   rj   rj   rk   r       z_GlancesCurses.erasec                 C   s   |    | j||d dS )a  Clear and update the screen.

        stats: Stats database to display
        cs_status:
            "None": standalone or server mode
            "Connected": Client is connected to the server
            "Disconnected": Client is disconnected from the server
        r   N)r  r   )ri   r   r   rj   rj   rk   flush  s   	z_GlancesCurses.flushc                 C   s   | j ||d |dkrtd d}d}t|}| jd | sm|sm| j|d}|tdkp5|td	k}|t	j
kr=|S |rN| jjrN| jj | j_d}|S |sg|d
krg| j ||d | jt| d d | sm|r$|S )a  Update the screen.

        INPUT
        stats: Stats database to display
        duration: duration of the loop
        cs_status:
            "None": standalone or server mode
            "Connected": Client is connected to the server
            "Disconnected": Client is disconnected from the server
        return_to_browser:
            True: Do not exist, return to the browser list
            False: Exit and return to the shell

        OUTPUT
        True: Exit key has been pressed
        False: Others cases...
        r  r   z0Update and export time higher than refresh_time.g?Fd   )r   r   r   rU   r  )delay)r  r
   r   r   rb   ZtimeoutZfinished_GlancesCurses__catch_keyr   rZ   r   rW   r,   r	  r   r   )ri   r   r  r   r   Z	isexitkeyZ	countdownrg   rj   rj   rk   update&  s*   

z_GlancesCurses.updater  c                 C   s   t d dS )zWait delay in msr  N)rZ   Znapms)ri   r  rj   rj   rk   r	  a  r  z_GlancesCurses.waitc              
   C   s   z2|rt tddd |d D dt d}W |S t tddd |d D dt d}W |S  tyM } ztd| W Y d	}~d
S d	}~ww )z1Return the width of the formatted curses message.r  c                 S   s4   g | ]}|d  st t t|d ddndqS )r  r  asciireplacer  r   r   encoder   r-   rj   rj   rk   r   j  s    ,z:_GlancesCurses.get_stats_display_width.<locals>.<listcomp>r   r   r  c                 S   s(   g | ]}t t t|d  ddqS )r  r  r  r   r"  rj   rj   rk   r   n  s     z(ERROR: Can not compute plugin width ({})Nr   )r   r   r   r   r   r
   rn   ro   )ri   	curse_msgr   r#   r   rj   rj   rk   r   e  s&   


z&_GlancesCurses.get_stats_display_widthc              
   C   sZ   zdd |d D  d}W |d S  ty, } ztd| W Y d}~dS d}~ww )	z|Return the height of the formatted curses message.

        The height is defined by the number of '\n' (new line).
        c                 S   s   g | ]}|d  qS )r  rj   r"  rj   rj   rk   r   |  s    z;_GlancesCurses.get_stats_display_height.<locals>.<listcomp>r   r   z)ERROR: Can not compute plugin height ({})Nr   r   )countr   r
   rn   ro   )ri   r#  r#   r   rj   rj   rk   r   v  s   z'_GlancesCurses.get_stats_display_height)NN)Fr   )NNrR   r   r  N)TTr  r   )rR   NF)r  )/__name__
__module____qualname____doc__r   r   r   r   r   r   r   r   r  rl   r_   rq   rh   r`   ra   rv   r   r  r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r	  r   r   rj   rj   rj   rk   r   .   s   	
 !"#$&'()*+9
7	x
x
# K
g
`


;
r   c                   @      e Zd ZdZdS )GlancesCursesStandalonez'Class for the Glances curse standalone.Nr%  r&  r'  r(  rj   rj   rj   rk   r*        r*  c                   @   r)  )GlancesCursesClientz#Class for the Glances curse client.Nr+  rj   rj   rj   rk   r-    r,  r-  c                       (   e Zd Z fddZ fddZ  ZS )r
  c                       t t| j|i | d S r   )superr
  rl   ri   rW   kwargs	__class__rj   rk   rl        zGlancesTextbox.__init__c                    s(   |dkrdS |dkrdS t t| |S )Nr   r      r}   )r0  r
  
do_commandri   Zchr3  rj   rk   r7    s
   zGlancesTextbox.do_commandr%  r&  r'  rl   r7  __classcell__rj   rj   r3  rk   r
        r
  c                       r.  )r  c                    r/  r   )r0  r  rl   r1  r3  rj   rk   rl     r5  zGlancesTextboxYesNo.__init__c                    s   t t| |S r   )r0  r  r7  r8  r3  rj   rk   r7    s   zGlancesTextboxYesNo.do_commandr9  rj   rj   r3  rk   r    r;  r  )#r(  Z
__future__r   r\   Zglances.compatr   r   r   r   r   Zglances.globalsr   r	   Zglances.loggerr
   Zglances.eventsr   Zglances.processesr   r   Zglances.timerr   rZ   Zcurses.panelZcurses.textpadr   ImportErrorr[   r]   objectr   r*  r-  r
  r  rj   rj   rj   rk   <module>   sH   	        ^