Hi, I am making a new script with GUI and I want to be able to change current master from a button. Is there a way to change selected master from Python? Alternatively, if there is a way to notify the script that the current master has changed, that would be helpful (I was thinking of routinely checking the current master, like every second or something).
To get the current master: call
selectedFontMaster.id on the font.
To set the master in a tab, use
setMasterIndex_ on the tab.
I used some of that stuff in the Kernkraft Plugin.
The font has a property .masterIndex
That can be used to get and set the master in the current tab.
Thanks guys, it worked!
I have a script with vanilla GUI that needs to change its EditText and slider values according to the choice of current master. I have no way of knowing if the user has changed the master or not, so I made a master switcher popup in my window. I don’t think this is the smartest option and think there should be some kind of observer. Am I right?
What exactly are you trying to do?
Let’s say you have a slider that represents LSB and you can adjust spacing that way. To make it Multiple Master savvy, it needs to move the slider position when the current master has changed.
Have a peek into my Synced Tabs. I implemented a master change observer there. That should get you going.