Author Topic: enumerating (listing) defined character styles  (Read 1566 times)

ancientgeek

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
  • Scribus User
enumerating (listing) defined character styles
« on: October 12, 2014, 11:32:18 am »
How do I enumerate the currently defined character styles in Python?
I need to make sure that certain character styles are defined in the current Scribus document.

Rummidge

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
  • Scribus User
Re: enumerating (listing) defined character styles
« Reply #1 on: June 29, 2015, 05:07:06 pm »
I know this topic is quite old but...

I am also interested in the topic you were, but I still got no answers. Meanwhile, I have partially solved (or avoided) your problem as you described it:

Quote
I need to make sure that certain character styles are defined in the current Scribus document.

by ensuring a given Master Page is loaded, something you can check via something similar to:

Code: [Select]
    def checkValidMasterPage(self,masterPageName):
        # if CD Sleeve is not a defined as a masterpage in the current document, we cannot use it
        if masterPageName not in scribus.masterPageNames():
            scribus.messageBox('Usage Error', 'You need a CD Sleeve Document open', icon=0, button1=1)
            sys.exit(2)

Good luck if you are still around!

It would be nice if the new API makes life easier in dealing with styles.