Question about config in addons

Javi Domínguez


I don't understand what happens with configuration values ​​that unexpectedly they change their type. I'm goin to describing the problem:

I have this definition:

confspec = {

Note that scale is boolean.

I then assign to profile[0] because I want my addon to be independent of the active profile. I'm not sure if this is the right way but it usually works for me:

config.conf.profiles[0]["screenshots"]["scale"] = config.conf["screenshots"]["scale"]

The problem comes when I open the settings panel

TypeError: CheckBox.SetValue(): argument 1 has unexpected type 'str'

I jump this error to be able to continue the execution and I get to:

config.conf.profiles[0]["screenshots"]["scale"] = self.checkboxEnlargement.GetValue()

Here the type is boolean, correct, And so it continues for the rest of the session, until I restart NVDA. When the GlobalPlugin is reloaded, in the first line of __init__ I check the type and it is STR.

I can patch it by adding a few lines and it will work but I'd rather understand what's going on. Does anyone have any ideas?

Full code is here:


Join { to automatically receive all group messages.