[Spambayes-checkins] spambayes/Outlook2000/dialogs dlgcore.py, 1.1.2.1, 1.1.2.2 dlgutils.py, 1.1.2.1, 1.1.2.2 processors.py, 1.1.2.1, 1.1.2.2 test_dialogs.py, 1.1.2.2, 1.1.2.3

Mark Hammond mhammond at users.sourceforge.net
Sun Aug 3 22:09:20 EDT 2003


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

Modified Files:
      Tag: outlook-dialog-branch
	dlgcore.py dlgutils.py processors.py test_dialogs.py 
Log Message:
More hacking on the dialogs.


Index: dlgcore.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/dialogs/Attic/dlgcore.py,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -d -r1.1.2.1 -r1.1.2.2
*** dlgcore.py	4 Aug 2003 01:15:47 -0000	1.1.2.1
--- dlgcore.py	4 Aug 2003 04:09:18 -0000	1.1.2.2
***************
*** 2,6 ****
  # Driven completely by "Control Processor" objects.
  
! # 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.
--- 2,6 ----
  # Driven completely by "Control Processor" objects.
  
! # 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.
***************
*** 98,101 ****
--- 98,104 ----
                  existing.append(instance)
  
+     def _GetIDName(self, cid):
+         return self.manager.dialog_parser.names.get(cid, str(cid))
+ 
      def CreateWindow(self):
          self._DoCreate(win32gui.CreateDialogIndirect)
***************
*** 169,173 ****
              tt_text = cp.GetPopupHelpText(iCtrlId)
          else:
!             print "Can not get command processor for", iCtrlId
          if tt_text:
              self.tt.ShowTooltipForControl(iCtrlId, tt_text)
--- 172,176 ----
              tt_text = cp.GetPopupHelpText(iCtrlId)
          else:
!             print "Can not get command processor for", self._GetIDName(iCtrlId)
          if tt_text:
              self.tt.ShowTooltipForControl(iCtrlId, tt_text)
***************
*** 214,218 ****
          handler = self.command_processors.get(idFrom)
          if handler is None:
!             print "Ignoring OnNotify for", idFrom
              return
          handler.OnNotify( (hwndFrom, idFrom, code), wparam, lparam)
--- 217,221 ----
          handler = self.command_processors.get(idFrom)
          if handler is None:
!             print "Ignoring OnNotify for", self._GetIDName(idFrom)
              return
          handler.OnNotify( (hwndFrom, idFrom, code), wparam, lparam)
***************
*** 223,227 ****
          handler = self.command_processors.get(id)
          if handler is None:
!             print "Ignoring OnCommand for", id
              return
  
--- 226,230 ----
          handler = self.command_processors.get(id)
          if handler is None:
!             print "Ignoring OnCommand for", self._GetIDName(id)
              return
  

Index: dlgutils.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/dialogs/Attic/dlgutils.py,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -d -r1.1.2.1 -r1.1.2.2
*** dlgutils.py	4 Aug 2003 01:15:47 -0000	1.1.2.1
--- dlgutils.py	4 Aug 2003 04:09:18 -0000	1.1.2.2
***************
*** 8,13 ****
      return ((h & 0xFFFF) << 16) | (l & 0xFFFF)
  
  def SetWaitCursor(wait):
!     import win32gui
      if wait:
          hCursor = win32gui.LoadCursor(0, win32con.IDC_WAIT)
--- 8,15 ----
      return ((h & 0xFFFF) << 16) | (l & 0xFFFF)
  
+ MAKELPARAM=MAKELONG
+ 
  def SetWaitCursor(wait):
!     import win32gui, win32con
      if wait:
          hCursor = win32gui.LoadCursor(0, win32con.IDC_WAIT)

Index: processors.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/dialogs/Attic/processors.py,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -d -r1.1.2.1 -r1.1.2.2
*** processors.py	4 Aug 2003 01:15:47 -0000	1.1.2.1
--- processors.py	4 Aug 2003 04:09:18 -0000	1.1.2.2
***************
*** 1,5 ****
  # Control Processors for our dialog.
  
! # 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.
--- 1,5 ----
  # Control Processors for our dialog.
  
! # 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.
***************
*** 64,83 ****
          assert ctrlid == self.control_id
          return " ".join(self.func.__doc__.split())
- 
- class DialogCommand(ButtonProcessor):
-     def __init__(self, window, control_ids, idd):
-         self.idd = idd
-         ButtonProcessor.__init__(self, window, control_ids)
-     def OnClicked(self, id):
-         parent = self.window.hwnd
-         # Thos form and the other form may "share" options, or at least
-         # depend on others.  So we must save the current form back to the
-         # options object, display the new dialog, then reload the current
-         # form from the options object/
-         self.window.SaveAllControls()
-         ShowDialog(parent, self.window.manager, self.idd)
-         self.window.LoadAllControls()
-         
-     def GetPopupHelpText(self, id):
-         dd = self.window.manager.dialog_parser.dialogs[self.idd]
-         return "Displays the %s dialog" % dd.caption
--- 64,65 ----

Index: test_dialogs.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/dialogs/Attic/test_dialogs.py,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -d -r1.1.2.2 -r1.1.2.3
*** test_dialogs.py	4 Aug 2003 01:42:27 -0000	1.1.2.2
--- test_dialogs.py	4 Aug 2003 04:09:18 -0000	1.1.2.3
***************
*** 65,71 ****
          return "Displays the %s dialog" % dd.caption
  
  dialog_map = {
      "IDD_MANAGER" : (
!         (CloseButtonProcessor,    "IDOK"),
          (VersionStringProcessor,  "IDC_VERSION"),
          (BoolButtonProcessor,     "IDC_BUT_TRAIN_FROM_SPAM_FOLDER",
--- 65,85 ----
          return "Displays the %s dialog" % dd.caption
  
+ from async_processor import AsyncCommandProcessor
+ 
+ def test_async(manager, progress):
+     import time
+     progress.set_max_ticks(10)
+     for i in range(10):
+         progress.set_status("Number %d" % i)
+         progress.tick()
+         time.sleep(1)
+         if progress.stop_requested():
+             break
+     progress.set_status("Finished")
+ 
+ 
  dialog_map = {
      "IDD_MANAGER" : (
!         (CloseButtonProcessor,    "IDOK IDCANCEL"),
          (VersionStringProcessor,  "IDC_VERSION"),
          (BoolButtonProcessor,     "IDC_BUT_TRAIN_FROM_SPAM_FOLDER",
***************
*** 79,83 ****
      ),
      "IDD_FILTER_NOW" : (
!         (CloseButtonProcessor,    "IDOK"),
          (BoolButtonProcessor,     "IDC_BUT_UNREAD",    "Filter_Now.only_unread"),
          (BoolButtonProcessor,     "IDC_BUT_UNSEEN",    "Filter_Now.only_unseen"),
--- 93,97 ----
      ),
      "IDD_FILTER_NOW" : (
!         (CloseButtonProcessor,    "IDOK IDCANCEL"),
          (BoolButtonProcessor,     "IDC_BUT_UNREAD",    "Filter_Now.only_unread"),
          (BoolButtonProcessor,     "IDC_BUT_UNSEEN",    "Filter_Now.only_unseen"),
***************
*** 87,93 ****
                                    "Filter_Now.folder_ids",
                                    "Filter_Now.include_sub"),
      ),
      "IDD_FILTER" : (
!         (CloseButtonProcessor,    "IDOK"),
          (FolderIDProcessor,       "IDC_FOLDER_WATCH IDC_BROWSE_WATCH",
                                    "Filter.watch_folder_ids",
--- 101,111 ----
                                    "Filter_Now.folder_ids",
                                    "Filter_Now.include_sub"),
+         (AsyncCommandProcessor,   "IDC_START IDC_PROGRESS IDC_PROGRESS_TEXT",
+                                   test_async, "Start Filtering", "Stop Filtering",
+                                   "IDC_BUT_UNSEEN IDC_BUT_UNREAD IDC_BROWSE " \
+                                   "IDOK IDC_BUT_ACT_SCORE IDC_BUT_ACT_ALL"),
      ),
      "IDD_FILTER" : (
!         (CloseButtonProcessor,    "IDOK IDCANCEL"),
          (FolderIDProcessor,       "IDC_FOLDER_WATCH IDC_BROWSE_WATCH",
                                    "Filter.watch_folder_ids",
***************
*** 109,113 ****
      ),
      "IDD_TRAINING" : (
!         (CloseButtonProcessor,    "IDOK"),
          (FolderIDProcessor,       "IDC_STATIC_HAM IDC_BROWSE_HAM",
                                    "Training.ham_folder_ids",
--- 127,131 ----
      ),
      "IDD_TRAINING" : (
!         (CloseButtonProcessor,    "IDOK IDCANCEL"),
          (FolderIDProcessor,       "IDC_STATIC_HAM IDC_BROWSE_HAM",
                                    "Training.ham_folder_ids",





More information about the Spambayes-checkins mailing list