Back to index

scribus-ng  1.3.4.dfsg+svn20071115
pochette_cd.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 # -*- coding: utf-8 -*-
00003 
00004 """ This script creates a CD Pochette - a paper pocket for CD/DVD disc """
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 margins = (0, 0, 0, 0)
00015 paper = (210, 297)
00016 
00017 def main():
00018     if newDocument(paper, margins, 1, 1, 1, NOFACINGPAGES, FIRSTPAGELEFT,1):
00019         setUnit(1)
00020         newPage(-1)
00021         gotoPage(1)
00022         createLayer("normal")
00023         setActiveLayer("normal")
00024         a = createText(98.5, 20, 100, 10)
00025         setText("CD pochette - front page", a)
00026         setFontSize(11, a)
00027         setTextAlignment(1, a)
00028         b = createText(28.5, 45, 120, 120)
00029         setFillColor("None", b)
00030         c = createText(148.5, 45, 120, 120)
00031         setFillColor("None", c)
00032         createLayer("bords_perdus")
00033         setActiveLayer("bords_perdus")
00034         img1 = createImage(24.35, 41.25 , 124.20, 127.95,)
00035         img2 = createImage(148.55, 41.25 , 124.20, 127.95,)
00036         createLayer("coupe")
00037         setActiveLayer("coupe")
00038         t1 = createLine(28.5, 38, 28.5, 43)
00039         setLineWidth(0.1, t1)
00040         t2 = createLine(148.5, 38, 148.5, 43)
00041         setLineWidth(0.1, t2)
00042         t3 = createLine(268.5, 38, 268.5, 43)
00043         setLineWidth(0.1, t3)
00044         t4 = createLine(28.5, 172, 28.5, 167)
00045         setLineWidth(0.1, t4)
00046         t5 = createLine(148.5, 172, 148.5, 167)
00047         setLineWidth(0.1, t5)
00048         t6 = createLine(268.5, 172, 268.5, 167)
00049         setLineWidth(0.1, t6)
00050         t7 = createLine(21.5, 45, 26.5, 45)
00051         setLineWidth(0.1, t7)
00052         t8 = createLine(21.5, 165, 26.5, 165)
00053         setLineWidth(0.1, t8)
00054         t9 = createLine(270.5, 45, 275.5, 45)
00055         setLineWidth(0.1, t9)
00056         t10 = createLine(270.5, 165, 275.5, 165)
00057         setLineWidth(0.1, t10)
00058         gotoPage(2)
00059         setActiveLayer("normal")
00060         a2 = createText(98.5, 20, 100, 10)
00061         setText("CD pochette - back page", a2)
00062         setFontSize(11, a2)
00063         setTextAlignment(1, a2)
00064         a2t = createText(204, 44, 78, 9)
00065         setText("Mode d'emploi :", a2t)
00066         setFontSize(13, a2t)
00067         setTextAlignment(1, a2t)
00068         a21 = createText(204, 54, 78, 87)
00069         setText("Usage. TODO: tranlslate it from french", a21)
00070         setFontSize(11, a21)
00071         setTextAlignment(0, a21)
00072         b2 = createText(28.5, 162.10, 117, 6)
00073         setText("Texte sur la tranche", b2)
00074         setFontSize(9, b2)
00075         setTextAlignment(1, b2)
00076         rotateObjectAbs(90, b2)
00077         setFillColor("None", b2)
00078         c2 = createText(34.5, 45, 137.5, 117)
00079         setFillColor("None", c2)
00080         d2 = createText(28.5, 162.10, 117, 6)
00081         setText("Texte sur la tranche", d2)
00082         setFontSize(9, d2)
00083         setTextAlignment(1, d2)
00084         rotateObjectAbs(90, d2)
00085         setFillColor("None", d2)
00086         moveObject(143.5, 0, d2)
00087         setActiveLayer("bords_perdus")
00088         img3 = createImage(24.35, 41.25 , 157.50, 126.50,)
00089         setActiveLayer("coupe")
00090         t21 = createLine(28.5, 38, 28.5, 43)
00091         setLineWidth(0.1, t21)
00092         t22 = createLine(34.5, 38, 34.5, 43)
00093         setLineWidth(0.1, t22)
00094         t23 = createLine(172, 38, 172, 43)
00095         setLineWidth(0.1, t23)
00096         t24 = createLine(178, 38, 178, 43)
00097         setLineWidth(0.1, t24)
00098         t25 = createLine(28.5, 164.5, 28.5, 169.5)
00099         setLineWidth(0.1, t25)
00100         t26 = createLine(34.5, 164, 34.5, 169.5)
00101         setLineWidth(0.1, t26)
00102         t27 = createLine(172, 164, 172, 169.5)
00103         setLineWidth(0.1, t27)
00104         t28 = createLine(178, 164, 178, 169.5)
00105         setLineWidth(0.1, t28)
00106         t29 = createLine(22.5, 45, 27.5, 45)
00107         setLineWidth(0.1, t29)
00108         t30 = createLine(22.5, 162, 27.5, 162)
00109         setLineWidth(0.1, t30)
00110         t31 = createLine(179.5, 45, 184.5, 45)
00111         setLineWidth(0.1, t31)
00112         t32 = createLine(179.5, 162, 184.5, 162)
00113         setLineWidth(0.1, t32)
00114         saveDocAs("pochette_CD.sla")
00115 
00116 if __name__ == '__main__':
00117     main()