~ubuntu-branches/ubuntu/wily/scribus/wily-proposed

« back to all changes in this revision

Viewing changes to scribus/plugins/scriptplugin/samples/startup_hook.py

  • Committer: Package Import Robot
  • Author(s): Oleksandr Moskalenko
  • Date: 2012-02-09 21:50:56 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20120209215056-2wrx1ara0jbm7fi5
Tags: 1.4.0.dfsg+r17287-1
* New upstream stable release upload into Debian (Closes: #654703).
* Applied the Ubuntu armel patch.
* Removed non-free color swatches from resources.
* debian/control:
  - Moved icc-profiles from Recommends to Suggests (Closes: #655885).
  - Updated Standards-Version to 3.9.2.
  - Updated extended description per lintian warning.
* debian/rules:
  - Update mailcap (Closes: #630751). A request for mime.types update has
    been sent to the mime-support maintainer.
  - Added build-arch and build-indep targets per lintian warning.
* debian/patches:
  - top_cmakelists.patch - don't copy extra docs and changelogs.
  - scribus_cmakelists.patch - don't copy extra docs and changelogs.
  - scribus_cmakelists.patch - don't install the non-free "doc" dir.
  - profiles_cmakelists.patch - don't install non-free sRGB profile.
* debian/copyright: 
  - Converted to the DEP5 machine readable foramt.
  - Added licenses for free color swatches.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/env python
2
 
# -*- coding: utf8 -*-
3
 
 
4
 
"""
5
 
This script is a simple example to show how you can trigger things based on
6
 
event hooks provided by Scribus. This sample runs the `gotSignal' method
7
 
when the app has finished setting up and it emits the appStarted() signal.
8
 
This is useful if, for example, you need access to the main window to
9
 
do your setup when running as a startup script.
10
 
 
11
 
This script isn't very interesting unless you run it as a startup script,
12
 
with Scribus running in an xterm, and watch the output on stdout/stderr.
13
 
 
14
 
You will need PyQt for this script to work.
15
 
"""
16
 
 
17
 
try:
18
 
    import qt
19
 
except:
20
 
    print "Seems you don't have PyQt. Doing nothing."
21
 
    return
22
 
 
23
 
from qt import SIGNAL, PYSIGNAL, SLOT
24
 
 
25
 
# Note that to connect to signals etc you MUST inherit from QObject or a subclass
26
 
# of QObject.
27
 
class Recipient(qt.QObject):
28
 
 
29
 
    def __init__(self):
30
 
        # Connect ourselves to the "appStarted()" signal emitted by Scribus.
31
 
        # Ask PyQt to run the self.gotSignal method when the signal is emitted.
32
 
        self.connect(qt.qApp, SIGNAL("appStarted()"), self.gotSignal)
33
 
 
34
 
    def gotSignal(self):
35
 
        print "PONG!"
36
 
 
37
 
if __name__ == '__main__':
38
 
    recip = Recipient();