close scribus by python script

Previous topic - Next topic

kincza

Hello,

I made an python script to convert sla files to eps. This function works as a service. After the scribus has started the script is loaded with an autohotkey script.
My script is listening on an ActiveMQ queue. If the message is arrived to the queue, the script convert the sla file (was specified in the message) to eps format.
Howewer sometimes (after hundred of messages or after 3-4 days) the scribus is slower and slower. I thought that it would be better if I restart the scribus after 100 messages but I don't know how can I close the scribus from the python script.
It is possible?

Regards,

kincza

Astroman Pete

Yes. I'd do it with Qt's QApplication object. You'll need a PyQt installation of the same version as Scribus' Qt installation.

When I run this as an extension script, it exits Scribus:


import site

# Replace with site.getsitepackages(), site.getusersitepackages()
# from you're system Python installation.
SITE_DIRS = ['C:/Python27', 'C:/Python27/lib/site-packages', ]

for p in SITE_DIRS:
    site.addsitedir(p)

import PyQt4.QtGui as gui

app = gui.QApplication.instance()
app.exit(0)