[Spambayes-checkins] spambayes/Outlook2000/dialogs
opt_processors.py, 1.5, 1.6
Mark Hammond
mhammond at users.sourceforge.net
Tue Aug 19 06:55:41 EDT 2003
Update of /cvsroot/spambayes/spambayes/Outlook2000/dialogs
In directory sc8-pr-cvs1:/tmp/cvs-serv23517
Modified Files:
opt_processors.py
Log Message:
Add a dumb, non-bool radio button processor.
Index: opt_processors.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/dialogs/opt_processors.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** opt_processors.py 18 Aug 2003 16:47:56 -0000 1.5
--- opt_processors.py 19 Aug 2003 12:55:39 -0000 1.6
***************
*** 3,7 ****
# SpamBayes options.
! # This module is part of the spambayes project, which is Copyright 2002
# The Python Software Foundation and is covered by the Python Software
# Foundation license.
--- 3,7 ----
# SpamBayes options.
! # This module is part of the spambayes project, which is Copyright 2003
# The Python Software Foundation and is covered by the Python Software
# Foundation license.
***************
*** 71,74 ****
--- 71,109 ----
self.SetOptionValue(check)
+ class RadioButtonProcessor(OptionControlProcessor):
+ def OnCommand(self, wparam, lparam):
+ code = win32api.HIWORD(wparam)
+ if code == win32con.BN_CLICKED:
+ self.UpdateValue_FromControl()
+ def UpdateControl_FromValue(self):
+ value = self.option.get()
+ i = 0
+ first = chwnd = self.GetControl()
+ while chwnd:
+ print "have control", chwnd, i, value
+ if i==value:
+ win32gui.SendMessage(chwnd, win32con.BM_SETCHECK, 1)
+ break
+ chwnd = win32gui.GetNextDlgGroupItem(self.window.hwnd,
+ chwnd,
+ False)
+ assert chwnd!=first, "Back where I started!"
+ i += 1
+ else:
+ assert 0, "Could not find control for value %s" % value
+ def UpdateValue_FromControl(self):
+ all_ids = [self.control_id] + self.other_ids
+ chwnd = self.GetControl()
+ i = 0
+ while chwnd:
+ checked = win32gui.SendMessage(chwnd, win32con.BM_GETCHECK)
+ if checked:
+ self.SetOptionValue(i)
+ break
+ chwnd = win32gui.GetNextDlgGroupItem(self.window.hwnd, chwnd, False)
+ i += 1
+ else:
+ assert 0, "Couldn't find a checked button"
+
# A "Combo" processor, that loads valid strings from the option.
class ComboProcessor(OptionControlProcessor):
More information about the Spambayes-checkins
mailing list