Scribus 1.7.0.svn New Scripting Functions

Previous topic - Next topic

Darkoni

Hi!

I have made a compilation of my own script functions that I needed for Scribus.

The functions are:

* guidesLock
* guidesSnap
* textFrameChainShow
* unlinkTextFrameAndCutText
* selectObjectAlone
* placeSVGname
* placeSVGnameFromString
* insertHtmlFromString
* getDocumentationIndex
* getDocumentation

More on GitLab:

https://gitlab.com/Darkoni/Scribus_170_New_Scripting_Functions/

Darko Nikolić  8)

a.l.e

hi darko

wow.

some feedback from my side:


  • guidesLock() and guidesSnap(): they need an argument -- defaulting to True -- for turning off the feature. probably the companions isGuidesLock() and isGuidesSnap() are also to be created in the same go (this is mostly an instinctive reaction: i'm not 100% sure that there is a use case for checking the state)
    finally, the commands should probably go to cmdpage, not cmdtext.
  • textFrameChainShow(): i'd rather call it showTextFramesChain() and as for the guides, it should have an argument to turn it off and a "getter" to test its state.
  • unlinkTextFrameAndCutText(): rather than creating a new function, i'd prefer to see a new named (optional) argument (cutText=False) in unlinkTextFrame().
  • selectObjectAlone(): it's indeed tedious to always need to clear the selection first. as for unlinking the text frames, i'd prefer a named argument "clearSelection=False" in selectObject, which would also "automatically" better document the "odd" behavior of selectObject()
  • placeSVGname(): i'd prefer to see placeSVG() to always return the name of the group that has been created (iirc, not trivial to do; but i think that i have an unfinished patch that goes in that direction)
  • placeSVGnameFromString(): i guess that the filename in placeSVG() should be optional and it needs a named argument svgString (or similar). probably, you saw that coming, after the previous comments : - )
  • insterHTMLFromString(): see above : - )
  • getDocumentation: you can achieve the same with python's dir (and with the inspect module it gets rather powerful: i have a script -- currently in a ḧeavy refactoring process (adding arbitrary text) -- that with the help of mkdocs produces https://impagina.org/scribus-scripter-api ).
    i'm not sure that this new command is really needed.

all in all, you seem to propose a few useful commands for the scripter api and a few others that can help in automatically setting up a "standard" environment.

nice.

if you need help for the changes i suggested just ask.
it would be nice if you could propose patches that can get into scribus!

have a nice sunday
a.l.e