
    Je                         d Z ddlmZ ddlmZ ddl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  G d	 d
      Z G d de      Zy)z
Breakpoint Plugin.
    N)Signal)PluginsSpyderDockablePlugin)on_plugin_availableon_plugin_teardown_)BreakpointWidget)ApplicationMenusc                       e Zd ZdZy)BreakpointsActionslist_breakpoints_actionN)__name__
__module____qualname__ListBreakpoints     C/usr/lib/python3/dist-packages/spyder/plugins/breakpoints/plugin.pyr   r      s    /Or   r   c                      e Zd ZdZdZej                  gZej                  gZ	ej                  gZeZeZdZ e       Z	  eee      Z	  eeee      Z	  e       Z	 ed        Zd Zd Zd Z eej                        d	        Z eej                        d
        Z eej                        d        Z  eej                        d        Z!d Z"ddZ#y)Breakpointsz!
    Breakpoint list Plugin.
    breakpointsFc                      t        d      S )Nr   r   r   r   r   get_namezBreakpoints.get_nameY   s    r   c                     t        d      S )Nz*Manage code breakpoints in a unified pane.r   selfs    r   get_descriptionzBreakpoints.get_description]   s    =>>r   c                 $    | j                  d      S )Nr   )create_iconr   s    r   get_iconzBreakpoints.get_icon`   s    ..r   c                    | j                         }|j                  j                  | j                         |j                  j                  | j                         |j                  j                  | j                         |j
                  j                  | j
                         | j                  t        j                  t        d      | j                  | j                                y )NzList breakpoints)	triggeredicon)
get_widget#sig_clear_all_breakpoints_requestedconnectsig_clear_breakpoint_requestedsig_edit_goto_requested$sig_conditional_breakpoint_requestedcreate_actionr   r   r	   switch_to_pluginr!   )r   widgets     r   on_initializezBreakpoints.on_initializec   s    "22::44	6--55//	1&&..t/K/KL33;;55	7 	.. !++	 	 	
r   )pluginc                 >   | j                         }| j                  t        j                        }| j	                  t
        j                        }|j                  j                  | j                         |j                  j                  |j                         |j                  j                  |j                         |j                  j                  |j                         |j                   j                  |j"                         |xj$                  |gz  c_        y N)r%   
get_pluginr   Editor
get_actionr   r   breakpoints_savedr'   set_datar&   clear_all_breakpointsr(   clear_breakpointr)   loadr*   "set_or_edit_conditional_breakpointpythonfile_dependent_actionsr   r-   editorlist_actions       r   on_editor_availablezBreakpoints.on_editor_availableu   s    "0oo&8&H&HI 	  ((722::((	*--55f6M6MN&&..v{{;33;;55	7 	++}<+r   c                     | j                  t        j                        }| j                  t        j
                        }|j                  |t        j                         y N)menu_id)	r2   r   MainMenur4   r   r   add_item_to_application_menur   Debug)r   mainmenur>   s      r   on_main_menu_availablez"Breakpoints.on_main_menu_available   sJ    ??7#3#34oo&8&H&HI--!1!7!7 	. 	9r   c                 H   | j                         }| j                  t        j                        }| j	                  t
        j                        }|j                  j                  | j                         |j                  j                  |j                         |j                  j                  |j                         |j                  j                  |j                         |j                   j                  |j"                         |j$                  j'                  |       y r1   )r%   r2   r   r3   r4   r   r   r5   
disconnectr6   r&   r7   r(   r8   r)   r9   r*   r:   r;   remover<   s       r   on_editor_teardownzBreakpoints.on_editor_teardown   s    "0oo&8&H&HI  ++DMM:22==((	*--88##	%&&11&++>33>>55	7 	++22;?r   c                     | j                  t        j                        }|j                  t        j
                  t        j                         y rA   )r2   r   rC   !remove_item_from_application_menur   r   r   rE   )r   rF   s     r   on_main_menu_teardownz!Breakpoints.on_main_menu_teardown   s<    ??7#3#3422..8H8N8N 	3 	Pr   c                 L   | j                  di d      }t        |j                               D ]s  }t        j                  |      s|j                  |       *t        j                  |      }||k7  sE|j                  |      }||v r||   j                  |       o|||<   u |S )z?
        Load breakpoint data from configuration file.
        r   run)defaultsection)get_conflistkeysospisfilepopnormcaseextend)r   breakpoints_dictfilenamenew_filenamebps        r   
_load_datazBreakpoints._load_data   s      == ) 

 -2245 	8H::h' $$X.<<1Lx'%))(3#33$\299"=57$\2	8  r   Nc                 f    || j                         }| j                         j                  |       y)z
        Set breakpoint data on widget.

        Parameters
        ----------
        data: dict, optional
            Breakpoint data to use. If None, data from the configuration
            will be loaded. Default is None.
        N)r_   r%   r6   )r   datas     r   r6   zBreakpoints.set_data   s*     <??$D""4(r   r1   )$r   r   r   __doc__NAMEr   r3   REQUIRESrC   OPTIONALHelpTABIFYr
   WIDGET_CLASSCONF_SECTION	CONF_FILEr   r&   strintr(   r)   r*   staticmethodr   r   r!   r.   r   r?   rG   r   rK   rN   r_   r6   r   r   r   r   r   $   s3    DH  !Hll^F#LLI +1('
 &,C%5"	 %S#s3 ,28(    ?/
$ /= 0="  0 019 29 w~~.@ /@  w//0P 1P 4)r   r   )rb   os.pathpathrV   qtpy.QtCorer   spyder.api.pluginsr   r   )spyder.api.plugin_registration.decoratorsr   r   spyder.api.translationsr	   .spyder.plugins.breakpoints.widgets.main_widgetr
   spyder.plugins.mainmenu.apir   r   r   r   r   r   <module>rv      s@   
   =- % K 8
0 0j)& j)r   