pcbnew.GR_TEXT_HJUSTIFY_LEFT and pcbnew.GR_TEXT_VJUSTIFY_TOP disappeared from KiCad 7.0 Python bindings

I was using such values to properly set title block layout:

title_block = pcbnew.PCB_TEXT(self.board)
title_block.SetLayer(self.config_layer)
title_block.SetHorizJustify(pcbnew.GR_TEXT_HJUSTIFY_LEFT)
title_block.SetVertJustify(pcbnew.GR_TEXT_VJUSTIFY_TOP)
title_block.SetVisible(False)
self.config_textbox = title_block

Now it throws an exception since both GR_TEXT_HJUSTIFY_LEFT and GR_TEXT_VJUSTIFY_TOP don’t exists anymore . How can I fix this?

Or otherwise how can I check for the Kicad/API version and skip such lines of code?

They are now GR_TEXT_H_ALIGN_LEFT and such.

Use pcbnew.Version() or hasattr() to determine what’s in api.

from which version of Kicad is supported pcbnew.Version() ? I think 6.0 … right?

See also LBYL vs. EAFP. There is no API, only some bindings (using the wrong terminology will only allow to defer things more).

1 Like

Everything is an API if you squint hard enough. Calling it bindings while technically accurate doesn’t convey the purpose.

There is no need to speed anything up, I have first hand knowledge that kicad devs are working on it. They also were always clear that this is not stable API and never defended bindings as a choice as opposed to proper API, it just was not a priority to rework it until now.

Complaints were rightfully dismissed because plugin authors were given adequate warning.
You can argue that users that grow to like and depend on plugins are not aware of this and their complaints about plugins not being updated fast enough to new kicad versions are valid. But it’s all volunteer efforts, you’ll never be able to satisfy everyone.
And progress is made in the right direction, look at where kicad was just 2 years ago. As a plugin author myself, a stable API can’t come fast enough, as a kicad contributor I understand it’s a lot of work.
PCM solved important issue of discoverability and ease of installation of plugins. It’s the main reason we even hear so many complaints about api instability - users are now actually using plugins.
Arguing about semantics and what should and shouldn’t be called API doesn’t move the needle. New api is being worked on.

Looking forward to it (since adapting a plugin isn’t that fun).

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.