preferences.py 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530
  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. from core.utils import _
  18. class PreferencesDialog(PreferencesBaseDialog):
  19. """!User preferences dialog"""
  20. def __init__(self, parent, giface, settings = UserSettings,
  21. title = _("Modeler settings")):
  22. PreferencesBaseDialog.__init__(self, parent = parent, giface = giface, title = title,
  23. settings = settings)
  24. # create notebook pages
  25. self._createGeneralPage(self.notebook)
  26. self._createActionPage(self.notebook)
  27. self._createDataPage(self.notebook)
  28. self._createLoopPage(self.notebook)
  29. self.SetMinSize(self.GetBestSize())
  30. self.SetSize(self.size)
  31. def _createGeneralPage(self, notebook):
  32. """!Create notebook page for action settings"""
  33. panel = wx.Panel(parent = notebook, id = wx.ID_ANY)
  34. notebook.AddPage(page = panel, text = _("General"))
  35. # colors
  36. border = wx.BoxSizer(wx.VERTICAL)
  37. box = wx.StaticBox (parent = panel, id = wx.ID_ANY,
  38. label = " %s " % _("Item properties"))
  39. sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
  40. gridSizer = wx.GridBagSizer (hgap = 3, vgap = 3)
  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. gridSizer.AddGrowableCol(0)
  57. sizer.Add(item = gridSizer, proportion = 1, flag = wx.ALL | wx.EXPAND, border = 5)
  58. border.Add(item = sizer, proportion = 0, flag = wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border = 3)
  59. panel.SetSizer(border)
  60. return panel
  61. def _createActionPage(self, notebook):
  62. """!Create notebook page for action settings"""
  63. panel = wx.Panel(parent = notebook, id = wx.ID_ANY)
  64. notebook.AddPage(page = panel, text = _("Action"))
  65. # colors
  66. border = wx.BoxSizer(wx.VERTICAL)
  67. box = wx.StaticBox (parent = panel, id = wx.ID_ANY,
  68. label = " %s " % _("Color"))
  69. sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
  70. gridSizer = wx.GridBagSizer (hgap = 3, vgap = 3)
  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. gridSizer.AddGrowableCol(0)
  117. sizer.Add(item = gridSizer, proportion = 1, flag = wx.ALL | wx.EXPAND, border = 5)
  118. border.Add(item = sizer, proportion = 0, flag = wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border = 3)
  119. # size
  120. box = wx.StaticBox (parent = panel, id = wx.ID_ANY,
  121. label = " %s " % _("Shape size"))
  122. sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
  123. gridSizer = wx.GridBagSizer (hgap=3, vgap=3)
  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. gridSizer.AddGrowableCol(0)
  155. sizer.Add(item=gridSizer, proportion=1, flag=wx.ALL | wx.EXPAND, border=5)
  156. border.Add(item=sizer, proportion=0, flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=3)
  157. panel.SetSizer(border)
  158. return panel
  159. def _createDataPage(self, notebook):
  160. """!Create notebook page for data settings"""
  161. panel = wx.Panel(parent = notebook, id = wx.ID_ANY)
  162. notebook.AddPage(page = panel, text = _("Data"))
  163. # colors
  164. border = wx.BoxSizer(wx.VERTICAL)
  165. box = wx.StaticBox (parent = panel, id = wx.ID_ANY,
  166. label = " %s " % _("Type"))
  167. sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
  168. gridSizer = wx.GridBagSizer (hgap = 3, vgap = 3)
  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. gridSizer.AddGrowableCol(0)
  215. sizer.Add(item = gridSizer, proportion = 1, flag = wx.ALL | wx.EXPAND, border = 5)
  216. border.Add(item = sizer, proportion = 0, flag = wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border = 3)
  217. # size
  218. box = wx.StaticBox (parent = panel, id = wx.ID_ANY,
  219. label = " %s " % _("Shape size"))
  220. sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
  221. gridSizer = wx.GridBagSizer (hgap=3, vgap=3)
  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. gridSizer.AddGrowableCol(0)
  253. sizer.Add(item=gridSizer, proportion=1, flag=wx.ALL | wx.EXPAND, border=5)
  254. border.Add(item=sizer, proportion=0, flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=3)
  255. panel.SetSizer(border)
  256. return panel
  257. def _createLoopPage(self, notebook):
  258. """!Create notebook page for loop settings"""
  259. panel = wx.Panel(parent = notebook, id = wx.ID_ANY)
  260. notebook.AddPage(page = panel, text = _("Loop"))
  261. # colors
  262. border = wx.BoxSizer(wx.VERTICAL)
  263. box = wx.StaticBox (parent = panel, id = wx.ID_ANY,
  264. label = " %s " % _("Color"))
  265. sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
  266. gridSizer = wx.GridBagSizer (hgap = 3, vgap = 3)
  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. gridSizer.AddGrowableCol(0)
  283. sizer.Add(item = gridSizer, proportion = 1, flag = wx.ALL | wx.EXPAND, border = 5)
  284. border.Add(item = sizer, proportion = 0, flag = wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border = 3)
  285. # size
  286. box = wx.StaticBox (parent = panel, id = wx.ID_ANY,
  287. label = " %s " % _("Shape size"))
  288. sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
  289. gridSizer = wx.GridBagSizer (hgap=3, vgap=3)
  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. gridSizer.AddGrowableCol(0)
  321. sizer.Add(item=gridSizer, proportion=1, flag=wx.ALL | wx.EXPAND, border=5)
  322. border.Add(item=sizer, proportion=0, flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=3)
  323. panel.SetSizer(border)
  324. return panel
  325. def OnApply(self, event):
  326. """!Button 'Apply' pressed"""
  327. PreferencesBaseDialog.OnApply(self, event)
  328. self.parent.GetModel().Update()
  329. self.parent.GetCanvas().Refresh()
  330. def OnSave(self, event):
  331. """!Button 'Save' pressed"""
  332. PreferencesBaseDialog.OnSave(self, event)
  333. self.parent.GetModel().Update()
  334. self.parent.GetCanvas().Refresh()
  335. class PropertiesDialog(wx.Dialog):
  336. """!Model properties dialog
  337. """
  338. def __init__(self, parent, id = wx.ID_ANY,
  339. title = _('Model properties'),
  340. size = (350, 400),
  341. style = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER):
  342. wx.Dialog.__init__(self, parent, id, title, size = size,
  343. style = style)
  344. self.metaBox = wx.StaticBox(parent = self, id = wx.ID_ANY,
  345. label=" %s " % _("Metadata"))
  346. self.cmdBox = wx.StaticBox(parent = self, id = wx.ID_ANY,
  347. label=" %s " % _("Commands"))
  348. self.name = wx.TextCtrl(parent = self, id = wx.ID_ANY,
  349. size = (300, 25))
  350. self.desc = wx.TextCtrl(parent = self, id = wx.ID_ANY,
  351. style = wx.TE_MULTILINE,
  352. size = (300, 50))
  353. self.author = wx.TextCtrl(parent = self, id = wx.ID_ANY,
  354. size = (300, 25))
  355. # commands
  356. self.overwrite = wx.CheckBox(parent = self, id=wx.ID_ANY,
  357. label=_("Allow output files to overwrite existing files"))
  358. self.overwrite.SetValue(UserSettings.Get(group='cmd', key='overwrite', subkey='enabled'))
  359. # buttons
  360. self.btnOk = wx.Button(self, wx.ID_OK)
  361. self.btnCancel = wx.Button(self, wx.ID_CANCEL)
  362. self.btnOk.SetDefault()
  363. self.btnOk.SetToolTipString(_("Apply properties"))
  364. self.btnOk.SetDefault()
  365. self.btnCancel.SetToolTipString(_("Close dialog and ignore changes"))
  366. self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
  367. self._layout()
  368. def _layout(self):
  369. metaSizer = wx.StaticBoxSizer(self.metaBox, wx.VERTICAL)
  370. gridSizer = wx.GridBagSizer(hgap = 3, vgap = 3)
  371. gridSizer.Add(item = wx.StaticText(parent = self, id = wx.ID_ANY,
  372. label = _("Name:")),
  373. flag = wx.ALIGN_LEFT |
  374. wx.ALIGN_CENTER_VERTICAL,
  375. pos = (0, 0))
  376. gridSizer.Add(item = self.name,
  377. flag = wx.ALIGN_LEFT |
  378. wx.ALIGN_CENTER_VERTICAL | wx.EXPAND,
  379. pos = (0, 1))
  380. gridSizer.Add(item = wx.StaticText(parent = self, id = wx.ID_ANY,
  381. label = _("Description:")),
  382. flag = wx.ALIGN_LEFT |
  383. wx.ALIGN_CENTER_VERTICAL,
  384. pos = (1, 0))
  385. gridSizer.Add(item = self.desc,
  386. flag = wx.ALIGN_LEFT |
  387. wx.ALIGN_CENTER_VERTICAL | wx.EXPAND,
  388. pos = (1, 1))
  389. gridSizer.Add(item = wx.StaticText(parent = self, id = wx.ID_ANY,
  390. label = _("Author(s):")),
  391. flag = wx.ALIGN_LEFT |
  392. wx.ALIGN_CENTER_VERTICAL,
  393. pos = (2, 0))
  394. gridSizer.Add(item = self.author,
  395. flag = wx.ALIGN_LEFT |
  396. wx.ALIGN_CENTER_VERTICAL | wx.EXPAND,
  397. pos = (2, 1))
  398. gridSizer.AddGrowableCol(1)
  399. gridSizer.AddGrowableRow(1)
  400. metaSizer.Add(item = gridSizer, proportion = 1, flag = wx.EXPAND)
  401. cmdSizer = wx.StaticBoxSizer(self.cmdBox, wx.VERTICAL)
  402. cmdSizer.Add(item = self.overwrite,
  403. flag = wx.EXPAND | wx.ALL, border = 3)
  404. btnStdSizer = wx.StdDialogButtonSizer()
  405. btnStdSizer.AddButton(self.btnCancel)
  406. btnStdSizer.AddButton(self.btnOk)
  407. btnStdSizer.Realize()
  408. mainSizer = wx.BoxSizer(wx.VERTICAL)
  409. mainSizer.Add(item=metaSizer, proportion=1,
  410. flag=wx.EXPAND | wx.ALL, border=5)
  411. mainSizer.Add(item=cmdSizer, proportion=0,
  412. flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM, border=5)
  413. mainSizer.Add(item=btnStdSizer, proportion=0,
  414. flag=wx.EXPAND | wx.ALL | wx.ALIGN_RIGHT, border=5)
  415. self.SetSizer(mainSizer)
  416. mainSizer.Fit(self)
  417. def OnCloseWindow(self, event):
  418. self.Hide()
  419. def GetValues(self):
  420. """!Get values"""
  421. return { 'name' : self.name.GetValue(),
  422. 'description' : self.desc.GetValue(),
  423. 'author' : self.author.GetValue(),
  424. 'overwrite' : self.overwrite.IsChecked() }
  425. def Init(self, prop):
  426. """!Initialize dialog"""
  427. self.name.SetValue(prop['name'])
  428. self.desc.SetValue(prop['description'])
  429. self.author.SetValue(prop['author'])
  430. if 'overwrite' in prop:
  431. self.overwrite.SetValue(prop['overwrite'])