Configtool: default new config options to disabled.

New boolean options were all enabled, which was a problem
especially with the boolean choices DISPLAY_BUS_xxx and
DISPLAY_TYPE_xxx: all choice entries were set to True, so display
code was not only enabled behind the users back, but also set to
an arbitrary value (depending on the Python implementation).
This commit is contained in:
Markus Hitter 2016-06-03 21:47:01 +02:00
parent 776b3dec94
commit 5a28a62717
2 changed files with 18 additions and 0 deletions

View File

@ -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.

View File

@ -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.