> Nonetheless, C?dric is right, even though you can create a style you cannot 
> apply it with a script.

Yes, we can apply it in selected paragraph. No problem. This snippet
show functions that do the job:

APPEND = -1  # -1 append text to frame

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

def applyStyle(style,story):

    '''Try apply style to selected text. If style doesn't exist, create it.'''

    try:

        scribus.setStyle(style, story)

    except:

        scribus.createParagraphStyle(style)

        scribus.setStyle(style, story)

    return story


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

# Insert text and
 format paragraph

def formatParagraph(textBegin,text,style,story):

    '''Insert text and format paragraph.'''

    paraLen = len(text)

    scribus.insertText(text, APPEND, story)

    scribus.selectText(textBegin, paraLen-1, story)

    applyStyle(style, story)

    # Hyphenate if style is in hyphenation list

    if hyphenate.count(style) != 0:

        scribus.hyphenateText()

    return paraLen



------------------------------
nome: "Jos? Antonio Meira da Rocha"
googletalk: email: MSN: joseantoniorocha at gmail.com
ve?culo: [ http://meiradarocha.jor.br ]
------------------------------

Reply via email to