Update of /cvsroot/pywin32/pywin32/win32/Lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22863/Lib
Modified Files:
Tag: py3k
win32gui_struct.py
Log Message:
Get menu demo running in Py3k
Index: win32gui_struct.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/Lib/win32gui_struct.py,v
retrieving revision 1.11
retrieving revision 1.11.2.1
diff -C2 -d -r1.11 -r1.11.2.1
*** win32gui_struct.py 4 May 2008 10:45:54 -0000 1.11
--- win32gui_struct.py 11 Sep 2008 07:48:21 -0000 1.11.2.1
***************
*** 89,96 ****
if text is not None:
fMask |= win32con.MIIM_STRING
! if isinstance(text, unicode):
! text = text.encode("mbcs")
! str_buf = array.array("c", text+'\0')
! cch = len(str_buf)
# We are taking address of strbuf - it must not die until windows
# has finished with our structure.
--- 89,97 ----
if text is not None:
fMask |= win32con.MIIM_STRING
! if not isinstance(text, str):
! raise TypeError('MENUITEMINFO text must be unicode')
! encoded_text = (text+'\0').encode("utf-16-le")
! str_buf = array.array("b", encoded_text)
! cch = len(text)
# We are taking address of strbuf - it must not die until windows
# has finished with our structure.
***************
*** 109,123 ****
fState,
wID,
! long(hSubMenu),
! long(hbmpChecked),
! long(hbmpUnchecked),
dwItemData,
lptext,
cch,
! long(hbmpItem)
)
# Now copy the string to a writable buffer, so that the result
# could be passed to a 'Get' function
! return array.array("c", item), extras
def UnpackMENUITEMINFO(s):
--- 110,124 ----
fState,
wID,
! int(hSubMenu),
! int(hbmpChecked),
! int(hbmpUnchecked),
dwItemData,
lptext,
cch,
! int(hbmpItem)
)
# Now copy the string to a writable buffer, so that the result
# could be passed to a 'Get' function
! return array.array("b", item), extras
def UnpackMENUITEMINFO(s):
|