pre = wx.PreDialog()
g.frame.res.LoadOnDialog(pre, parent, 'DIALOG_CONTENT_CHECKLIST')
self.PostCreate(pre)
- self.list = xrc.XRCCTRL(self, 'CHECKLIST')
+ self.list = xrc.XRCCTRL(self, 'CHECK_LIST')
# Set list items
i = 0
for v,ch in value:
def GetValue(self):
if self.textModified: # text has newer value
try:
- return eval(self.text.GetValue())
+ return self.text.GetValue().split('|')
except SyntaxError:
wx.LogError('Syntax error in parameter value: ' + self.GetName())
return []
self.freeze = True
if not value: value = []
self.value = value
- self.text.SetValue(str(value)) # update text ctrl
+ if value:
+ repr_ = reduce(lambda a,b: '%s|%s' % (a,b), value)
+ else:
+ repr_ = ''
+ self.text.SetValue(repr_) # update text ctrl
self.freeze = False
def OnButtonEdit(self, evt):
if self.textModified: # text has newer value
- try:
- self.value = eval(self.text.GetValue())
- except SyntaxError:
- wx.LogError('Syntax error in parameter value: ' + self.GetName())
- self.value = []
+ self.value = self.GetValue()
dlg = ContentDialog(self, self.value)
if dlg.ShowModal() == wx.ID_OK:
value = []
ParamContent.__init__(self, parent, name)
def OnButtonEdit(self, evt):
if self.textModified: # text has newer value
- try:
- self.value = eval(self.text.GetValue())
- except SyntaxError:
- wx.LogError('Syntax error in parameter value: ' + self.GetName())
- self.value = []
+ self.value = self.GetValue()
dlg = ContentCheckListDialog(self, self.value)
if dlg.ShowModal() == wx.ID_OK:
value = []
self.SetModified()
self.textModified = False
dlg.Destroy()
+ def SetValue(self, value):
+ self.freeze = True
+ if not value: value = []
+ self.value = value
+ if value:
+ if len(value) == 1: repr_ = str(value)
+ else: repr_ = reduce(lambda a,b: '%s|%s' % (a,b), value)
+ else:
+ repr_ = ''
+ self.text.SetValue(repr_) # update text ctrl
+ self.freeze = False
class IntListDialog(wx.Dialog):
def __init__(self, parent, value):