preferences.py 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529
  1. """!
  2. @package gmodeler.preferences
  3. @brief wxGUI Graphical Modeler - preferences
  4. Classes:
  5. - preferences::PreferencesDialog
  6. - preferences::PropertiesDialog
  7. (C) 2010-2012 by the GRASS Development Team
  8. This program is free software under the GNU General Public License
  9. (>=v2). Read the file COPYING that comes with GRASS for details.
  10. @author Martin Landa <landa.martin gmail.com>
  11. """
  12. import wx
  13. import wx.lib.colourselect as csel
  14. from core import globalvar
  15. from gui_core.preferences import PreferencesBaseDialog
  16. from core.settings import UserSettings
  17. class PreferencesDialog(PreferencesBaseDialog):
  18. """!User preferences dialog"""
  19. def __init__(self, parent, settings = UserSettings,
  20. title = _("Modeler settings")):
  21. PreferencesBaseDialog.__init__(self, parent = parent, title = title,
  22. settings = settings)
  23. # create notebook pages
  24. self._createGeneralPage(self.notebook)
  25. self._createActionPage(self.notebook)
  26. self._createDataPage(self.notebook)
  27. self._createLoopPage(self.notebook)
  28. self.SetMinSize(self.GetBestSize())
  29. self.SetSize(self.size)
  30. def _createGeneralPage(self, notebook):
  31. """!Create notebook page for action settings"""
  32. panel = wx.Panel(parent = notebook, id = wx.ID_ANY)
  33. notebook.AddPage(page = panel, text = _("General"))
  34. # colors
  35. border = wx.BoxSizer(wx.VERTICAL)
  36. box = wx.StaticBox (parent = panel, id = wx.ID_ANY,
  37. label = " %s " % _("Item properties"))
  38. sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
  39. gridSizer = wx.GridBagSizer (hgap = 3, vgap = 3)
  40. gridSizer.AddGrowableCol(0)
  41. row = 0
  42. gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
  43. label = _("Disabled:")),
  44. flag = wx.ALIGN_LEFT |
  45. wx.ALIGN_CENTER_VERTICAL,
  46. pos = (row, 0))
  47. rColor = csel.ColourSelect(parent = panel, id = wx.ID_ANY,
  48. colour = self.settings.Get(group='modeler', key='disabled', subkey='color'),
  49. size = globalvar.DIALOG_COLOR_SIZE)
  50. rColor.SetName('GetColour')
  51. self.winId['modeler:disabled:color'] = rColor.GetId()
  52. gridSizer.Add(item = rColor,
  53. flag = wx.ALIGN_RIGHT |
  54. wx.ALIGN_CENTER_VERTICAL,
  55. pos = (row, 1))
  56. sizer.Add(item = gridSizer, proportion = 1, flag = wx.ALL | wx.EXPAND, border = 5)
  57. border.Add(item = sizer, proportion = 0, flag = wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border = 3)
  58. panel.SetSizer(border)
  59. return panel
  60. def _createActionPage(self, notebook):
  61. """!Create notebook page for action settings"""
  62. panel = wx.Panel(parent = notebook, id = wx.ID_ANY)
  63. notebook.AddPage(page = panel, text = _("Action"))
  64. # colors
  65. border = wx.BoxSizer(wx.VERTICAL)
  66. box = wx.StaticBox (parent = panel, id = wx.ID_ANY,
  67. label = " %s " % _("Color"))
  68. sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
  69. gridSizer = wx.GridBagSizer (hgap = 3, vgap = 3)
  70. gridSizer.AddGrowableCol(0)
  71. row = 0
  72. gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
  73. label = _("Valid:")),
  74. flag = wx.ALIGN_LEFT |
  75. wx.ALIGN_CENTER_VERTICAL,
  76. pos = (row, 0))
  77. vColor = csel.ColourSelect(parent = panel, id = wx.ID_ANY,
  78. colour = self.settings.Get(group='modeler', key='action', subkey=('color', 'valid')),
  79. size = globalvar.DIALOG_COLOR_SIZE)
  80. vColor.SetName('GetColour')
  81. self.winId['modeler:action:color:valid'] = vColor.GetId()
  82. gridSizer.Add(item = vColor,
  83. flag = wx.ALIGN_RIGHT |
  84. wx.ALIGN_CENTER_VERTICAL,
  85. pos = (row, 1))
  86. row += 1
  87. gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
  88. label = _("Invalid:")),
  89. flag = wx.ALIGN_LEFT |
  90. wx.ALIGN_CENTER_VERTICAL,
  91. pos = (row, 0))
  92. iColor = csel.ColourSelect(parent = panel, id = wx.ID_ANY,
  93. colour = self.settings.Get(group='modeler', key='action', subkey=('color', 'invalid')),
  94. size = globalvar.DIALOG_COLOR_SIZE)
  95. iColor.SetName('GetColour')
  96. self.winId['modeler:action:color:invalid'] = iColor.GetId()
  97. gridSizer.Add(item = iColor,
  98. flag = wx.ALIGN_RIGHT |
  99. wx.ALIGN_CENTER_VERTICAL,
  100. pos = (row, 1))
  101. row += 1
  102. gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
  103. label = _("Running:")),
  104. flag = wx.ALIGN_LEFT |
  105. wx.ALIGN_CENTER_VERTICAL,
  106. pos = (row, 0))
  107. rColor = csel.ColourSelect(parent = panel, id = wx.ID_ANY,
  108. colour = self.settings.Get(group='modeler', key='action', subkey=('color', 'running')),
  109. size = globalvar.DIALOG_COLOR_SIZE)
  110. rColor.SetName('GetColour')
  111. self.winId['modeler:action:color:running'] = rColor.GetId()
  112. gridSizer.Add(item = rColor,
  113. flag = wx.ALIGN_RIGHT |
  114. wx.ALIGN_CENTER_VERTICAL,
  115. pos = (row, 1))
  116. sizer.Add(item = gridSizer, proportion = 1, flag = wx.ALL | wx.EXPAND, border = 5)
  117. border.Add(item = sizer, proportion = 0, flag = wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border = 3)
  118. # size
  119. box = wx.StaticBox (parent = panel, id = wx.ID_ANY,
  120. label = " %s " % _("Shape size"))
  121. sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
  122. gridSizer = wx.GridBagSizer (hgap=3, vgap=3)
  123. gridSizer.AddGrowableCol(0)
  124. row = 0
  125. gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
  126. label = _("Width:")),
  127. flag = wx.ALIGN_LEFT |
  128. wx.ALIGN_CENTER_VERTICAL,
  129. pos = (row, 0))
  130. width = wx.SpinCtrl(parent = panel, id = wx.ID_ANY,
  131. min = 0, max = 500,
  132. initial = self.settings.Get(group='modeler', key='action', subkey=('size', 'width')))
  133. width.SetName('GetValue')
  134. self.winId['modeler:action:size:width'] = width.GetId()
  135. gridSizer.Add(item = width,
  136. flag = wx.ALIGN_RIGHT |
  137. wx.ALIGN_CENTER_VERTICAL,
  138. pos = (row, 1))
  139. row += 1
  140. gridSizer.Add(item = wx.StaticText(parent=panel, id=wx.ID_ANY,
  141. label=_("Height:")),
  142. flag = wx.ALIGN_LEFT |
  143. wx.ALIGN_CENTER_VERTICAL,
  144. pos=(row, 0))
  145. height = wx.SpinCtrl(parent = panel, id = wx.ID_ANY,
  146. min = 0, max = 500,
  147. initial = self.settings.Get(group='modeler', key='action', subkey=('size', 'height')))
  148. height.SetName('GetValue')
  149. self.winId['modeler:action:size:height'] = height.GetId()
  150. gridSizer.Add(item = height,
  151. flag = wx.ALIGN_RIGHT |
  152. wx.ALIGN_CENTER_VERTICAL,
  153. pos = (row, 1))
  154. sizer.Add(item=gridSizer, proportion=1, flag=wx.ALL | wx.EXPAND, border=5)
  155. border.Add(item=sizer, proportion=0, flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=3)
  156. panel.SetSizer(border)
  157. return panel
  158. def _createDataPage(self, notebook):
  159. """!Create notebook page for data settings"""
  160. panel = wx.Panel(parent = notebook, id = wx.ID_ANY)
  161. notebook.AddPage(page = panel, text = _("Data"))
  162. # colors
  163. border = wx.BoxSizer(wx.VERTICAL)
  164. box = wx.StaticBox (parent = panel, id = wx.ID_ANY,
  165. label = " %s " % _("Type"))
  166. sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
  167. gridSizer = wx.GridBagSizer (hgap = 3, vgap = 3)
  168. gridSizer.AddGrowableCol(0)
  169. row = 0
  170. gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
  171. label = _("Raster:")),
  172. flag = wx.ALIGN_LEFT |
  173. wx.ALIGN_CENTER_VERTICAL,
  174. pos = (row, 0))
  175. rColor = csel.ColourSelect(parent = panel, id = wx.ID_ANY,
  176. colour = self.settings.Get(group='modeler', key='data', subkey=('color', 'raster')),
  177. size = globalvar.DIALOG_COLOR_SIZE)
  178. rColor.SetName('GetColour')
  179. self.winId['modeler:data:color:raster'] = rColor.GetId()
  180. gridSizer.Add(item = rColor,
  181. flag = wx.ALIGN_RIGHT |
  182. wx.ALIGN_CENTER_VERTICAL,
  183. pos = (row, 1))
  184. row += 1
  185. gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
  186. label = _("3D raster:")),
  187. flag = wx.ALIGN_LEFT |
  188. wx.ALIGN_CENTER_VERTICAL,
  189. pos = (row, 0))
  190. r3Color = csel.ColourSelect(parent = panel, id = wx.ID_ANY,
  191. colour = self.settings.Get(group='modeler', key='data', subkey=('color', 'raster3d')),
  192. size = globalvar.DIALOG_COLOR_SIZE)
  193. r3Color.SetName('GetColour')
  194. self.winId['modeler:data:color:raster3d'] = r3Color.GetId()
  195. gridSizer.Add(item = r3Color,
  196. flag = wx.ALIGN_RIGHT |
  197. wx.ALIGN_CENTER_VERTICAL,
  198. pos = (row, 1))
  199. row += 1
  200. gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
  201. label = _("Vector:")),
  202. flag = wx.ALIGN_LEFT |
  203. wx.ALIGN_CENTER_VERTICAL,
  204. pos = (row, 0))
  205. vColor = csel.ColourSelect(parent = panel, id = wx.ID_ANY,
  206. colour = self.settings.Get(group='modeler', key='data', subkey=('color', 'vector')),
  207. size = globalvar.DIALOG_COLOR_SIZE)
  208. vColor.SetName('GetColour')
  209. self.winId['modeler:data:color:vector'] = vColor.GetId()
  210. gridSizer.Add(item = vColor,
  211. flag = wx.ALIGN_RIGHT |
  212. wx.ALIGN_CENTER_VERTICAL,
  213. pos = (row, 1))
  214. sizer.Add(item = gridSizer, proportion = 1, flag = wx.ALL | wx.EXPAND, border = 5)
  215. border.Add(item = sizer, proportion = 0, flag = wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border = 3)
  216. # size
  217. box = wx.StaticBox (parent = panel, id = wx.ID_ANY,
  218. label = " %s " % _("Shape size"))
  219. sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
  220. gridSizer = wx.GridBagSizer (hgap=3, vgap=3)
  221. gridSizer.AddGrowableCol(0)
  222. row = 0
  223. gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
  224. label = _("Width:")),
  225. flag = wx.ALIGN_LEFT |
  226. wx.ALIGN_CENTER_VERTICAL,
  227. pos = (row, 0))
  228. width = wx.SpinCtrl(parent = panel, id = wx.ID_ANY,
  229. min = 0, max = 500,
  230. initial = self.settings.Get(group='modeler', key='data', subkey=('size', 'width')))
  231. width.SetName('GetValue')
  232. self.winId['modeler:data:size:width'] = width.GetId()
  233. gridSizer.Add(item = width,
  234. flag = wx.ALIGN_RIGHT |
  235. wx.ALIGN_CENTER_VERTICAL,
  236. pos = (row, 1))
  237. row += 1
  238. gridSizer.Add(item = wx.StaticText(parent=panel, id=wx.ID_ANY,
  239. label=_("Height:")),
  240. flag = wx.ALIGN_LEFT |
  241. wx.ALIGN_CENTER_VERTICAL,
  242. pos=(row, 0))
  243. height = wx.SpinCtrl(parent = panel, id = wx.ID_ANY,
  244. min = 0, max = 500,
  245. initial = self.settings.Get(group='modeler', key='data', subkey=('size', 'height')))
  246. height.SetName('GetValue')
  247. self.winId['modeler:data:size:height'] = height.GetId()
  248. gridSizer.Add(item = height,
  249. flag = wx.ALIGN_RIGHT |
  250. wx.ALIGN_CENTER_VERTICAL,
  251. pos = (row, 1))
  252. sizer.Add(item=gridSizer, proportion=1, flag=wx.ALL | wx.EXPAND, border=5)
  253. border.Add(item=sizer, proportion=0, flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=3)
  254. panel.SetSizer(border)
  255. return panel
  256. def _createLoopPage(self, notebook):
  257. """!Create notebook page for loop settings"""
  258. panel = wx.Panel(parent = notebook, id = wx.ID_ANY)
  259. notebook.AddPage(page = panel, text = _("Loop"))
  260. # colors
  261. border = wx.BoxSizer(wx.VERTICAL)
  262. box = wx.StaticBox (parent = panel, id = wx.ID_ANY,
  263. label = " %s " % _("Color"))
  264. sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
  265. gridSizer = wx.GridBagSizer (hgap = 3, vgap = 3)
  266. gridSizer.AddGrowableCol(0)
  267. row = 0
  268. gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
  269. label = _("Valid:")),
  270. flag = wx.ALIGN_LEFT |
  271. wx.ALIGN_CENTER_VERTICAL,
  272. pos = (row, 0))
  273. vColor = csel.ColourSelect(parent = panel, id = wx.ID_ANY,
  274. colour = self.settings.Get(group='modeler', key='loop', subkey=('color', 'valid')),
  275. size = globalvar.DIALOG_COLOR_SIZE)
  276. vColor.SetName('GetColour')
  277. self.winId['modeler:loop:color:valid'] = vColor.GetId()
  278. gridSizer.Add(item = vColor,
  279. flag = wx.ALIGN_RIGHT |
  280. wx.ALIGN_CENTER_VERTICAL,
  281. pos = (row, 1))
  282. sizer.Add(item = gridSizer, proportion = 1, flag = wx.ALL | wx.EXPAND, border = 5)
  283. border.Add(item = sizer, proportion = 0, flag = wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border = 3)
  284. # size
  285. box = wx.StaticBox (parent = panel, id = wx.ID_ANY,
  286. label = " %s " % _("Shape size"))
  287. sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
  288. gridSizer = wx.GridBagSizer (hgap=3, vgap=3)
  289. gridSizer.AddGrowableCol(0)
  290. row = 0
  291. gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
  292. label = _("Width:")),
  293. flag = wx.ALIGN_LEFT |
  294. wx.ALIGN_CENTER_VERTICAL,
  295. pos = (row, 0))
  296. width = wx.SpinCtrl(parent = panel, id = wx.ID_ANY,
  297. min = 0, max = 500,
  298. initial = self.settings.Get(group='modeler', key='loop', subkey=('size', 'width')))
  299. width.SetName('GetValue')
  300. self.winId['modeler:loop:size:width'] = width.GetId()
  301. gridSizer.Add(item = width,
  302. flag = wx.ALIGN_RIGHT |
  303. wx.ALIGN_CENTER_VERTICAL,
  304. pos = (row, 1))
  305. row += 1
  306. gridSizer.Add(item = wx.StaticText(parent=panel, id=wx.ID_ANY,
  307. label=_("Height:")),
  308. flag = wx.ALIGN_LEFT |
  309. wx.ALIGN_CENTER_VERTICAL,
  310. pos=(row, 0))
  311. height = wx.SpinCtrl(parent = panel, id = wx.ID_ANY,
  312. min = 0, max = 500,
  313. initial = self.settings.Get(group='modeler', key='loop', subkey=('size', 'height')))
  314. height.SetName('GetValue')
  315. self.winId['modeler:loop:size:height'] = height.GetId()
  316. gridSizer.Add(item = height,
  317. flag = wx.ALIGN_RIGHT |
  318. wx.ALIGN_CENTER_VERTICAL,
  319. pos = (row, 1))
  320. sizer.Add(item=gridSizer, proportion=1, flag=wx.ALL | wx.EXPAND, border=5)
  321. border.Add(item=sizer, proportion=0, flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=3)
  322. panel.SetSizer(border)
  323. return panel
  324. def OnApply(self, event):
  325. """!Button 'Apply' pressed"""
  326. PreferencesBaseDialog.OnApply(self, event)
  327. self.parent.GetModel().Update()
  328. self.parent.GetCanvas().Refresh()
  329. def OnSave(self, event):
  330. """!Button 'Save' pressed"""
  331. PreferencesBaseDialog.OnSave(self, event)
  332. self.parent.GetModel().Update()
  333. self.parent.GetCanvas().Refresh()
  334. class PropertiesDialog(wx.Dialog):
  335. """!Model properties dialog
  336. """
  337. def __init__(self, parent, id = wx.ID_ANY,
  338. title = _('Model properties'),
  339. size = (350, 400),
  340. style = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER):
  341. wx.Dialog.__init__(self, parent, id, title, size = size,
  342. style = style)
  343. self.metaBox = wx.StaticBox(parent = self, id = wx.ID_ANY,
  344. label=" %s " % _("Metadata"))
  345. self.cmdBox = wx.StaticBox(parent = self, id = wx.ID_ANY,
  346. label=" %s " % _("Commands"))
  347. self.name = wx.TextCtrl(parent = self, id = wx.ID_ANY,
  348. size = (300, 25))
  349. self.desc = wx.TextCtrl(parent = self, id = wx.ID_ANY,
  350. style = wx.TE_MULTILINE,
  351. size = (300, 50))
  352. self.author = wx.TextCtrl(parent = self, id = wx.ID_ANY,
  353. size = (300, 25))
  354. # commands
  355. self.overwrite = wx.CheckBox(parent = self, id=wx.ID_ANY,
  356. label=_("Allow output files to overwrite existing files"))
  357. self.overwrite.SetValue(UserSettings.Get(group='cmd', key='overwrite', subkey='enabled'))
  358. # buttons
  359. self.btnOk = wx.Button(self, wx.ID_OK)
  360. self.btnCancel = wx.Button(self, wx.ID_CANCEL)
  361. self.btnOk.SetDefault()
  362. self.btnOk.SetToolTipString(_("Apply properties"))
  363. self.btnOk.SetDefault()
  364. self.btnCancel.SetToolTipString(_("Close dialog and ignore changes"))
  365. self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
  366. self._layout()
  367. def _layout(self):
  368. metaSizer = wx.StaticBoxSizer(self.metaBox, wx.VERTICAL)
  369. gridSizer = wx.GridBagSizer(hgap = 3, vgap = 3)
  370. gridSizer.AddGrowableCol(1)
  371. gridSizer.AddGrowableRow(1)
  372. gridSizer.Add(item = wx.StaticText(parent = self, id = wx.ID_ANY,
  373. label = _("Name:")),
  374. flag = wx.ALIGN_LEFT |
  375. wx.ALIGN_CENTER_VERTICAL,
  376. pos = (0, 0))
  377. gridSizer.Add(item = self.name,
  378. flag = wx.ALIGN_LEFT |
  379. wx.ALIGN_CENTER_VERTICAL | wx.EXPAND,
  380. pos = (0, 1))
  381. gridSizer.Add(item = wx.StaticText(parent = self, id = wx.ID_ANY,
  382. label = _("Description:")),
  383. flag = wx.ALIGN_LEFT |
  384. wx.ALIGN_CENTER_VERTICAL,
  385. pos = (1, 0))
  386. gridSizer.Add(item = self.desc,
  387. flag = wx.ALIGN_LEFT |
  388. wx.ALIGN_CENTER_VERTICAL | wx.EXPAND,
  389. pos = (1, 1))
  390. gridSizer.Add(item = wx.StaticText(parent = self, id = wx.ID_ANY,
  391. label = _("Author(s):")),
  392. flag = wx.ALIGN_LEFT |
  393. wx.ALIGN_CENTER_VERTICAL,
  394. pos = (2, 0))
  395. gridSizer.Add(item = self.author,
  396. flag = wx.ALIGN_LEFT |
  397. wx.ALIGN_CENTER_VERTICAL | wx.EXPAND,
  398. pos = (2, 1))
  399. metaSizer.Add(item = gridSizer, proportion = 1, flag = wx.EXPAND)
  400. cmdSizer = wx.StaticBoxSizer(self.cmdBox, wx.VERTICAL)
  401. cmdSizer.Add(item = self.overwrite,
  402. flag = wx.EXPAND | wx.ALL, border = 3)
  403. btnStdSizer = wx.StdDialogButtonSizer()
  404. btnStdSizer.AddButton(self.btnCancel)
  405. btnStdSizer.AddButton(self.btnOk)
  406. btnStdSizer.Realize()
  407. mainSizer = wx.BoxSizer(wx.VERTICAL)
  408. mainSizer.Add(item=metaSizer, proportion=1,
  409. flag=wx.EXPAND | wx.ALL, border=5)
  410. mainSizer.Add(item=cmdSizer, proportion=0,
  411. flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM, border=5)
  412. mainSizer.Add(item=btnStdSizer, proportion=0,
  413. flag=wx.EXPAND | wx.ALL | wx.ALIGN_RIGHT, border=5)
  414. self.SetSizer(mainSizer)
  415. mainSizer.Fit(self)
  416. def OnCloseWindow(self, event):
  417. self.Hide()
  418. def GetValues(self):
  419. """!Get values"""
  420. return { 'name' : self.name.GetValue(),
  421. 'description' : self.desc.GetValue(),
  422. 'author' : self.author.GetValue(),
  423. 'overwrite' : self.overwrite.IsChecked() }
  424. def Init(self, prop):
  425. """!Initialize dialog"""
  426. self.name.SetValue(prop['name'])
  427. self.desc.SetValue(prop['description'])
  428. self.author.SetValue(prop['author'])
  429. if 'overwrite' in prop:
  430. self.overwrite.SetValue(prop['overwrite'])