Example #1
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)
Example #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)
Example #3
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)
Example #4
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)