+ self.valuesSpecific = g.currentXXX.winStyles
+ if self.valuesSpecific: # override if using specific styles
+ # Remove duplicates
+ self.valuesGeneric = [s for s in genericStyles
+ if s not in self.valuesSpecific]
+ EVT_BUTTON(self, self.ID_BUTTON_CHOICES, self.OnButtonChoicesBoth)
+ else:
+ self.values = genericStyles
+ def OnButtonChoicesBoth(self, evt):
+ dlg = g.frame.res.LoadDialog(self, 'DIALOG_STYLES')
+ listBoxSpecific = XRCCTRL(dlg, 'CHECKLIST_SPECIFIC')
+ listBoxSpecific.InsertItems(self.valuesSpecific, 0)
+ listBoxGeneric = XRCCTRL(dlg, 'CHECKLIST_GENERIC')
+ listBoxGeneric.InsertItems(self.valuesGeneric, 0)
+ value = map(string.strip, self.text.GetValue().split('|'))
+ if value == ['']: value = []
+ # Set specific styles
+ value2 = [] # collect generic and ignored here
+ for i in value:
+ try:
+ listBoxSpecific.Check(self.valuesSpecific.index(i))
+ except ValueError:
+ # Try to find equal
+ if self.equal.has_key(i):
+ listBoxSpecific.Check(self.valuesSpecific.index(self.equal[i]))
+ else:
+ value2.append(i)
+ ignored = []
+ # Set generic styles, collect non-standart values
+ for i in value2:
+ try:
+ listBoxGeneric.Check(self.valuesGeneric.index(i))
+ except ValueError:
+ # Try to find equal
+ if self.equal.has_key(i):
+ listBoxGeneric.Check(self.valuesGeneric.index(self.equal[i]))
+ else:
+ print 'WARNING: unknown flag: %s: ignored.' % i
+ ignored.append(i)
+ if dlg.ShowModal() == wxID_OK:
+ value = [self.valuesSpecific[i]
+ for i in range(listBoxSpecific.GetCount())
+ if listBoxSpecific.IsChecked(i)] + \
+ [self.valuesGeneric[i]
+ for i in range(listBoxGeneric.GetCount())
+ if listBoxGeneric.IsChecked(i)] + ignored
+ if value:
+ self.SetValue(reduce(lambda a,b: a+'|'+b, value))
+ else:
+ self.SetValue('')
+ self.SetModified()
+ dlg.Destroy()