Ich versuche gerade ein StartUp-Script für scribus zu schreiben. In der scribus-Dokumentation findet sich folgender Beispielcode:
Code: Alles auswählen
#!/usr/bin/env python
# -*- coding: utf8 -*-
"""
This script is a simple example to show how you can trigger things based on
event hooks provided by Scribus. This sample runs the `gotSignal' method
when the app has finished setting up and it emits the appStarted() signal.
This is useful if, for example, you need access to the main window to
do your setup when running as a startup script.
This script isn't very interesting unless you run it as a startup script,
with Scribus running in an xterm, and watch the output on stdout/stderr.
You will need PyQt for this script to work.
"""
try:
import qt
except:
print "Seems you don't have PyQt. Doing nothing."
return
from qt import SIGNAL, PYSIGNAL, SLOT
# Note that to connect to signals etc you MUST inherit from QObject or a subclass
# of QObject.
class Recipient(qt.QObject):
def __init__(self):
# Connect ourselves to the "appStarted()" signal emitted by Scribus.
# Ask PyQt to run the self.gotSignal method when the signal is emitted.
self.connect(qt.qApp, SIGNAL("appStarted()"), self.gotSignal)
def gotSignal(self):
print "PONG!"
if __name__ == '__main__':
recip = Recipient();
Code: Alles auswählen
#!/usr/bin/env python
# -*- coding: utf8 -*-
import sys
import scribus
from PyQt4 import QtGui, QtCore
# Note that to connect to signals etc you MUST inherit from QObject or a subclass
# of QObject.
class Recipient(QtCore.QObject):
def __init__(self):
print "Test Self"
# Connect ourselves to the "appStarted()" signal emitted by Scribus.
# Ask PyQt to run the self.gotSignal method when the signal is emitted.
self.connect(QtGui.qApp, QtCore.SIGNAL("appStarted()"), self.gotSignal)
def gotSignal(self):
print "Test Signal"
scribus.openDoc("/home/foo/Dokument-1.sla")
if __name__ == '__main__':
print "Test Start"
recip = Recipient();
Code: Alles auswählen
Traceback (most recent call last):
File "", line 8, in
File "/home/scribus/startup_hook.py", line 17, in
import atexit
ImportError: No module named atexit
Ist meine Vermutung richtig? Kann mir bitte jemand auf die Sprünge helfen um das Script noch zum Laufen zu bekommen.
Vielen Dank
Klaus2002