Subversion Repositories Scribus

Compare Revisions

Regard whitespace Rev 2616 → Rev 2617

47,5 → 47,8
bool showSplash;
bool showFontInfo;
QString file;
void appStarted();
0,0 → 1,38
#!/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.
import qt
print "Seems you don't have PyQt. Doing nothing."
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();
Property changes:
Added: svn:eol-style
## -0,0 +1 ##
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: branches/Version13x/Scribus/scribus/scribusapp.cpp
--- branches/Version13x/Scribus/scribus/scribusapp.cpp (revision 2616)
+++ branches/Version13x/Scribus/scribus/scribusapp.cpp (revision 2617)
@@ -172,8 +172,14 @@
if (file != "")
+ // A hook for plug-ins and scripts to trigger on. Some plugins and scripts
+ // require the app to be fully set up (in particular, the main window to be
+ // built and shown) before running their setup.
+ emit appStarted();