コード例 #1
0
def copyPlayer(sourceName, destinationName):
    if scribus.objectExists(sourceName):
        doc = scribus.getDocName()
        unit = scribus.getUnit()
        (PageWidth, PageHeight) = scribus.getPageSize()
        (iT, iI, iO, iB) = scribus.getPageMargins()
        NewPagepoint = PageHeight - iT - iB
        player = scribus.selectObject(sourceName)
        #Duplicate the object...
        scribus.duplicateObject(sourceName)
        x = scribus.getSelectedObject()
        newObjectName = str(x)
        size = scribus.getSize(newObjectName)
        scribus.moveObject(0, size[1], newObjectName)
        (x, y) = scribus.getPosition(newObjectName)
        scribus.setRedraw(1)
        scribus.docChanged(1)
        if (y + size[1] > NewPagepoint):
            currentPage = scribus.currentPage()
            scribus.newPage(-1)
            newPage = currentPage + 1
            scribus.copyObject(newObjectName)
            scribus.deleteObject(newObjectName)
            scribus.gotoPage(newPage)
            scribus.pasteObject(newObjectName)
            scribus.moveObjectAbs(iO, iT, newObjectName)
        scribus.setNewName(destinationName, sourceName)
        scribus.setNewName(sourceName, newObjectName)
コード例 #2
0
def fileMatchingTextFrame(sampleFrameName, pattern):
    pagenum = scribus.pageCount()
    for page in range(1, pagenum + 1):
        scribus.gotoPage(page)
        d = scribus.getPageItems()
        for item in d:
            # print(item)
            frameName = item[0]
            if (item[1] == 4):
                if frameName != sampleFrameName and remove_copy_prefix(frameName).startswith(pattern):
                    print(frameName + " found")
                    position = scribus.getPosition(frameName)
                    scribus.selectObject(sampleFrameName)
                    scribus.duplicateObject()
                    #duplicateFrameName = scribus.getSelectedObject()
                    scribus.moveObjectAbs(position[0], position[1])
                    scribus.deleteObject(frameName)
コード例 #3
0
def fileMatchingTextFrame(sampleFrameName, pattern):
    pagenum = scribus.pageCount()
    for page in range(1, pagenum + 1):
        scribus.gotoPage(page)
        d = scribus.getPageItems()
        for item in d:
            # print(item)
            frameName = item[0]
            if (item[1] == 4):
                if frameName != sampleFrameName and remove_copy_prefix(
                        frameName).startswith(pattern):
                    print(frameName + " found")
                    position = scribus.getPosition(frameName)
                    scribus.selectObject(sampleFrameName)
                    scribus.duplicateObject()
                    #duplicateFrameName = scribus.getSelectedObject()
                    scribus.moveObjectAbs(position[0], position[1])
                    scribus.deleteObject(frameName)
コード例 #4
0

checkForOneFrameSelected()

currentFrameName = scribus.getSelectedObject()
print(currentFrameName)

if (scribus.getObjectType(currentFrameName) == 4):
    scribus.messageBox('Scribus - Usage Error',
                       "You did not select a textframe. Try again.",
                       scribus.ICON_WARNING, scribus.BUTTON_OK)
    sys.exit(2)

# the pattern is the name of the current frame up to the first digit
# and with the "Copy of " at the beginning stripped away.
matchNonDigit = re.compile(r'(^\D+)')
matchResult = matchNonDigit.search(currentFrameName)
pattern = matchResult.group(1)
pattern = remove_copy_prefix(pattern)
pattern = remove_copy_prefix(pattern)
print("pattern: " + pattern)

scribus.duplicateObject()
duplicateFrameName = scribus.getSelectedObject()

print(duplicateFrameName)

fileMatchingTextFrame(duplicateFrameName, pattern)

scribus.deleteObject(duplicateFrameName)
コード例 #5
0
                    scribus.moveObjectAbs(position[0], position[1])
                    scribus.deleteObject(frameName)
                    # TODO: rename the duplicate to the old frameName

checkForOneFrameSelected()
 
currentFrameName = scribus.getSelectedObject()
print(currentFrameName)

if (scribus.getObjectType(currentFrameName) == 4):
    scribus.messageBox('Scribus - Usage Error', "You did not select a textframe. Try again.", scribus.ICON_WARNING, scribus.BUTTON_OK)
    sys.exit(2)

# the pattern is the name of the current frame up to the first digit
# and with the "Copy of " at the beginning stripped away.
matchNonDigit = re.compile(r'(^\D+)')
matchResult = matchNonDigit.search(currentFrameName)
pattern = matchResult.group(1)
pattern = remove_copy_prefix(pattern)
pattern = remove_copy_prefix(pattern)
print("pattern: " + pattern)

scribus.duplicateObject()
duplicateFrameName = scribus.getSelectedObject()

print(duplicateFrameName)

fileMatchingTextFrame(duplicateFrameName, pattern)

scribus.deleteObject(duplicateFrameName)
コード例 #6
0
def main(argv):
    unit = scribus.getUnit()
    units = ['pts','mm','inches','picas','cm','ciceros']
    unitlabel = units[unit]
    
# get page size
    pagesize = scribus.getPageSize()

    
# ask for layout style
    layout_style = scribus.valueDialog("Select Mirror", layout_text, "v")
    if layout_style == "":
        sys.exit()

        

# v = vertical mirror
    if layout_style == "v":            
        # warn and exit if no selection
        if scribus.selectionCount() == 0:
            scribus.messageBox("Error", "Select an object first!", icon=scribus.ICON_WARNING)
            sys.exit()
        
        #create mirror guides
        scribus.setVGuides(scribus.getHGuides() + [pagesize[0]/2])
        
        #get selected object
        selection_name = scribus.getSelectedObject(0)
        objectpos = scribus.getPosition(selection_name)
        objectsize = scribus.getSize(selection_name)
        
        #duplicate object
        scribus.duplicateObject(selection_name)
        
        #move object
        newobjectpos = (pagesize[0] - (objectpos[0] + objectsize[0]) , objectpos[1])
        scribus.moveObjectAbs(newobjectpos[0], objectpos[1], selection_name)
        
        #flip object
        scribus.flipObject(1,0,selection_name)

        

# h = horizontal mirror
    if layout_style == "h":            
        # warn and exit if no selection
        if scribus.selectionCount() == 0:
            scribus.messageBox("Error", "Select an object first!", icon=scribus.ICON_WARNING)
            sys.exit()
        
        #create mirror guides
        scribus.setHGuides(scribus.getHGuides() + [pagesize[1]/2])
        
        #get selected object
        selection_name = scribus.getSelectedObject(0)
        objectpos = scribus.getPosition(selection_name)
        objectsize = scribus.getSize(selection_name)
        
        #duplicate object
        scribus.duplicateObject(selection_name)
        
        #move object
        newobjectpos = (objectpos[0] , pagesize[1] - (objectpos[1] + objectsize[1]))
        scribus.moveObjectAbs(objectpos[0], newobjectpos[1], selection_name)
        
        #flip object
        scribus.flipObject(0,1,selection_name)