Back to index

scribus-ng  1.3.4.dfsg+svn20071115
trait_de_coupe.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 # -*- coding: utf-8 -*-
00003 
00004 """ Draws a "crop marks" around selected object """
00005 
00006 import sys
00007 
00008 try:
00009     from scribus import *
00010 except ImportError:
00011     print "This script only runs from within Scribus."
00012     sys.exit(1)
00013 
00014 def main():
00015     userUnit = getUnit()
00016     setUnit(1)
00017     x,y = getPosition()
00018     l,h = getSize()
00019     t1 = createLine(x, y-2, x, y-7)
00020     setLineWidth(0.1, t1)
00021     t2 = createLine(x+l, y-2, x+l, y-7)
00022     setLineWidth(0.1, t2)
00023     t3 = createLine(x, y+7+h, x, y+2+h)
00024     setLineWidth(0.1, t3)
00025     t4 = createLine(x+l, y+7+h, x+l, y+2+h)
00026     setLineWidth(0.1, t4)
00027     t5 = createLine(x-2, y, x-7, y)
00028     setLineWidth(0.1, t5)
00029     t6 = createLine(x-2, y+h, x-7, y+h)
00030     setLineWidth(0.1, t6)
00031     t7 = createLine(x+l+2, y+h, x+l+7, y+h)
00032     setLineWidth(0.1, t7)
00033     t7 = createLine(x+l+2, y, x+l+7, y)
00034     setLineWidth(0.1, t7)
00035     deselectAll()
00036     setUnit(userUnit)
00037 
00038 if __name__ == '__main__':
00039     if haveDoc() and selectionCount():
00040         main()
00041     else:
00042         messageBox("trait_de_coupe.py", "Please select an object to put crop marks around<i>before</i> running this script.", ICON_INFORMATION)