[Spambayes-checkins] spambayes/Outlook2000/dialogs dialog_map.py, 1.17, 1.18 wizard_processors.py, 1.6, 1.7

Mark Hammond mhammond at users.sourceforge.net
Sun Aug 24 01:56:54 EDT 2003


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

Modified Files:
	dialog_map.py wizard_processors.py 
Log Message:
A wizard that is starting to look pretty good.  Can now be accessed via
the 'Manager' dialog.


Index: dialog_map.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/dialogs/dialog_map.py,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** dialog_map.py	24 Aug 2003 06:38:21 -0000	1.17
--- dialog_map.py	24 Aug 2003 07:56:52 -0000	1.18
***************
*** 7,11 ****
  import wizard_processors as wiz
  
! from dialogs import ShowDialog, MakePropertyPage
  
  try:
--- 7,11 ----
  import wizard_processors as wiz
  
! from dialogs import ShowDialog, MakePropertyPage, ShowWizard
  
  try:
***************
*** 231,235 ****
      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
--- 231,235 ----
      def OnClicked(self, id):
          parent = self.window.hwnd
!         # This 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
***************
*** 242,245 ****
--- 242,246 ----
          dd = self.window.manager.dialog_parser.dialogs[self.idd]
          return "Displays the %s dialog" % dd.caption
+ 
  class HiddenDialogCommand(DialogCommand):
      def __init__(self, window, control_ids, idd):
***************
*** 256,259 ****
--- 257,283 ----
          return "Nothing to see here."
  
+ class ShowWizardCommand(DialogCommand):
+     def OnClicked(self, id):
+         import win32con
+         existing = self.window
+         manager = self.window.manager
+         # Kill the main dialog - but first have to find it!
+         dlg = self.window.hwnd
+         while dlg:
+             style = win32api.GetWindowLong(dlg, win32con.GWL_STYLE)
+             if not style & win32con.WS_CHILD:
+                 break
+             dlg = win32gui.GetParent(dlg)
+         else:
+             assert 0, "no parent!"
+ 
+         try:
+             parent = win32gui.GetParent(dlg)
+         except win32gui.error:
+             parent = 0 # no parent
+         win32gui.EndDialog(dlg, win32con.IDOK)
+         # And show the wizard.
+         ShowWizard(parent, manager, self.idd, use_existing_config = True)
+     
  def WizardFinish(mgr, window):
      print "Wizard Done!"
***************
*** 333,336 ****
--- 357,361 ----
          (DialogCommand,           "IDC_BUT_TRAIN_NOW", "IDD_TRAINING"),
          (DialogCommand,           "IDC_ADVANCED_BTN", "IDD_ADVANCED"),
+         (ShowWizardCommand,       "IDC_BUT_WIZARD", "IDD_WIZARD"),
          ),
      "IDD_FILTER_NOW" : (
***************
*** 407,412 ****
           """IDD_WIZARD_WELCOME IDD_WIZARD_FOLDERS_WATCH IDD_WIZARD_FOLDERS_REST
           IDD_WIZARD_FOLDERS_TRAIN IDD_WIZARD_TRAIN
           IDD_WIZARD_FINISHED_UNCONFIGURED IDD_WIZARD_FINISHED_UNTRAINED
!          IDD_WIZARD_FINISHED_TRAINED
           """,
           WizardFinish),
--- 432,438 ----
           """IDD_WIZARD_WELCOME IDD_WIZARD_FOLDERS_WATCH IDD_WIZARD_FOLDERS_REST
           IDD_WIZARD_FOLDERS_TRAIN IDD_WIZARD_TRAIN
+          IDD_WIZARD_TRAINING_IS_IMPORTANT
           IDD_WIZARD_FINISHED_UNCONFIGURED IDD_WIZARD_FINISHED_UNTRAINED
!          IDD_WIZARD_FINISHED_TRAINED IDD_WIZARD_FINISHED_TRAIN_LATER
           """,
           WizardFinish),
***************
*** 416,419 ****
--- 442,448 ----
          (RadioButtonProcessor,    "IDC_BUT_PREPARATION", "Wizard.preparation"),
          ),
+     "IDD_WIZARD_TRAINING_IS_IMPORTANT" : (
+         (BoolButtonProcessor,     "IDC_BUT_TRAIN IDC_BUT_UNTRAINED",    "Wizard.will_train_later"),
+     ),
      "IDD_WIZARD_FOLDERS_REST": (
          (wiz.EditableFolderIDProcessor,"IDC_FOLDER_CERTAIN IDC_BROWSE_SPAM",
***************
*** 445,448 ****
--- 474,479 ----
      ),
      "IDD_WIZARD_FINISHED_TRAINED": (
+     ),
+     "IDD_WIZARD_FINISHED_TRAIN_LATER" : (
      ),
  }

Index: wizard_processors.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/dialogs/wizard_processors.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** wizard_processors.py	24 Aug 2003 06:37:20 -0000	1.6
--- wizard_processors.py	24 Aug 2003 07:56:52 -0000	1.7
***************
*** 176,181 ****
          if id == 'IDD_WIZARD_WELCOME':
              # Welcome page
!             if config.wizard.preparation == 0:
!                 return "IDD_WIZARD_FOLDERS_WATCH"
              elif config.wizard.preparation == 1: # pre-prepared.
                  return "IDD_WIZARD_FOLDERS_TRAIN"
--- 176,181 ----
          if id == 'IDD_WIZARD_WELCOME':
              # Welcome page
!             if config.wizard.preparation == 0: # unprepared
!                 return "IDD_WIZARD_TRAINING_IS_IMPORTANT"
              elif config.wizard.preparation == 1: # pre-prepared.
                  return "IDD_WIZARD_FOLDERS_TRAIN"
***************
*** 184,187 ****
--- 184,192 ----
              else:
                  assert 0, "oops"
+         elif id == 'IDD_WIZARD_TRAINING_IS_IMPORTANT':
+             if config.wizard.will_train_later:
+                 # user wants to pre-sort and configure later.
+                 return 'IDD_WIZARD_FINISHED_TRAIN_LATER'
+             return 'IDD_WIZARD_FOLDERS_WATCH'
          elif id == 'IDD_WIZARD_FOLDERS_TRAIN':
              return 'IDD_WIZARD_TRAIN'





More information about the Spambayes-checkins mailing list