[pywin32-checkins] pywin32/win32/Demos win32gui_dialog.py, 1.7.2.1, 1.7.2.2
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Roger U. <ru...@us...> - 2008-09-11 04:02:38
|
Update of /cvsroot/pywin32/pywin32/win32/Demos In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30640 Modified Files: Tag: py3k win32gui_dialog.py Log Message: Fixes for wide-character build Index: win32gui_dialog.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/Demos/win32gui_dialog.py,v retrieving revision 1.7.2.1 retrieving revision 1.7.2.2 diff -C2 -d -r1.7.2.1 -r1.7.2.2 *** win32gui_dialog.py 29 Aug 2008 04:59:23 -0000 1.7.2.1 --- win32gui_dialog.py 11 Sep 2008 04:02:48 -0000 1.7.2.2 *************** *** 72,76 **** vals.append(0) else: ! str_buf = array.array("b", val+'\0') vals.append(str_buf.buffer_info()[0]) vals.append(len(val)) --- 72,89 ---- vals.append(0) else: ! # Unicode object no longer supports buffer interface. According to pep 3137 ! # (http://www.python.org/dev/peps/pep-3137/) ! # this is because the internal represention is platform dependent. This seems ! # spurious to me since whatever code receives the data alreeady needs to know ! # the encoding anyway, whether it's python's internal encoding or not. And since ! # there is no way to specify the encoding in the data itself, what difference does ! # it make ? ! if isinstance(val, str): ! val=(val+'\0').encode('utf-16-le') ! else: ! # Should this continue to accept a byte string, or would it be better to ! # throw an error here ? ! val=val+b'\0' ! str_buf = array.array("b", val) vals.append(str_buf.buffer_info()[0]) vals.append(len(val)) *************** *** 219,227 **** lvc.text = "Title" lvc.cx = 200 ! win32gui.SendMessage(self.hwndList, commctrl.LVM_INSERTCOLUMN, 0, lvc.toparam()) lvc.iSubItem = 0 lvc.text = "Order" lvc.cx = 50 ! win32gui.SendMessage(self.hwndList, commctrl.LVM_INSERTCOLUMN, 0, lvc.toparam()) win32gui.UpdateWindow(self.hwnd) --- 232,240 ---- lvc.text = "Title" lvc.cx = 200 ! win32gui.SendMessage(self.hwndList, commctrl.LVM_INSERTCOLUMNW, 0, lvc.toparam()) lvc.iSubItem = 0 lvc.text = "Order" lvc.cx = 50 ! win32gui.SendMessage(self.hwndList, commctrl.LVM_INSERTCOLUMNW, 0, lvc.toparam()) win32gui.UpdateWindow(self.hwnd) *************** *** 234,242 **** num_items = win32gui.SendMessage(self.hwndList, commctrl.LVM_GETITEMCOUNT) item = LVITEM(text=columns[0], iItem = num_items) ! new_index = win32gui.SendMessage(self.hwndList, commctrl.LVM_INSERTITEM, 0, item.toparam()) col_no = 1 for col in columns[1:]: item = LVITEM(text=col, iItem = new_index, iSubItem = col_no) ! win32gui.SendMessage(self.hwndList, commctrl.LVM_SETITEM, 0, item.toparam()) col_no += 1 self.list_data[new_index] = data --- 247,255 ---- num_items = win32gui.SendMessage(self.hwndList, commctrl.LVM_GETITEMCOUNT) item = LVITEM(text=columns[0], iItem = num_items) ! new_index = win32gui.SendMessage(self.hwndList, commctrl.LVM_INSERTITEMW, 0, item.toparam()) col_no = 1 for col in columns[1:]: item = LVITEM(text=col, iItem = new_index, iSubItem = col_no) ! win32gui.SendMessage(self.hwndList, commctrl.LVM_SETITEMW, 0, item.toparam()) col_no += 1 self.list_data[new_index] = data *************** *** 294,298 **** 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 \ --- 307,311 ---- def OnNotify(self, hwnd, msg, wparam, lparam): ! format = "iiiiiiiiiii" ## ??? needs adjustment for 64-bit ??? buf = win32gui.PyMakeBuffer(struct.calcsize(format), lparam) hwndFrom, idFrom, code, iItem, iSubItem, uNewState, uOldState, uChanged, actionx, actiony, lParam \ |