³ò
ZAIHc           @   s  d  Z  d Z d Z d d k Z d d k Z d d k Z d d k i Z d d k i	 Z	 d d k
 l Z y% d d k Z e i i e i ƒ Z Wn: e j
 o. e i i e ƒ Z e i i e d ƒ Z n Xe i i e d ƒ Z d d k Z e i i d e ƒ d d	 k l Z d d
 k l Z e i d =e i o d e j o d e Z n d „  Z d e f d „  ƒ  YZ d d d „  ƒ  YZ d S(   s   www.stani.bet   GPLs   
This module was originally developed for SPE - Stani's Python Editor
Pleave leave this header intact.

Homepage:   http://pythonide.stani.be
Email:      spe.stani.be@gmail.com
Copyright:  (c) 2005 www.stani.be
License:    GPL (contact me for other licenses)

This program is free software; you can redistribute it and/or modify it 
under the terms of the GNU General Public License as published by the 
Free Software Foundation; either version 2 of the License, or any later 
version.

This program is distributed in the hope that it will be useful, 
but WITHOUT ANY WARRANTY; without even the implied warranty of 
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along 
with this program; if not, write to the Free Software Foundation, Inc., 
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA    
iÿÿÿÿN(   t   winpdbDialogt   winpdbs	   winpdb.pyi    (   t   CSimpleSessionManager(   t   start_embedded_debuggert    s   "%s"c         C   s   |  S(   N(    (   t   x(    (    s    C:\py\_spe\plugins\spe_winpdb.pyt   _;   s    t   SessionManagerc           B   s_   e  Z d  Z e Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d „  Z e d „ Z RS(	   t    c         C   s?   | |  _  | i |  _ | i i |  _ t i |  d |  i ƒd  S(   Nt   fAllowUnencrypted(   t   runnert   appt   fCryptot	   encryptedR   t   __init__(   t   selfR   (    (    s    C:\py\_spe\plugins\spe_winpdb.pyR   C   s    	c         C   s»   |  i  o d  Sn |  i i } | i | ƒ | oQ t i | i d | d |  i t i t i	 Bt i
 Bƒ } | i ƒ  } | i ƒ  n
 t i } | t i j o |  i i ƒ  n |  i ƒ  d  S(   Ns(   %s
Do you want to launch the debugger?

s   SPE - %s(   t   debuggerR   t   childActivet	   setStatust   wxt   MessageDialogt   framet   command_linet   YES_NOt
   NO_DEFAULTt   ICON_QUESTIONt	   ShowModalt   Destroyt	   ID_CANCELt   ID_YESR   t   debugt
   request_go(   R   t   statust   messaget
   showDialogt   childt   dlgt   answer(    (    s    C:\py\_spe\plugins\spe_winpdb.pyt   _ask_to_launch_debuggerI   s    
 
	c         C   sP   t  |  i _ |  i i t  ƒ |  i i } | i d |  i ƒ | i i	 i
 ƒ  d  S(   Ns   Terminated "%s"(   t   FalseR   t   runningt
   _check_runR   R   R   R   t	   statusBart   throbbert   stop(   R   R$   (    (    s    C:\py\_spe\plugins\spe_winpdb.pyt   _feedback_terminate\   s
    c         C   s3   t  i |  i d d |  i d d d |  i i ƒd  S(   NR!   s   Unhandled exception at "%s"R"   s    An unhandled exception occurred.R#   (   R   t	   CallAfterR'   R   R   t   exceptionPrevious(   R   (    (    s    C:\py\_spe\plugins\spe_winpdb.pyt   unhandled_exception_callbacke   s    c         C   s4   |  i  i } t i | i d |  i ƒ |  i ƒ  d  S(   Ns   Terminating "%s"(   R   R   R   R/   R   R   R    (   R   R$   (    (    s    C:\py\_spe\plugins\spe_winpdb.pyt"   script_about_to_terminate_callbackl   s    c         C   s   t  i |  i ƒ |  i ƒ  d  S(   N(   R   R/   R.   t   detach(   R   (    (    s    C:\py\_spe\plugins\spe_winpdb.pyt   script_terminated_callbackr   s    c         C   sê   |  i  i } |  i ƒ  \ } } t i t i t i t g } |  i p | i	 d ƒ n t i
 o | i d | g ƒ n | i d | g ƒ y1 t i | Œ  t |  _ | i d |  i d ƒ Wn) t j
 o } | i d | d ƒ n Xd S(   s$   Attach WinPdb to the running script.s   -ts   -p"%s"s   -as$   WinPdb Debugger is attached to "%s".i   s   WinPdb Debugger failed: "%s".N(   R   R   t   prepare_attacht   ost   P_NOWAITt   infot   PYTHON_EXECt   WINPDBR   t   appendt   WINt   extendt   spawnlt   TrueR   R   R   t	   Exception(   R   R$   t   ridt   pwdt   argsR"   (    (    s    C:\py\_spe\plugins\spe_winpdb.pyR   x   s"    	

	c         C   sr   | |  _  |  i i } | i i i ƒ  | i d | ƒ |  i i t	 ƒ t	 |  i _
 t i t i |  | | f ƒ d S(   s   Launch a script with rpdb2.s   Running "%s"N(   R   R   R   R+   R,   t   runR   R   R*   R?   R)   t   threadt   start_new_threadR   t   launch(   R   R   t   fchdirR$   (    (    s    C:\py\_spe\plugins\spe_winpdb.pyRG   Ž   s    	(   t   __name__t
   __module__R   R(   R   R   R'   R.   R1   R2   R4   R   R?   RG   (    (    (    s    C:\py\_spe\plugins\spe_winpdb.pyR   =   s   								t   Runnerc           B   s_   e  Z g  Z d  Z e Z e Z d „  Z d „  Z	 d „  Z
 d „  Z d „  Z d „  Z d „  Z RS(   R	   c         C   s}   | |  _  d  |  _ d |  _ | i o |  i d 7_ n |  i  i } | i i o | i i i |  _	 n | i
 i i |  _	 d  S(   Ns   SPE - Run files    (encrypted)(   R   t   Nonet   sessiont   titleR   R   R   t   menuBart   check_run_debugR*   t   parentFrame(   R   R   R$   (    (    s    C:\py\_spe\plugins\spe_winpdb.pyR   ¡   s    			
c         C   sq  |  i  i } | i ƒ  o7| i ƒ  o)| i } t i |  i  i | ƒ } | i ƒ  } | i	 ƒ  | t
 i j oÁ |  i  i } t i t i t i g } | i | d ƒ t i i | ƒ oX t i o d | j o d | } n | i | ƒ | d } | o | i | ƒ qn t i | Œ  | i d d ƒ qm|  i t ƒ | i d d ƒ n |  i t ƒ | i d d ƒ d  S(	   Nt
   parametersR   s   "%s"t	   argumentss'   WinPdb Debugger is succesfully started.i   s   WinPdb Debugger was cancelled.s6   File must be saved before WinPdb Debugger is launched.(   R   R   t   confirmSavet   isNewt   fileNameR   t   dialogRQ   R   R   R   R   t	   debugInfoR6   R7   R8   R9   R=   t   patht   existsR<   R;   R>   R   R*   R(   (   R   R$   t   namet   debugDialogR&   t   _infoRC   t   script_args(    (    s    C:\py\_spe\plugins\spe_winpdb.pyt   _debug_childActive¯   s2    	

c         C   s^   |  i  o |  i ƒ  nC |  i i } | i ƒ  o | i ƒ  o |  i | ƒ n |  i ƒ  d S(   s   Run/stop fileN(   R)   R-   R   R   RT   RU   RD   t   cancel(   R   R$   (    (    s    C:\py\_spe\plugins\spe_winpdb.pyt   switchÌ   s    
c   	   	   C   s  | i  } d d k l } | | |  i |  i d |  i i d d ƒ} | i ƒ  } | i i	 ƒ  } | i
 i	 ƒ  } | i ƒ  | t i j om |  i i |  i ƒ | |  _ | |  _ | } |  i o | d |  i 7} n t |  ƒ |  _ |  i i | ƒ n |  i ƒ  d S(   s,   Show dialog for arguments and launch script.iÿÿÿÿ(   t   RunWinPdbDialogt   parentt   idR   N(   RV   t   _spe.dialogs.runWinPdbDialogRb   t   argumentsPreviousR0   R   RQ   R   RS   t   GetValuet	   exceptionR   R   t   ID_OKR;   t   dlg_argumentsR   RM   RG   R`   (	   R   R$   RV   Rb   t   runWinPdbDialogR&   Rj   t   dlg_exceptionR   (    (    s    C:\py\_spe\plugins\spe_winpdb.pyRD   Ø   s*    			
		
c         C   sX   y |  i  i ƒ  Wn@ t j
 o4 } | o$ |  i i } | i d | d ƒ qT n Xd S(   s   Stop script.s9   WinPdb unhandled exception while stopping debuggee: "%s".i   N(   RM   t   stop_debuggeeR@   R   R   R   (   R   R"   R$   (    (    s    C:\py\_spe\plugins\spe_winpdb.pyR-   ó   s    c         C   s)   |  i  o |  i i ƒ  n |  i ƒ  d S(   s'   Debug running script or current script.N(   R)   RM   R   R_   (   R   (    (    s    C:\py\_spe\plugins\spe_winpdb.pyR   ü   s    
c         C   s-   |  i  t ƒ |  i i } | i d d ƒ d S(   s.   Cancel running a script. (feedback on toolbar)s-   Running the script with WinPdb was cancelled.i   N(   R*   R(   R   R   R   (   R   R$   (    (    s    C:\py\_spe\plugins\spe_winpdb.pyR`     s    (   RI   RJ   Rf   Rj   R?   R0   R(   R)   R   R_   Ra   RD   R-   R   R`   (    (    (    s    C:\py\_spe\plugins\spe_winpdb.pyRK   ™   s   							(    (   t
   __author__t   __license__t   __doc__R6   RE   R   t	   _spe.infoR8   t	   _spe.Menut   Menut   dialogsR   R   RY   t   dirnamet   __file__t
   winpdb_dirt   ImportErrort   plugins_dirt   joinR:   t   syst   insertt   rpdb2R   R   R<   R   R   RK   (    (    (    s    C:\py\_spe\plugins\spe_winpdb.pys   <module>   s0   
	\