home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 November / CPNL0711.ISO / beeld / teken / scribus-1.3.3.9-win32-install.exe / share / samples / trait_de_coupe.py < prev    next >
Text File  |  2004-12-14  |  1KB  |  43 lines

  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3.  
  4. """ Draws a "crop marks" around selected object """
  5.  
  6. import sys
  7.  
  8. try:
  9.     from scribus import *
  10. except ImportError:
  11.     print "This script only runs from within Scribus."
  12.     sys.exit(1)
  13.  
  14. def main():
  15.     userUnit = getUnit()
  16.     setUnit(1)
  17.     x,y = getPosition()
  18.     l,h = getSize()
  19.     t1 = createLine(x, y-2, x, y-7)
  20.     setLineWidth(0.1, t1)
  21.     t2 = createLine(x+l, y-2, x+l, y-7)
  22.     setLineWidth(0.1, t2)
  23.     t3 = createLine(x, y+7+h, x, y+2+h)
  24.     setLineWidth(0.1, t3)
  25.     t4 = createLine(x+l, y+7+h, x+l, y+2+h)
  26.     setLineWidth(0.1, t4)
  27.     t5 = createLine(x-2, y, x-7, y)
  28.     setLineWidth(0.1, t5)
  29.     t6 = createLine(x-2, y+h, x-7, y+h)
  30.     setLineWidth(0.1, t6)
  31.     t7 = createLine(x+l+2, y+h, x+l+7, y+h)
  32.     setLineWidth(0.1, t7)
  33.     t7 = createLine(x+l+2, y, x+l+7, y)
  34.     setLineWidth(0.1, t7)
  35.     deselectAll()
  36.     setUnit(userUnit)
  37.  
  38. if __name__ == '__main__':
  39.     if haveDoc() and selectionCount():
  40.         main()
  41.     else:
  42.         messageBox("trait_de_coupe.py", "Please select an object to put crop marks around<i>before</i> running this script.", ICON_INFORMATION)
  43.