Update of /cvsroot/pywin32/pywin32/win32/Demos
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15490/Demos
Modified Files:
Tag: py3k
BackupRead_BackupWrite.py BackupSeek_streamheaders.py
CopyFileEx.py CreateFileTransacted_MiniVersion.py
FileSecurityTest.py GetSaveFileName.py OpenEncryptedFileRaw.py
RegRestoreKey.py SystemParametersInfo.py cerapi.py
desktopmanager.py eventLogDemo.py getfilever.py
mmapfile_demo.py print_desktop.py rastest.py timer_demo.py
win32clipboardDemo.py win32comport_demo.py
win32console_demo.py win32cred_demo.py win32fileDemo.py
win32gui_demo.py win32gui_devicenotify.py win32gui_dialog.py
win32gui_menu.py win32gui_taskbar.py win32netdemo.py
win32rcparser_demo.py win32servicedemo.py
win32ts_logoff_disconnected.py winprocess.py
Log Message:
Changes to build for Python 3.0
Index: CreateFileTransacted_MiniVersion.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/Demos/CreateFileTransacted_MiniVersion.py,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -C2 -d -r1.2 -r1.2.2.1
*** CreateFileTransacted_MiniVersion.py 8 Nov 2007 20:02:30 -0000 1.2
--- CreateFileTransacted_MiniVersion.py 29 Aug 2008 04:59:23 -0000 1.2.2.1
***************
*** 22,26 ****
tempdir=win32api.GetTempPath()
tempfile=win32api.GetTempFileName(tempdir,'cft')[0]
! print tempfile
f=open(tempfile,'w')
f.write('This is original file.\n')
--- 22,26 ----
tempdir=win32api.GetTempPath()
tempfile=win32api.GetTempFileName(tempdir,'cft')[0]
! print(tempfile)
f=open(tempfile,'w')
f.write('This is original file.\n')
***************
*** 46,50 ****
win32con.FILE_SHARE_READ|win32con.FILE_SHARE_WRITE,
None, win32con.OPEN_EXISTING, 0 , None, Transaction=trans, MiniVersion=base_ver)
! print 'version:',base_ver,win32file.ReadFile(hfile_0, 100)
hfile_0.Close()
--- 46,50 ----
win32con.FILE_SHARE_READ|win32con.FILE_SHARE_WRITE,
None, win32con.OPEN_EXISTING, 0 , None, Transaction=trans, MiniVersion=base_ver)
! print('version:',base_ver,win32file.ReadFile(hfile_0, 100))
hfile_0.Close()
***************
*** 52,56 ****
win32con.FILE_SHARE_READ|win32con.FILE_SHARE_WRITE,
None, win32con.OPEN_EXISTING, 0 , None, Transaction=trans, MiniVersion=ver_1)
! print 'version:',ver_1,win32file.ReadFile(hfile_1, 100)
hfile_1.Close()
--- 52,56 ----
win32con.FILE_SHARE_READ|win32con.FILE_SHARE_WRITE,
None, win32con.OPEN_EXISTING, 0 , None, Transaction=trans, MiniVersion=ver_1)
! print('version:',ver_1,win32file.ReadFile(hfile_1, 100))
hfile_1.Close()
***************
*** 58,62 ****
win32con.FILE_SHARE_READ|win32con.FILE_SHARE_WRITE,
None, win32con.OPEN_EXISTING, 0 , None, Transaction=trans, MiniVersion=ver_2)
! print 'version:',ver_2,win32file.ReadFile(hfile_2, 100)
hfile_2.Close()
--- 58,62 ----
win32con.FILE_SHARE_READ|win32con.FILE_SHARE_WRITE,
None, win32con.OPEN_EXISTING, 0 , None, Transaction=trans, MiniVersion=ver_2)
! print('version:',ver_2,win32file.ReadFile(hfile_2, 100))
hfile_2.Close()
Index: BackupSeek_streamheaders.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/Demos/BackupSeek_streamheaders.py,v
retrieving revision 1.1
retrieving revision 1.1.4.1
diff -C2 -d -r1.1 -r1.1.4.1
*** BackupSeek_streamheaders.py 7 Jan 2005 00:20:24 -0000 1.1
--- BackupSeek_streamheaders.py 29 Aug 2008 04:59:23 -0000 1.1.4.1
***************
*** 19,23 ****
tempdir=win32api.GetTempPath()
tempfile=win32api.GetTempFileName(tempdir,'bkr')[0]
! print 'Filename:',tempfile
f=open(tempfile,'w')
--- 19,23 ----
tempdir=win32api.GetTempPath()
tempfile=win32api.GetTempFileName(tempdir,'bkr')[0]
! print('Filename:',tempfile)
f=open(tempfile,'w')
***************
*** 59,63 ****
def parse_stream_header(h,ctxt,data):
stream_type, stream_attributes, stream_size, stream_name_size=struct.unpack(win32_stream_id_format,data)
! print '\nType:',stream_type,stream_types[stream_type], 'Attributes:', stream_attributes, 'Size:', stream_size, 'Name len:',stream_name_size
if stream_name_size>0:
## ??? sdk says this size is in characters, but it appears to be number of bytes ???
--- 59,63 ----
def parse_stream_header(h,ctxt,data):
stream_type, stream_attributes, stream_size, stream_name_size=struct.unpack(win32_stream_id_format,data)
! print('\nType:',stream_type,stream_types[stream_type], 'Attributes:', stream_attributes, 'Size:', stream_size, 'Name len:',stream_name_size)
if stream_name_size>0:
## ??? sdk says this size is in characters, but it appears to be number of bytes ???
***************
*** 66,70 ****
else:
stream_name='Unnamed'
! print 'Name:'+stream_name
return ctxt, stream_type, stream_attributes, stream_size, stream_name_size, stream_name
--- 66,70 ----
else:
stream_name='Unnamed'
! print('Name:'+stream_name)
return ctxt, stream_type, stream_attributes, stream_size, stream_name_size, stream_name
***************
*** 79,83 ****
if stream_size>0:
bytes_moved=win32file.BackupSeek(h, stream_size, ctxt)
! print 'Moved: ',bytes_moved
win32file.BackupRead(h, win32_stream_id_size, win32_stream_id_buf, True, True, ctxt)
--- 79,83 ----
if stream_size>0:
bytes_moved=win32file.BackupSeek(h, stream_size, ctxt)
! print('Moved: ',bytes_moved)
win32file.BackupRead(h, win32_stream_id_size, win32_stream_id_buf, True, True, ctxt)
Index: CopyFileEx.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/Demos/CopyFileEx.py,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -C2 -d -r1.2 -r1.2.2.1
*** CopyFileEx.py 8 Nov 2007 20:02:29 -0000 1.2
--- CopyFileEx.py 29 Aug 2008 04:59:23 -0000 1.2.2.1
***************
*** 5,10 ****
def ProgressRoutine(TotalFileSize, TotalBytesTransferred, StreamSize, StreamBytesTransferred,
StreamNumber, CallbackReason, SourceFile, DestinationFile, Data):
! print Data
! print TotalFileSize, TotalBytesTransferred, StreamSize, StreamBytesTransferred, StreamNumber, CallbackReason, SourceFile, DestinationFile
##if TotalBytesTransferred > 100000:
## return win32file.PROGRESS_STOP
--- 5,10 ----
def ProgressRoutine(TotalFileSize, TotalBytesTransferred, StreamSize, StreamBytesTransferred,
StreamNumber, CallbackReason, SourceFile, DestinationFile, Data):
! print(Data)
! print(TotalFileSize, TotalBytesTransferred, StreamSize, StreamBytesTransferred, StreamNumber, CallbackReason, SourceFile, DestinationFile)
##if TotalBytesTransferred > 100000:
## return win32file.PROGRESS_STOP
***************
*** 14,18 ****
fsrc=win32api.GetTempFileName(temp_dir,'cfe')[0]
fdst=win32api.GetTempFileName(temp_dir,'cfe')[0]
! print fsrc, fdst
f=open(fsrc,'w')
--- 14,18 ----
fsrc=win32api.GetTempFileName(temp_dir,'cfe')[0]
fdst=win32api.GetTempFileName(temp_dir,'cfe')[0]
! print(fsrc, fdst)
f=open(fsrc,'w')
Index: RegRestoreKey.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/Demos/RegRestoreKey.py,v
retrieving revision 1.1
retrieving revision 1.1.4.1
diff -C2 -d -r1.1 -r1.1.4.1
*** RegRestoreKey.py 30 Nov 2006 07:05:24 -0000 1.1
--- RegRestoreKey.py 29 Aug 2008 04:59:23 -0000 1.1.4.1
***************
*** 5,9 ****
temp_dir=win32api.GetTempPath()
fname=win32api.GetTempFileName(temp_dir,'rsk')[0]
! print fname
## file can't exist
os.remove(fname)
--- 5,9 ----
temp_dir=win32api.GetTempPath()
fname=win32api.GetTempFileName(temp_dir,'rsk')[0]
! print(fname)
## file can't exist
os.remove(fname)
Index: win32cred_demo.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/Demos/win32cred_demo.py,v
retrieving revision 1.1
retrieving revision 1.1.4.1
diff -C2 -d -r1.1 -r1.1.4.1
*** win32cred_demo.py 13 Sep 2006 07:44:27 -0000 1.1
--- win32cred_demo.py 29 Aug 2008 04:59:23 -0000 1.1.4.1
***************
*** 14,18 ****
attrs=[
! {'Keyword':'attr1', 'Flags':0, 'Value':u'unicode data'},
{'Keyword':'attr2', 'Flags':0, 'Value':'character data'}
]
--- 14,18 ----
attrs=[
! {'Keyword':'attr1', 'Flags':0, 'Value':'unicode data'},
{'Keyword':'attr2', 'Flags':0, 'Value':'character data'}
]
***************
*** 23,27 ****
win32cred.CredWrite(cred)
pwd=None
! print win32cred.CredRead(target, win32cred.CRED_TYPE_DOMAIN_PASSWORD)
## Marshal saved credential and use it to log on
--- 23,27 ----
win32cred.CredWrite(cred)
pwd=None
! print(win32cred.CredRead(target, win32cred.CRED_TYPE_DOMAIN_PASSWORD))
## Marshal saved credential and use it to log on
***************
*** 29,33 ****
th=win32security.LogonUser(mc,None,'',win32con.LOGON32_LOGON_INTERACTIVE, win32con.LOGON32_PROVIDER_DEFAULT)
win32security.ImpersonateLoggedOnUser(th)
! print 'GetUserName:',win32api.GetUserName()
win32security.RevertToSelf()
--- 29,33 ----
th=win32security.LogonUser(mc,None,'',win32con.LOGON32_LOGON_INTERACTIVE, win32con.LOGON32_PROVIDER_DEFAULT)
win32security.ImpersonateLoggedOnUser(th)
! print('GetUserName:',win32api.GetUserName())
win32security.RevertToSelf()
Index: OpenEncryptedFileRaw.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/Demos/OpenEncryptedFileRaw.py,v
retrieving revision 1.1
retrieving revision 1.1.4.1
diff -C2 -d -r1.1 -r1.1.4.1
*** OpenEncryptedFileRaw.py 18 Sep 2006 07:17:29 -0000 1.1
--- OpenEncryptedFileRaw.py 29 Aug 2008 04:59:23 -0000 1.1.4.1
***************
*** 7,11 ****
f.write(input_buffer)
## python 2.3 throws an error if return value is a plain int
! return long(winerror.ERROR_SUCCESS)
def WriteCallback(output_buffer, data, buflen):
--- 7,11 ----
f.write(input_buffer)
## python 2.3 throws an error if return value is a plain int
! return int(winerror.ERROR_SUCCESS)
def WriteCallback(output_buffer, data, buflen):
***************
*** 22,30 ****
os.remove(dst_dir)
os.mkdir(dst_dir)
! print 'Destination dir:', dst_dir
## create an encrypted file
fname=win32api.GetTempFileName(dst_dir,'ref')[0]
! print 'orig file:',fname
f=open(fname,'w')
f.write('xxxxxxxxxxxxxxxx\n'*32768)
--- 22,30 ----
os.remove(dst_dir)
os.mkdir(dst_dir)
! print('Destination dir:', dst_dir)
## create an encrypted file
fname=win32api.GetTempFileName(dst_dir,'ref')[0]
! print('orig file:',fname)
f=open(fname,'w')
f.write('xxxxxxxxxxxxxxxx\n'*32768)
***************
*** 41,45 ****
## backup raw data of encrypted file
bkup_fname=win32api.GetTempFileName(dst_dir,'bef')[0]
! print 'backup file:', bkup_fname
f=open(bkup_fname,'wb')
ctxt=win32file.OpenEncryptedFileRaw(fname,0)
--- 41,45 ----
## backup raw data of encrypted file
bkup_fname=win32api.GetTempFileName(dst_dir,'bef')[0]
! print('backup file:', bkup_fname)
f=open(bkup_fname,'wb')
ctxt=win32file.OpenEncryptedFileRaw(fname,0)
***************
*** 53,57 ****
## restore data from backup to new encrypted file
dst_fname=win32api.GetTempFileName(dst_dir,'wef')[0]
! print 'restored file:', dst_fname
f=open(bkup_fname,'rb')
ctxtout=win32file.OpenEncryptedFileRaw(dst_fname, win32file.CREATE_FOR_IMPORT)
--- 53,57 ----
## restore data from backup to new encrypted file
dst_fname=win32api.GetTempFileName(dst_dir,'wef')[0]
! print('restored file:', dst_fname)
f=open(bkup_fname,'rb')
ctxtout=win32file.OpenEncryptedFileRaw(dst_fname, win32file.CREATE_FOR_IMPORT)
Index: win32clipboardDemo.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/Demos/win32clipboardDemo.py,v
retrieving revision 1.2
retrieving revision 1.2.4.1
diff -C2 -d -r1.2 -r1.2.4.1
*** win32clipboardDemo.py 3 Feb 2003 00:30:29 -0000 1.2
--- win32clipboardDemo.py 29 Aug 2008 04:59:23 -0000 1.2.4.1
***************
*** 7,16 ****
if not __debug__:
! print "WARNING: The test code in this module uses assert"
! print "This instance of Python has asserts disabled, so many tests will be skipped"
cf_names = {}
# Build map of CF_* constants to names.
! for name, val in win32con.__dict__.items():
if name[:3]=="CF_" and name != "CF_SCREENFONTS": # CF_SCREEN_FONTS==CF_TEXT!?!?
cf_names[val] = name
--- 7,16 ----
if not __debug__:
! print("WARNING: The test code in this module uses assert")
! print("This instance of Python has asserts disabled, so many tests will be skipped")
cf_names = {}
# Build map of CF_* constants to names.
! for name, val in list(win32con.__dict__.items()):
if name[:3]=="CF_" and name != "CF_SCREENFONTS": # CF_SCREEN_FONTS==CF_TEXT!?!?
cf_names[val] = name
***************
*** 41,45 ****
got = GetClipboardData(win32con.CF_UNICODETEXT)
assert got == text, "Didnt get the correct result back - '%r'." % (got,)
! assert type(got)==types.UnicodeType, "Didnt get the correct result back - '%r'." % (got,)
got = GetClipboardData(win32con.CF_OEMTEXT)
--- 41,45 ----
got = GetClipboardData(win32con.CF_UNICODETEXT)
assert got == text, "Didnt get the correct result back - '%r'." % (got,)
! assert type(got)==str, "Didnt get the correct result back - '%r'." % (got,)
got = GetClipboardData(win32con.CF_OEMTEXT)
***************
*** 48,52 ****
# Unicode tests
EmptyClipboard()
! text = u"Hello from Python unicode"
# Now set the Unicode value
SetClipboardData(win32con.CF_UNICODETEXT, text)
--- 48,52 ----
# Unicode tests
EmptyClipboard()
! text = "Hello from Python unicode"
# Now set the Unicode value
SetClipboardData(win32con.CF_UNICODETEXT, text)
***************
*** 54,58 ****
got = GetClipboardData(win32con.CF_UNICODETEXT)
assert got == text, "Didnt get the correct result back - '%r'." % (got,)
! assert type(got)==types.UnicodeType, "Didnt get the correct result back - '%r'." % (got,)
# Close and open the clipboard to ensure auto-conversions take place.
--- 54,58 ----
got = GetClipboardData(win32con.CF_UNICODETEXT)
assert got == text, "Didnt get the correct result back - '%r'." % (got,)
! assert type(got)==str, "Didnt get the correct result back - '%r'." % (got,)
# Close and open the clipboard to ensure auto-conversions take place.
***************
*** 68,75 ****
# Make sure we get back the correct types.
got = GetClipboardData(win32con.CF_UNICODETEXT)
! assert type(got)==types.UnicodeType, "Didnt get the correct result back - '%r'." % (got,)
got = GetClipboardData(win32con.CF_OEMTEXT)
assert got == text, "Didnt get the correct result back - '%r'." % (got,)
! print "Clipboard text tests worked correctly"
finally:
CloseClipboard()
--- 68,75 ----
# Make sure we get back the correct types.
got = GetClipboardData(win32con.CF_UNICODETEXT)
! assert type(got)==str, "Didnt get the correct result back - '%r'." % (got,)
got = GetClipboardData(win32con.CF_OEMTEXT)
assert got == text, "Didnt get the correct result back - '%r'." % (got,)
! print("Clipboard text tests worked correctly")
finally:
CloseClipboard()
***************
*** 92,97 ****
n = "unknown (%s)" % (enum,)
! print "Have format", n
! print "Clipboard enumerator tests worked correctly"
finally:
CloseClipboard()
--- 92,97 ----
n = "unknown (%s)" % (enum,)
! print("Have format", n)
! print("Clipboard enumerator tests worked correctly")
finally:
CloseClipboard()
***************
*** 108,120 ****
# Just for the fun of it pickle Python objects through the clipboard
fmt = RegisterClipboardFormat("Python Pickle Format")
! import cPickle
pickled_object = Foo(a=1, b=2, Hi=3)
! SetClipboardData(fmt, cPickle.dumps( pickled_object ) )
# Now read it back.
data = GetClipboardData(fmt)
! loaded_object = cPickle.loads(data)
! assert cPickle.loads(data) == pickled_object, "Didnt get the correct data!"
! print "Clipboard custom format tests worked correctly"
finally:
CloseClipboard()
--- 108,120 ----
# Just for the fun of it pickle Python objects through the clipboard
fmt = RegisterClipboardFormat("Python Pickle Format")
! import pickle
pickled_object = Foo(a=1, b=2, Hi=3)
! SetClipboardData(fmt, pickle.dumps( pickled_object ) )
# Now read it back.
data = GetClipboardData(fmt)
! loaded_object = pickle.loads(data)
! assert pickle.loads(data) == pickled_object, "Didnt get the correct data!"
! print("Clipboard custom format tests worked correctly")
finally:
CloseClipboard()
Index: win32ts_logoff_disconnected.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/Demos/win32ts_logoff_disconnected.py,v
retrieving revision 1.1
retrieving revision 1.1.4.1
diff -C2 -d -r1.1 -r1.1.4.1
*** win32ts_logoff_disconnected.py 5 Jul 2006 15:25:57 -0000 1.1
--- win32ts_logoff_disconnected.py 29 Aug 2008 04:59:23 -0000 1.1.4.1
***************
*** 10,13 ****
sessionid=session['SessionId']
username=win32ts.WTSQuerySessionInformation(win32ts.WTS_CURRENT_SERVER_HANDLE, sessionid, win32ts.WTSUserName)
! print 'Logging off disconnected user:',username
win32ts.WTSLogoffSession(win32ts.WTS_CURRENT_SERVER_HANDLE, sessionid, True)
--- 10,13 ----
sessionid=session['SessionId']
username=win32ts.WTSQuerySessionInformation(win32ts.WTS_CURRENT_SERVER_HANDLE, sessionid, win32ts.WTSUserName)
! print('Logging off disconnected user:',username)
win32ts.WTSLogoffSession(win32ts.WTS_CURRENT_SERVER_HANDLE, sessionid, True)
Index: win32fileDemo.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/Demos/win32fileDemo.py,v
retrieving revision 1.6
retrieving revision 1.6.4.1
diff -C2 -d -r1.6 -r1.6.4.1
*** win32fileDemo.py 5 May 2003 01:01:20 -0000 1.6
--- win32fileDemo.py 29 Aug 2008 04:59:23 -0000 1.6.4.1
***************
*** 29,33 ****
handle.Close()
if data == test_data:
! print "Successfully wrote and read a file"
os.unlink(testName)
--- 29,33 ----
handle.Close()
if data == test_data:
! print("Successfully wrote and read a file")
os.unlink(testName)
Index: win32gui_dialog.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/Demos/win32gui_dialog.py,v
retrieving revision 1.7
retrieving revision 1.7.2.1
diff -C2 -d -r1.7 -r1.7.2.1
*** win32gui_dialog.py 4 Jan 2007 08:30:33 -0000 1.7
--- win32gui_dialog.py 29 Aug 2008 04:59:23 -0000 1.7.2.1
***************
*** 24,28 ****
import struct, array
import commctrl
! import Queue
import os
--- 24,28 ----
import struct, array
import commctrl
! import queue
import os
***************
*** 44,55 ****
else:
full_fmt += fmt
! for name, val in kw.items():
! if not self.__dict__.has_key(name):
! raise ValueError, "LVITEM structures do not have an item '%s'" % (name,)
self.__dict__[name] = val
def __setattr__(self, attr, val):
! if not attr.startswith("_") and not self.__dict__.has_key(attr):
! raise AttributeError, attr
self.__dict__[attr] = val
--- 44,55 ----
else:
full_fmt += fmt
! for name, val in list(kw.items()):
! if name not in self.__dict__:
! raise ValueError("LVITEM structures do not have an item '%s'" % (name,))
self.__dict__[name] = val
def __setattr__(self, attr, val):
! if not attr.startswith("_") and attr not in self.__dict__:
! raise AttributeError(attr)
self.__dict__[attr] = val
***************
*** 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,76 ----
vals.append(0)
else:
! str_buf = array.array("b", val+'\0')
vals.append(str_buf.buffer_info()[0])
vals.append(len(val))
***************
*** 81,85 ****
vals.append(val)
full_fmt += fmt
! return apply(struct.pack, (full_fmt,) + tuple(vals) )
--- 81,85 ----
vals.append(val)
full_fmt += fmt
! return struct.pack(*(full_fmt,) + tuple(vals))
***************
*** 139,144 ****
try:
classAtom = win32gui.RegisterClass(wc)
! except win32gui.error, err_info:
! if err_info[0]!=winerror.ERROR_CLASS_ALREADY_EXISTS:
raise
return className
--- 139,144 ----
try:
classAtom = win32gui.RegisterClass(wc)
! except win32gui.error as err_info:
! if err_info.args[0]!=winerror.ERROR_CLASS_ALREADY_EXISTS:
raise
return className
***************
*** 150,154 ****
# Window frame and title
! dlg = [ [title, (0, 0, 210, 250), style, None, (8, "MS Sans Serif"), None, dlgClassName], ]
# ID label and text box
--- 150,154 ----
# Window frame and title
! dlg = [ [title, (0, 0, 210, 250), style, 0, (8, "MS Sans Serif"), None, dlgClassName], ]
# ID label and text box
***************
*** 248,253 ****
l,t,r,b = win32gui.GetWindowRect(self.hwnd)
dt_l, dt_t, dt_r, dt_b = win32gui.GetWindowRect(desktop)
! centre_x, centre_y = win32gui.ClientToScreen( desktop, ( (dt_r-dt_l)/2, (dt_b-dt_t)/2) )
! win32gui.MoveWindow(hwnd, centre_x-(r/2), centre_y-(b/2), r-l, b-t, 0)
self._SetupList()
l,t,r,b = win32gui.GetClientRect(self.hwnd)
--- 248,253 ----
l,t,r,b = win32gui.GetWindowRect(self.hwnd)
dt_l, dt_t, dt_r, dt_b = win32gui.GetWindowRect(desktop)
! centre_x, centre_y = win32gui.ClientToScreen( desktop, ( (dt_r-dt_l)//2, (dt_b-dt_t)//2) )
! win32gui.MoveWindow(hwnd, centre_x-(r//2), centre_y-(b//2), r-l, b-t, 0)
self._SetupList()
l,t,r,b = win32gui.GetClientRect(self.hwnd)
***************
*** 286,295 ****
while 1:
params = self.result_queue.get(0)
! apply(self.AddListItem, params)
! except Queue.Empty:
pass
def OnSearchFinished(self, hwnd, msg, wparam, lparam):
! print "OnSearchFinished"
def OnNotify(self, hwnd, msg, wparam, lparam):
--- 286,295 ----
while 1:
params = self.result_queue.get(0)
! self.AddListItem(*params)
! except queue.Empty:
pass
def OnSearchFinished(self, hwnd, msg, wparam, lparam):
! print("OnSearchFinished")
def OnNotify(self, hwnd, msg, wparam, lparam):
***************
*** 305,309 ****
code += commctrl.PY_0U
if code == commctrl.NM_DBLCLK:
! print "Double click on item", iItem+1
return 1
--- 305,309 ----
code += commctrl.PY_0U
if code == commctrl.NM_DBLCLK:
! print("Double click on item", iItem+1)
return 1
***************
*** 321,331 ****
import threading
! self.result_queue = Queue.Queue()
thread = threading.Thread(target = fill_slowly, args=(self.result_queue, self.hwnd) )
thread.start()
elif id == IDC_BUTTON_DISPLAY:
! print "Display button selected"
sel = win32gui.SendMessage(self.hwndList, commctrl.LVM_GETNEXTITEM, -1, commctrl.LVNI_SELECTED)
! print "The selected item is", sel+1
# These function differ based on how the window is used, so may be overridden
--- 321,331 ----
import threading
! self.result_queue = queue.Queue()
thread = threading.Thread(target = fill_slowly, args=(self.result_queue, self.hwnd) )
thread.start()
elif id == IDC_BUTTON_DISPLAY:
! print("Display button selected")
sel = win32gui.SendMessage(self.hwndList, commctrl.LVM_GETNEXTITEM, -1, commctrl.LVNI_SELECTED)
! print("The selected item is", sel+1)
# These function differ based on how the window is used, so may be overridden
Index: SystemParametersInfo.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/Demos/SystemParametersInfo.py,v
retrieving revision 1.1
retrieving revision 1.1.4.1
diff -C2 -d -r1.1 -r1.1.4.1
*** SystemParametersInfo.py 16 Oct 2005 17:17:10 -0000 1.1
--- SystemParametersInfo.py 29 Aug 2008 04:59:23 -0000 1.1.4.1
***************
*** 14,25 ****
"SPI_GETFONTSMOOTHINGCONTRAST", "SPI_GETFONTSMOOTHINGTYPE", "SPI_GETFOCUSBORDERHEIGHT",
"SPI_GETFOCUSBORDERWIDTH", "SPI_GETMOUSECLICKLOCKTIME"):
! print pname
cget=getattr(win32con,pname)
cset=getattr(win32con,pname.replace('_GET','_SET'))
orig_value=win32gui.SystemParametersInfo(cget)
! print '\toriginal setting:',orig_value
win32gui.SystemParametersInfo(cset, orig_value+1)
new_value=win32gui.SystemParametersInfo(cget)
! print '\tnew value:',new_value
assert new_value==orig_value+1
win32gui.SystemParametersInfo(cset, orig_value)
--- 14,25 ----
"SPI_GETFONTSMOOTHINGCONTRAST", "SPI_GETFONTSMOOTHINGTYPE", "SPI_GETFOCUSBORDERHEIGHT",
"SPI_GETFOCUSBORDERWIDTH", "SPI_GETMOUSECLICKLOCKTIME"):
! print(pname)
cget=getattr(win32con,pname)
cset=getattr(win32con,pname.replace('_GET','_SET'))
orig_value=win32gui.SystemParametersInfo(cget)
! print('\toriginal setting:',orig_value)
win32gui.SystemParametersInfo(cset, orig_value+1)
new_value=win32gui.SystemParametersInfo(cget)
! print('\tnew value:',new_value)
assert new_value==orig_value+1
win32gui.SystemParametersInfo(cset, orig_value)
***************
*** 35,46 ****
"SPI_GETTOOLTIPANIMATION", "SPI_GETTOOLTIPFADE", "SPI_GETUIEFFECTS", "SPI_GETACTIVEWINDOWTRACKING",
"SPI_GETACTIVEWNDTRKZORDER"):
! print pname
cget=getattr(win32con,pname)
cset=getattr(win32con,pname.replace('_GET','_SET'))
orig_value=win32gui.SystemParametersInfo(cget)
! print orig_value
win32gui.SystemParametersInfo(cset, not orig_value)
new_value=win32gui.SystemParametersInfo(cget)
! print new_value
assert orig_value!=new_value
win32gui.SystemParametersInfo(cset, orig_value)
--- 35,46 ----
"SPI_GETTOOLTIPANIMATION", "SPI_GETTOOLTIPFADE", "SPI_GETUIEFFECTS", "SPI_GETACTIVEWINDOWTRACKING",
"SPI_GETACTIVEWNDTRKZORDER"):
! print(pname)
cget=getattr(win32con,pname)
cset=getattr(win32con,pname.replace('_GET','_SET'))
orig_value=win32gui.SystemParametersInfo(cget)
! print(orig_value)
win32gui.SystemParametersInfo(cset, not orig_value)
new_value=win32gui.SystemParametersInfo(cget)
! print(new_value)
assert orig_value!=new_value
win32gui.SystemParametersInfo(cset, orig_value)
***************
*** 54,65 ****
"SPI_GETKEYBOARDPREF","SPI_GETSCREENSAVEACTIVE","SPI_GETMENUDROPALIGNMENT",
"SPI_GETDRAGFULLWINDOWS", "SPI_GETSHOWIMEUI"):
! print pname
cget=getattr(win32con,pname)
cset=getattr(win32con,pname.replace('_GET','_SET'))
orig_value=win32gui.SystemParametersInfo(cget)
! print orig_value
win32gui.SystemParametersInfo(cset, not orig_value)
new_value=win32gui.SystemParametersInfo(cget)
! print new_value
assert orig_value!=new_value
win32gui.SystemParametersInfo(cset, orig_value)
--- 54,65 ----
"SPI_GETKEYBOARDPREF","SPI_GETSCREENSAVEACTIVE","SPI_GETMENUDROPALIGNMENT",
"SPI_GETDRAGFULLWINDOWS", "SPI_GETSHOWIMEUI"):
! print(pname)
cget=getattr(win32con,pname)
cset=getattr(win32con,pname.replace('_GET','_SET'))
orig_value=win32gui.SystemParametersInfo(cget)
! print(orig_value)
win32gui.SystemParametersInfo(cset, not orig_value)
new_value=win32gui.SystemParametersInfo(cget)
! print(new_value)
assert orig_value!=new_value
win32gui.SystemParametersInfo(cset, orig_value)
***************
*** 68,81 ****
! print "SPI_GETICONTITLELOGFONT"
lf=win32gui.SystemParametersInfo(win32con.SPI_GETICONTITLELOGFONT)
orig_height=lf.lfHeight
orig_italic=lf.lfItalic
! print 'Height:', orig_height, 'Italic:',orig_italic
lf.lfHeight+=2
lf.lfItalic=not lf.lfItalic
win32gui.SystemParametersInfo(win32con.SPI_SETICONTITLELOGFONT, lf)
new_lf=win32gui.SystemParametersInfo(win32con.SPI_GETICONTITLELOGFONT)
! print 'New Height:', new_lf.lfHeight, 'New Italic:',new_lf.lfItalic
assert new_lf.lfHeight==orig_height+2
assert new_lf.lfItalic!=orig_italic
--- 68,81 ----
! print("SPI_GETICONTITLELOGFONT")
lf=win32gui.SystemParametersInfo(win32con.SPI_GETICONTITLELOGFONT)
orig_height=lf.lfHeight
orig_italic=lf.lfItalic
! print('Height:', orig_height, 'Italic:',orig_italic)
lf.lfHeight+=2
lf.lfItalic=not lf.lfItalic
win32gui.SystemParametersInfo(win32con.SPI_SETICONTITLELOGFONT, lf)
new_lf=win32gui.SystemParametersInfo(win32con.SPI_GETICONTITLELOGFONT)
! print('New Height:', new_lf.lfHeight, 'New Italic:',new_lf.lfItalic)
assert new_lf.lfHeight==orig_height+2
assert new_lf.lfItalic!=orig_italic
******...
[truncated message content] |