diff --git a/configtool/boardpanel.py b/configtool/boardpanel.py index e449153..8376048 100644 --- a/configtool/boardpanel.py +++ b/configtool/boardpanel.py @@ -267,6 +267,18 @@ class BoardPanel(wx.Panel): self.parseDefineName(ln) self.parseDefineValue(ln) + # Set all boolean generic configuration items to False, so items not yet + # existing in the user configuration default to disabled. + # + # An alternative would be to allow both, enabled and disabled booleans + # in board.generic.h, which then allows to set an appropriate default for + # each #define. This was tried but conflicted with config file writing code + # below (disabled #defines were reset to the default, even when set + # differently in the GUI), so this would need adjustment, too. + for k in self.cfgValues.keys(): + if isinstance(self.cfgValues[k], bool): + self.cfgValues[k] = False + # Read the user configuration. This usually overwrites all of the items # read above, but not those missing in the user configuration, e.g. # when reading an older config. diff --git a/configtool/printerpanel.py b/configtool/printerpanel.py index 08ab132..7eb7211 100644 --- a/configtool/printerpanel.py +++ b/configtool/printerpanel.py @@ -232,6 +232,12 @@ class PrinterPanel(wx.Panel): self.parseDefineName(ln) self.parseDefineValue(ln) + # Set all boolean generic configuration items to False, so items not yet + # existing in the user configuration default to disabled. + for k in self.cfgValues.keys(): + if isinstance(self.cfgValues[k], bool): + self.cfgValues[k] = False + # Read the user configuration. This usually overwrites all of the items # read above, but not those missing in the user configuration, e.g. # when reading an older config.