[spambayes-dev] New Outlook Dialogs Problem

Kenny Pitt kennypitt at hotmail.com
Wed Aug 13 11:37:57 EDT 2003


Meyer, Tony wrote:
> If I haven't got enough training information to enable filtering, the
> "enable filtering" box isn't greyed out anymore.  If I try to check it,
> it doesn't check, and I get this traceback:
> 
> Traceback (most recent call last):
>   File "D:\cvs\spambayes\spambayes\Outlook2000\dialogs\dlgcore.py", line
> 286, in OnCommand
>     self.ApplyHandlingOptionValueError(handler.OnCommand, wparam,
> lparam)
>   File "D:\cvs\spambayes\spambayes\Outlook2000\dialogs\dlgcore.py", line
> 245, in ApplyHandlingOptionValueError
>     self.dialog_def.caption, mb_flags)
> AttributeError: ProcessorDialog instance has no attribute 'dialog_def'
> 
> (I'd try and fix this myself, but the new dialog code still has me
> overwhelmed ;)
> 

Here's a first stab at a fix.  Maybe Mark can clean this up and plug any 
additional holes that I didn't notice.

Index: dlgcore.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/dialogs/dlgcore.py,v
retrieving revision 1.2
diff -u -r1.2 dlgcore.py
--- dlgcore.py	10 Aug 2003 07:26:49 -0000	1.2
+++ dlgcore.py	13 Aug 2003 14:34:54 -0000
@@ -86,6 +86,9 @@

      def DoModal(self):
          return self._DoCreate(win32gui.DialogBoxIndirect)
+
+    def GetCaption(self):
+        return win32gui.GetWindowText(self.hwnd)

      def GetMessageMap(self):
          ret = {
@@ -242,7 +245,7 @@
          except ValueError, why:
              mb_flags = win32con.MB_ICONEXCLAMATION | win32con.MB_OK
              win32gui.MessageBox(self.hwnd, str(why),
-                                self.dialog_def.caption, mb_flags)
+                                self.GetCaption(), mb_flags)
              return False

      def SaveAllControls(self):

Index: dialog_map.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/dialogs/dialog_map.py,v
retrieving revision 1.2
diff -u -r1.2 dialog_map.py
--- dialog_map.py	10 Aug 2003 07:26:49 -0000	1.2
+++ dialog_map.py	13 Aug 2003 14:34:46 -0000
@@ -35,6 +35,14 @@
                               0, db_status)

  class FilterEnableProcessor(BoolButtonProcessor):
+    def OnOptionChanged(self, option):
+        self.Init()
+
+    def Init(self):
+        BoolButtonProcessor.Init(self)
+        reason = self.window.manager.GetDisabledReason()
+        win32gui.EnableWindow(self.GetControl(), reason is None)
+
      def UpdateValue_FromControl(self):
          check = win32gui.SendMessage(self.GetControl(), 
win32con.BM_GETCHECK)
          if check:

-- 
Kenny Pitt




More information about the spambayes-dev mailing list