[Spambayes-checkins] spambayes/Outlook2000/dialogs dialog_map.py,
1.7, 1.8 dlgcore.py, 1.5, 1.6 opt_processors.py, 1.4, 1.5
Adam Walker
xenogeist at users.sourceforge.net
Mon Aug 18 10:47:59 EDT 2003
Update of /cvsroot/spambayes/spambayes/Outlook2000/dialogs
In directory sc8-pr-cvs1:/tmp/cvs-serv30967/Outlook2000/dialogs
Modified Files:
dialog_map.py dlgcore.py opt_processors.py
Log Message:
Allow combos to optionally map "user friendly" names to option values. Applied this to the read state options on the advanced tab.
Index: dialog_map.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/dialogs/dialog_map.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** dialog_map.py 18 Aug 2003 14:17:03 -0000 1.7
--- dialog_map.py 18 Aug 2003 16:47:56 -0000 1.8
***************
*** 303,308 ****
(MsSliderProcessor, "IDC_DELAY2_TEXT IDC_DELAY2_SLIDER", "Experimental.timer_interval"),
(BoolButtonProcessor, "IDC_INBOX_TIMER_ONLY", "Experimental.timer_only_receive_folders"),
! (ComboProcessor, "IDC_DEL_SPAM_RS", "General.delete_as_spam_message_state"),
! (ComboProcessor, "IDC_RECOVER_RS", "General.recover_from_spam_message_state"),
),
"IDD_DIAGNOSIC" : (
--- 303,310 ----
(MsSliderProcessor, "IDC_DELAY2_TEXT IDC_DELAY2_SLIDER", "Experimental.timer_interval"),
(BoolButtonProcessor, "IDC_INBOX_TIMER_ONLY", "Experimental.timer_only_receive_folders"),
! (ComboProcessor, "IDC_DEL_SPAM_RS", "General.delete_as_spam_message_state",
! "make no change to the read state,mark as read,mark as unread"),
! (ComboProcessor, "IDC_RECOVER_RS", "General.recover_from_spam_message_state",
! "make no change to the read state,mark as read,mark as unread"),
),
"IDD_DIAGNOSIC" : (
Index: dlgcore.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/dialogs/dlgcore.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** dlgcore.py 18 Aug 2003 13:31:53 -0000 1.5
--- dlgcore.py 18 Aug 2003 16:47:56 -0000 1.6
***************
*** 282,289 ****
TooltipDialog.OnCommand(self, hwnd, msg, wparam, lparam)
id = win32api.LOWORD(wparam)
! handler = self.command_processors.get(id)
! if handler is None:
print "Ignoring OnCommand for", self._GetIDName(id)
return
self.ApplyHandlingOptionValueError(handler.OnCommand, wparam, lparam)
--- 282,294 ----
TooltipDialog.OnCommand(self, hwnd, msg, wparam, lparam)
id = win32api.LOWORD(wparam)
! # Sometimes called after OnDestroy???
! if self.command_processors is None:
print "Ignoring OnCommand for", self._GetIDName(id)
return
+ else:
+ handler = self.command_processors.get(id)
+ if handler is None:
+ print "Ignoring OnCommand for", self._GetIDName(id)
+ return
self.ApplyHandlingOptionValueError(handler.OnCommand, wparam, lparam)
Index: opt_processors.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/dialogs/opt_processors.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** opt_processors.py 17 Aug 2003 21:12:11 -0000 1.4
--- opt_processors.py 18 Aug 2003 16:47:56 -0000 1.5
***************
*** 73,76 ****
--- 73,87 ----
# A "Combo" processor, that loads valid strings from the option.
class ComboProcessor(OptionControlProcessor):
+ def __init__(self, window, control_ids, option,text=None):
+ OptionControlProcessor.__init__(self, window, control_ids, option)
+ if text:
+ temp = text.split(",")
+ print temp
+ self.option_to_text = zip(self.option.valid_input(), temp)
+ self.text_to_option = dict(zip(temp, self.option.valid_input()))
+ else:
+ self.option_to_text = zip(self.option.valid_input(),self.option.valid_input())
+ self.text_to_option = dict(self.option_to_text)
+
def OnCommand(self, wparam, lparam):
code = win32api.HIWORD(wparam)
***************
*** 82,88 ****
index = sel_index = 0
value = self.option.get()
! for s in self.option.valid_input():
! win32gui.SendMessage(combo, win32con.CB_ADDSTRING, 0, s)
! if value.startswith(s):
sel_index = index
index += 1
--- 93,99 ----
index = sel_index = 0
value = self.option.get()
! for opt,text in self.option_to_text:
! win32gui.SendMessage(combo, win32con.CB_ADDSTRING, 0, text)
! if value.startswith(opt):
sel_index = index
index += 1
***************
*** 96,100 ****
win32gui.SendMessage(combo, win32con.CB_GETLBTEXT, sel, buffer)
# Trim the \0 from the end.
! self.SetOptionValue(buffer.tostring()[:-1])
class EditNumberProcessor(OptionControlProcessor):
--- 107,112 ----
win32gui.SendMessage(combo, win32con.CB_GETLBTEXT, sel, buffer)
# Trim the \0 from the end.
! text = buffer.tostring()[:-1]
! self.SetOptionValue(self.text_to_option[text])
class EditNumberProcessor(OptionControlProcessor):
More information about the Spambayes-checkins
mailing list