[pywin32-checkins] pywin32/win32/Demos win32gui_dialog.py, 1.12, 1.13
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
|
From: Mark H. <mha...@us...> - 2009-01-13 22:53:02
|
Update of /cvsroot/pywin32/pywin32/win32/Demos In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv17040 Modified Files: win32gui_dialog.py Log Message: make py3k-friendly, fix 64bit issue, and remove old workaround Index: win32gui_dialog.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/Demos/win32gui_dialog.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** win32gui_dialog.py 27 Nov 2008 11:11:11 -0000 1.12 --- win32gui_dialog.py 13 Jan 2009 22:52:57 -0000 1.13 *************** *** 72,76 **** vals.append(0) else: ! str_buf = array.array("c", val+'\0') vals.append(str_buf.buffer_info()[0]) vals.append(len(val)) --- 72,83 ---- vals.append(0) else: ! # Note this demo still works with byte strings. An ! # alternate strategy would be to use unicode natively ! # and use the 'W' version of the messages - eg, ! # LVM_SETITEMW etc. ! val = val + "\0" ! if isinstance(val, unicode): ! val = val.encode("mbcs") ! str_buf = array.array("b", val) vals.append(str_buf.buffer_info()[0]) vals.append(len(val)) *************** *** 294,307 **** def OnNotify(self, hwnd, msg, wparam, lparam): ! format = "iiiiiiiiiii" buf = win32gui.PyMakeBuffer(struct.calcsize(format), lparam) hwndFrom, idFrom, code, iItem, iSubItem, uNewState, uOldState, uChanged, actionx, actiony, lParam \ = struct.unpack(format, buf) - # *sigh* - work around a problem with old commctrl modules, which had a - # bad value for PY_OU, which therefore cause most "control notification" - # messages to be wrong. - # Code that needs to work with both pre and post pywin32-204 must do - # this too. - code += commctrl.PY_0U if code == commctrl.NM_DBLCLK: print "Double click on item", iItem+1 --- 301,308 ---- def OnNotify(self, hwnd, msg, wparam, lparam): ! format = "PPiiiiiiiiP" buf = win32gui.PyMakeBuffer(struct.calcsize(format), lparam) hwndFrom, idFrom, code, iItem, iSubItem, uNewState, uOldState, uChanged, actionx, actiony, lParam \ = struct.unpack(format, buf) if code == commctrl.NM_DBLCLK: print "Double click on item", iItem+1 |