ó
œ<Ìac           @   sq   d  Z  d d l Z d d l Z d d l Z d d l Z d d l Z d e j f d „  ƒ  YZ d „  Z d „  Z	 d S(   s  
**Project Name:**      MakeHuman

**Product Home Page:** http://www.makehuman.org/

**Code Home Page:**    https://bitbucket.org/MakeHuman/makehuman/

**Authors:**           Glynn Clements

**Copyright(c):**      MakeHuman Team 2001-2014

**Licensing:**         AGPL3 (http://www.makehuman.org/doc/node/the_makehuman_application.html)

    This file is part of MakeHuman (www.makehuman.org).

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as
    published by the Free Software Foundation, either version 3 of the
    License, or (at your option) 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 Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

**Coding Standards:**  See http://www.makehuman.org/node/165

Abstract
--------

Image viewer plugin .
Useful for showing the rendering results.
It can also be used to view other MH related image files,
like textures, bump maps etc.
iÿÿÿÿNt   ViewerTaskViewc           B   s   e  Z d  „  Z d „  Z RS(   c            sÂ   t  t ˆ  ƒ j | d ƒ ˆ  j t j ƒ  ƒ ˆ  _ d  ˆ  _ ˆ  j	 t j
 d ƒ ƒ } | j t j d ƒ ƒ ˆ  _ | j t j d ƒ ƒ ˆ  _ ˆ  j j ‡  f d †  ƒ } ˆ  j j ‡  f d †  ƒ } d  S(   Nt   Viewert   Toolst   Refreshs
   Save As...c            s©   ˆ  j  sR t j  j t j d ƒ ƒ s= t j t j d ƒ ƒ n  t j d ƒ ˆ  _  n  t j t j  j ˆ  j  ƒ d d ƒ } | r¥ t j  j | ƒ ˆ  _  ˆ  j	 j
 | ƒ n  d  S(   Nt   renderi    s6   PNG Image (*.png);;JPEG Image (*.jpg);;All files (*.*)(   t   patht   ost   existst   mht   getPatht   makedirst   getSaveFileNamet   splitextt   dirnamet   imaget   save(   t   eventt   filename(   t   self(    s   plugins/4_rendering_9_viewer.pyt	   onClicked<   s    		c            s$   ˆ  j  s d  Sˆ  j j ˆ  j  ƒ d  S(   N(   R   R   t   setImage(   R   (   R   (    s   plugins/4_rendering_9_viewer.pyR   H   s    	(   t   superR    t   __init__t   addTopWidgett   guit   ZoomableImageViewR   t   NoneR   t   addLeftWidgett   GroupBoxt	   addWidgett   Buttont   refrBtnt   saveBtnt   mhEvent(   R   t   categoryt   toolsR   (    (   R   s   plugins/4_rendering_9_viewer.pyR   3   s    	c         C   sH   t  | t ƒ r | |  _ n	 d  |  _ |  j j | ƒ t j d | ƒ d  S(   Ns"   Image "%s" loaded in image viewer.(   t
   isinstancet
   basestringR   R   R   R   t   logt   message(   R   R   (    (    s   plugins/4_rendering_9_viewer.pyR   N   s
    	(   t   __name__t
   __module__R   R   (    (    (    s   plugins/4_rendering_9_viewer.pyR    2   s   	c         C   s5   |  j  d ƒ } t | ƒ } d | _ | j | ƒ d  S(   Nt	   Renderingg       @(   t   getCategoryR    t	   sortOrdert   addTask(   t   appR"   t   taskview(    (    s   plugins/4_rendering_9_viewer.pyt   loadV   s    	c         C   s   d  S(   N(    (   R.   (    (    s   plugins/4_rendering_9_viewer.pyt   unload\   s    (
   t   __doc__R   R   t   gui3dR   R&   t   TaskViewR    R0   R1   (    (    (    s   plugins/4_rendering_9_viewer.pyt   <module>)   s   $	