[Spambayes-checkins] spambayes/Outlook2000/dialogs opt_processors.py, 1.10, 1.11

Mark Hammond mhammond at users.sourceforge.net
Mon Aug 25 20:53:11 EDT 2003


Update of /cvsroot/spambayes/spambayes/Outlook2000/dialogs
In directory sc8-pr-cvs1:/tmp/cvs-serv22985

Modified Files:
	opt_processors.py 
Log Message:
Boolean processor takes an optional list of control IDs to disable if
the option is False.


Index: opt_processors.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/dialogs/opt_processors.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** opt_processors.py	26 Aug 2003 02:26:13 -0000	1.10
--- opt_processors.py	26 Aug 2003 02:53:09 -0000	1.11
***************
*** 72,79 ****
--- 72,86 ----
  # where we must "uncheck" the other button.
  class BoolButtonProcessor(OptionControlProcessor):
+     def __init__(self, window, control_ids, option, disable_when_false_ids=""):
+         OptionControlProcessor.__init__(self, window, control_ids, option)
+         self.disable_ids = [window.manager.dialog_parser.ids[id]
+                             for id in disable_when_false_ids.split()]
      def OnCommand(self, wparam, lparam):
          code = win32api.HIWORD(wparam)
          if code == win32con.BN_CLICKED:
              self.UpdateValue_FromControl()
+     def UpdateEnabledStates(self, enabled):
+         for other in self.disable_ids:
+             win32gui.EnableWindow(self.GetControl(other), enabled)
      def UpdateControl_FromValue(self):
          value = self.GetOptionValue()
***************
*** 81,88 ****
--- 88,97 ----
          for other in self.other_ids:
              win32gui.SendMessage(self.GetControl(other), win32con.BM_SETCHECK, not value)
+         self.UpdateEnabledStates(value)
      def UpdateValue_FromControl(self):
          check = win32gui.SendMessage(self.GetControl(), win32con.BM_GETCHECK)
          check = not not check # force bool!
          self.SetOptionValue(check)
+         self.UpdateEnabledStates(check)
  
  class RadioButtonProcessor(OptionControlProcessor):





More information about the Spambayes-checkins mailing list