Scribus Forums

Scribus => Scripts and Plugins => Topic started by: dtribby on November 11, 2024, 07:49:40 AM

Title: Is there a way to delete a paragraph style in a script?
Post by: dtribby on November 11, 2024, 07:49:40 AM
I'm testing out Scribus 1.6.2 after having used 1.4.x for years. The main sticking point is all of the extra paragraph styles created when loading text from a file.

I've got a script that will tell me all of the unused paragraph styles whose names begin with the name of the current frame. I would like to delete all of them from the script, but could not find a Scribus function that does that action.

Is there a way to delete a paragraph style from a script?
Title: Re: Is there a way to delete a paragraph style in a script?
Post by: a.l.e on November 11, 2024, 07:53:44 PM
I did a quick search and, indeed, the command seems to be missing from the scripted API.

But it's probably easy to add.

On Thursday, I could give it a try.
Title: Re: Is there a way to delete a paragraph style in a script?
Post by: dtribby on November 11, 2024, 09:18:02 PM
Thanks! That would be great.
Title: Re: Is there a way to delete a paragraph style in a script?
Post by: a.l.e on November 14, 2024, 09:59:04 PM
I started to work on it...

... With a bit of luck, Saturday I could have a patch ready...
Title: Re: Is there a way to delete a paragraph style in a script?
Post by: dtribby on January 12, 2025, 07:39:33 AM
Did the new function to delete a paragraph style make it into Scribus version 1.6.3? I don't see it in the "For Developers/Scripter API/Creating & Manipulating Styles" section of Scribus Help for 1.6.3.

In the script, I tried
 deleteParagraphStyle(style)
but got the "name ... is not defined" error.
Title: Re: Is there a way to delete a paragraph style in a script?
Post by: a.l.e on January 12, 2025, 01:17:59 PM
Sorry, no.

I did some work on it, but the existing code for deleting styles is more intricate than I would have thoughts.

I still don't understand the meaning of all the arguments and how to make it work without being tightly bound to the Style manager.

I have not given up yet, and need to find some time to further dig into this...