[Spambayes-checkins] spambayes/Outlook2000/dialogs dialog_map.py, 1.28, 1.29

Mark Hammond mhammond at users.sourceforge.net
Tue Aug 26 18:07:09 EDT 2003


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

Modified Files:
	dialog_map.py 
Log Message:
Add 'View Log' button to the Diagnostics dialog.


Index: dialog_map.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/dialogs/dialog_map.py,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** dialog_map.py	26 Aug 2003 21:41:18 -0000	1.28
--- dialog_map.py	27 Aug 2003 00:07:07 -0000	1.29
***************
*** 203,206 ****
--- 203,234 ----
      import os
      os.startfile(window.manager.windows_data_directory)
+ def ShowLog(window):
+     """Opens the log file for the current SpamBayes session
+     """
+     import sys, os, win32api
+     if 1 or hasattr(sys, "frozen"):
+         # current log always "spambayes1.log"
+         log_name = os.path.join(win32api.GetTempPath(), "spambayes1.log")
+         if not os.path.exists(log_name):
+             window.manager.ReportError("The log file for this session can not be located")
+         else:
+             cmd = 'notepad.exe "%s"' % log_name
+             os.system(cmd)
+     else:
+         question = "As you are running from source-code, viewing the\n" \
+                    "log means executing a Python program.  If you already\n" \
+                    "have a viewer running, the output may appear in either.\n\n"\
+                    "Do you want to execute this viewer?"
+         if not window.manager.AskQuestion(question):
+             return
+         # source-code users - fire up win32traceutil.py
+         import win32traceutil # will already be imported
+         py_name = win32traceutil.__file__
+         if py_name[-1] in 'co': # pyc/pyo
+             py_name = py_name[:-1]
+         # execute the .py file - hope that this will manage to invoke
+         # python.exe for it.  If this breaks for you, feel free to send me
+         # a patch :)
+         os.system('start ' + win32api.GetShortPathName(py_name))
  
  def ResetConfig(window):
***************
*** 426,429 ****
--- 454,458 ----
          (BoolButtonProcessor,     "IDC_SAVE_SPAM_SCORE",    "Filter.save_spam_info"),
          (IntProcessor,   "IDC_VERBOSE_LOG",  "General.verbose"),
+         (CommandButtonProcessor, "IDC_BUT_VIEW_LOG", ShowLog, ()),
          (CloseButtonProcessor,    "IDOK IDCANCEL"),
          ),





More information about the Spambayes-checkins mailing list