[Spambayes-checkins] spambayes/Outlook2000 addin.py,1.86,1.87
Mark Hammond
mhammond at users.sourceforge.net
Wed Aug 6 00:56:23 EDT 2003
Update of /cvsroot/spambayes/spambayes/Outlook2000
In directory sc8-pr-cvs1:/tmp/cvs-serv23428
Modified Files:
addin.py
Log Message:
Don't update the image, caption and tooltip text for the buttons
every time we startup. This also avoids clobbering the clipboard
as we start.
Fixes [ 780819 ] Images pasted to clipboard each startup
(but doesn't fix the crashes :( )
Index: addin.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/addin.py,v
retrieving revision 1.86
retrieving revision 1.87
diff -C2 -d -r1.86 -r1.87
*** addin.py 4 Aug 2003 00:56:07 -0000 1.86
--- addin.py 6 Aug 2003 06:56:21 -0000 1.87
***************
*** 561,573 ****
class ButtonDeleteAsSpamEvent(ButtonDeleteAsEventBase):
- def Init(self, manager, explorer):
- ButtonDeleteAsEventBase.Init(self, manager, explorer)
- image = "delete_as_spam.bmp"
- self.Caption = "Delete As Spam"
- self.TooltipText = \
- "Move the selected message to the Spam folder,\n" \
- "and train the system that this is Spam."
- SetButtonImage(self, image, manager)
-
def OnClick(self, button, cancel):
msgstore = self.manager.message_store
--- 561,564 ----
***************
*** 623,637 ****
class ButtonRecoverFromSpamEvent(ButtonDeleteAsEventBase):
- def Init(self, manager, explorer):
- ButtonDeleteAsEventBase.Init(self, manager, explorer)
- image = "recover_ham.bmp"
- self.Caption = "Recover from Spam"
- self.TooltipText = \
- "Recovers the selected item back to the folder\n" \
- "it was filtered from (or to the Inbox if this\n" \
- "folder is not known), and trains the system that\n" \
- "this is a good message\n"
- SetButtonImage(self, image, manager)
-
def OnClick(self, button, cancel):
msgstore = self.manager.message_store
--- 614,617 ----
***************
*** 724,740 ****
activeExplorer = self
assert self.toolbar is None, "Should not yet have a toolbar"
! # Add our "Delete as ..." and "Recover as" buttons
self.but_delete_as = self._AddControl(
None,
constants.msoControlButton,
ButtonDeleteAsSpamEvent, (self.manager, self),
BeginGroup = False,
! Tag = "SpamBayesCommand.DeleteAsSpam")
! # And again for "Recover as"
self.but_recover_as = self._AddControl(
None,
constants.msoControlButton,
ButtonRecoverFromSpamEvent, (self.manager, self),
! Tag = "SpamBayesCommand.RecoverFromSpam")
# The main tool-bar dropdown with all our entries.
--- 704,734 ----
activeExplorer = self
assert self.toolbar is None, "Should not yet have a toolbar"
!
! # Add our "Delete as ..." and "Recover from" buttons
! tt_text = "Move the selected message to the Spam folder,\n" \
! "and train the system that this is Spam."
self.but_delete_as = self._AddControl(
None,
constants.msoControlButton,
ButtonDeleteAsSpamEvent, (self.manager, self),
+ Caption="Delete As Spam",
+ TooltipText = tt_text,
BeginGroup = False,
! Tag = "SpamBayesCommand.DeleteAsSpam",
! image = "delete_as_spam.bmp")
! # And again for "Recover from"
! tt_text = \
! "Recovers the selected item back to the folder\n" \
! "it was filtered from (or to the Inbox if this\n" \
! "folder is not known), and trains the system that\n" \
! "this is a good message\n"
self.but_recover_as = self._AddControl(
None,
constants.msoControlButton,
ButtonRecoverFromSpamEvent, (self.manager, self),
! Caption="Recover from Spam",
! TooltipText = tt_text,
! Tag = "SpamBayesCommand.RecoverFromSpam",
! image = "recover_ham.bmp")
# The main tool-bar dropdown with all our entries.
***************
*** 807,810 ****
--- 801,809 ----
# that.
assert item_attrs.has_key('Tag'), "Need a 'Tag' attribute!"
+ image_fname = None
+ if 'image' in item_attrs:
+ image_fname = item_attrs['image']
+ del item_attrs['image']
+
tag = item_attrs["Tag"]
item = self.CommandBars.FindControl(
***************
*** 852,855 ****
--- 851,863 ----
print "FAILED to add the toolbar item '%s' - %s" % (tag,e)
return
+ if image_fname:
+ # Eeek - only available in derived class.
+ assert control_type == constants.msoControlButton
+ but = CastTo(item, "_CommandBarButton")
+ SetButtonImage(but, image_fname, self.manager)
+ # Set the extra attributes passed in.
+ for attr, val in item_attrs.items():
+ setattr(item, attr, val)
+
# Hook events for the item, but only if we haven't already in some
# other explorer instance.
***************
*** 860,866 ****
# as the item destructs.
self.explorers_collection.button_event_map[tag] = item
- # Set the extra attributes passed in.
- for attr, val in item_attrs.items():
- setattr(item, attr, val)
return item
--- 868,871 ----
More information about the Spambayes-checkins
mailing list