³ņ
cŗ&Ic           @   sV   d  d k  Z  d  d k Z d  d k Z d  d k Z d  d k Z d e f d     YZ d S(   i’’’’Nt
   OpenOfficec           B   sų   e  Z d  d e d  Z e i d    Z e i d    Z e i d    Z e i d    Z	 e i d    Z
 e i d    Z e i e d	   Z e i d
    Z e i d    Z e i d    Z d d d d d  Z d   Z d   Z RS(   t	   localhostiŅ  c         C   s£   | |  _  | |  _ | |  _ d  |  _ | |  _ d  |  _ | |  _ d  |  _ d  |  _	 d  |  _
 | o |  i   n |  i   |  i d  |  _ |  i   |  i   d  S(   Ns   com.sun.star.awt.Toolkit(   t   logt   hostt
   executablet   Nonet   oo_pidt   portt   presentationt
   propertiest   doct   framet   windowt   start_oot   create_oo_connectiont   create_instancet   toolkitt   create_windowt   create_frame(   t   selfR   R	   R   R   R   t   start(    (    sL   /home/credativ/UK/projects/onelan/pyplayer/player_presentation_openoffice.pyt   __init__   s     										

c         C   sš   t  i   } | i i d |  } t } d } x­ | p„ y, | i d |  i |  i f  |  _ t	 } Wq0 t
 i j
 oc | d j o |  i i d  n | d j o |  i i d    n | d 7} t i d  q0 Xq0 W|  i i |  _ d  S(   Ns"   com.sun.star.bridge.UnoUrlResolveri    s:   uno:socket,host=%s,port=%s;urp;StarOffice.ComponentContexts   OOo not available, retrying...i
   s   OOo not available, giving up.i   (   t   unot   getComponentContextt   ServiceManagert   createInstanceWithContextt   Falset   resolveR   R   t   ctxt   Truet   player_presentation_errorst   NoConnectExceptionR   t   debugt   timet   sleept   smgr(   R   t   local_contextt   resolvert	   connectedt   connectcount(    (    sL   /home/credativ/UK/projects/onelan/pyplayer/player_presentation_openoffice.pyR       s(    	 	

c         C   s>   t  i t  i |  i d d |  i |  i f d d d  |  _ d  S(   Nt   soffices#   -accept=socket,host=%s,port=%s;urp;s
   -norestores
   -invisibles   -nofirststartwizard(   t   ost   spawnlt   P_NOWAITR   R   R   R   (   R   (    (    sL   /home/credativ/UK/projects/onelan/pyplayer/player_presentation_openoffice.pyR   6   s    c         C   sß   t  i d  } t  i d  } |  i i   } | |   } d d	 d     Y} |   } |   } | | _ d  | _ d | _ t  i d d  | _	 | i
 | i B| i B| i B| i B| i B| _ d | _ |  i i |  |  _ d  S(
   Ns!   com.sun.star.awt.WindowDescriptors   com.sun.star.awt.Rectanglet   WindowAttributeClassc           B   s   e  Z d    Z RS(   c         S   s   t  i d |  S(   Ns#   com.sun.star.awt.WindowAttribute.%s(   R   t   getConstantByName(   R   t   name(    (    sL   /home/credativ/UK/projects/onelan/pyplayer/player_presentation_openoffice.pyt   __getattr__J   s    (   t   __name__t
   __module__R/   (    (    (    sL   /home/credativ/UK/projects/onelan/pyplayer/player_presentation_openoffice.pyR,   I   s   i’’’’s   com.sun.star.awt.WindowClasst   TOPt
   workwindow(    (   R   t   getClassR	   t   get_locationt   BoundsR   t   Parentt   ParentIndext   Enumt   Typet   BORDERt	   CLOSEABLEt   FULLSIZEt   MOVEABLEt   SIZEABLEt   SYSTEMDEPENDENTt   WindowAttributest   WindowServiceNameR   t   createWindowR   (   R   t   WindowDescriptort	   Rectanglet   loct   rectR,   t   WindowAttributet   wd(    (    sL   /home/credativ/UK/projects/onelan/pyplayer/player_presentation_openoffice.pyR   A   s    					"	c         C   s5   |  i  d  |  _ |  i i |  i  d  |  i _ d  S(   Ns   com.sun.star.frame.Frame(   R   R   t
   initializeR   R   t   LayoutManager(   R   (    (    sL   /home/credativ/UK/projects/onelan/pyplayer/player_presentation_openoffice.pyR   ]   s    c         C   s4   |  i  d  j	 o  |  i  i d d d d d  n d  S(   NiŠ  id   i   (   R   R   t
   setPosSize(   R   (    (    sL   /home/credativ/UK/projects/onelan/pyplayer/player_presentation_openoffice.pyt   move_offscreenc   s    c         C   sD   |  i  t  |  i i | d d d  |  _ |  i i   |  _ |  i S(   Nt   _selfi   (    (   t   set_visibleR   R   t   loadComponentFromURLR
   t   getPresentationR   (   R   t   url(    (    sL   /home/credativ/UK/projects/onelan/pyplayer/player_presentation_openoffice.pyt   get_presentationh   s    c         C   sG   | o |  i    n/ |  i   |  i d  j	 o |  i i t  n d  S(   N(   t   set_locationRM   R   R   t
   setVisibleR   (   R   t   visible(    (    sL   /home/credativ/UK/projects/onelan/pyplayer/player_presentation_openoffice.pyRO   o   s
    
c         C   sO   |  i  i   \ } } } } |  i d  j	 o  |  i i | | | | d  n d  S(   Ni   (   R	   R5   R   R   RL   (   R   t   xt   yt   wt   h(    (    sL   /home/credativ/UK/projects/onelan/pyplayer/player_presentation_openoffice.pyRT   x   s    c         C   s&   |  i  i |  |  i i | |  i  S(   N(   R   R    R#   R   R   (   R   t   instance_type(    (    sL   /home/credativ/UK/projects/onelan/pyplayer/player_presentation_openoffice.pyR   ~   s    c      	   C   sĄ   |  i  d  j	 o: y |  i  i t  Wn t i j
 o n Xd  |  _  n xX |  i |  i g D]D } | d  j	 o1 y | i   Wn t i j
 o n Xd  } q] q] Wt	 i
 d |  i f  d  S(   Ns
   kill -9 %d(   R
   R   t   closeR   R   t   DisposedExceptionR   R   t   disposeR)   t   systemR   (   R   t   oo_obj(    (    sL   /home/credativ/UK/projects/onelan/pyplayer/player_presentation_openoffice.pyt	   terminate   s     c         C   s   t  i d  } |   } | d  j o | | _ n | d  j o | | _ n | d  j o | | _ n | d  j o | | _ n | S(   Ns    com.sun.star.beans.PropertyValue(   R   R4   R   t   Namet   Valuet   Handlet   State(   R   Rb   Rc   Rd   Re   t   PropertyValuet   oPropertyValue(    (    sL   /home/credativ/UK/projects/onelan/pyplayer/player_presentation_openoffice.pyt   makePropertyValue   s    	c         C   s%   |  i  d  j	 o |  i  i   n d  S(   N(   R   R   t   toFront(   R   (    (    sL   /home/credativ/UK/projects/onelan/pyplayer/player_presentation_openoffice.pyt   to_front„   s    c         C   s%   |  i  d  j	 o |  i  i   n d  S(   N(   R   R   t   toBack(   R   (    (    sL   /home/credativ/UK/projects/onelan/pyplayer/player_presentation_openoffice.pyt   to_back©   s    N(   R0   R1   R   R   t   player_presentation_utilst
   log_methodR   R   R   R   RM   RS   RO   RT   R   Ra   R   Rh   Rj   Rl   (    (    (    sL   /home/credativ/UK/projects/onelan/pyplayer/player_presentation_openoffice.pyR    
   s    	(   R)   R!   R   R   Rm   t   objectR    (    (    (    sL   /home/credativ/UK/projects/onelan/pyplayer/player_presentation_openoffice.pys   <module>   s
   
