GRASS Programmer's Manual  6.5.svn(2012)-r51648
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
gmodeler/preferences.py
Go to the documentation of this file.
00001 """!
00002 @package gmodeler.preferences
00003 
00004 @brief wxGUI Graphical Modeler - preferences
00005 
00006 Classes:
00007  - preferences::PreferencesDialog
00008  - preferences::PropertiesDialog
00009 
00010 (C) 2010-2011 by the GRASS Development Team
00011 
00012 This program is free software under the GNU General Public License
00013 (>=v2). Read the file COPYING that comes with GRASS for details.
00014 
00015 @author Martin Landa <landa.martin gmail.com>
00016 """
00017 
00018 import wx
00019 import wx.lib.colourselect    as csel
00020 
00021 from core                 import globalvar
00022 from gui_core.preferences import PreferencesBaseDialog
00023 from core.settings        import UserSettings
00024 
00025 class PreferencesDialog(PreferencesBaseDialog):
00026     """!User preferences dialog"""
00027     def __init__(self, parent, settings = UserSettings,
00028                  title = _("Modeler settings")):
00029         
00030         PreferencesBaseDialog.__init__(self, parent = parent, title = title,
00031                                        settings = settings)
00032         
00033         # create notebook pages
00034         self._createGeneralPage(self.notebook)
00035         self._createActionPage(self.notebook)
00036         self._createDataPage(self.notebook)
00037         self._createLoopPage(self.notebook)
00038         
00039         self.SetMinSize(self.GetBestSize())
00040         self.SetSize(self.size)
00041 
00042     def _createGeneralPage(self, notebook):
00043         """!Create notebook page for action settings"""
00044         panel = wx.Panel(parent = notebook, id = wx.ID_ANY)
00045         notebook.AddPage(page = panel, text = _("General"))
00046         
00047         # colors
00048         border = wx.BoxSizer(wx.VERTICAL)
00049         box   = wx.StaticBox (parent = panel, id = wx.ID_ANY,
00050                               label = " %s " % _("Item properties"))
00051         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
00052         
00053         gridSizer = wx.GridBagSizer (hgap = 3, vgap = 3)
00054         gridSizer.AddGrowableCol(0)
00055         
00056         row = 0
00057         gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
00058                                            label = _("Disabled:")),
00059                       flag = wx.ALIGN_LEFT |
00060                       wx.ALIGN_CENTER_VERTICAL,
00061                       pos = (row, 0))
00062         rColor = csel.ColourSelect(parent = panel, id = wx.ID_ANY,
00063                                    colour = self.settings.Get(group='modeler', key='disabled', subkey='color'),
00064                                    size = globalvar.DIALOG_COLOR_SIZE)
00065         rColor.SetName('GetColour')
00066         self.winId['modeler:disabled:color'] = rColor.GetId()
00067         
00068         gridSizer.Add(item = rColor,
00069                       flag = wx.ALIGN_RIGHT |
00070                       wx.ALIGN_CENTER_VERTICAL,
00071                       pos = (row, 1))
00072         
00073         sizer.Add(item = gridSizer, proportion = 1, flag = wx.ALL | wx.EXPAND, border = 5)
00074         border.Add(item = sizer, proportion = 0, flag = wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border = 3)
00075 
00076         panel.SetSizer(border)
00077         
00078         return panel
00079 
00080     def _createActionPage(self, notebook):
00081         """!Create notebook page for action settings"""
00082         panel = wx.Panel(parent = notebook, id = wx.ID_ANY)
00083         notebook.AddPage(page = panel, text = _("Action"))
00084         
00085         # colors
00086         border = wx.BoxSizer(wx.VERTICAL)
00087         box   = wx.StaticBox (parent = panel, id = wx.ID_ANY,
00088                               label = " %s " % _("Color"))
00089         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
00090         
00091         gridSizer = wx.GridBagSizer (hgap = 3, vgap = 3)
00092         gridSizer.AddGrowableCol(0)
00093         
00094         row = 0
00095         gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
00096                                          label = _("Valid:")),
00097                       flag = wx.ALIGN_LEFT |
00098                       wx.ALIGN_CENTER_VERTICAL,
00099                       pos = (row, 0))
00100         vColor = csel.ColourSelect(parent = panel, id = wx.ID_ANY,
00101                                    colour = self.settings.Get(group='modeler', key='action', subkey=('color', 'valid')),
00102                                    size = globalvar.DIALOG_COLOR_SIZE)
00103         vColor.SetName('GetColour')
00104         self.winId['modeler:action:color:valid'] = vColor.GetId()
00105         
00106         gridSizer.Add(item = vColor,
00107                       flag = wx.ALIGN_RIGHT |
00108                       wx.ALIGN_CENTER_VERTICAL,
00109                       pos = (row, 1))
00110 
00111         row += 1
00112         gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
00113                                          label = _("Invalid:")),
00114                       flag = wx.ALIGN_LEFT |
00115                       wx.ALIGN_CENTER_VERTICAL,
00116                       pos = (row, 0))
00117         iColor = csel.ColourSelect(parent = panel, id = wx.ID_ANY,
00118                                    colour = self.settings.Get(group='modeler', key='action', subkey=('color', 'invalid')),
00119                                    size = globalvar.DIALOG_COLOR_SIZE)
00120         iColor.SetName('GetColour')
00121         self.winId['modeler:action:color:invalid'] = iColor.GetId()
00122         
00123         gridSizer.Add(item = iColor,
00124                       flag = wx.ALIGN_RIGHT |
00125                       wx.ALIGN_CENTER_VERTICAL,
00126                       pos = (row, 1))
00127 
00128         row += 1
00129         gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
00130                                          label = _("Running:")),
00131                       flag = wx.ALIGN_LEFT |
00132                       wx.ALIGN_CENTER_VERTICAL,
00133                       pos = (row, 0))
00134         rColor = csel.ColourSelect(parent = panel, id = wx.ID_ANY,
00135                                    colour = self.settings.Get(group='modeler', key='action', subkey=('color', 'running')),
00136                                    size = globalvar.DIALOG_COLOR_SIZE)
00137         rColor.SetName('GetColour')
00138         self.winId['modeler:action:color:running'] = rColor.GetId()
00139         
00140         gridSizer.Add(item = rColor,
00141                       flag = wx.ALIGN_RIGHT |
00142                       wx.ALIGN_CENTER_VERTICAL,
00143                       pos = (row, 1))
00144         
00145         sizer.Add(item = gridSizer, proportion = 1, flag = wx.ALL | wx.EXPAND, border = 5)
00146         border.Add(item = sizer, proportion = 0, flag = wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border = 3)
00147         
00148         # size
00149         box   = wx.StaticBox (parent = panel, id = wx.ID_ANY,
00150                               label = " %s " % _("Shape size"))
00151         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
00152         
00153         gridSizer = wx.GridBagSizer (hgap=3, vgap=3)
00154         gridSizer.AddGrowableCol(0)
00155 
00156         row = 0
00157         gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
00158                                          label = _("Width:")),
00159                       flag = wx.ALIGN_LEFT |
00160                       wx.ALIGN_CENTER_VERTICAL,
00161                       pos = (row, 0))
00162         
00163         width = wx.SpinCtrl(parent = panel, id = wx.ID_ANY,
00164                             min = 0, max = 500,
00165                             initial = self.settings.Get(group='modeler', key='action', subkey=('size', 'width')))
00166         width.SetName('GetValue')
00167         self.winId['modeler:action:size:width'] = width.GetId()
00168         
00169         gridSizer.Add(item = width,
00170                       flag = wx.ALIGN_RIGHT |
00171                       wx.ALIGN_CENTER_VERTICAL,
00172                       pos = (row, 1))
00173 
00174         row += 1
00175         gridSizer.Add(item = wx.StaticText(parent=panel, id=wx.ID_ANY,
00176                                          label=_("Height:")),
00177                       flag = wx.ALIGN_LEFT |
00178                       wx.ALIGN_CENTER_VERTICAL,
00179                       pos=(row, 0))
00180         
00181         height = wx.SpinCtrl(parent = panel, id = wx.ID_ANY,
00182                              min = 0, max = 500,
00183                              initial = self.settings.Get(group='modeler', key='action', subkey=('size', 'height')))
00184         height.SetName('GetValue')
00185         self.winId['modeler:action:size:height'] = height.GetId()
00186         
00187         gridSizer.Add(item = height,
00188                       flag = wx.ALIGN_RIGHT |
00189                       wx.ALIGN_CENTER_VERTICAL,
00190                       pos = (row, 1))
00191         
00192         sizer.Add(item=gridSizer, proportion=1, flag=wx.ALL | wx.EXPAND, border=5)
00193         border.Add(item=sizer, proportion=0, flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=3)
00194                 
00195         panel.SetSizer(border)
00196         
00197         return panel
00198 
00199     def _createDataPage(self, notebook):
00200         """!Create notebook page for data settings"""
00201         panel = wx.Panel(parent = notebook, id = wx.ID_ANY)
00202         notebook.AddPage(page = panel, text = _("Data"))
00203         
00204         # colors
00205         border = wx.BoxSizer(wx.VERTICAL)
00206         box   = wx.StaticBox (parent = panel, id = wx.ID_ANY,
00207                               label = " %s " % _("Type"))
00208         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
00209         
00210         gridSizer = wx.GridBagSizer (hgap = 3, vgap = 3)
00211         gridSizer.AddGrowableCol(0)
00212         
00213         row = 0
00214         gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
00215                                          label = _("Raster:")),
00216                       flag = wx.ALIGN_LEFT |
00217                       wx.ALIGN_CENTER_VERTICAL,
00218                       pos = (row, 0))
00219         rColor = csel.ColourSelect(parent = panel, id = wx.ID_ANY,
00220                                    colour = self.settings.Get(group='modeler', key='data', subkey=('color', 'raster')),
00221                                    size = globalvar.DIALOG_COLOR_SIZE)
00222         rColor.SetName('GetColour')
00223         self.winId['modeler:data:color:raster'] = rColor.GetId()
00224         
00225         gridSizer.Add(item = rColor,
00226                       flag = wx.ALIGN_RIGHT |
00227                       wx.ALIGN_CENTER_VERTICAL,
00228                       pos = (row, 1))
00229 
00230         row += 1
00231         gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
00232                                          label = _("3D raster:")),
00233                       flag = wx.ALIGN_LEFT |
00234                       wx.ALIGN_CENTER_VERTICAL,
00235                       pos = (row, 0))
00236         r3Color = csel.ColourSelect(parent = panel, id = wx.ID_ANY,
00237                                     colour = self.settings.Get(group='modeler', key='data', subkey=('color', 'raster3d')),
00238                                     size = globalvar.DIALOG_COLOR_SIZE)
00239         r3Color.SetName('GetColour')
00240         self.winId['modeler:data:color:raster3d'] = r3Color.GetId()
00241         
00242         gridSizer.Add(item = r3Color,
00243                       flag = wx.ALIGN_RIGHT |
00244                       wx.ALIGN_CENTER_VERTICAL,
00245                       pos = (row, 1))
00246         
00247         row += 1
00248         gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
00249                                          label = _("Vector:")),
00250                       flag = wx.ALIGN_LEFT |
00251                       wx.ALIGN_CENTER_VERTICAL,
00252                       pos = (row, 0))
00253         vColor = csel.ColourSelect(parent = panel, id = wx.ID_ANY,
00254                                    colour = self.settings.Get(group='modeler', key='data', subkey=('color', 'vector')),
00255                                    size = globalvar.DIALOG_COLOR_SIZE)
00256         vColor.SetName('GetColour')
00257         self.winId['modeler:data:color:vector'] = vColor.GetId()
00258         
00259         gridSizer.Add(item = vColor,
00260                       flag = wx.ALIGN_RIGHT |
00261                       wx.ALIGN_CENTER_VERTICAL,
00262                       pos = (row, 1))
00263         
00264         sizer.Add(item = gridSizer, proportion = 1, flag = wx.ALL | wx.EXPAND, border = 5)
00265         border.Add(item = sizer, proportion = 0, flag = wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border = 3)
00266 
00267         # size
00268         box   = wx.StaticBox (parent = panel, id = wx.ID_ANY,
00269                               label = " %s " % _("Shape size"))
00270         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
00271         
00272         gridSizer = wx.GridBagSizer (hgap=3, vgap=3)
00273         gridSizer.AddGrowableCol(0)
00274         
00275         row = 0
00276         gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
00277                                          label = _("Width:")),
00278                       flag = wx.ALIGN_LEFT |
00279                       wx.ALIGN_CENTER_VERTICAL,
00280                       pos = (row, 0))
00281         
00282         width = wx.SpinCtrl(parent = panel, id = wx.ID_ANY,
00283                             min = 0, max = 500,
00284                             initial = self.settings.Get(group='modeler', key='data', subkey=('size', 'width')))
00285         width.SetName('GetValue')
00286         self.winId['modeler:data:size:width'] = width.GetId()
00287         
00288         gridSizer.Add(item = width,
00289                       flag = wx.ALIGN_RIGHT |
00290                       wx.ALIGN_CENTER_VERTICAL,
00291                       pos = (row, 1))
00292 
00293         row += 1
00294         gridSizer.Add(item = wx.StaticText(parent=panel, id=wx.ID_ANY,
00295                                          label=_("Height:")),
00296                       flag = wx.ALIGN_LEFT |
00297                       wx.ALIGN_CENTER_VERTICAL,
00298                       pos=(row, 0))
00299         
00300         height = wx.SpinCtrl(parent = panel, id = wx.ID_ANY,
00301                              min = 0, max = 500,
00302                              initial = self.settings.Get(group='modeler', key='data', subkey=('size', 'height')))
00303         height.SetName('GetValue')
00304         self.winId['modeler:data:size:height'] = height.GetId()
00305         
00306         gridSizer.Add(item = height,
00307                       flag = wx.ALIGN_RIGHT |
00308                       wx.ALIGN_CENTER_VERTICAL,
00309                       pos = (row, 1))
00310         
00311         sizer.Add(item=gridSizer, proportion=1, flag=wx.ALL | wx.EXPAND, border=5)
00312         border.Add(item=sizer, proportion=0, flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=3)
00313         
00314         panel.SetSizer(border)
00315         
00316         return panel
00317 
00318     def _createLoopPage(self, notebook):
00319         """!Create notebook page for loop settings"""
00320         panel = wx.Panel(parent = notebook, id = wx.ID_ANY)
00321         notebook.AddPage(page = panel, text = _("Loop"))
00322         
00323         # colors
00324         border = wx.BoxSizer(wx.VERTICAL)
00325         box   = wx.StaticBox (parent = panel, id = wx.ID_ANY,
00326                               label = " %s " % _("Color"))
00327         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
00328         
00329         gridSizer = wx.GridBagSizer (hgap = 3, vgap = 3)
00330         gridSizer.AddGrowableCol(0)
00331         
00332         row = 0
00333         gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
00334                                          label = _("Valid:")),
00335                       flag = wx.ALIGN_LEFT |
00336                       wx.ALIGN_CENTER_VERTICAL,
00337                       pos = (row, 0))
00338         vColor = csel.ColourSelect(parent = panel, id = wx.ID_ANY,
00339                                    colour = self.settings.Get(group='modeler', key='loop', subkey=('color', 'valid')),
00340                                    size = globalvar.DIALOG_COLOR_SIZE)
00341         vColor.SetName('GetColour')
00342         self.winId['modeler:loop:color:valid'] = vColor.GetId()
00343         
00344         gridSizer.Add(item = vColor,
00345                       flag = wx.ALIGN_RIGHT |
00346                       wx.ALIGN_CENTER_VERTICAL,
00347                       pos = (row, 1))
00348         
00349         sizer.Add(item = gridSizer, proportion = 1, flag = wx.ALL | wx.EXPAND, border = 5)
00350         border.Add(item = sizer, proportion = 0, flag = wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border = 3)
00351         
00352         # size
00353         box   = wx.StaticBox (parent = panel, id = wx.ID_ANY,
00354                               label = " %s " % _("Shape size"))
00355         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
00356         
00357         gridSizer = wx.GridBagSizer (hgap=3, vgap=3)
00358         gridSizer.AddGrowableCol(0)
00359 
00360         row = 0
00361         gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
00362                                          label = _("Width:")),
00363                       flag = wx.ALIGN_LEFT |
00364                       wx.ALIGN_CENTER_VERTICAL,
00365                       pos = (row, 0))
00366         
00367         width = wx.SpinCtrl(parent = panel, id = wx.ID_ANY,
00368                             min = 0, max = 500,
00369                             initial = self.settings.Get(group='modeler', key='loop', subkey=('size', 'width')))
00370         width.SetName('GetValue')
00371         self.winId['modeler:loop:size:width'] = width.GetId()
00372         
00373         gridSizer.Add(item = width,
00374                       flag = wx.ALIGN_RIGHT |
00375                       wx.ALIGN_CENTER_VERTICAL,
00376                       pos = (row, 1))
00377 
00378         row += 1
00379         gridSizer.Add(item = wx.StaticText(parent=panel, id=wx.ID_ANY,
00380                                          label=_("Height:")),
00381                       flag = wx.ALIGN_LEFT |
00382                       wx.ALIGN_CENTER_VERTICAL,
00383                       pos=(row, 0))
00384         
00385         height = wx.SpinCtrl(parent = panel, id = wx.ID_ANY,
00386                              min = 0, max = 500,
00387                              initial = self.settings.Get(group='modeler', key='loop', subkey=('size', 'height')))
00388         height.SetName('GetValue')
00389         self.winId['modeler:loop:size:height'] = height.GetId()
00390         
00391         gridSizer.Add(item = height,
00392                       flag = wx.ALIGN_RIGHT |
00393                       wx.ALIGN_CENTER_VERTICAL,
00394                       pos = (row, 1))
00395         
00396         sizer.Add(item=gridSizer, proportion=1, flag=wx.ALL | wx.EXPAND, border=5)
00397         border.Add(item=sizer, proportion=0, flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=3)
00398                 
00399         panel.SetSizer(border)
00400         
00401         return panel
00402 
00403     def OnApply(self, event):
00404         """!Button 'Apply' pressed"""
00405         PreferencesBaseDialog.OnApply(self, event)
00406         
00407         self.parent.GetModel().Update()
00408         self.parent.GetCanvas().Refresh()
00409 
00410     def OnSave(self, event):
00411         """!Button 'Save' pressed"""
00412         PreferencesBaseDialog.OnSave(self, event)
00413         
00414         self.parent.GetModel().Update()
00415         self.parent.GetCanvas().Refresh()
00416 
00417 class PropertiesDialog(wx.Dialog):
00418     """!Model properties dialog
00419     """
00420     def __init__(self, parent, id = wx.ID_ANY,
00421                  title = _('Model properties'),
00422                  size = (350, 400),
00423                  style = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER):
00424         wx.Dialog.__init__(self, parent, id, title, size = size,
00425                            style = style)
00426         
00427         self.metaBox = wx.StaticBox(parent = self, id = wx.ID_ANY,
00428                                     label=" %s " % _("Metadata"))
00429         self.cmdBox = wx.StaticBox(parent = self, id = wx.ID_ANY,
00430                                    label=" %s " % _("Commands"))
00431         
00432         self.name = wx.TextCtrl(parent = self, id = wx.ID_ANY,
00433                                 size = (300, 25))
00434         self.desc = wx.TextCtrl(parent = self, id = wx.ID_ANY,
00435                                 style = wx.TE_MULTILINE,
00436                                 size = (300, 50))
00437         self.author = wx.TextCtrl(parent = self, id = wx.ID_ANY,
00438                                 size = (300, 25))
00439         
00440         # commands
00441         self.overwrite = wx.CheckBox(parent = self, id=wx.ID_ANY,
00442                                      label=_("Allow output files to overwrite existing files"))
00443         self.overwrite.SetValue(UserSettings.Get(group='cmd', key='overwrite', subkey='enabled'))
00444         
00445         # buttons
00446         self.btnOk     = wx.Button(self, wx.ID_OK)
00447         self.btnCancel = wx.Button(self, wx.ID_CANCEL)
00448         self.btnOk.SetDefault()
00449         
00450         self.btnOk.SetToolTipString(_("Apply properties"))
00451         self.btnOk.SetDefault()
00452         self.btnCancel.SetToolTipString(_("Close dialog and ignore changes"))
00453         
00454         self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
00455         
00456         self._layout()
00457 
00458     def _layout(self):
00459         metaSizer = wx.StaticBoxSizer(self.metaBox, wx.VERTICAL)
00460         gridSizer = wx.GridBagSizer(hgap = 3, vgap = 3)
00461         gridSizer.AddGrowableCol(0)
00462         gridSizer.AddGrowableRow(1)
00463         gridSizer.Add(item = wx.StaticText(parent = self, id = wx.ID_ANY,
00464                                          label = _("Name:")),
00465                       flag = wx.ALIGN_LEFT |
00466                       wx.ALIGN_CENTER_VERTICAL,
00467                       pos = (0, 0))
00468         gridSizer.Add(item = self.name,
00469                       flag = wx.ALIGN_LEFT |
00470                       wx.ALIGN_CENTER_VERTICAL | wx.EXPAND,
00471                       pos = (0, 1))
00472         gridSizer.Add(item = wx.StaticText(parent = self, id = wx.ID_ANY,
00473                                          label = _("Description:")),
00474                       flag = wx.ALIGN_LEFT |
00475                       wx.ALIGN_CENTER_VERTICAL,
00476                       pos = (1, 0))
00477         gridSizer.Add(item = self.desc,
00478                       flag = wx.ALIGN_LEFT |
00479                       wx.ALIGN_CENTER_VERTICAL | wx.EXPAND,
00480                       pos = (1, 1))
00481         gridSizer.Add(item = wx.StaticText(parent = self, id = wx.ID_ANY,
00482                                          label = _("Author(s):")),
00483                       flag = wx.ALIGN_LEFT |
00484                       wx.ALIGN_CENTER_VERTICAL,
00485                       pos = (2, 0))
00486         gridSizer.Add(item = self.author,
00487                       flag = wx.ALIGN_LEFT |
00488                       wx.ALIGN_CENTER_VERTICAL | wx.EXPAND,
00489                       pos = (2, 1))
00490         metaSizer.Add(item = gridSizer)
00491         
00492         cmdSizer = wx.StaticBoxSizer(self.cmdBox, wx.VERTICAL)
00493         cmdSizer.Add(item = self.overwrite,
00494                      flag = wx.EXPAND | wx.ALL, border = 3)
00495         
00496         btnStdSizer = wx.StdDialogButtonSizer()
00497         btnStdSizer.AddButton(self.btnCancel)
00498         btnStdSizer.AddButton(self.btnOk)
00499         btnStdSizer.Realize()
00500         
00501         mainSizer = wx.BoxSizer(wx.VERTICAL)
00502         mainSizer.Add(item=metaSizer, proportion=1,
00503                       flag=wx.EXPAND | wx.ALL, border=5)
00504         mainSizer.Add(item=cmdSizer, proportion=0,
00505                       flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM, border=5)
00506         mainSizer.Add(item=btnStdSizer, proportion=0,
00507                       flag=wx.EXPAND | wx.ALL | wx.ALIGN_RIGHT, border=5)
00508         
00509         self.SetSizer(mainSizer)
00510         mainSizer.Fit(self)
00511 
00512     def OnCloseWindow(self, event):
00513         self.Hide()
00514         
00515     def GetValues(self):
00516         """!Get values"""
00517         return { 'name'        : self.name.GetValue(),
00518                  'description' : self.desc.GetValue(),
00519                  'author'      : self.author.GetValue(),
00520                  'overwrite'   : self.overwrite.IsChecked() }
00521     
00522     def Init(self, prop):
00523         """!Initialize dialog"""
00524         self.name.SetValue(prop['name'])
00525         self.desc.SetValue(prop['description'])
00526         self.author.SetValue(prop['author'])
00527         if 'overwrite' in prop:
00528             self.overwrite.SetValue(prop['overwrite'])