[Scribus] different paragraph-Styles from scripter (1.3)
Ralf-Diether Ebel
ebel
Fri Oct 21 12:44:47 CEST 2005
On 21 Oct 2005 15:34 Craig Ringer wrote:
> Ralf-Diether Ebel wrote:
> > setText("ABC"+chr(13),ob) #chr(13) should be paragraph -or?
>
> That's exactly equivalent to:
>
> setText("ABC\r")
>
> though it's more common to use:
>
> setText("ABC\n")
Thanks, I didn't know that.
> Scribus doesn't appear to care about the difference.
>
> > setStyle("Style1,ob)
> > insertText("DEF",-1,ob)
> > selectText(4,3,ob)
> > setStyle("Style2,ob)
> >
> > Regardless what I do, the whole frame has always the same style,
> > normaly the last applied.
>
> Yep. setStyle(...) will only apply its effects to a selection if no
> object target is given. I realise that's surprising, but it's
> consistent with the rest of the API, and until/unless we can perhaps
> provide a more OO API it's likely to stay like that.
>
> Unfortunately, that doesn't seem to be working right now. I'm unsure
> of why that is. It seems to be a problem with selecting the text range
> rather than with applying the style, as if I hand-select the range it
> all works fine. I'm using current "great breakage" CVS not anoncvs, so
> it's entirely possible this is a problem you won't have. Please let me
> know.
With me it's also now working, using anoncvs, even if i give no object in
the setStyle.
> On a side note, would you find something like this more friendly
> (extended example):
>
> doc = scribus.documents.currentDocument()
> ob = doc.newTextFrame(100,100,100,100,doc.currentPage)
> ob.text = "ABC\nfred\n"
> par0 = ob.selectText(0,3) # select first paragraph
> par0.style = doc.styles["fred"]
> par1and2.style = doc.styles.defaultStyle()
> ob.text += "More text\n"
> ob.paragraph[2].paragraphStyle = doc.styles["wilma"]
Thanks,
will try it
>
> Frames could also be acccessed by name, eg:
>
> doc.frames["barney"]
>
> and manipulated by properties, eg:
>
> doc.frames["barney"].text =
> scribus.documents["MyDoc"].frames["barney"]
>
> plus it should be possible to do things like use slices to make
> selections on frames and work with the selection, though that's
> require a much more flexible concept of "selection" than the Scribus
> core presently has:
>
> ob.pars[1:3].style = "dinosaur"
>
> There are lots of fun possibilities for making scripting more
> intuitive and "python-like". With Boost::Python it might not even be
> insanely painful to implement ;-)
>
> If I ever find myself landing on about a billion years of free time
> and sort out the other things I really need to do in the Scribus core
> code (encoding fixes, FileLoader plugin work, etc) that's what I'm
> really hoping to put in place with the approval of Petr and all you
> folks who use the scripting API. Look reasonable?
Sorry, I'm just little bit trying with python to make an every-day
calendar. I just have to look at the above to understand this, but many
thanks.
Ralf-Diether Ebel
Gruß Ralf-Diether
PGP-Key Fingerprint:
0C9C 8A65 D8A9 2566 A4E0 3738 7F4C B1D8 E031 4065
More information about the scribus
mailing list