[Spambayes-checkins] spambayes/Outlook2000/dialogs dialog_map.py, 1.11, 1.12 test_dialogs.py, 1.4, 1.5 wizard_processors.py, 1.1, 1.2

Mark Hammond mhammond at users.sourceforge.net
Tue Aug 19 07:27:29 EDT 2003


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

Modified Files:
	dialog_map.py test_dialogs.py wizard_processors.py 
Log Message:
A little more wizard work.


Index: dialog_map.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/dialogs/dialog_map.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** dialog_map.py	19 Aug 2003 01:33:51 -0000	1.11
--- dialog_map.py	19 Aug 2003 13:27:27 -0000	1.12
***************
*** 5,8 ****
--- 5,9 ----
  from processors import *
  from opt_processors import *
+ import wizard_processors as wiz
  
  from dialogs import ShowDialog, MakePropertyPage
***************
*** 248,316 ****
  def WizardFinish(mgr, window):
      print "Done!"
-     
- class WizardButtonProcessor(ButtonProcessor):
-     def __init__(self, window, control_ids, pages, finish_fn):
-         ButtonProcessor.__init__(self, window,control_ids)
-         self.back_btn_id = self.other_ids[0]
-         self.page_ids = pages.split()
-         self.currentPage = None
-         self.currentPageIndex = -1
-         self.currentPageHwnd = None
-         self.finish_fn = finish_fn
-         self.page_placeholder_id = self.other_ids[1]
-         
-     def Init(self):
-         ButtonProcessor.Init(self)
-         self.back_btn_hwnd = self.GetControl(self.back_btn_id)
-         self.forward_btn_hwnd = self.GetControl()
-         self.forward_captions = win32gui.GetWindowText(self.forward_btn_hwnd).split(",")
-         self.page_placeholder_hwnd = self.GetControl(self.page_placeholder_id)
-         self.switchToPage(0)
-     def atFinish(self):
-         return self.currentPageIndex==len(self.page_ids)-1
-             
-     def changeControls(self):
-         win32gui.EnableWindow(self.back_btn_hwnd,self.currentPageIndex!=0)
-         index = 0
-         if self.atFinish():
-             index = 1
-         win32gui.SetWindowText(self.forward_btn_hwnd, self.forward_captions[index])
-         
-     def OnClicked(self, id):
-         if id == self.control_id:
-             if self.atFinish():
-                 if not self.currentPage.SaveAllControls():
-                     return
-                 #finish
-                 win32gui.EnableWindow(self.forward_btn_hwnd, False)
-                 win32gui.EnableWindow(self.back_btn_hwnd, False)
-                 try:
-                     #optional
-                     h = GetControl(self.window.manager.dialog_parser.ids["IDCANCEL"])
-                     win32gui.EnableWindow(h, False)
-                 except:
-                     pass
-                         
-                 self.finish_fn(self.window.manager, self.window)
-                 win32gui.SendMessage(self.window.hwnd, win32con.WM_CLOSE, 0, 0)
-             else:
-                 #forward
-                 self.switchToPage(self.currentPageIndex+1)
-         elif id == self.back_btn_id:
-             #backward
-             self.switchToPage(self.currentPageIndex-1)
-     
-     def switchToPage(self, index):
-         if self.currentPageHwnd is not None:
-             if not self.currentPage.SaveAllControls():
-                 return 1
-             win32gui.DestroyWindow(self.currentPageHwnd)
-         #template = self.window.manager.dialog_parser.dialogs[self.page_ids[index]]
-         self.currentPage = MakePropertyPage(self.page_placeholder_hwnd, self.window.manager, self.page_ids[index],3)
-         self.currentPageHwnd = self.currentPage.CreateWindow()
-         self.currentPageIndex = index
-         self.changeControls()
-         return 0
-         
  
  from async_processor import AsyncCommandProcessor
--- 249,252 ----
***************
*** 401,408 ****
          (CloseButtonProcessor,    "IDOK IDCANCEL"),
          ),
      "IDD_WIZARD": (
          (CloseButtonProcessor,  "IDCANCEL"),
!         (WizardButtonProcessor, "IDC_FORWARD_BTN IDC_BACK_BTN IDC_PAGE_PLACEHOLDER",
!          "IDD_GENERAL IDD_FILTER IDD_ADVANCED", WizardFinish),
!         )
  }
--- 337,362 ----
          (CloseButtonProcessor,    "IDOK IDCANCEL"),
          ),
+     # All the wizards
      "IDD_WIZARD": (
          (CloseButtonProcessor,  "IDCANCEL"),
!         (wiz.ConfigureWizardProcessor, "IDC_FORWARD_BTN IDC_BACK_BTN IDC_PAGE_PLACEHOLDER",
!          """IDD_WIZARD_WELCOME IDD_WIZARD_FOLDERS_WATCH IDD_WIZARD_FOLDERS_REST
!          IDD_WIZARD_FINISHED_UNCONFIGURED IDD_WIZARD_FINISHED_UNTRAINED
!          """,
!          WizardFinish),
!         ),
!     "IDD_WIZARD_WELCOME": (
!         (CommandButtonProcessor,  "IDC_ABOUT_BTN", ShowAbout, ()),
!         (RadioButtonProcessor,    "IDC_BUT_PREPARATION", "Wizard.preparation"),
!         ),
!     "IDD_WIZARD_FOLDERS_REST": (
!         ),
!     "IDD_WIZARD_FOLDERS_WATCH": (
!         (wiz.WatchFolderIDProcessor,"IDC_FOLDER_WATCH IDC_BROWSE_WATCH",
!                                     "Wizard.watch_folder_ids"),
!         ),
!     "IDD_WIZARD_FINISHED_UNCONFIGURED": (
!         ),
!     "IDD_WIZARD_FINISHED_UNTRAINED": (
!         ),
  }

Index: test_dialogs.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/dialogs/test_dialogs.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** test_dialogs.py	19 Aug 2003 01:29:50 -0000	1.4
--- test_dialogs.py	19 Aug 2003 13:27:27 -0000	1.5
***************
*** 18,20 ****
--- 18,42 ----
      if len(sys.argv)>1:
          idd = sys.argv[1]
+     if idd=='IDD_WIZARD':
+         # not sure where this should go yet.
+         import config
+         extra_defaults = {
+             "Wizard" : (
+                 ("preparation", "How prepared? radio on welcome", 0,
+                  """""",
+                 config.INTEGER, config.RESTORE),
+                 (config.FolderIDOption,
+                    "watch_folder_ids", "Folders to watch for new messages", [],
+                     """The list of folders SpamBayes will watch for new messages,
+                     processing messages as defined by the filters.""",
+                     config.FOLDER_ID, config.DO_NOT_RESTORE),
+                 )
+             }
+         extra_defaults.update(config.defaults)
+         # This is evil and wont look like this at all
+         c = config.CreateConfig(extra_defaults)
+         mgr.options = c
+         mgr.config = config.OptionsContainer(c)
+ 
+ 
      ShowDialog(0, mgr, idd)

Index: wizard_processors.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/dialogs/wizard_processors.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** wizard_processors.py	19 Aug 2003 12:56:37 -0000	1.1
--- wizard_processors.py	19 Aug 2003 13:27:27 -0000	1.2
***************
*** 135,136 ****
--- 135,140 ----
          elif id == 'IDD_WIZARD_FOLDERS_REST':
              return 'IDD_WIZARD_FINISHED_UNTRAINED'
+ 
+ class WatchFolderIDProcessor(opt_processors.FolderIDProcessor):
+     # todo - default to the "inbox" folder
+     pass





More information about the Spambayes-checkins mailing list