[pywin32-checkins] /hgroot/pywin32/pywin32: Add IFileOperation, IFileOperationProgr...
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: <pyw...@li...> - 2012-11-03 09:24:55
|
changeset 7ff3b8548772 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=7ff3b8548772 summary: Add IFileOperation, IFileOperationProgressSink, and related interfaces and functions diffstat: AutoDuck/pywin32.mak | 1 + CHANGES.txt | 9 + com/win32comext/propsys/pscon.py | 4 + com/win32comext/propsys/src/PyIObjectWithPropertyKey.cpp | 81 + com/win32comext/propsys/src/PyIObjectWithPropertyKey.h | 21 + com/win32comext/propsys/src/PyIPropertyChange.cpp | 65 + com/win32comext/propsys/src/PyIPropertyChange.h | 20 + com/win32comext/propsys/src/PyIPropertyChangeArray.cpp | 207 ++++ com/win32comext/propsys/src/PyIPropertyChangeArray.h | 26 + com/win32comext/propsys/src/propsys.cpp | 101 +- com/win32comext/shell/demos/IFileOperationProgressSink.py | 107 ++ com/win32comext/shell/shellcon.py | 40 + com/win32comext/shell/src/PyIFileOperation.cpp | 659 +++++++++++++ com/win32comext/shell/src/PyIFileOperation.h | 39 + com/win32comext/shell/src/PyIFileOperationProgressSink.cpp | 320 ++++++ com/win32comext/shell/src/PyIFileOperationProgressSink.h | 119 ++ com/win32comext/shell/src/shell.cpp | 8 +- setup.py | 5 + 18 files changed, 1828 insertions(+), 4 deletions(-) diffs (truncated from 2011 to 300 lines): diff -r e4fc118e3893 -r 7ff3b8548772 AutoDuck/pywin32.mak --- a/AutoDuck/pywin32.mak Mon Oct 29 14:40:40 2012 +1100 +++ b/AutoDuck/pywin32.mak Sat Nov 03 05:22:36 2012 -0400 @@ -55,6 +55,7 @@ $(WIN32COMEXT_DIR)\axdebug\src\*.cpp \ $(WIN32COMEXT_DIR)\axcontrol\src\*.cpp \ $(WIN32COMEXT_DIR)\shell\src\*.cpp \ + $(WIN32COMEXT_DIR)\shell\src\*.h \ $(WIN32COMEXT_DIR)\internet\src\*.cpp \ $(WIN32COMEXT_DIR)\taskscheduler\src\*.cpp \ $(WIN32COMEXT_DIR)\authorization\src\*.cpp \ diff -r e4fc118e3893 -r 7ff3b8548772 CHANGES.txt --- a/CHANGES.txt Mon Oct 29 14:40:40 2012 +1100 +++ b/CHANGES.txt Sat Nov 03 05:22:36 2012 -0400 @@ -4,6 +4,15 @@ hg log -rb2xx: > log.out However contributors are encouraged to add their own entries for their work. +Since build 218: +---------------- +* win32com.shell + Add interfaces IFileOperation and IFileOperationProgressSink + +* win32com.propsys + Add interfaces IPropertyChange, IPropertyChangeArray, and IObjectWithPropertyKey + Add functions PSCreateSimplePropertyChange, PSCreatePropertyChangeArray, and SHSetDefaultProperties + Since build 217: ---------------- * mapiutil.py GetPropTagName has been modified to return the fully qualified diff -r e4fc118e3893 -r 7ff3b8548772 com/win32comext/propsys/pscon.py --- a/com/win32comext/propsys/pscon.py Mon Oct 29 14:40:40 2012 +1100 +++ b/com/win32comext/propsys/pscon.py Sat Nov 03 05:22:36 2012 -0400 @@ -717,3 +717,7 @@ PKEY_AppUserModel_ExcludeFromShowInNewInstall = (IID('{9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}'), 8) PKEY_AppUserModel_PreventPinning = (IID('{9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}'), 9) +# PKA_FLAGS, used with IPropertyChange +PKA_SET = 0 +PKA_APPEND = 1 +PKA_DELETE = 2 diff -r e4fc118e3893 -r 7ff3b8548772 com/win32comext/propsys/src/PyIObjectWithPropertyKey.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/com/win32comext/propsys/src/PyIObjectWithPropertyKey.cpp Sat Nov 03 05:22:36 2012 -0400 @@ -0,0 +1,81 @@ +// This file implements the IObjectWithPropertyKey Interface and Gateway for Python. +// Generated by makegw.py + +#include "PythonCOM.h" +#include "PythonCOMServer.h" +#include "propsys.h" +#include "PyIObjectWithPropertyKey.h" +#include "PyPROPVARIANT.h" + +// @doc - This file contains autoduck documentation +// --------------------------------------------------- +// +// Interface Implementation + +PyIObjectWithPropertyKey::PyIObjectWithPropertyKey(IUnknown *pdisp): + PyIUnknown(pdisp) +{ + ob_type = &type; +} + +PyIObjectWithPropertyKey::~PyIObjectWithPropertyKey() +{ +} + +/* static */ IObjectWithPropertyKey *PyIObjectWithPropertyKey::GetI(PyObject *self) +{ + return (IObjectWithPropertyKey *)PyIUnknown::GetI(self); +} + +// @pymethod |PyIObjectWithPropertyKey|SetPropertyKey|Sets the property id +PyObject *PyIObjectWithPropertyKey::SetPropertyKey(PyObject *self, PyObject *args) +{ + IObjectWithPropertyKey *pIOWPK = GetI(self); + if ( pIOWPK == NULL ) + return NULL; + PROPERTYKEY key; + // @pyparm <o PyPROPERTYKEY>|key||The identifier of the property + if ( !PyArg_ParseTuple(args, "O&:SetPropertyKey", + PyWinObject_AsPROPERTYKEY, &key)) + return NULL; + HRESULT hr; + PY_INTERFACE_PRECALL; + hr = pIOWPK->SetPropertyKey(key); + PY_INTERFACE_POSTCALL; + + if ( FAILED(hr) ) + return PyCom_BuildPyException(hr, pIOWPK, IID_IObjectWithPropertyKey ); + Py_INCREF(Py_None); + return Py_None; +} + +// @pymethod <o PyPROPERTYKEY>|PyIObjectWithPropertyKey|GetPropertyKey|Returns the property id +PyObject *PyIObjectWithPropertyKey::GetPropertyKey(PyObject *self, PyObject *args) +{ + IObjectWithPropertyKey *pIOWPK = GetI(self); + if ( pIOWPK == NULL ) + return NULL; + PROPERTYKEY key; + HRESULT hr; + PY_INTERFACE_PRECALL; + hr = pIOWPK->GetPropertyKey(&key); + PY_INTERFACE_POSTCALL; + + if ( FAILED(hr) ) + return PyCom_BuildPyException(hr, pIOWPK, IID_IObjectWithPropertyKey ); + return PyWinObject_FromPROPERTYKEY(key); +} + +// @object PyIObjectWithPropertyKey|Interface implemented by objects that have an associated property id +static struct PyMethodDef PyIObjectWithPropertyKey_methods[] = +{ + { "SetPropertyKey", PyIObjectWithPropertyKey::SetPropertyKey, 1 }, // @pymeth SetPropertyKey|Sets the property id + { "GetPropertyKey", PyIObjectWithPropertyKey::GetPropertyKey, METH_NOARGS }, // @pymeth GetPropertyKey|Returns the property id + { NULL } +}; + +PyComTypeObject PyIObjectWithPropertyKey::type("PyIObjectWithPropertyKey", + &PyIUnknown::type, + sizeof(PyIObjectWithPropertyKey), + PyIObjectWithPropertyKey_methods, + GET_PYCOM_CTOR(PyIObjectWithPropertyKey)); diff -r e4fc118e3893 -r 7ff3b8548772 com/win32comext/propsys/src/PyIObjectWithPropertyKey.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/com/win32comext/propsys/src/PyIObjectWithPropertyKey.h Sat Nov 03 05:22:36 2012 -0400 @@ -0,0 +1,21 @@ +// This file declares the IObjectWithPropertyKey Interface and Gateway for Python. +// Generated by makegw.py +// --------------------------------------------------- +// +// Interface Declaration + +class PyIObjectWithPropertyKey : public PyIUnknown +{ +public: + MAKE_PYCOM_CTOR(PyIObjectWithPropertyKey); + static IObjectWithPropertyKey *GetI(PyObject *self); + static PyComTypeObject type; + + // The Python methods + static PyObject *SetPropertyKey(PyObject *self, PyObject *args); + static PyObject *GetPropertyKey(PyObject *self, PyObject *args); + +protected: + PyIObjectWithPropertyKey(IUnknown *pdisp); + ~PyIObjectWithPropertyKey(); +}; diff -r e4fc118e3893 -r 7ff3b8548772 com/win32comext/propsys/src/PyIPropertyChange.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/com/win32comext/propsys/src/PyIPropertyChange.cpp Sat Nov 03 05:22:36 2012 -0400 @@ -0,0 +1,65 @@ +// This file implements the IPropertyChange Interface and Gateway for Python. +// Generated by makegw.py + +#include "PythonCOM.h" +#include "PythonCOMServer.h" +#include "propsys.h" +#include "PyIObjectWithPropertyKey.h" +#include "PyIPropertyChange.h" +#include "PyPROPVARIANT.h" + +// @doc - This file contains autoduck documentation +// --------------------------------------------------- +// +// Interface Implementation + +PyIPropertyChange::PyIPropertyChange(IUnknown *pdisp): + PyIObjectWithPropertyKey(pdisp) +{ + ob_type = &type; +} + +PyIPropertyChange::~PyIPropertyChange() +{ +} + +/* static */ IPropertyChange *PyIPropertyChange::GetI(PyObject *self) +{ + return (IPropertyChange *)PyIObjectWithPropertyKey::GetI(self); +} + +// @pymethod <o PyPROPVARIANT>|PyIPropertyChange|ApplyToPropVariant|Applies the change to a variant value +PyObject *PyIPropertyChange::ApplyToPropVariant(PyObject *self, PyObject *args) +{ + IPropertyChange *pIPC = GetI(self); + if ( pIPC == NULL ) + return NULL; + PROPVARIANT *origval; + PROPVARIANT changedval; + // @pyparm <o PyPROPVARIANT>|OrigVal||The value to be modified + if (!PyArg_ParseTuple(args, "O&:ApplyToPropVariant", + PyWinObject_AsPROPVARIANT, &origval)) + return NULL; + + HRESULT hr; + PY_INTERFACE_PRECALL; + hr = pIPC->ApplyToPropVariant(*origval, &changedval); + PY_INTERFACE_POSTCALL; + + if ( FAILED(hr) ) + return PyCom_BuildPyException(hr, pIPC, IID_IPropertyChange ); + return PyWinObject_FromPROPVARIANT(changedval); +} + +// @object PyIPropertyChange|Interface used to specify a change to a property +static struct PyMethodDef PyIPropertyChange_methods[] = +{ + { "ApplyToPropVariant", PyIPropertyChange::ApplyToPropVariant, 1 }, // @pymeth ApplyToPropVariant|Applies the change to a variant value + { NULL } +}; + +PyComTypeObject PyIPropertyChange::type("PyIPropertyChange", + &PyIObjectWithPropertyKey::type, // @base PyIPropertyChange|PyIObjectWithPropertyKey + sizeof(PyIPropertyChange), + PyIPropertyChange_methods, + GET_PYCOM_CTOR(PyIPropertyChange)); diff -r e4fc118e3893 -r 7ff3b8548772 com/win32comext/propsys/src/PyIPropertyChange.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/com/win32comext/propsys/src/PyIPropertyChange.h Sat Nov 03 05:22:36 2012 -0400 @@ -0,0 +1,20 @@ +// This file declares the IPropertyChange Interface and Gateway for Python. +// Generated by makegw.py +// --------------------------------------------------- +// +// Interface Declaration + +class PyIPropertyChange : public PyIObjectWithPropertyKey +{ +public: + MAKE_PYCOM_CTOR(PyIPropertyChange); + static IPropertyChange *GetI(PyObject *self); + static PyComTypeObject type; + + // The Python methods + static PyObject *ApplyToPropVariant(PyObject *self, PyObject *args); + +protected: + PyIPropertyChange(IUnknown *pdisp); + ~PyIPropertyChange(); +}; diff -r e4fc118e3893 -r 7ff3b8548772 com/win32comext/propsys/src/PyIPropertyChangeArray.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/com/win32comext/propsys/src/PyIPropertyChangeArray.cpp Sat Nov 03 05:22:36 2012 -0400 @@ -0,0 +1,207 @@ +// This file implements the IPropertyChangeArray Interface and Gateway for Python. +// Generated by makegw.py + +#include "PythonCOM.h" +#include "PythonCOMServer.h" +#include "propsys.h" +#include "PyIPropertyChangeArray.h" +#include "PyPROPVARIANT.h" + +// @doc - This file contains autoduck documentation +// --------------------------------------------------- +// +// Interface Implementation + +PyIPropertyChangeArray::PyIPropertyChangeArray(IUnknown *pdisp): + PyIUnknown(pdisp) +{ + ob_type = &type; +} + +PyIPropertyChangeArray::~PyIPropertyChangeArray() +{ +} + +/* static */ IPropertyChangeArray *PyIPropertyChangeArray::GetI(PyObject *self) +{ + return (IPropertyChangeArray *)PyIUnknown::GetI(self); +} + +// @pymethod int|PyIPropertyChangeArray|GetCount|Returns the number of changes in the array +PyObject *PyIPropertyChangeArray::GetCount(PyObject *self, PyObject *args) +{ + IPropertyChangeArray *pIPCA = GetI(self); + if ( pIPCA == NULL ) + return NULL; + UINT cOperations; + HRESULT hr; + PY_INTERFACE_PRECALL; + hr = pIPCA->GetCount(&cOperations); + PY_INTERFACE_POSTCALL; + + if ( FAILED(hr) ) + return PyCom_BuildPyException(hr, pIPCA, IID_IPropertyChangeArray ); + return PyLong_FromUnsignedLong(cOperations); +} + +// @pymethod <o PyIPropertyChange>|PyIPropertyChangeArray|GetAt|Retrieves a change by zero-based index +PyObject *PyIPropertyChangeArray::GetAt(PyObject *self, PyObject *args) +{ + IPropertyChangeArray *pIPCA = GetI(self); + if ( pIPCA == NULL ) + return NULL; |