+ self.value = []
+ dlg = ContentCheckListDialog(self, self.value)
+ if dlg.ShowModal() == wxID_OK:
+ value = []
+ for i in range(dlg.list.Number()):
+ value.append((dlg.list.GetString(i), dlg.list.IsChecked(i)))
+ # Add ignored flags
+ self.SetValue(value)
+ self.SetModified()
+ self.textModified = false
+ dlg.Destroy()
+
+class IntListDialog(wxDialogPtr):
+ def __init__(self, parent, value):
+ # Is this normal???
+ w = frame.res.LoadDialog(parent, 'DIALOG_INTLIST')
+ wxDialogPtr.__init__(self, w.this)
+ self.thisown = 1
+ self.Center()
+ self.list = self.FindWindowByName('LIST')
+ # Set list items
+ value.sort()
+ for v in value:
+ if type(v) != IntType:
+ wxLogError('Invalid item type')
+ else:
+ self.list.Append(str(v))
+ self.SetAutoLayout(true)
+ self.GetSizer().Fit(self)
+ # Callbacks
+ self.ID_BUTTON_ADD = XMLID('BUTTON_ADD')
+ self.ID_BUTTON_REMOVE = XMLID('BUTTON_REMOVE')
+ EVT_BUTTON(self, self.ID_BUTTON_ADD, self.OnButtonAppend)
+ EVT_BUTTON(self, self.ID_BUTTON_REMOVE, self.OnButtonRemove)
+ EVT_UPDATE_UI(self, self.ID_BUTTON_REMOVE, self.OnUpdateUI)
+ def OnButtonAppend(self, evt):
+ s = wxGetTextFromUser('Enter new number:', 'Add', '', self)
+ # Check that it's unique
+ try:
+ v = int(s)
+ s = str(v) # to be sure
+ i = self.list.FindString(s)
+ if i == -1: # ignore non-unique
+ # Find place to insert
+ found = false
+ for i in range(self.list.Number()):
+ if int(self.list.GetString(i)) > v:
+ found = true
+ break
+ if found: self.list.InsertItems([s], i)
+ else: self.list.Append(s)
+ except ValueError:
+ wxLogError('List item is not an int!')
+ def OnButtonRemove(self, evt):
+ self.list.Delete(self.list.GetSelection())
+ def OnUpdateUI(self, evt):
+ if evt.GetId() == self.ID_BUTTON_REMOVE:
+ evt.Enable(self.list.GetSelection() != -1)
+
+# For growable list
+class ParamIntList(ParamContent):
+ def __init__(self, parent, name):
+ ParamContent.__init__(self, parent, name)