[Spambayes-checkins] spambayes/Outlook2000 about.html, 1.18, 1.19 addin.py, 1.90, 1.91 manager.py, 1.69, 1.70 train.py, 1.27, 1.28

Mark Hammond mhammond at users.sourceforge.net
Sun Aug 10 01:26:51 EDT 2003


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

Modified Files:
	about.html addin.py manager.py train.py 
Log Message:
Merge in outlook-dialog-branch.  Thanks everyone.


Index: about.html
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/about.html,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** about.html	4 Aug 2003 15:06:08 -0000	1.18
--- about.html	10 Aug 2003 07:26:48 -0000	1.19
***************
*** 99,111 ****
  system is also trained.  This makes it less likely that another
  similar mail will be incorrectly classified in the future.<br>
! <br>
  <h2><a name="Installing_and_Configuring"></a>Installing and Configuring
  the plugin</h2>
  If you download the installer version of this plugin (ie, you
! downloaded a .EXE file you use to install), then everthing is installed
  and just needs to be configured.&nbsp; If you downloaded the sourcecode
  version of the plugin, please view README.txt for installation
! instructions.<br>
! Configuring the plugin requires the following steps:<br>
  <table cellpadding="2" cellspacing="2" border="0"
   style="text-align: left; width: 100%;">
--- 99,111 ----
  system is also trained.&nbsp; This makes it less likely that another
  similar mail will be incorrectly classified in the future.<br>
! <br />
  <h2><a name="Installing_and_Configuring"></a>Installing and Configuring
  the plugin</h2>
  If you download the installer version of this plugin (ie, you
! downloaded a .EXE file you use to install), then everything is installed
  and just needs to be configured.&nbsp; If you downloaded the sourcecode
  version of the plugin, please view README.txt for installation
! instructions.<br />
! Configuring the plugin requires the following steps:<br/><br/>
  <table cellpadding="2" cellspacing="2" border="0"
   style="text-align: left; width: 100%;">
***************
*** 114,118 ****
        <td style="vertical-align: top;">
        <ol>
!         <li>Confirm the plugin is installed:<br>
  Start Outlook, select your Inbox, then look at your Outlook
  toolbar.&nbsp; Just below the standard Toolbar, you should see a new
--- 114,118 ----
        <td style="vertical-align: top;">
        <ol>
!         <li style="margin-bottom: 1em;">Confirm the plugin is installed:<br/>
  Start Outlook, select your Inbox, then look at your Outlook
  toolbar.&nbsp; Just below the standard Toolbar, you should see a new
***************
*** 122,127 ****
  appear, please see <a href="docs/troubleshooting.html">the
  troubleshooting guide</a>.</li>
!         <li>Create <span style="font-style: italic;">Spam</span> and <span
!  style="font-style: italic;">Unsure</span> folders<br>
  Use the normal Outlook functions to create two new folders.&nbsp; These
  can be named anything you like, and can appear anywhere in the folder
--- 122,127 ----
  appear, please see <a href="docs/troubleshooting.html">the
  troubleshooting guide</a>.</li>
!         <li style="margin-bottom: 1em;">Create <span style="font-style: italic;">
!         Spam</span> and <span style="font-style: italic;">Unsure</span> folders<br />
  Use the normal Outlook functions to create two new folders.&nbsp; These
  can be named anything you like, and can appear anywhere in the folder
***************
*** 129,133 ****
  something like <span style="font-style: italic;">Spam</span> and <span
   style="font-style: italic;">Possible Spam</span>.</li>
!         <li>Manually create initial training data<br>
  Go through your <span style="font-style: italic;">Inbox, Deleted Items</span>
  and any other folders likely to have spam, and move as much as possible
--- 129,133 ----
  something like <span style="font-style: italic;">Spam</span> and <span
   style="font-style: italic;">Possible Spam</span>.</li>
!         <li style="margin-bottom: 1em;">Manually create initial training data<br/>
  Go through your <span style="font-style: italic;">Inbox, Deleted Items</span>
  and any other folders likely to have spam, and move as much as possible
***************
*** 136,140 ****
  of good messages we train on.&nbsp; Don't worry too much about missing
  one or two spam - the system is likely to find them for you as we
! rescore your existing email.<br>
  If your Inbox is so full of Spam you don't know where to start, you may
  like to create a temporary folder for the purposes of training your
--- 136,140 ----
  of good messages we train on.&nbsp; Don't worry too much about missing
  one or two spam - the system is likely to find them for you as we
! rescore your existing email.<br/><br/>
  If your Inbox is so full of Spam you don't know where to start, you may
  like to create a temporary folder for the purposes of training your
***************
*** 142,148 ****
  new folder (roughly the same number as Spam you are training on is
  best) and nominate this temporary folder instead of your Inbox.&nbsp;
! Once trained, you can dispose of this folder.<br>
!         </li>
!         <li>Configure and Train SpamBayes<br>
  Now we have our folders setup with some initial training data, we can
  configure the plugin.&nbsp; From the <span style="font-style: italic;">SpamBayes</span>
--- 142,147 ----
  new folder (roughly the same number as Spam you are training on is
  best) and nominate this temporary folder instead of your Inbox.&nbsp;
! Once trained, you can dispose of this folder.</li>
!         <li style="margin-bottom: 1em;">Configure and Train SpamBayes<br/>
  Now we have our folders setup with some initial training data, we can
  configure the plugin.&nbsp; From the <span style="font-style: italic;">SpamBayes</span>
***************
*** 150,161 ****
  Manager...</span>&nbsp; This will display the main dialog, as shown to
  the right.</li>
!         <li>Select Train Now, and the training dialog, also shown to
  the right will appear.&nbsp; You will need to select your Inbox as the
  folder for good messages, and your new Spam folder as the source of
  junk messages.&nbsp; Ensure that <span style="font-style: italic;">Score
  messages after training</span> is selected, so we can see how effective
! our Inbox cleanup was.<br>
!         </li>
!         <li>Click on the Train Now button, and a progress indicator
  will be displayed as your messages are trained and scored.&nbsp; When
  finished, close the training window to return
--- 149,159 ----
  Manager...</span>&nbsp; This will display the main dialog, as shown to
  the right.</li>
!         <li style="margin-bottom: 1em;">Select Train Now, and the training dialog, also shown to
  the right will appear.&nbsp; You will need to select your Inbox as the
  folder for good messages, and your new Spam folder as the source of
  junk messages.&nbsp; Ensure that <span style="font-style: italic;">Score
  messages after training</span> is selected, so we can see how effective
! our Inbox cleanup was.</li>
!         <li style="margin-bottom: 1em;">Click on the Train Now button, and a progress indicator
  will be displayed as your messages are trained and scored.&nbsp; When
  finished, close the training window to return
***************
*** 164,169 ****
        </td>
        <td style="vertical-align: top;"><img
!  src="docs/images/manager.jpg" title="" alt="Anti-Spam manager"
!  style="width: 369px; height: 335px;"><br>
        <div style="text-align: center;">The SpamBayes Manager dialog<br>
        <br>
--- 162,171 ----
        </td>
        <td style="vertical-align: top;"><img
!  src="docs/images/manager-select.jpg" title="" alt="SpamBayes Toolbar"
!  style="width: 354px; height: 138px;"><br>
!       <div style="text-align: center;">The SpamBayes Toolbar<br>
!       <br>
!       <img src="docs/images/manager.jpg" title="" alt="SpamBayes manager"
!  style="width: 369px; height: 352px;"><br>
        <div style="text-align: center;">The SpamBayes Manager dialog<br>
        <br>

Index: addin.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/addin.py,v
retrieving revision 1.90
retrieving revision 1.91
diff -C2 -d -r1.90 -r1.91
*** addin.py	8 Aug 2003 17:13:18 -0000	1.90
--- addin.py	10 Aug 2003 07:26:48 -0000	1.91
***************
*** 429,432 ****
--- 429,447 ----
                  self.manager.SaveBayesPostIncrementalTrain()
  
+ def ShowAbout(mgr):
+     mgr.ShowHtml("about.html")
+     
+ def ShowSpamBayesWebsite(mgr):
+     os.startfile("http://spambayes.sourceforge.net/")
+ def ShowFAQ(mgr):
+     os.startfile("http://spambayes.sourceforge.net/faq.html")
+ def ShowFAQ(mgr):
+     os.startfile("http://spambayes.sourceforge.net/faq.html")
+ def ShowBugTracker(mgr):
+     os.startfile("http://sourceforge.net/tracker/?group_id=61702&atid=498103")
+     
+ def ShowTroubleshooting(mgr):
+     mgr.ShowHtml("docs/troubleshooting.html")
+     
  # Event function fired from the "Show Clues" UI items.
  def ShowClues(mgr, explorer):
***************
*** 789,792 ****
--- 804,852 ----
                             Visible=True,
                             Tag = "SpamBayesCommand.CheckVersion")
+             helpPopup = self._AddControl(
+                             popup,
+                             constants.msoControlPopup,
+                             None, None,
+                             Caption="Help",
+                             TooltipText = "SpamBayes help documents",
+                             Enabled = True,
+                             Tag = "SpamBayesCommand.HelpPopup")
+             if helpPopup is not None:
+                 helpPopup = CastTo(helpPopup, "CommandBarPopup")
+                 self._AddControl(helpPopup,
+                                constants.msoControlButton,
+                                ButtonEvent, (ShowAbout, self.manager,),
+                                Caption="About SpamBayes",
+                                Enabled=True,
+                                Visible=True,
+                                Tag = "SpamBayesCommand.Help.ShowAbout")
+                 self._AddControl(helpPopup,
+                                constants.msoControlButton,
+                                ButtonEvent, (ShowTroubleshooting, self.manager,),
+                                Caption="Troubleshooting Guide",
+                                Enabled=True,
+                                Visible=True,
+                                Tag = "SpamBayesCommand.Help.ShowTroubleshooting")
+                 self._AddControl(helpPopup,
+                                constants.msoControlButton,
+                                ButtonEvent, (ShowSpamBayesWebsite, self.manager,),
+                                Caption="SpamBayes Website",
+                                Enabled=True,
+                                Visible=True,
+                                Tag = "SpamBayesCommand.Help.ShowSpamBayes Website")
+                 self._AddControl(helpPopup,
+                                constants.msoControlButton,
+                                ButtonEvent, (ShowFAQ, self.manager,),
+                                Caption="Frequently Asked Questions",
+                                Enabled=True,
+                                Visible=True,
+                                Tag = "SpamBayesCommand.Help.ShowFAQ")
+                 self._AddControl(helpPopup,
+                                constants.msoControlButton,
+                                ButtonEvent, (ShowBugTracker, self.manager,),
+                                Caption="SpamBayes Bug Tracker",
+                                Enabled=True,
+                                Visible=True,
+                                Tag = "SpamBayesCommand.Help.BugTacker")
          # If we are running from Python sources, enable a few extra items
          if not hasattr(sys, "frozen"):

Index: manager.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/manager.py,v
retrieving revision 1.69
retrieving revision 1.70
diff -C2 -d -r1.69 -r1.70
*** manager.py	30 Jul 2003 03:22:51 -0000	1.69
--- manager.py	10 Aug 2003 07:26:48 -0000	1.70
***************
*** 7,10 ****
--- 7,11 ----
  import shutil
  import traceback
+ import operator
  import win32api, win32con, win32ui
  
***************
*** 199,202 ****
--- 200,204 ----
          self.stats = Stats()
          self.outlook = outlook
+         self.dialog_parser = None
  
          import_early_core_spambayes_stuff()
***************
*** 688,717 ****
              raise
  
!     def ShowManager(self):
!         def do_train(dlg):
!             import train
!             import dialogs.TrainingDialog
!             d = dialogs.TrainingDialog.TrainingDialog(dlg.mgr, train.trainer)
!             d.DoModal()
  
!         def do_filter(dlg):
!             import filter
!             import dialogs.FilterDialog
!             d = dialogs.FilterDialog.FilterNowDialog(dlg.mgr, filter.filterer)
!             d.DoModal()
  
!         def define_filter(dlg):
!             import filter
!             import dialogs.FilterDialog
!             d = dialogs.FilterDialog.FilterArrivalsDialog(dlg.mgr, filter.filterer)
!             d.DoModal()
!             if dlg.mgr.addin is not None:
!                 dlg.mgr.addin.FiltersChanged()
  
!         import dialogs.ManagerDialog
!         d = dialogs.ManagerDialog.ManagerDialog(self, do_train, do_filter, define_filter)
!         d.DoModal()
          # And re-save now, just incase Outlook dies on the way down.
          self.SaveConfig()
  
  _mgr = None
--- 690,748 ----
              raise
  
!     def GetDisabledReason(self):
!         # Gets the reason why the plugin can not be enabled.
!         # If return is None, then it can be enabled (and indeed may be!)
!         # Otherwise return is the string reason
!         nspam = self.bayes.nspam
!         nham = self.bayes.nham
!         config = self.config.filter
!         # For the sake of getting reasonable results, let's insist
!         # on 5 spam and 5 ham messages before we can allow filtering
!         # to be enabled.
!         min_ham = 5
!         min_spam = 5
!         ok_to_enable = operator.truth(config.watch_folder_ids)
!         if not ok_to_enable:
!             return "You must define folders to watch for new messages"
!         
!         ok_to_enable = nspam >= min_spam and nham >= min_ham
!         if not ok_to_enable:
!             return "There must be %d good and %d spam messages\n" \
!                    "trained before filtering can be enabled" \
!                    % (min_ham, min_spam)
  
!         ok_to_enable = operator.truth(config.spam_folder_id)
!         if not ok_to_enable:
!             return "You must define the folder to receive your certain spam"
  
!         return None
  
!     def ShowManager(self):
!         import dialogs
!         # Need to get the plugin hwnd
!         dialogs.ShowDialog(0, self, "IDD_MANAGER")
          # And re-save now, just incase Outlook dies on the way down.
          self.SaveConfig()
+         
+     def ShowHtml(self,fileName):
+         """Displays the main SpamBayes documentation in your Web browser"""
+         import sys, os
+         if hasattr(sys, "frozen"):
+             # Same directory as to the executable.
+             fname = os.path.join(os.path.dirname(sys.argv[0]),
+                                     fileName)
+         else:
+             # (ie, main Outlook2000) dir
+             fname = os.path.join(os.path.dirname(__file__),
+                                     fileName)
+         fname = os.path.abspath(fname)
+         from dialogs import SetWaitCursor
+         if os.path.isfile(fname):
+             SetWaitCursor(1)
+             os.startfile(fname)
+             SetWaitCursor(0)
+         else:
+             print "Cant find ",fileName," - fix messagebox"
+             #self.MessageBox("Can't find "+fileName)
  
  _mgr = None

Index: train.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/train.py,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** train.py	15 May 2003 22:52:00 -0000	1.27
--- train.py	10 Aug 2003 07:26:49 -0000	1.28
***************
*** 98,103 ****
  
  # Called back from the dialog to do the actual training.
! def trainer(mgr, progress, rebuild, rescore = True):
      config = mgr.config
  
      if not config.training.ham_folder_ids or not config.training.spam_folder_ids:
--- 98,105 ----
  
  # Called back from the dialog to do the actual training.
! def trainer(mgr, progress):
      config = mgr.config
+     rebuild = config.training.rebuild
+     rescore = config.training.rescore
  
      if not config.training.ham_folder_ids or not config.training.spam_folder_ids:





More information about the Spambayes-checkins mailing list