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, giface, settings = UserSettings,
  20. title = _("Modeler settings")):
  21. PreferencesBaseDialog.__init__(self, parent = parent, giface = giface, 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. row = 0
  41. gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
  42. label = _("Disabled:")),
  43. flag = wx.ALIGN_LEFT |
  44. wx.ALIGN_CENTER_VERTICAL,
  45. pos = (row, 0))
  46. rColor = csel.ColourSelect(parent = panel, id = wx.ID_ANY,
  47. colour = self.settings.Get(group='modeler', key='disabled', subkey='color'),
  48. size = globalvar.DIALOG_COLOR_SIZE)
  49. rColor.SetName('GetColour')
  50. self.winId['modeler:disabled:color'] = rColor.GetId()
  51. gridSizer.Add(item = rColor,
  52. flag = wx.ALIGN_RIGHT |
  53. wx.ALIGN_CENTER_VERTICAL,
  54. pos = (row, 1))
  55. gridSizer.AddGrowableCol(0)
  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. row = 0
  71. gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
  72. label = _("Valid:")),
  73. flag = wx.ALIGN_LEFT |
  74. wx.ALIGN_CENTER_VERTICAL,
  75. pos = (row, 0))
  76. vColor = csel.ColourSelect(parent = panel, id = wx.ID_ANY,
  77. colour = self.settings.Get(group='modeler', key='action', subkey=('color', 'valid')),
  78. size = globalvar.DIALOG_COLOR_SIZE)
  79. vColor.SetName('GetColour')
  80. self.winId['modeler:action:color:valid'] = vColor.GetId()
  81. gridSizer.Add(item = vColor,
  82. flag = wx.ALIGN_RIGHT |
  83. wx.ALIGN_CENTER_VERTICAL,
  84. pos = (row, 1))
  85. row += 1
  86. gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
  87. label = _("Invalid:")),
  88. flag = wx.ALIGN_LEFT |
  89. wx.ALIGN_CENTER_VERTICAL,
  90. pos = (row, 0))
  91. iColor = csel.ColourSelect(parent = panel, id = wx.ID_ANY,
  92. colour = self.settings.Get(group='modeler', key='action', subkey=('color', 'invalid')),
  93. size = globalvar.DIALOG_COLOR_SIZE)
  94. iColor.SetName('GetColour')
  95. self.winId['modeler:action:color:invalid'] = iColor.GetId()
  96. gridSizer.Add(item = iColor,
  97. flag = wx.ALIGN_RIGHT |
  98. wx.ALIGN_CENTER_VERTICAL,
  99. pos = (row, 1))
  100. row += 1
  101. gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
  102. label = _("Running:")),
  103. flag = wx.ALIGN_LEFT |
  104. wx.ALIGN_CENTER_VERTICAL,
  105. pos = (row, 0))
  106. rColor = csel.ColourSelect(parent = panel, id = wx.ID_ANY,
  107. colour = self.settings.Get(group='modeler', key='action', subkey=('color', 'running')),
  108. size = globalvar.DIALOG_COLOR_SIZE)
  109. rColor.SetName('GetColour')
  110. self.winId['modeler:action:color:running'] = rColor.GetId()
  111. gridSizer.Add(item = rColor,
  112. flag = wx.ALIGN_RIGHT |
  113. wx.ALIGN_CENTER_VERTICAL,
  114. pos = (row, 1))
  115. gridSizer.AddGrowableCol(0)
  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. row = 0
  124. gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
  125. label = _("Width:")),
  126. flag = wx.ALIGN_LEFT |
  127. wx.ALIGN_CENTER_VERTICAL,
  128. pos = (row, 0))
  129. width = wx.SpinCtrl(parent = panel, id = wx.ID_ANY,
  130. min = 0, max = 500,
  131. initial = self.settings.Get(group='modeler', key='action', subkey=('size', 'width')))
  132. width.SetName('GetValue')
  133. self.winId['modeler:action:size:width'] = width.GetId()
  134. gridSizer.Add(item = width,
  135. flag = wx.ALIGN_RIGHT |
  136. wx.ALIGN_CENTER_VERTICAL,
  137. pos = (row, 1))
  138. row += 1
  139. gridSizer.Add(item = wx.StaticText(parent=panel, id=wx.ID_ANY,
  140. label=_("Height:")),
  141. flag = wx.ALIGN_LEFT |
  142. wx.ALIGN_CENTER_VERTICAL,
  143. pos=(row, 0))
  144. height = wx.SpinCtrl(parent = panel, id = wx.ID_ANY,
  145. min = 0, max = 500,
  146. initial = self.settings.Get(group='modeler', key='action', subkey=('size', 'height')))
  147. height.SetName('GetValue')
  148. self.winId['modeler:action:size:height'] = height.GetId()
  149. gridSizer.Add(item = height,
  150. flag = wx.ALIGN_RIGHT |
  151. wx.ALIGN_CENTER_VERTICAL,
  152. pos = (row, 1))
  153. gridSizer.AddGrowableCol(0)
  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. row = 0
  169. gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
  170. label = _("Raster:")),
  171. flag = wx.ALIGN_LEFT |
  172. wx.ALIGN_CENTER_VERTICAL,
  173. pos = (row, 0))
  174. rColor = csel.ColourSelect(parent = panel, id = wx.ID_ANY,
  175. colour = self.settings.Get(group='modeler', key='data', subkey=('color', 'raster')),
  176. size = globalvar.DIALOG_COLOR_SIZE)
  177. rColor.SetName('GetColour')
  178. self.winId['modeler:data:color:raster'] = rColor.GetId()
  179. gridSizer.Add(item = rColor,
  180. flag = wx.ALIGN_RIGHT |
  181. wx.ALIGN_CENTER_VERTICAL,
  182. pos = (row, 1))
  183. row += 1
  184. gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
  185. label = _("3D raster:")),
  186. flag = wx.ALIGN_LEFT |
  187. wx.ALIGN_CENTER_VERTICAL,
  188. pos = (row, 0))
  189. r3Color = csel.ColourSelect(parent = panel, id = wx.ID_ANY,
  190. colour = self.settings.Get(group='modeler', key='data', subkey=('color', 'raster3d')),
  191. size = globalvar.DIALOG_COLOR_SIZE)
  192. r3Color.SetName('GetColour')
  193. self.winId['modeler:data:color:raster3d'] = r3Color.GetId()
  194. gridSizer.Add(item = r3Color,
  195. flag = wx.ALIGN_RIGHT |
  196. wx.ALIGN_CENTER_VERTICAL,
  197. pos = (row, 1))
  198. row += 1
  199. gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
  200. label = _("Vector:")),
  201. flag = wx.ALIGN_LEFT |
  202. wx.ALIGN_CENTER_VERTICAL,
  203. pos = (row, 0))
  204. vColor = csel.ColourSelect(parent = panel, id = wx.ID_ANY,
  205. colour = self.settings.Get(group='modeler', key='data', subkey=('color', 'vector')),
  206. size = globalvar.DIALOG_COLOR_SIZE)
  207. vColor.SetName('GetColour')
  208. self.winId['modeler:data:color:vector'] = vColor.GetId()
  209. gridSizer.Add(item = vColor,
  210. flag = wx.ALIGN_RIGHT |
  211. wx.ALIGN_CENTER_VERTICAL,
  212. pos = (row, 1))
  213. gridSizer.AddGrowableCol(0)
  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. row = 0
  222. gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
  223. label = _("Width:")),
  224. flag = wx.ALIGN_LEFT |
  225. wx.ALIGN_CENTER_VERTICAL,
  226. pos = (row, 0))
  227. width = wx.SpinCtrl(parent = panel, id = wx.ID_ANY,
  228. min = 0, max = 500,
  229. initial = self.settings.Get(group='modeler', key='data', subkey=('size', 'width')))
  230. width.SetName('GetValue')
  231. self.winId['modeler:data:size:width'] = width.GetId()
  232. gridSizer.Add(item = width,
  233. flag = wx.ALIGN_RIGHT |
  234. wx.ALIGN_CENTER_VERTICAL,
  235. pos = (row, 1))
  236. row += 1
  237. gridSizer.Add(item = wx.StaticText(parent=panel, id=wx.ID_ANY,
  238. label=_("Height:")),
  239. flag = wx.ALIGN_LEFT |
  240. wx.ALIGN_CENTER_VERTICAL,
  241. pos=(row, 0))
  242. height = wx.SpinCtrl(parent = panel, id = wx.ID_ANY,
  243. min = 0, max = 500,
  244. initial = self.settings.Get(group='modeler', key='data', subkey=('size', 'height')))
  245. height.SetName('GetValue')
  246. self.winId['modeler:data:size:height'] = height.GetId()
  247. gridSizer.Add(item = height,
  248. flag = wx.ALIGN_RIGHT |
  249. wx.ALIGN_CENTER_VERTICAL,
  250. pos = (row, 1))
  251. gridSizer.AddGrowableCol(0)
  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. row = 0
  267. gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
  268. label = _("Valid:")),
  269. flag = wx.ALIGN_LEFT |
  270. wx.ALIGN_CENTER_VERTICAL,
  271. pos = (row, 0))
  272. vColor = csel.ColourSelect(parent = panel, id = wx.ID_ANY,
  273. colour = self.settings.Get(group='modeler', key='loop', subkey=('color', 'valid')),
  274. size = globalvar.DIALOG_COLOR_SIZE)
  275. vColor.SetName('GetColour')
  276. self.winId['modeler:loop:color:valid'] = vColor.GetId()
  277. gridSizer.Add(item = vColor,
  278. flag = wx.ALIGN_RIGHT |
  279. wx.ALIGN_CENTER_VERTICAL,
  280. pos = (row, 1))
  281. gridSizer.AddGrowableCol(0)
  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. row = 0
  290. gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
  291. label = _("Width:")),
  292. flag = wx.ALIGN_LEFT |
  293. wx.ALIGN_CENTER_VERTICAL,
  294. pos = (row, 0))
  295. width = wx.SpinCtrl(parent = panel, id = wx.ID_ANY,
  296. min = 0, max = 500,
  297. initial = self.settings.Get(group='modeler', key='loop', subkey=('size', 'width')))
  298. width.SetName('GetValue')
  299. self.winId['modeler:loop:size:width'] = width.GetId()
  300. gridSizer.Add(item = width,
  301. flag = wx.ALIGN_RIGHT |
  302. wx.ALIGN_CENTER_VERTICAL,
  303. pos = (row, 1))
  304. row += 1
  305. gridSizer.Add(item = wx.StaticText(parent=panel, id=wx.ID_ANY,
  306. label=_("Height:")),
  307. flag = wx.ALIGN_LEFT |
  308. wx.ALIGN_CENTER_VERTICAL,
  309. pos=(row, 0))
  310. height = wx.SpinCtrl(parent = panel, id = wx.ID_ANY,
  311. min = 0, max = 500,
  312. initial = self.settings.Get(group='modeler', key='loop', subkey=('size', 'height')))
  313. height.SetName('GetValue')
  314. self.winId['modeler:loop:size:height'] = height.GetId()
  315. gridSizer.Add(item = height,
  316. flag = wx.ALIGN_RIGHT |
  317. wx.ALIGN_CENTER_VERTICAL,
  318. pos = (row, 1))
  319. gridSizer.AddGrowableCol(0)
  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.Add(item = wx.StaticText(parent = self, id = wx.ID_ANY,
  371. label = _("Name:")),
  372. flag = wx.ALIGN_LEFT |
  373. wx.ALIGN_CENTER_VERTICAL,
  374. pos = (0, 0))
  375. gridSizer.Add(item = self.name,
  376. flag = wx.ALIGN_LEFT |
  377. wx.ALIGN_CENTER_VERTICAL | wx.EXPAND,
  378. pos = (0, 1))
  379. gridSizer.Add(item = wx.StaticText(parent = self, id = wx.ID_ANY,
  380. label = _("Description:")),
  381. flag = wx.ALIGN_LEFT |
  382. wx.ALIGN_CENTER_VERTICAL,
  383. pos = (1, 0))
  384. gridSizer.Add(item = self.desc,
  385. flag = wx.ALIGN_LEFT |
  386. wx.ALIGN_CENTER_VERTICAL | wx.EXPAND,
  387. pos = (1, 1))
  388. gridSizer.Add(item = wx.StaticText(parent = self, id = wx.ID_ANY,
  389. label = _("Author(s):")),
  390. flag = wx.ALIGN_LEFT |
  391. wx.ALIGN_CENTER_VERTICAL,
  392. pos = (2, 0))
  393. gridSizer.Add(item = self.author,
  394. flag = wx.ALIGN_LEFT |
  395. wx.ALIGN_CENTER_VERTICAL | wx.EXPAND,
  396. pos = (2, 1))
  397. gridSizer.AddGrowableCol(1)
  398. gridSizer.AddGrowableRow(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'])