Difference between revisions of "Generate a ten page layout with three columns on each page"

From Scribus Wiki
Jump to navigation Jump to search
m
(deprecated newdoc)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
 
{{Scripting Index}}
 
{{Scripting Index}}
  
The following script generates a ten page layout with three columns a columnline and a column-headline on each page. It's an example for using some base script elements like newDoc(), newPage(), createText() an so on. Its been tested with scribus 1.3.1cvs on Mac OSX. Please pay attention to the FIRSTPAGELEFT constant. During my tests scribus creates a right page as first page. I think this is a bug and could get corrected next time, so you have to change it to FISTPAGERIGHT.
+
The following script generates a ten page layout with three columns a columnline and a column-headline on each page. It's an example for using some base script elements like newDoc(), newPage(), createText() an so on. Its been tested with '''scribus 1.3.1cvs on Mac OSX'''. Please pay attention to the FIRSTPAGELEFT constant. During my tests scribus creates a right page as first page. I think this is a bug and could get corrected next time, so you have to change it to FISTPAGERIGHT.
 +
 
 +
 
 +
Warning !! 'newDoc' function is deprecated. Use instead newDocument(). Look at the online manual for more details.
 +
 
 +
todo : update script.
 +
 
  
 
----
 
----
Line 28: Line 34:
 
     createText(59, 24, 55/mm, 199/mm, "Kolumne_"+str(f+1)+"_links_2")
 
     createText(59, 24, 55/mm, 199/mm, "Kolumne_"+str(f+1)+"_links_2")
 
     createText(118, 24, 55/mm, 199/mm, "Kolumne_"+str(f+1)+"_links_3")</nowiki></pre>
 
     createText(118, 24, 55/mm, 199/mm, "Kolumne_"+str(f+1)+"_links_3")</nowiki></pre>
 +
 +
----
 +
 +
For use with '''scribus 1.2.3''' you have to change the constants for calculating Millimeters/Points mm to Millimeters and the constant FIRSTPAGELEFT to FIRSTPAGERIGHT because scribus 1.2.3 has no bug here.
 +
 +
 +
----
 +
 +
<pre><nowiki>from scribus import *
 +
newDoc((185, 250), (12, 20, 15, 28), PORTRAIT, 1, UNIT_MILLIMETERS, FACINGPAGES, FIRSTPAGERIGHT)
 +
 +
for i in range(9) :
 +
    newPage(-1)
 +
 +
for f in range(1,10,2) :
 +
    gotoPage(f)
 +
    createLine(12, 20, 126, 20)
 +
    createText(71, 15, 55/Millimeters, 6/Millimeters, "Kolumnentitel_"+str(f))
 +
    setText("Kolumnentitel", "Kolumnentitel_"+str(f))
 +
    setTextAlignment(ALIGN_RIGHT, "Kolumnentitel_"+str(f))
 +
    createText(12, 24, 55/Millimeters, 199/Millimeters, "Kolumne_"+str(f)+"_rechts_1")
 +
    createText(71, 24, 55/Millimeters, 199/Millimeters, "Kolumne_"+str(f)+"_rechts_2")
 +
    createText(130, 24, 35/Millimeters, 199/Millimeters, "Kolumne_"+str(f)+"_rechts_3")
 +
    gotoPage(f+1)
 +
    createLine(59, 20, 173, 20)
 +
    createText(59, 15, 55/Millimeters, 6/Millimeters, "Kolumnentitel_"+str(f+1))
 +
    setText("Kolumnentitel", "Kolumnentitel_"+str(f+1))
 +
    setTextAlignment(ALIGN_LEFT, "Kolumnentitel_"+str(f+1))
 +
    createText(20, 24, 35/Millimeters, 199/Millimeters, "Kolumne_"+str(f+1)+"_links_1")
 +
    createText(59, 24, 55/Millimeters, 199/Millimeters, "Kolumne_"+str(f+1)+"_links_2")
 +
    createText(118, 24, 55/Millimeters, 199/Millimeters, "Kolumne_"+str(f+1)+"_links_3")</nowiki></pre>
 +
  
 
----
 
----

Latest revision as of 16:49, 18 December 2014

This article is part of the Scripts series.

The following script generates a ten page layout with three columns a columnline and a column-headline on each page. It's an example for using some base script elements like newDoc(), newPage(), createText() an so on. Its been tested with scribus 1.3.1cvs on Mac OSX. Please pay attention to the FIRSTPAGELEFT constant. During my tests scribus creates a right page as first page. I think this is a bug and could get corrected next time, so you have to change it to FISTPAGERIGHT.


Warning !! 'newDoc' function is deprecated. Use instead newDocument(). Look at the online manual for more details.

todo : update script.



from scribus import *
newDoc((185, 250), (12, 20, 15, 28), PORTRAIT, 1, UNIT_MILLIMETERS, FACINGPAGES, FIRSTPAGELEFT)

for i in range(9) :
    newPage(-1)

for f in range(1,10,2) :
    gotoPage(f)
    createLine(12, 20, 126, 20)
    createText(71, 15, 55/mm, 6/mm, "Kolumnentitel_"+str(f))
    setText("Kolumnentitel", "Kolumnentitel_"+str(f))
    setTextAlignment(ALIGN_RIGHT, "Kolumnentitel_"+str(f))
    createText(12, 24, 55/mm, 199/mm, "Kolumne_"+str(f)+"_rechts_1")
    createText(71, 24, 55/mm, 199/mm, "Kolumne_"+str(f)+"_rechts_2")
    createText(130, 24, 35/mm, 199/mm, "Kolumne_"+str(f)+"_rechts_3")
    gotoPage(f+1)
    createLine(59, 20, 173, 20)
    createText(59, 15, 55/mm, 6/mm, "Kolumnentitel_"+str(f+1))
    setText("Kolumnentitel", "Kolumnentitel_"+str(f+1))
    setTextAlignment(ALIGN_LEFT, "Kolumnentitel_"+str(f+1))
    createText(20, 24, 35/mm, 199/mm, "Kolumne_"+str(f+1)+"_links_1")
    createText(59, 24, 55/mm, 199/mm, "Kolumne_"+str(f+1)+"_links_2")
    createText(118, 24, 55/mm, 199/mm, "Kolumne_"+str(f+1)+"_links_3")

For use with scribus 1.2.3 you have to change the constants for calculating Millimeters/Points mm to Millimeters and the constant FIRSTPAGELEFT to FIRSTPAGERIGHT because scribus 1.2.3 has no bug here.



from scribus import *
newDoc((185, 250), (12, 20, 15, 28), PORTRAIT, 1, UNIT_MILLIMETERS, FACINGPAGES, FIRSTPAGERIGHT)

for i in range(9) :
    newPage(-1)

for f in range(1,10,2) :
    gotoPage(f)
    createLine(12, 20, 126, 20)
    createText(71, 15, 55/Millimeters, 6/Millimeters, "Kolumnentitel_"+str(f))
    setText("Kolumnentitel", "Kolumnentitel_"+str(f))
    setTextAlignment(ALIGN_RIGHT, "Kolumnentitel_"+str(f))
    createText(12, 24, 55/Millimeters, 199/Millimeters, "Kolumne_"+str(f)+"_rechts_1")
    createText(71, 24, 55/Millimeters, 199/Millimeters, "Kolumne_"+str(f)+"_rechts_2")
    createText(130, 24, 35/Millimeters, 199/Millimeters, "Kolumne_"+str(f)+"_rechts_3")
    gotoPage(f+1)
    createLine(59, 20, 173, 20)
    createText(59, 15, 55/Millimeters, 6/Millimeters, "Kolumnentitel_"+str(f+1))
    setText("Kolumnentitel", "Kolumnentitel_"+str(f+1))
    setTextAlignment(ALIGN_LEFT, "Kolumnentitel_"+str(f+1))
    createText(20, 24, 35/Millimeters, 199/Millimeters, "Kolumne_"+str(f+1)+"_links_1")
    createText(59, 24, 55/Millimeters, 199/Millimeters, "Kolumne_"+str(f+1)+"_links_2")
    createText(118, 24, 55/Millimeters, 199/Millimeters, "Kolumne_"+str(f+1)+"_links_3")