[python-win32] Writing an COM server and client with PyWin32

Thomas Pietrowski thopiekar at gmail.com
Mon Dec 11 17:47:19 EST 2017


Dear mailing-list members,

first I'd like to introduce myself. I'm Thomas Pietrowski and I'm working
on a plugin, which shall enable Windows Automation for Cura.
Cura is a slicing application for 3D-printers written in Python and I would
like to control this application over COM.

The last weeks I worked hard on getting something working and managed to do
function calls and get values of some attributes.
However, something I still don't manage to do is receiving signals.

While slicing there is the progress sent within Cura as a Qt signal. This
is one of the Qt signals, which I would turn into a COM event.
So whenever the progress changes, the widget in the GUI will get updated,
as well as the event will be sent over COM.

However, this is what I have in mind. What I still can't manage to get
working is executing a "DoEvent()" function, which emits an signal and
receiving the "OnEvent()" in my handler.
Whenever I want to DispatchWithEvents() or do a WithEvents() on a running
client session, I always get an error that the client can't manage to
automise something and I shall use makepy.
After using makepy I still get the same issue. So I guess I made something
wrong while writing my IDL and/or COM server. Therefore my client is not
able to get all the info it needs.

All source are available on GitHub:
https://github.com/thopiekar/CuraInterfacePlugin/tree/master-sending-and-receiving-signals
(here: "master-sending-and-receiving-signals" branch)

Do you see any mistakes I made?
Alternatively, do you have a working server/client example with working
events? This would probably give me an kickstart :)

With kind regards
- Thomas Karl Pietrowski
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20171211/b5af7cb7/attachment.html>


More information about the python-win32 mailing list