예제 #1
0
 def ShowManager(self):
     import dialogs
     dialogs.ShowDialog(0, self, self.config, "IDD_MANAGER")
     # And re-save now, just incase Outlook dies on the way down.
     self.SaveConfig()
     # And update the cutoff values in bayes_options (which the
     # stats use) to our thresholds.
     bayes_options["Categorization", "spam_cutoff"] = \
                                     self.config.filter.spam_threshold \
                                     / 100.0
     bayes_options["Categorization", "ham_cutoff"] = \
                                     self.config.filter.unsure_threshold \
                                     / 100.0
     # And tell the addin that our filters may have changed.
     if self.addin is not None:
         self.addin.FiltersChanged()
예제 #2
0
def CommitWizardConfig(manager, wc):
    # If the user want to manually configure, then don't do anything
    if wc.wizard.preparation == 2:  # manually configure
        import dialogs
        dialogs.ShowDialog(0, manager, manager.config, "IDD_MANAGER")
        manager.SaveConfig()
        return

    # Create the ham and spam folders, if necessary.
    manager.config.filter.watch_folder_ids = wc.filter.watch_folder_ids
    if wc.filter.spam_folder_id:
        manager.config.filter.spam_folder_id = wc.filter.spam_folder_id
    else:
        assert wc.wizard.spam_folder_name, "No ID, and no name!!!"
        f = _CreateFolder(manager, wc.wizard.spam_folder_name,
                          "contains spam filtered by SpamBayes")
        manager.config.filter.spam_folder_id = f.GetID()
    if wc.filter.unsure_folder_id:
        manager.config.filter.unsure_folder_id = wc.filter.unsure_folder_id
    else:
        assert wc.wizard.unsure_folder_name, "No ID, and no name!!!"
        f = _CreateFolder(manager, wc.wizard.unsure_folder_name,
                          "contains messages SpamBayes is uncertain about")
        manager.config.filter.unsure_folder_id = f.GetID()
    if wc.training.ham_folder_ids:
        manager.config.training.ham_folder_ids = wc.training.ham_folder_ids
    if wc.training.spam_folder_ids:
        manager.config.training.spam_folder_ids = wc.training.spam_folder_ids

    wiz_cd = manager.wizard_classifier_data
    manager.wizard_classifier_data = None
    if wiz_cd:
        manager.classifier_data.Adopt(wiz_cd)
    if wc.wizard.will_train_later:
        # User cancelled, but said they will sort their mail for us.
        # don't save the config - this will force the wizard up next time
        # outlook is started.
        pass
    else:
        # All done - enable, and save the config
        manager.config.filter.enabled = True
        manager.SaveConfig()
예제 #3
0
 def ShowManager(self, id="IDD_MANAGER"):
     import dialogs
     dialogs.ShowDialog(0, self, self.config, id)
예제 #4
0
 def ShowFilterNow(self):
     import dialogs
     dialogs.ShowDialog(0, self, self.config, "IDD_FILTER_NOW")
     # And re-save now, just incase Outlook dies on the way down.
     self.SaveConfig()