def OnDismiss(self): combo = self.GetCombo() value = [] for i in range(self.GetCount()): if self.IsChecked(i): value.append(self.values[i]) # Add ignored flags value.extend(self.ignored) strValue = '|'.join(value) if combo.GetValue() != strValue: combo.SetValue(strValue) Presenter.setApplied(False) wx.combo.ComboPopup.OnDismiss(self)
def OnDismiss(self): """Set the display string to a character seperated string of the checked items.""" combo = self.GetCombo() value = [] for i in range(self.GetCount()): if self.IsChecked(i): value.append(self.choices[i]) strValue = self.separator.join(value) if combo.GetValue() != strValue: combo.SetText(strValue) wx.combo.ComboPopup.OnDismiss(self)
def OnPopup(self): combo = self.GetCombo() value = map(string.strip, combo.GetValue().split('|')) if value == ['']: value = [] self.ignored = [] for i in value: try: self.Check(self.values.index(i)) except ValueError: # Try to find equal if self.equal.has_key(i): self.Check(self.values.index(self.equal[i])) else: logger.warning('unknown flag: %s: ignored.', i) self.ignored.append(i) wx.combo.ComboPopup.OnPopup(self)
def OnPopup(self): """Show the CheckListBox, checking items that are in the display string.""" combo = self.GetCombo() value = [x.strip() for x in combo.GetValue().split(self.separator)] if value == ['']: value = [] for i in range(self.GetCount()): self.Check(i, False) for i in value: try: self.Check(self.choices.index(i)) except ValueError: # Try to find equal if self.equal.has_key(i): self.Check(self.choices.index(self.equal[i])) wx.combo.ComboPopup.OnPopup(self)