[Spambayes-checkins] spambayes/Outlook2000/dialogs
FolderSelector.py, 1.29, 1.30
Mark Hammond
mhammond at users.sourceforge.net
Mon Sep 8 20:14:31 EDT 2003
Update of /cvsroot/spambayes/spambayes/Outlook2000/dialogs
In directory sc8-pr-cvs1:/tmp/cvs-serv31757
Modified Files:
FolderSelector.py
Log Message:
Get the "New Folder" button working again (*sigh*)
Index: FolderSelector.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/dialogs/FolderSelector.py,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** FolderSelector.py 9 Sep 2003 01:26:12 -0000 1.29
--- FolderSelector.py 9 Sep 2003 02:14:28 -0000 1.30
***************
*** 194,205 ****
return array.array("c", buf), extra
def UnpackTVItem(buffer):
item_mask, item_hItem, item_state, item_stateMask, \
item_textptr, item_cchText, item_image, item_selimage, \
item_cChildren, item_param = struct.unpack("10i", buffer)
! # ensure only items listed by the mask are valid
if not (item_mask & commctrl.TVIF_TEXT): item_textptr = item_cchText = None
if not (item_mask & commctrl.TVIF_CHILDREN): item_cChildren = None
- if not (item_mask & commctrl.TVIF_HANDLE): item_hItem = None
if not (item_mask & commctrl.TVIF_IMAGE): item_image = None
if not (item_mask & commctrl.TVIF_PARAM): item_param = None
--- 194,228 ----
return array.array("c", buf), extra
+ # Make a new buffer suitable for querying hitem's attributes.
+ def EmptyTVITEM(hitem, mask = None, text_buf_size=512):
+ extra = [] # objects we must keep references to
+ if mask is None:
+ mask = commctrl.TVIF_HANDLE | commctrl.TVIF_STATE | commctrl.TVIF_TEXT | \
+ commctrl.TVIF_IMAGE | commctrl.TVIF_SELECTEDIMAGE | \
+ commctrl.TVIF_CHILDREN | commctrl.TVIF_PARAM
+ if mask & commctrl.TVIF_TEXT:
+ text_buffer = array.array("c", "\0" * text_buf_size)
+ extra.append(text_buffer)
+ text_addr, text_len = text_buffer.buffer_info()
+ else:
+ text_addr = text_len = 0
+ format = "iiiiiiiiii"
+ buf = struct.pack(format,
+ mask, hitem,
+ 0, 0,
+ text_addr, text_len, # text
+ 0, 0,
+ 0, 0)
+ return array.array("c", buf), extra
+
def UnpackTVItem(buffer):
item_mask, item_hItem, item_state, item_stateMask, \
item_textptr, item_cchText, item_image, item_selimage, \
item_cChildren, item_param = struct.unpack("10i", buffer)
! # ensure only items listed by the mask are valid (except we assume the
! # handle is always valid - some notifications (eg, TVN_ENDLABELEDIT) set a
! # mask that doesn't include the handle, but the docs explicity say it is.)
if not (item_mask & commctrl.TVIF_TEXT): item_textptr = item_cchText = None
if not (item_mask & commctrl.TVIF_CHILDREN): item_cChildren = None
if not (item_mask & commctrl.TVIF_IMAGE): item_image = None
if not (item_mask & commctrl.TVIF_PARAM): item_param = None
***************
*** 359,364 ****
def _GetTVItem(self, h):
! text_buffer = "\0" * 1024
! buffer, extra = PackTVITEM(h, 0, 0, text_buffer, None, None, None, -1)
win32gui.SendMessage(self.list, commctrl.TVM_GETITEM,
0, buffer.buffer_info()[0])
--- 382,386 ----
def _GetTVItem(self, h):
! buffer, extra = EmptyTVITEM(h)
win32gui.SendMessage(self.list, commctrl.TVM_GETITEM,
0, buffer.buffer_info()[0])
More information about the Spambayes-checkins
mailing list