[scribus] Text edit through Python Scribus API

Fresco Gamba robot at yugo.at
Mon Nov 28 15:01:48 UTC 2011


Being redirected from the IRC channel, I am seeking some useful advice
on this mailing-list. I am currently stuck with an issue regarding
changing text attributes through the python API. For a collaborative
software publication we are using RSS feeds (form Wordpress) which are
fetched and "beautified" into several Scribus text-boxes. Most of the
html-tags are being purged through the use of regular expressions.
However, I would like to keep the <br> , <strong> <b> and <i> tags in
order to keep the text nicely formatted. Hence, I would need to change
the font-face within certain textboxes and applying them to specific
words. As far as I can read from the documentation, there is no such a
function in the python API. setFont() applies the selected font to the
whole textbox. Is there are any work-around known to achieve the same
result within python as manually selecting a word and changing its
attributes within the Scribus Texteditor ?

I guess, a function to set a different fontface from a certain position
within the textbox would do the trick; sthg. like:
scribus.setFontPos(font, startPos, endPos, textbox);

where startPos and endPos could be guessed utilizing python find("<b>")
etc..

Anyone had similar problems and/or found workarounds?

Thanks,
/f




More information about the scribus mailing list