[Spambayes-checkins] spambayes/Outlook2000 addin.py,1.102,1.103

Mark Hammond mhammond at users.sourceforge.net
Wed Aug 27 02:59:10 EDT 2003


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

Modified Files:
	addin.py 
Log Message:
Tweak the toolbars:
* Set OnAction for each item - this fixes:
  [ 776808 ] Expanding toolbar crashes outlook
* All sub-items are now temporary.  This should fix the problem of ordering
  sub-items between releases.


Index: addin.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/addin.py,v
retrieving revision 1.102
retrieving revision 1.103
diff -C2 -d -r1.102 -r1.103
*** addin.py	27 Aug 2003 05:24:51 -0000	1.102
--- addin.py	27 Aug 2003 08:59:07 -0000	1.103
***************
*** 666,670 ****
      # shows how to make a transparent bmp.
      # Also note that the clipboard takes ownership of the handle -
!     # this, we can not simply perform this load once and reuse the image.
      if not os.path.isabs(fname):
          # images relative to the application path
--- 666,670 ----
      # shows how to make a transparent bmp.
      # Also note that the clipboard takes ownership of the handle -
!     # thus, we can not simply perform this load once and reuse the image.
      if not os.path.isabs(fname):
          # images relative to the application path
***************
*** 819,823 ****
                          Visible=True,
                          Tag=tag)
!         
      def _AddControl(self,
                      parent, # who the control is added to
--- 819,823 ----
                          Visible=True,
                          Tag=tag)
! 
      def _AddControl(self,
                      parent, # who the control is added to
***************
*** 847,850 ****
--- 847,862 ----
                          Type = control_type,
                          Tag = tag)
+         # we only create top-level items as permanent, so we keep a little control
+         # over how they are ordered, especially between releases where the
+         # subitems are subject to change.  This will prevent the user
+         # customising the dropdown items, but that is probably OK.
+         # (we could stay permanent and use the 'before' arg, but this
+         # is still pretty useless if the user has customized)
+         temporary = parent is not None
+         if item is not None and temporary:
+             # oops - we used to create them perm, but
+             item.Delete(False)
+             item = None
+ 
          if item is None:
              if parent is None:
***************
*** 882,886 ****
              # Now add the item itself to the parent.
              try:
!                 item = parent.Controls.Add(Type=control_type, Temporary=False)
              except pythoncom.com_error, e:
                  # Toolbars seem to still fail randomly for some users.
--- 894,898 ----
              # Now add the item itself to the parent.
              try:
!                 item = parent.Controls.Add(Type=control_type, Temporary=temporary)
              except pythoncom.com_error, e:
                  # Toolbars seem to still fail randomly for some users.
***************
*** 896,899 ****
--- 908,914 ----
              for attr, val in item_attrs.items():
                  setattr(item, attr, val)
+         # didn't previously set this, and it seems to fix alot of problem - so
+         # we set it for every object, even existing ones.
+         item.OnAction = "<!" + OutlookAddin._reg_progid_ + ">"
  
          # Hook events for the item, but only if we haven't already in some





More information about the Spambayes-checkins mailing list