Ejemplo n.º 1
0
def createCell(text, roffset, coffset, w, h, marginl, margint, isBlack):
    #Create textbox
    box=scribus.createRect(marginl+(roffset-1)*w,margint+(coffset-1)*h, w, h)
    textBox=scribus.createText(marginl+(roffset-1)*w,margint+(coffset-1)*h, w, h)
    #insert the text into textbox
    scribus.setFont("Arial Bold", textBox)
    
    
    
    #Default  font size
    fontSize=12
    if len(text) < 50: fontSize=14
    if len(text) < 20: fontSize=16
    scribus.setFontSize(fontSize, textBox)
    scribus.setTextDistances(3, 3, 3, 3, textBox)
    scribus.insertText(text, 0, textBox)

    #black card
    if isBlack==True:
        scribus.setFillColor("Black", box)
        scribus.setTextColor("White", textBox)
        scribus.setLineColor("White", box)


    #add Logo
    hOffset=37
    wOffset=5
    addLogo(marginl+(roffset-1)*w+wOffset,margint+(coffset-1)*h+hOffset, isBlack)
    return
Ejemplo n.º 2
0
 def pasteCaption(self, xpos, ypos, text, width, imgheight=0, footer=False):
    height = 5 
    rect = scribus.createRect(xpos, ypos, width, height)
    scribus.setFillColor("Black",rect)
    scribus.setFillTransparency(0.60,rect)
    scribus.setCornerRadius(ROUNDS,rect)
    scribus.setLineColor("White",rect)
    scribus.setLineWidth(0.4,rect)
    frame = scribus.createText(xpos+2, ypos+1, width, height)
    self.styleText(text, "imageCaption", frame)
    scribus.setTextColor("White",frame)
    scribus.setFillColor("None",frame)
    # there are probably some performance issues in the following section of code
    if scribus.textOverflows(frame) == 0:
       # its a one liner, so shrink width
       while scribus.textOverflows(frame) == 0 and width > 5:
          width = width - 1
          scribus.sizeObject(width, height, frame)
       scribus.sizeObject(width+2, height, frame)
       scribus.sizeObject(width+4, height, rect)
    else:
       # its a multi liner, expand vertically
       while scribus.textOverflows(frame) > 0:
          height = height + 1
          scribus.sizeObject(width, height, frame)
       scribus.sizeObject(width, height+1, rect)
    if footer:
       scribus.moveObject(0,imgheight - height - 1,rect)
       scribus.moveObject(0,imgheight - height - 1,frame)
    self.imageframes.append(rect)
    self.imageframes.append(frame)
Ejemplo n.º 3
0
def createCell(text, roffset, coffset, w, h, marginl, margint, isBlack):
    #Create textbox
    box=scribus.createRect(marginl+(roffset-1)*w,margint+(coffset-1)*h, w, h)
    textBox=scribus.createText(marginl+(roffset-1)*w,margint+(coffset-1)*h, w, h)
    #insert the text into textbox
    scribus.setFont("Arial Bold", textBox)
    
    
    
    #Default  font size
    fontSize=12
    if len(text) < 50: fontSize=14
    if len(text) < 20: fontSize=16
    scribus.setFontSize(fontSize, textBox)
    scribus.setTextDistances(3, 3, 3, 3, textBox)
    scribus.insertText(text, 0, textBox)

    #black card
    if isBlack==True:
        scribus.setFillColor("Black", box)
        scribus.setTextColor("White", textBox)
        scribus.setLineColor("White", box)


    #add Logo
    hOffset=37
    wOffset=5
    addLogo(marginl+(roffset-1)*w+wOffset,margint+(coffset-1)*h+hOffset, isBlack)
    return
Ejemplo n.º 4
0
 def pasteCaption(self, xpos, ypos, text, width, imgheight=0, footer=False):
     height = 5
     rect = scribus.createRect(xpos, ypos, width, height)
     scribus.setFillColor("Black", rect)
     scribus.setFillTransparency(0.60, rect)
     scribus.setCornerRadius(ROUNDS, rect)
     scribus.setLineColor("White", rect)
     scribus.setLineWidth(0.4, rect)
     frame = scribus.createText(xpos + 2, ypos + 1, width, height)
     self.styleText(text, "imageCaption", frame)
     scribus.setTextColor("White", frame)
     scribus.setFillColor("None", frame)
     # there are probably some performance issues in the following section of code
     if scribus.textOverflows(frame) == 0:
         # its a one liner, so shrink width
         while scribus.textOverflows(frame) == 0 and width > 5:
             width = width - 1
             scribus.sizeObject(width, height, frame)
         scribus.sizeObject(width + 2, height, frame)
         scribus.sizeObject(width + 4, height, rect)
     else:
         # its a multi liner, expand vertically
         while scribus.textOverflows(frame) > 0:
             height = height + 1
             scribus.sizeObject(width, height, frame)
         scribus.sizeObject(width, height + 1, rect)
     if footer:
         scribus.moveObject(0, imgheight - height - 1, rect)
         scribus.moveObject(0, imgheight - height - 1, frame)
     self.imageframes.append(rect)
     self.imageframes.append(frame)
Ejemplo n.º 5
0
def main(argv):

	rectColor = "Black"
	topMargin, leftMargin, rightMargin, bottomMargin = scribus.getPageMargins()
	pageWidth, pageHeight = scribus.getPageSize()
	printAreaWidth  = pageWidth  - leftMargin - rightMargin
	printAreaHeight = pageHeight - topMargin  - bottomMargin

	vertRectW = random.randrange(2,4)
	vertRectH = random.randrange(48,50)
	horRectW = random.randrange(47,49)
	horRectH = random.randrange(2,5)

	startx = leftMargin
	endx = pageWidth - leftMargin - horRectW
	starty = topMargin
	endy = pageHeight - topMargin - vertRectH

	numberRectVert = random.randrange(400,600)
	numberRectHor = random.randrange(400,600)
	opacity = 0

	scribus.progressTotal(numberRectVert+numberRectHor)
	scribus.setRedraw(False)

	for i in range(1, numberRectVert):
		opacity = opacity + 0.002
		xpos = random.randrange(int(startx),int(endx))
		ypos = random.randrange(int(starty),int(endy))
		rect = scribus.createRect(xpos, ypos, vertRectW, vertRectH)
		scribus.setFillColor(rectColor, rect)
		scribus.setLineColor("None", rect) 
		if opacity < 1:
			scribus.setFillTransparency(opacity, rect) 
		scribus.progressSet(i*2)


	for i in range(1, numberRectVert):
		opacity = opacity + 0.002
		xpos = random.randrange(int(startx),int(endx))
		ypos = random.randrange(int(starty),int(endy))
		recthor = scribus.createRect(xpos, ypos, horRectW, horRectH)
		scribus.setFillColor(rectColor, recthor)
		scribus.setLineColor("None", recthor) 
		if opacity < 1:
			scribus.setFillTransparency(opacity, recthor)

	scribus.progressReset()
	scribus.docChanged(True)
	scribus.statusMessage("Done")
	scribus.setRedraw(True)
Ejemplo n.º 6
0
def drawColor(colorname, h, v, width, height):  # h horizontal position, v vertical position
    """draws a color chart field with its caption for the given colorname at the h and v position
    """
    # get cmyk values and convert them to 0 - 255 values
    color = scribus.getColor(colorname)
    c = int(round(color[0] / 2.55))
    m = int(round(color[1] / 2.55))
    y = int(round(color[2] / 2.55))
    k = int(round(color[3] / 2.55))
    # get rgb color
    rgbcolor = scribus.getColorAsRGB(colorname)
    r = rgbcolor[0]
    g = rgbcolor[1]
    b = rgbcolor[2]
    # get webcolor
    webcolor = rgbhex(r, g, b)
    # but String for Textbox together
    colorDisplay = colorname
    if scribus.isSpotColor(colorname):
        colorDisplay += " (Spot Color)"
    colorstring = "%s\nC %i, M %i, Y %i, K %i, \nR %i, G %i, B %i \nRGB: %s" % (
        colorDisplay,
        c,
        m,
        y,
        k,
        r,
        g,
        b,
        webcolor,
    )

    # draw rectangle and set colors
    rect = scribus.createRect(h, v, width, height)
    scribus.setFillColor(colorname, rect)
    # if total amount of color is < 20 draw outline in Black for rectangle, else in same color
    if c + m + y + k < 20:
        scribus.setLineColor("Black", rect)
    else:
        scribus.setLineColor(colorname, rect)
    # create textbox and insert text
    textbox = scribus.createText(h + width + 5, v, 50, height)
    # set proper font size
    scribus.setFontSize(11, textbox)
    scribus.setTextAlignment(scribus.ALIGN_LEFT, textbox)
    # load the string into the textbox
    scribus.insertText(colorstring, 0, textbox)
Ejemplo n.º 7
0
def drawPlaceholders():
    page = scribus.getPageSize()
    margin = scribus.getPageMargins()

    # add the page margins
    rectangle = scribus.createRect(margin[1], margin[0],
                                   (page[0] - margin[1] - margin[2]),
                                   (page[1] - margin[0] - margin[3]))
    scribus.setFillColor('none', rectangle)
    scribus.setLineColor('Blue', rectangle)
    scribus.setLineWidth(0.4, rectangle)

    # add horizontal and vertical guides
    for item in scribus.getHGuides():
        line = scribus.createLine(0, item, page[0], item)
        scribus.setLineColor('Black', line)
        scribus.setLineWidth(0.6, line)
        scribus.setLineStyle(scribus.LINE_DASHDOT, line)

    for item in scribus.getVGuides():
        line = scribus.createLine(item, 0, item, page[0])
        scribus.setLineColor('Black', line)
        scribus.setLineWidth(0.6, line)
        scribus.setLineStyle(scribus.LINE_DASHDOT, line)

    # add a "crossed frame" for missing images
    for item in scribus.getAllObjects():
        if scribus.getObjectType(item) == 'ImageFrame':
            image = scribus.getImageFile(item)
            if image == '':
                pos = scribus.getPosition(item)
                size = scribus.getSize(item)
                rectangle = scribus.createRect(pos[0], pos[1], size[0],
                                               size[1])
                scribus.setFillColor('none', rectangle)
                scribus.setLineColor('Black', rectangle)
                scribus.setLineWidth(0.4, rectangle)
                line = scribus.createLine(pos[0], pos[1], pos[0] + size[0],
                                          pos[1] + size[1])
                scribus.setLineColor('Black', line)
                scribus.setLineWidth(0.4, line)
                line = scribus.createLine(pos[0], pos[1] + size[1],
                                          pos[0] + size[0], pos[1])
                scribus.setLineColor('Black', line)
                scribus.setLineWidth(0.4, line)
Ejemplo n.º 8
0
 def draw(self):
    if self.txt != "":
       if scribus.currentPage() % 2 == 0:   
          r = scribus.createRect(-1,self.y,8,self.height)
          t = scribus.createText(2,self.y + self.height,self.height,6)
       else:   
          (pagewidth, pageheight) = scribus.getPageSize()
          r = scribus.createRect(pagewidth-7,self.y,8,self.height)
          t = scribus.createText(pagewidth-5,self.y + self.height,self.height,6)
       scribus.setFillColor("Black",r)
       scribus.setFillShade(20,r)
       scribus.setLineColor("None",r)
       scribus.setCornerRadius(ROUNDS,r)
       scribus.insertText(self.txt, -1, t)
       scribus.deselectAll()
       scribus.selectObject(t)
       scribus.selectText(0, len(self.txt), t)
       scribus.setStyle("Sidebar", t)
       scribus.rotateObject(90,t)
       self.frames.append(r)
       self.frames.append(t)
Ejemplo n.º 9
0
def drawColor(colorname, h, v, width,
              height):  #h horizontal position, v vertical position
    """draws a color chart field with its caption for the given colorname at the h and v position
    """
    #get cmyk values and convert them to 0 - 255 values
    color = scribus.getColor(colorname)
    c = int(round(color[0] / 2.55))
    m = int(round(color[1] / 2.55))
    y = int(round(color[2] / 2.55))
    k = int(round(color[3] / 2.55))
    #get rgb color
    rgbcolor = scribus.getColorAsRGB(colorname)
    r = rgbcolor[0]
    g = rgbcolor[1]
    b = rgbcolor[2]
    #get webcolor
    webcolor = rgbhex(r, g, b)
    #but String for Textbox together
    colorDisplay = colorname
    if scribus.isSpotColor(colorname):
        colorDisplay += " (Spot Color)"
    colorstring = "%s\nC %i, M %i, Y %i, K %i, \nR %i, G %i, B %i \nRGB: %s" % (
        colorDisplay, c, m, y, k, r, g, b, webcolor)

    #draw rectangle and set colors
    rect = scribus.createRect(h, v, width, height)
    scribus.setFillColor(colorname, rect)
    #if total amount of color is < 20 draw outline in Black for rectangle, else in same color
    if c + m + y + k < 20:
        scribus.setLineColor("Black", rect)
    else:
        scribus.setLineColor(colorname, rect)
    #create textbox and insert text
    textbox = scribus.createText(h + width + 5, v, 50, height)
    #set proper font size
    scribus.setFontSize(11, textbox)
    scribus.setTextAlignment(scribus.ALIGN_LEFT, textbox)
    #load the string into the textbox
    scribus.insertText(colorstring, 0, textbox)
    scribus.setTextColor("Black", textbox)
def drawPlaceholders():
    page = scribus.getPageSize()
    margin = scribus.getPageMargins()

    # add the page margins
    rectangle = scribus.createRect(margin[1], margin[0], (page[0] - margin[1] - margin[2]), (page[1] - margin[0] - margin[3]))
    scribus.setFillColor('none', rectangle)
    scribus.setLineColor('Blue', rectangle)
    scribus.setLineWidth(0.4, rectangle)

    # add horizontal and vertical guides
    for item in scribus.getHGuides():
        line = scribus.createLine(0, item , page[0], item)
        scribus.setLineColor('Black', line)
        scribus.setLineWidth(0.6, line)
        scribus.setLineStyle(scribus.LINE_DASHDOT, line)

    for item in scribus.getVGuides():
        line = scribus.createLine(item, 0 , item, page[0])
        scribus.setLineColor('Black', line)
        scribus.setLineWidth(0.6, line)
        scribus.setLineStyle(scribus.LINE_DASHDOT, line)

    # add a "crossed frame" for missing images
    for item in scribus.getAllObjects():
        if scribus.getObjectType(item) == 'ImageFrame':
            image = scribus.getImageFile(item)
            if image == '':
                pos = scribus.getPosition(item)
                size = scribus.getSize(item)
                rectangle = scribus.createRect(pos[0], pos[1], size[0], size[1])
                scribus.setFillColor('none', rectangle)
                scribus.setLineColor('Black', rectangle)
                scribus.setLineWidth(0.4, rectangle)
                line = scribus.createLine(pos[0], pos[1] , pos[0] + size[0], pos[1] + size[1])
                scribus.setLineColor('Black', line)
                scribus.setLineWidth(0.4, line)
                line = scribus.createLine(pos[0], pos[1] + size[1], pos[0] + size[0], pos[1])
                scribus.setLineColor('Black', line)
                scribus.setLineWidth(0.4, line)
Ejemplo n.º 11
0
 def draw(self):
     if self.txt != "":
         if scribus.currentPage() % 2 == 0:
             r = scribus.createRect(-1, self.y, 8, self.height)
             t = scribus.createText(2, self.y + self.height, self.height, 6)
         else:
             (pagewidth, pageheight) = scribus.getPageSize()
             r = scribus.createRect(pagewidth - 7, self.y, 8, self.height)
             t = scribus.createText(pagewidth - 5, self.y + self.height,
                                    self.height, 6)
         scribus.setFillColor("Black", r)
         scribus.setFillShade(20, r)
         scribus.setLineColor("None", r)
         scribus.setCornerRadius(ROUNDS, r)
         scribus.insertText(self.txt, -1, t)
         scribus.deselectAll()
         scribus.selectObject(t)
         scribus.selectText(0, len(self.txt), t)
         scribus.setStyle("Sidebar", t)
         scribus.rotateObject(90, t)
         self.frames.append(r)
         self.frames.append(t)
Ejemplo n.º 12
0
def addLogo(x, y, isBlack):
    #square side
    a=5
    #line
    line=0.01
    #angle
    angle=15
    #LightGrey
    scribus.defineColor("LightGrey",0,0,0,128)
    #DarkGrey
    scribus.defineColor("DarkGrey",0,0,0,192)
    
    # White cards colors
    squareColor1="Black"
    lineColor1="White"
    squareColor2="DarkGrey"
    lineColor2="White"
    squareColor3="LightGrey"
    lineColor3="White"
    titleColor="Black"
    
    # Black cards colors
    if isBlack==True:
        squareColor1="DarkGrey"
        lineColor1="DarkGrey"
        squareColor2="LightGrey"
        lineColor2="LightGrey"
        squareColor3="White"
        lineColor3="White"
        titleColor="White"
    
    square1=scribus.createRect(x, y+a/10, a, a)
    scribus.setLineWidth(1, square1)
    scribus.setFillColor(squareColor1, square1)
    scribus.setLineColor(lineColor1, square1)
    scribus.rotateObject(angle, square1)
    
    square2=scribus.createRect(x+a/2, y, a, a)
    scribus.setLineWidth(1, square2)
    scribus.setFillColor(squareColor2, square2)
    scribus.setLineColor(lineColor2, square2)
    
    square3=scribus.createRect(x+a, y, a, a)
    scribus.setLineWidth(1, square3)
    scribus.setFillColor(squareColor3, square3)
    scribus.setLineColor(lineColor3, square3)
    scribus.rotateObject(-angle, square3)
    
    title=scribus.createText(x+10,y+2, 50, 5)
    scribus.setFont("Arial Bold", title)
    scribus.setFontSize(8, title)
    scribus.insertText("Game of Filth", 0, title)
    scribus.setTextColor(titleColor, title)
    return
Ejemplo n.º 13
0
def addLogo(x, y, isBlack):
    #square side
    a=5
    #line
    line=0.01
    #angle
    angle=15
    #LightGrey
    scribus.defineColor("LightGrey",0,0,0,128)
    #DarkGrey
    scribus.defineColor("DarkGrey",0,0,0,192)
    
    # White cards colors
    squareColor1="Black"
    lineColor1="White"
    squareColor2="DarkGrey"
    lineColor2="White"
    squareColor3="LightGrey"
    lineColor3="White"
    titleColor="Black"
    
    # Black cards colors
    if isBlack==True:
        squareColor1="DarkGrey"
        lineColor1="DarkGrey"
        squareColor2="LightGrey"
        lineColor2="LightGrey"
        squareColor3="White"
        lineColor3="White"
        titleColor="White"
    
    square1=scribus.createRect(x, y+a/10, a, a)
    scribus.setLineWidth(1, square1)
    scribus.setFillColor(squareColor1, square1)
    scribus.setLineColor(lineColor1, square1)
    scribus.rotateObject(angle, square1)
    
    square2=scribus.createRect(x+a/2, y, a, a)
    scribus.setLineWidth(1, square2)
    scribus.setFillColor(squareColor2, square2)
    scribus.setLineColor(lineColor2, square2)
    
    square3=scribus.createRect(x+a, y, a, a)
    scribus.setLineWidth(1, square3)
    scribus.setFillColor(squareColor3, square3)
    scribus.setLineColor(lineColor3, square3)
    scribus.rotateObject(-angle, square3)
    
    title=scribus.createText(x+10,y+2, 50, 5)
    scribus.setFont("Arial Bold", title)
    scribus.setFontSize(8, title)
    scribus.insertText("Cards Against Humanity", 0, title)
    scribus.setTextColor(titleColor, title)
    return
Ejemplo n.º 14
0
 def pasteSpacer(self, xpos, ypos, width, height):
     img = scribus.createRect(xpos, ypos, width, height)
     scribus.textFlowMode(img, 1)
     scribus.setLineColor("None", img)
     scribus.setFillColor("None", img)
     self.imageframes.append(img)
Ejemplo n.º 15
0
def main(argv):

    scribus.setUnit(scribus.UNIT_MILLIMETERS)

    # get page size
    pagesize = scribus.getPageSize()

    ###########################################

    # size and position of the exit buttons
    linksize = pagesize[0] / 30
    linkpos = pagesize[0] - linksize - 2

    # set up exit to page
    pagenum = scribus.pageCount()
    exittopage = scribus.valueDialog(
        "Exit to page",
        "Exit buttons should go to page (1-" + str(pagenum) + ") :", "1")

    #error
    #if exittopage > pagenum:
    #    scribus.messageBox("Error", "This page doesn't exist.")
    #    sys.exit()

    # get active layer, create new layer for exit buttons, set it as active
    activelayer = scribus.getActiveLayer()
    scribus.createLayer("Exitbuttons")
    scribus.setActiveLayer("Exitbuttons")

    #progressbar max
    scribus.progressTotal(pagenum)

    # iterate through all the pages
    page = 1
    while (page <= pagenum):

        #messagebar text
        scribus.messagebarText("Create exit buttons...")

        scribus.progressSet(page)
        scribus.gotoPage(page)

        # create rectangle
        exitrect = scribus.createRect(linkpos, 2, linksize, linksize,
                                      "exitrect" + str(page))
        scribus.setFillColor("White", exitrect)

        # create text in rectangle
        exittext = scribus.createText(linkpos, 4, linksize, linksize,
                                      "exittext" + str(page))

        scribus.setText("X", exittext)
        scribus.setFontSize(20, exittext)
        scribus.setTextAlignment(1, exittext)

        # create link annotation
        exitlink = scribus.createText(linkpos, 2, linksize, linksize,
                                      "exitlink" + str(page))
        #setLinkAnnotation(page,x,y,["name"])
        scribus.setLinkAnnotation(int(exittopage), 0, 0, exitlink)

        # add page number to iteration
        page += 1

    # go back to active layer
    scribus.setActiveLayer(activelayer)
Ejemplo n.º 16
0
import scribus
n = scribus.selectionCount()
list = []
for i in range(0, n):
    list.append(scribus.getSelectedObject(i))

margin = 2
fillColor = "White"
lineStyle = "noLine"
lineWidth = 0

#deselectAll()
for selected in list:
    x, y = scribus.getPosition(selected)
    width, height = scribus.getSize(selected)
    scribus.setFillColor(fillColor, selected)
    scribus.setLineShade(lineWidth, selected)
    scribus.setLineWidth(lineWidth, selected)
    scribus.setLineTransparency(lineWidth, selected)
    #scribus.setLineStyle(lineStyle, rectangle)
    #scribus.setStrokeColor(strokeColor, rectangle)
Ejemplo n.º 17
0
horRectH = random.randrange(2,5)

startx = leftMargin
endx = pageWidth - leftMargin - horRectW
starty = topMargin
endy = pageHeight - topMargin - vertRectH

numberRectVert = random.randrange(400,600)
numberRectHor = random.randrange(400,600)
opacity = 0

for i in range(1, numberRectVert):
	opacity = opacity + 0.002
	xpos = random.randrange(int(startx),int(endx))
	ypos = random.randrange(int(starty),int(endy))
	rect = scribus.createRect(xpos, ypos, vertRectW, vertRectH)
	scribus.setFillColor(rectColor, rect)
	scribus.setLineColor("None", rect) 
	if opacity < 1:
		scribus.setFillTransparency(opacity, rect) 


for i in range(1, numberRectVert):
	opacity = opacity + 0.002
	xpos = random.randrange(int(startx),int(endx))
	ypos = random.randrange(int(starty),int(endy))
	recthor = scribus.createRect(xpos, ypos, horRectW, horRectH)
	scribus.setFillColor(rectColor, recthor)
	scribus.setLineColor("None", recthor) 
	if opacity < 1:
		scribus.setFillTransparency(opacity, recthor) 
Ejemplo n.º 18
0
import scribus
n = scribus.selectionCount()
list = []
for i in range(0, n):
    list.append(scribus.getSelectedObject(i))

margin = 2
fillColor = "White"
lineStyle = "noLine"
lineWidth = 0

#deselectAll()
for selected in list:
    x, y = scribus.getPosition(selected)
    width, height = scribus.getSize(selected)
    rectangle = scribus.createRect(x - margin, y - margin, width + margin * 2,
                                   height + margin * 2)
    scribus.setFillColor(fillColor, rectangle)
    scribus.setLineShade(lineWidth, rectangle)
    #scribus.setLineStyle(lineStyle, rectangle)
    #scribus.setStrokeColor(strokeColor, rectangle)
unit = scribus.getUnit()
scribus.setUnit(unit)
scribus.setUnit(scribus.UNIT_MILLIMETERS)

item = scribus.getSelectedObject()
size = scribus.getSize(item)
position = scribus.getPosition(item)

thickness = 3

items_border = []

items_border.append(
    scribus.createRect(position[0], position[1], size[0], thickness))
items_border.append(
    scribus.createRect(position[0], position[1], thickness, size[1]))
items_border.append(
    scribus.createRect(position[0], position[1] + size[1] - thickness, size[0],
                       thickness))
items_border.append(
    scribus.createRect(position[0] + size[0] - thickness, position[1],
                       thickness, size[1]))

for i in items_border:
    scribus.setFillColor('Black', i)

scribus.groupObjects(items_border)

scribus.setUnit(unit)
Ejemplo n.º 20
0
 def pasteSpacer(self, xpos, ypos, width, height):
    img = scribus.createRect(xpos, ypos, width, height)
    scribus.textFlowMode(img,1)
    scribus.setLineColor("None",img)
    scribus.setFillColor("None",img)
    self.imageframes.append(img)
Ejemplo n.º 21
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

# Dieses Script von Michael Binder <*****@*****.**> ist unter einer Creative Commons Lizenz vom Typ Namensnennung - Weitergabe unter gleichen Bedingungen 3.0 Deutschland zugänglich. Um eine Kopie dieser Lizenz einzusehen, konsultieren Sie http://creativecommons.org/licenses/by-sa/3.0/de/ oder wenden Sie sich brieflich an Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.

"""Scribus Script

This script searches for a named object and marks the finding in yellow. """

try:
    import scribus
except ImportError:
    print "This script can only be run as an extension script from Scribus"
    sys.exit(1) 

# check opened document
if not scribus.haveDoc():
       scribus.messageBox('Scribus - Script Error', "No document open", scribus.ICON_WARNING, scribus.BUTTON_OK)
       sys.exit(1)

scribus.setRedraw(False)

defaultsearchfor = ""
searchfor = scribus.valueDialog("Search", "Search for this object.\nThe color of the found object will be changed to yellow.\n\nName:", defaultsearchfor)

scribus.deselectAll()
scribus.selectObject(searchfor)
scribus.setFillColor("Yellow", searchfor)
 
scribus.setRedraw(True)
scribus.docChanged(True)
      scribus.defineColor('Gray', 10, 10, 10, 10)
  for item in range(baseline + baseline_start*multiplicator, int(page[1] * multiplicator + baseline_start*multiplicator), baseline) :
    # print item/multiplicator
    while guide_i < guide_n - 1 and item/multiplicator > guide + 0.15 :
        guide_i = guide_i + 1
        guide = guide_list[guide_i]
    if item/multiplicator < guide - 0.15 :
        line = scribus.createLine(0, item/multiplicator , page[0], item/multiplicator)
        scribus.setLineColor('Gray', line)
        scribus.setLineWidth(0.6, line)
        # scribus.setLineStyle(scribus.LINE_DASHDOT, line)


# add the page margins
rectangle = scribus.createRect(margin[1], margin[0], (page[0] - margin[1] - margin[2]), (page[1] - margin[0] - margin[3]))
scribus.setFillColor('none', rectangle)
scribus.setLineColor('Blue', rectangle)
scribus.setLineWidth(0.4, rectangle)

# add horizontal and vertical guides
for item in scribus.getHGuides():
    line = scribus.createLine(0, item , page[0], item)
    scribus.setLineColor('Black', line)
    scribus.setLineWidth(0.6, line)
    scribus.setLineStyle(scribus.LINE_DASHDOT, line)

for item in scribus.getVGuides():
    line = scribus.createLine(item, 0 , item, page[1])
    scribus.setLineColor('Black', line)
    scribus.setLineWidth(0.6, line)
    scribus.setLineStyle(scribus.LINE_DASHDOT, line)
def main(argv):

    scribus.setUnit(scribus.UNIT_MILLIMETERS)

    # get page size and page count
    pagesize = scribus.getPageSize()
    pagenum = scribus.pageCount()

    #create on page
    selectedpage = scribus.valueDialog(
        "Select page", "Create arrows and annotation links on page (1-" +
        str(pagenum) + ") :", "1")

    # get active layer, create new layer for exit buttons, set it as active
    #activelayer = scribus.getActiveLayer()
    scribus.createLayer("Arrowlinks")
    scribus.setActiveLayer("Arrowlinks")

    #progressbar max
    scribus.progressTotal(pagenum)

    arrowinitxpos = 10
    arrowinitypos = 30

    scribus.gotoPage(int(selectedpage))

    page = 1
    ###########################################

    for i in range(pagenum):
        # create rectangle
        #exitrect = scribus.createRect(arrowinitxpos, 50, 30, 30, "exitrect")

        #messagebar text
        scribus.messagebarText(
            "Creating arrows and annotation links on page " + selectedpage +
            "...")

        #progress bar
        scribus.progressSet(page)

        #create and distribute arrow
        arrowpoly = [
            10, 30, 30, 10, 50, 30, 40, 30, 40, 50, 20, 50, 20, 30, 10, 30
        ]
        arrowup = scribus.createPolygon(arrowpoly)
        scribus.sizeObject(10, 10, arrowup)
        scribus.moveObjectAbs(arrowinitxpos, arrowinitypos, arrowup)
        scribus.setFillColor("White", arrowup)

        #create and distribute links
        arrowlink = scribus.createText(arrowinitxpos, arrowinitypos + 11, 10,
                                       10, "link_to_page_" + str(page))
        #setLinkAnnotation(page,x,y,["name"])
        scribus.setLinkAnnotation(int(page), 0, 0, arrowlink)

        arrowinitxpos += 11

        if arrowinitxpos > 250:
            arrowinitypos += 24
            arrowinitxpos = 10

        # add page number to iteration
        page += 1