Update of /cvsroot/pywin32/pywin32/com/win32comext/shell/demos
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv20331/com/win32comext/shell/demos
Modified Files:
Tag: py3k
IActiveDesktop.py IShellLinkDataList.py
IUniformResourceLocator.py create_link.py dump_link.py
explorer_browser.py shellexecuteex.py viewstate.py
walk_shell_folders.py
Log Message:
many more upgrades to py3k syntax
Index: create_link.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/demos/create_link.py,v
retrieving revision 1.1
retrieving revision 1.1.4.1
diff -C2 -d -r1.1 -r1.1.4.1
*** create_link.py 22 Sep 2006 04:53:30 -0000 1.1
--- create_link.py 26 Nov 2008 09:03:30 -0000 1.1.4.1
***************
*** 24,28 ****
import sys
if len(sys.argv)<2:
! print "Usage: %s LinkFile [path [, args[, description[, working_dir]]]]\n\nIf LinkFile does not exist, it will be created using the other args"
sys.exit(1)
file = sys.argv[1]
--- 24,28 ----
import sys
if len(sys.argv)<2:
! print("Usage: %s LinkFile [path [, args[, description[, working_dir]]]]\n\nIf LinkFile does not exist, it will be created using the other args")
sys.exit(1)
file = sys.argv[1]
***************
*** 32,36 ****
shortcut.load( file )
# now print data...
! print 'Shortcut in file %s to file:\n\t%s\nArguments:\n\t%s\nDescription:\n\t%s\nWorking Directory:\n\t%s\nItemIDs:\n\t<skipped>'%(
file,
shortcut.GetPath(shell.SLGP_SHORTPATH)[0],
--- 32,36 ----
shortcut.load( file )
# now print data...
! print('Shortcut in file %s to file:\n\t%s\nArguments:\n\t%s\nDescription:\n\t%s\nWorking Directory:\n\t%s\nItemIDs:\n\t<skipped>'%(
file,
shortcut.GetPath(shell.SLGP_SHORTPATH)[0],
***************
*** 39,46 ****
shortcut.GetWorkingDirectory(),
#shortcut.GetIDList(),
! )
else:
if len(sys.argv) <3:
! print "Link file does not exist\nYou must supply the path, args, description and working_dir as args"
sys.exit(1)
# create the shortcut using rest of args...
--- 39,46 ----
shortcut.GetWorkingDirectory(),
#shortcut.GetIDList(),
! ))
else:
if len(sys.argv) <3:
! print("Link file does not exist\nYou must supply the path, args, description and working_dir as args")
sys.exit(1)
# create the shortcut using rest of args...
Index: IUniformResourceLocator.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/demos/IUniformResourceLocator.py,v
retrieving revision 1.1
retrieving revision 1.1.4.1
diff -C2 -d -r1.1 -r1.1.4.1
*** IUniformResourceLocator.py 6 Apr 2006 10:50:40 -0000 1.1
--- IUniformResourceLocator.py 26 Nov 2008 09:03:30 -0000 1.1.4.1
***************
*** 21,25 ****
temp_dir=win32api.GetTempPath()
linkname=win32api.GetTempFileName(temp_dir, 'ish')[0]
! print 'Link:',linkname
os.remove(linkname)
linkname+='.url'
--- 21,25 ----
temp_dir=win32api.GetTempPath()
linkname=win32api.GetTempFileName(temp_dir, 'ish')[0]
! print('Link:',linkname)
os.remove(linkname)
linkname+='.url'
***************
*** 34,43 ****
property_ids=[(k,v) for k,v in shellcon.__dict__.items() if k.startswith('PID_INTSITE_')]
for pname, pval in property_ids:
! print pname, ps.ReadMultiple((pval,))[0]
ps=pss.Open(shell.FMTID_Intshcut)
property_ids=[(k,v) for k,v in shellcon.__dict__.items() if k.startswith('PID_IS_')]
for pname, pval in property_ids:
! print pname, ps.ReadMultiple((pval,))[0]
new_sh=InternetShortcut()
--- 34,43 ----
property_ids=[(k,v) for k,v in shellcon.__dict__.items() if k.startswith('PID_INTSITE_')]
for pname, pval in property_ids:
! print(pname, ps.ReadMultiple((pval,))[0])
ps=pss.Open(shell.FMTID_Intshcut)
property_ids=[(k,v) for k,v in shellcon.__dict__.items() if k.startswith('PID_IS_')]
for pname, pval in property_ids:
! print(pname, ps.ReadMultiple((pval,))[0])
new_sh=InternetShortcut()
Index: viewstate.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/demos/viewstate.py,v
retrieving revision 1.1
retrieving revision 1.1.4.1
diff -C2 -d -r1.1 -r1.1.4.1
*** viewstate.py 16 May 2005 07:53:18 -0000 1.1
--- viewstate.py 26 Nov 2008 09:03:30 -0000 1.1.4.1
***************
*** 10,14 ****
template_folder=os.path.split(sys.executable)[0]
! print 'Template folder:', template_folder
template_pidl=shell.SHILCreateFromPath(template_folder,0)[0]
template_pb=shell.SHGetViewStatePropertyBag(template_pidl, "Shell", shellcon.SHGVSPB_FOLDERNODEFAULTS, pythoncom.IID_IPropertyBag)
--- 10,14 ----
template_folder=os.path.split(sys.executable)[0]
! print('Template folder:', template_folder)
template_pidl=shell.SHILCreateFromPath(template_folder,0)[0]
template_pb=shell.SHGetViewStatePropertyBag(template_pidl, "Shell", shellcon.SHGVSPB_FOLDERNODEFAULTS, pythoncom.IID_IPropertyBag)
***************
*** 25,29 ****
full_fname=os.path.join(dir_name,fname)
if os.path.isdir(full_fname):
! print full_fname
pidl=shell.SHILCreateFromPath(full_fname,0)[0]
pb=shell.SHGetViewStatePropertyBag(pidl, "Shell", shellcon.SHGVSPB_FOLDERNODEFAULTS, pythoncom.IID_IPropertyBag)
--- 25,29 ----
full_fname=os.path.join(dir_name,fname)
if os.path.isdir(full_fname):
! print(full_fname)
pidl=shell.SHILCreateFromPath(full_fname,0)[0]
pb=shell.SHGetViewStatePropertyBag(pidl, "Shell", shellcon.SHGVSPB_FOLDERNODEFAULTS, pythoncom.IID_IPropertyBag)
Index: shellexecuteex.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/demos/shellexecuteex.py,v
retrieving revision 1.1
retrieving revision 1.1.4.1
diff -C2 -d -r1.1 -r1.1.4.1
*** shellexecuteex.py 2 Jul 2004 04:17:10 -0000 1.1
--- shellexecuteex.py 26 Nov 2008 09:03:30 -0000 1.1.4.1
***************
*** 4,8 ****
def ExplorePIDL():
pidl = shell.SHGetSpecialFolderLocation(0, shellcon.CSIDL_DESKTOP)
! print "The desktop is at", shell.SHGetPathFromIDList(pidl)
shell.ShellExecuteEx(fMask=shellcon.SEE_MASK_NOCLOSEPROCESS,
nShow=win32con.SW_NORMAL,
--- 4,8 ----
def ExplorePIDL():
pidl = shell.SHGetSpecialFolderLocation(0, shellcon.CSIDL_DESKTOP)
! print("The desktop is at", shell.SHGetPathFromIDList(pidl))
shell.ShellExecuteEx(fMask=shellcon.SEE_MASK_NOCLOSEPROCESS,
nShow=win32con.SW_NORMAL,
***************
*** 10,14 ****
lpVerb="explore",
lpIDList=pidl)
! print "Done!"
if __name__=='__main__':
--- 10,14 ----
lpVerb="explore",
lpIDList=pidl)
! print("Done!")
if __name__=='__main__':
Index: dump_link.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/demos/dump_link.py,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -C2 -d -r1.2 -r1.2.2.1
*** dump_link.py 18 Aug 2008 13:00:39 -0000 1.2
--- dump_link.py 26 Nov 2008 09:03:30 -0000 1.2.2.1
***************
*** 13,33 ****
shellLink.Resolve(0, shell.SLR_ANY_MATCH | shell.SLR_NO_UI)
fname, findData = shellLink.GetPath(0)
! print "Filename:", fname, ", UNC=", shellLink.GetPath(shell.SLGP_UNCPRIORITY)[0]
! print "Description:", shellLink.GetDescription()
! print "Working Directory:", shellLink.GetWorkingDirectory()
! print "Icon:", shellLink.GetIconLocation()
def FavDumper(nothing, path, names):
# called by os.path.walk
for name in names:
! print name,
try:
DumpLink(name)
except pythoncom.com_error:
! print " - not a link"
def DumpFavorites():
favfold = str(shell.SHGetSpecialFolderPath(0, shellcon.CSIDL_FAVORITES))
! print "Your favourites are at", favfold
os.path.walk(favfold, FavDumper, None)
--- 13,33 ----
shellLink.Resolve(0, shell.SLR_ANY_MATCH | shell.SLR_NO_UI)
fname, findData = shellLink.GetPath(0)
! print("Filename:", fname, ", UNC=", shellLink.GetPath(shell.SLGP_UNCPRIORITY)[0])
! print("Description:", shellLink.GetDescription())
! print("Working Directory:", shellLink.GetWorkingDirectory())
! print("Icon:", shellLink.GetIconLocation())
def FavDumper(nothing, path, names):
# called by os.path.walk
for name in names:
! print(name, end=' ')
try:
DumpLink(name)
except pythoncom.com_error:
! print(" - not a link")
def DumpFavorites():
favfold = str(shell.SHGetSpecialFolderPath(0, shellcon.CSIDL_FAVORITES))
! print("Your favourites are at", favfold)
os.path.walk(favfold, FavDumper, None)
***************
*** 38,47 ****
if files:
for file in files:
! print file
DumpLink(file)
! print
else:
! print "Can not find", fspec
else:
! print "Dumping your favorites folder!"
DumpFavorites()
--- 38,47 ----
if files:
for file in files:
! print(file)
DumpLink(file)
! print()
else:
! print("Can not find", fspec)
else:
! print("Dumping your favorites folder!")
DumpFavorites()
Index: explorer_browser.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/demos/explorer_browser.py,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -C2 -d -r1.2 -r1.2.2.1
*** explorer_browser.py 26 Jul 2008 07:02:34 -0000 1.2
--- explorer_browser.py 26 Nov 2008 09:03:30 -0000 1.2.2.1
***************
*** 17,35 ****
def OnNavigationComplete(self, pidl):
! print "OnNavComplete", pidl
def OnNavigationFailed(self, pidl):
! print "OnNavigationFailed", pidl
def OnNavigationPending(self, pidl):
! print "OnNavigationPending", pidl
def OnViewCreated(self, view):
! print "OnViewCreated", view
# And if our demo view has been registered, it may well
# be that view!
try:
pyview = unwrap(view)
! print "and look - its a Python implemented view!", pyview
except ValueError:
pass
--- 17,35 ----
def OnNavigationComplete(self, pidl):
! print("OnNavComplete", pidl)
def OnNavigationFailed(self, pidl):
! print("OnNavigationFailed", pidl)
def OnNavigationPending(self, pidl):
! print("OnNavigationPending", pidl)
def OnViewCreated(self, view):
! print("OnViewCreated", view)
# And if our demo view has been registered, it may well
# be that view!
try:
pyview = unwrap(view)
! print("and look - its a Python implemented view!", pyview)
except ValueError:
pass
***************
*** 79,87 ****
tree = sp.QueryService(shell.IID_INameSpaceTreeControl,
shell.IID_INameSpaceTreeControl)
! except pythoncom.com_error, exc:
# this should really only fail if no "nav" frame exists...
! print "Strange - failed to get the tree control even though " \
! "we asked for a EBO_SHOWFRAMES"
! print exc
else:
# get the IShellItem for the selection.
--- 79,87 ----
tree = sp.QueryService(shell.IID_INameSpaceTreeControl,
shell.IID_INameSpaceTreeControl)
! except pythoncom.com_error as exc:
# this should really only fail if no "nav" frame exists...
! print("Strange - failed to get the tree control even though " \
! "we asked for a EBO_SHOWFRAMES")
! print(exc)
else:
# get the IShellItem for the selection.
***************
*** 98,106 ****
def OnDestroy(self, hwnd, msg, wparam, lparam):
! print "tearing down ExplorerBrowser..."
self.eb.Unadvise(self.event_cookie)
self.eb.Destroy()
self.eb = None
! print "shutting down app..."
win32gui.PostQuitMessage(0)
--- 98,106 ----
def OnDestroy(self, hwnd, msg, wparam, lparam):
! print("tearing down ExplorerBrowser...")
self.eb.Unadvise(self.event_cookie)
self.eb.Destroy()
self.eb = None
! print("shutting down app...")
win32gui.PostQuitMessage(0)
Index: IShellLinkDataList.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/demos/IShellLinkDataList.py,v
retrieving revision 1.1
retrieving revision 1.1.4.1
diff -C2 -d -r1.1 -r1.1.4.1
*** IShellLinkDataList.py 6 Apr 2006 10:50:40 -0000 1.1
--- IShellLinkDataList.py 26 Nov 2008 09:03:30 -0000 1.1.4.1
***************
*** 6,10 ****
os.remove(linkname)
linkname+='.lnk'
! print 'Link name:',linkname
ish=pythoncom.CoCreateInstance(shell.CLSID_ShellLink, None,
pythoncom.CLSCTX_INPROC_SERVER, shell.IID_IShellLink)
--- 6,10 ----
os.remove(linkname)
linkname+='.lnk'
! print('Link name:',linkname)
ish=pythoncom.CoCreateInstance(shell.CLSID_ShellLink, None,
pythoncom.CLSCTX_INPROC_SERVER, shell.IID_IShellLink)
Index: walk_shell_folders.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/demos/walk_shell_folders.py,v
retrieving revision 1.1
retrieving revision 1.1.4.1
diff -C2 -d -r1.1 -r1.1.4.1
*** walk_shell_folders.py 27 Sep 2005 01:46:35 -0000 1.1
--- walk_shell_folders.py 26 Nov 2008 09:03:30 -0000 1.1.4.1
***************
*** 12,16 ****
dn = folder.GetDisplayNameOf(pidl,
shellcon.SHGDN_NORMAL)
! print indent, dn
if depth:
try:
--- 12,16 ----
dn = folder.GetDisplayNameOf(pidl,
shellcon.SHGDN_NORMAL)
! print(indent, dn)
if depth:
try:
Index: IActiveDesktop.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/demos/IActiveDesktop.py,v
retrieving revision 1.1
retrieving revision 1.1.4.1
diff -C2 -d -r1.1 -r1.1.4.1
*** IActiveDesktop.py 6 Apr 2006 10:50:40 -0000 1.1
--- IActiveDesktop.py 26 Nov 2008 09:03:30 -0000 1.1.4.1
***************
*** 6,10 ****
opts=iad.GetDesktopItemOptions()
if not (opts['ActiveDesktop'] and opts['EnableComponents']):
! print 'Warning: Enabling Active Desktop'
opts['ActiveDesktop']=True
opts['EnableComponents']=True
--- 6,10 ----
opts=iad.GetDesktopItemOptions()
if not (opts['ActiveDesktop'] and opts['EnableComponents']):
! print('Warning: Enabling Active Desktop')
opts['ActiveDesktop']=True
opts['EnableComponents']=True
***************
*** 17,23 ****
cnt=iad.GetDesktopItemCount()
! print 'Count:', cnt
for i in range(cnt):
! print iad.GetDesktopItem(i)
component={
--- 17,23 ----
cnt=iad.GetDesktopItemCount()
! print('Count:', cnt)
for i in range(cnt):
! print(iad.GetDesktopItem(i))
component={
|