[Spambayes-checkins] spambayes/Outlook2000 addin.py, 1.91, 1.92 manager.py, 1.70, 1.71

Mark Hammond mhammond at users.sourceforge.net
Sun Aug 10 01:49:14 EDT 2003


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

Modified Files:
	addin.py manager.py 
Log Message:
Clean up the help functions a little, and extend manager.ShowHTML to
actually handle URLs.


Index: addin.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/addin.py,v
retrieving revision 1.91
retrieving revision 1.92
diff -C2 -d -r1.91 -r1.92
*** addin.py	10 Aug 2003 07:26:48 -0000	1.91
--- addin.py	10 Aug 2003 07:49:11 -0000	1.92
***************
*** 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):
--- 429,432 ----
***************
*** 814,852 ****
              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"):
--- 799,823 ----
              if helpPopup is not None:
                  helpPopup = CastTo(helpPopup, "CommandBarPopup")
!                 self._AddHelpControl(helpPopup,
!                                      "About SpamBayes",
!                                      "about.html",
!                                      "SpamBayesCommand.Help.ShowAbout")
!                 self._AddHelpControl(helpPopup,
!                                      "Troubleshooting Guide",
!                                      "docs/troubleshooting.html",
!                                      "SpamBayesCommand.Help.ShowTroubleshooting")
!                 self._AddHelpControl(helpPopup,
!                                      "SpamBayes Website",
!                                      "http://spambayes.sourceforge.net/",
!                                      "SpamBayesCommand.Help.ShowSpamBayes Website")
!                 self._AddHelpControl(helpPopup,
!                                      "Frequently Asked Questions",
!                                      "http://spambayes.sourceforge.net/faq.html",
!                                      "SpamBayesCommand.Help.ShowFAQ")
!                 self._AddHelpControl(helpPopup,
!                                      "SpamBayes Bug Tracker",
!                                      "http://sourceforge.net/tracker/?group_id=61702&atid=498103",
!                                      "SpamBayesCommand.Help.BugTacker")
! 
          # If we are running from Python sources, enable a few extra items
          if not hasattr(sys, "frozen"):
***************
*** 860,863 ****
--- 831,843 ----
          self.have_setup_ui = True
  
+     def _AddHelpControl(self, parent, caption, url, tag):
+         self._AddControl(parent,
+                         constants.msoControlButton,
+                         ButtonEvent, (self.manager.ShowHtml, url),
+                         Caption=caption,
+                         Enabled=True,
+                         Visible=True,
+                         Tag=tag)
+         
      def _AddControl(self,
                      parent, # who the control is added to

Index: manager.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/manager.py,v
retrieving revision 1.70
retrieving revision 1.71
diff -C2 -d -r1.70 -r1.71
*** manager.py	10 Aug 2003 07:26:48 -0000	1.70
--- manager.py	10 Aug 2003 07:49:12 -0000	1.71
***************
*** 725,748 ****
          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
--- 725,750 ----
          self.SaveConfig()
          
!     def ShowHtml(self,url):
          """Displays the main SpamBayes documentation in your Web browser"""
!         import sys, os, urllib
!         if urllib.splittype(url)[0] is None: # just a file spec
!             if hasattr(sys, "frozen"):
!                 # Same directory as to the executable.
!                 fname = os.path.join(os.path.dirname(sys.argv[0]),
!                                         url)
!             else:
!                 # (ie, main Outlook2000) dir
!                 fname = os.path.join(os.path.dirname(__file__),
!                                         url)
!             fname = os.path.abspath(fname)
!             if not os.path.isfile(fname):
!                 self.ReportError("Can't find "+url)
!                 return
!             url = fname
!         # else assume it is valid!
          from dialogs import SetWaitCursor
!         SetWaitCursor(1)
!         os.startfile(url)
!         SetWaitCursor(0)
  
  _mgr = None





More information about the Spambayes-checkins mailing list