
    ը	fo                        d Z ddlZddlmZ ddlmZmZ ddlmZ ddl	m
c mZ ddlm
c mZ ddlmZ  G d dej$                        Zed	k(  r: ej*                         Z ed      Zej1                          ej3                          yy)
aE  
@package rdigit.dialogs

@brief rdigit dialog for creating new map.

Classes:
 - rdigit:NewRasterDialog

(C) 2014 by the GRASS Development Team
This program is free software under the GNU General Public
License (>=v2). Read the file COPYING that comes with GRASS
for details.

@author Anna Petrasova <kratochanna gmail.com>
    N)Select)Button
StaticText)GWarning)CalledModuleErrorc                   4    e Zd ZdZd Zd Zd Zd Zd Zd Z	y)	NewRasterDialogz_Dialog for new raster map name and type selection
    and selection of optional background map.c                    t         j                  j                  | |       | j                  t	        d             d | _        d | _        t        | d      | _        t        | d      | _	        t        j                  | g d      | _        | j                  j                  d       | j                  j                          t        | t         j                        }t        | t         j                         }|j#                          |j%                  t         j&                  | j(                         t        j*                  t         j,                        }t        j.                  dd	      }|j1                  t3        | t	        d
            ddt         j4                         |j1                  | j                  dd       |j1                  t3        | t	        d            ddt         j4                         |j1                  | j                  dd       |j1                  t3        | t	        d            dt         j6                  t         j4                  z         |j1                  | j                  dt         j6                         |j1                  |dt         j6                  t         j8                  z  d       t        j:                         }|j=                  |       |j=                  |       |j?                          |j1                  |t         j6                  t         j8                  z  d       | j                  j%                  t         j@                  | jB                         | jE                  |       |jG                  |        y )NzCreate new raster mapraster)parenttype)CELLFCELLDCELL)choicesr   )r   id
   )hgapvgapzName for new raster map:)label)r   r   )      )posspanflag)r   r   )r   r   z(Optionally select background raster map:)r   r   )   r   zNew raster map type:)   r   )r   r   )r   r   r   )
proportionr   border)r   r   )$wxDialog__init__SetTitle__name_typer   
_mapSelect_backgroundSelectChoice_typeChoiceSetSelectionSetFocusr   	ID_CANCELID_OK
SetDefaultBind
EVT_BUTTONOnOKBoxSizerVERTICALGridBagSizerAddr   ALIGN_CENTER_VERTICALEXPANDALLStdDialogButtonSizer	AddButtonRealizeEVT_TEXTOnBackgroundMapSetSizerFit)selfr   	btnCancelbtnOK	mainSizersizerbtnSizers          //usr/lib/grass83/gui/wxpython/rdigit/dialogs.pyr"   zNewRasterDialog.__init__    s   
		4(a/01

 !8<!'t(!C99T3MN%%a(  "$2<<8	drxx0

2==$)), KK,	Rb1		t1%?#@A))	 	 	
 			$//vF	;		t1%O#PQ))	 	 	
 			$((f6	B		t1%;#<=R555 	 	

 			$""RYY	?e		BFF0B2N**,9%5!hRYY%7C##BKK1E1EFi d    c                     | j                   j                         }	 t        j                  |      }| j                  j                  |d          y # t        $ r Y y w xY w)Ndatatype)r(   GetValuegrastraster_infor*   SetStringSelectionr   )rA   eventvaluerets       rG   r>   zNewRasterDialog.OnBackgroundMapX   sU    &&//1	##E*C//J@  		s   3A 	AAc                    | j                         }|s%t        | j                         t        d             y t	        j
                  |t	        j                         d         }|r|d   t	        j                         d   k(  rt        j                  | j                         t        d      |z  t        d      t        j                  t        j                  z  t        j                  z        }|j                         t        j                  k(  s|j                          y |j                          | j                  t        j                          y | j                  t        j                          y )	Nz(Please specify name for a new raster map)r   messageMAPSET)namemapsetrV   zRRaster map <%s> already exists in the current mapset. Do you want to overwrite it?z
Overwrite?)rS   captionstyle)
GetMapNamer   	GetParentr$   gcore	find_filegisenvr    MessageDialogYES_NOYES_DEFAULTICON_QUESTION	ShowModalID_YESDestroyEndModalr.   )rA   rO   mapNamefounddlgOverwrites        rG   r2   zNewRasterDialog.OnOK`   s	   //#~~'DE
 OO9QRExELLN8,DD!//NN$7
  lO))bnn4r7G7GG
  $--/299< ((* ((*MM"((+bhh'rH   c                 6    | j                   j                         S N)r'   rK   rA   s    rG   rY   zNewRasterDialog.GetMapName~   s    ''))rH   c                 6    | j                   j                         S rj   )r(   rK   rk   s    rG   GetBackgroundMapNamez$NewRasterDialog.GetBackgroundMapName   s    %%..00rH   c                 6    | j                   j                         S rj   )r*   GetStringSelectionrk   s    rG   
GetMapTypezNewRasterDialog.GetMapType   s    2244rH   N)
__name__
__module____qualname____doc__r"   r>   r2   rY   rm   rp    rH   rG   r	   r	      s&    16p(<*15rH   r	   __main__)rt   r    gui_core.gselectr   gui_core.wrapr   r   	core.gcmdr   grass.script.corescriptcorer[   grass.script.rasterr   rL   grass.exceptionsr   r!   r	   rq   AppappdlgShowMainLoopru   rH   rG   <module>r      sr     
 # ,  ! ! # # .i5bii i5X z
"&&(C
$
CHHJLLN	 rH   