[Spambayes-checkins] spambayes/Outlook2000/dialogs test_dialogs.py,
NONE, 1.1.2.1
Mark Hammond
mhammond at users.sourceforge.net
Sun Aug 3 19:16:30 EDT 2003
- Previous message: [Spambayes-checkins]
spambayes/Outlook2000/dialogs dlgcore.py, NONE,
1.1.2.1 dlgutils.py, NONE, 1.1.2.1 processors.py, NONE,
1.1.2.1 opt_processors.py, NONE, 1.1.2.1
- Next message: [Spambayes-checkins] spambayes/Outlook2000/dialogs test_dialogs.py,
1.1.2.1, 1.1.2.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/spambayes/spambayes/Outlook2000/dialogs
In directory sc8-pr-cvs1:/tmp/cvs-serv23083
Added Files:
Tag: outlook-dialog-branch
test_dialogs.py
Log Message:
Testing the new dialogs.
--- NEW FILE: test_dialogs.py ---
# Hack for testing - setup sys.path
if __name__=='__main__':
try:
import spambayes.Options
except ImportError:
import sys, os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), "..", "..")))
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), "..")))
from processors import *
from opt_processors import *
# "dialog specific" processors:
class VersionStringProcessor(ControlProcessor):
def Init(self):
from spambayes.Version import get_version_string
import sys
version_key = "Full Description"
if hasattr(sys, "frozen"):
version_key += " Binary"
version_string = get_version_string("Outlook", version_key)
win32gui.SendMessage(self.GetControl(), win32con.WM_SETTEXT,
0, version_string)
def GetPopupHelpText(self, cid):
return "The version of SpamBayes running"
def ShowAbout(mgr):
"""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]),
"about.html")
else:
# In the parent (ie, main Outlook2000) dir
fname = os.path.join(os.path.dirname(__file__),
os.pardir,
"about.html")
fname = os.path.abspath(fname)
if os.path.isfile(fname):
SetWaitCursor(1)
os.startfile(fname)
SetWaitCursor(0)
else:
print "Cant find about - fix messagebox"
self.MessageBox("Can't find about.html")
dialog_map = {
"IDD_MANAGER" : (
(CloseButtonProcessor, "IDOK"),
(VersionStringProcessor, "IDC_VERSION"),
(BoolButtonProcessor, "IDC_BUT_TRAIN_FROM_SPAM_FOLDER",
"Training.train_recovered_spam"),
(BoolButtonProcessor, "IDC_BUT_TRAIN_TO_SPAM_FOLDER",
"Training.train_manual_spam"),
(DialogCommand, "IDC_BUT_FILTER_NOW", "IDD_FILTER_NOW"),
(DialogCommand, "IDC_BUT_FILTER_DEFINE", "IDD_FILTER"),
(DialogCommand, "IDC_BUT_TRAIN_NOW", "IDD_TRAINING"),
(CommandButtonProcessor, "IDC_BUT_ABOUT", ShowAbout, ()),
),
"IDD_FILTER_NOW" : (
(CloseButtonProcessor, "IDOK"),
(BoolButtonProcessor, "IDC_BUT_UNREAD", "Filter_Now.only_unread"),
(BoolButtonProcessor, "IDC_BUT_UNSEEN", "Filter_Now.only_unseen"),
(BoolButtonProcessor, "IDC_BUT_ACT_ALL IDC_BUT_ACT_SCORE",
"Filter_Now.action_all"),
(FolderIDProcessor, "IDC_FOLDER_NAMES IDC_BROWSE",
"Filter_Now.folder_ids",
"Filter_Now.include_sub"),
),
"IDD_FILTER" : (
(CloseButtonProcessor, "IDOK"),
(FolderIDProcessor, "IDC_FOLDER_WATCH IDC_BROWSE_WATCH",
"Filter.watch_folder_ids",
"Filter.watch_include_sub"),
(ComboProcessor, "IDC_ACTION_CERTAIN", "Filter.spam_action"),
(FolderIDProcessor, "IDC_FOLDER_CERTAIN IDC_BROWSE_CERTAIN",
"Filter.spam_folder_id"),
(EditNumberProcessor, "IDC_EDIT_CERTAIN IDC_SLIDER_CERTAIN",
"Filter.spam_threshold"),
(FolderIDProcessor, "IDC_FOLDER_UNSURE IDC_BROWSE_UNSURE",
"Filter.unsure_folder_id"),
(EditNumberProcessor, "IDC_EDIT_UNSURE IDC_SLIDER_UNSURE",
"Filter.unsure_threshold"),
(ComboProcessor, "IDC_ACTION_UNSURE", "Filter.unsure_action"),
(DialogCommand, "IDC_BUT_FILTER_NOW", "IDD_FILTER_NOW"),
),
"IDD_TRAINING" : (
(CloseButtonProcessor, "IDOK"),
(FolderIDProcessor, "IDC_STATIC_HAM IDC_BROWSE_HAM",
"Training.ham_folder_ids",
"Training.ham_include_sub"),
(FolderIDProcessor, "IDC_STATIC_SPAM IDC_BROWSE_SPAM",
"Training.spam_folder_ids",
"Training.spam_include_sub"),
(BoolButtonProcessor, "IDC_BUT_RESCORE", "Training.rescore"),
(BoolButtonProcessor, "IDC_BUT_REBUILD", "Training.rebuild"),
)
}
def LoadDialogs(rc_file):
from dialogs.resources import rcparser
if not os.path.isabs(rc_file):
rc_file = os.path.join( os.path.dirname( rcparser.__file__ ), rc_file)
return rcparser.ParseDialogs(rc_file)
def ShowDialog(parent, manager, idd):
"""Displays another dialog"""
commands = dialog_map[idd]
import dlgcore
dlg = dlgcore.Dialog(parent, manager, idd, commands)
dlg.DoModal()
if __name__=='__main__':
import manager
mgr = manager.GetManager()
mgr.dialog_parser = LoadDialogs("dialogs.rc")
ShowDialog(0, mgr, "IDD_MANAGER")
- Previous message: [Spambayes-checkins]
spambayes/Outlook2000/dialogs dlgcore.py, NONE,
1.1.2.1 dlgutils.py, NONE, 1.1.2.1 processors.py, NONE,
1.1.2.1 opt_processors.py, NONE, 1.1.2.1
- Next message: [Spambayes-checkins] spambayes/Outlook2000/dialogs test_dialogs.py,
1.1.2.1, 1.1.2.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Spambayes-checkins
mailing list