Configtool: deal with missing #defines requiring a value.

This is done by parsing values from the generic config before
parsing those in the user config. Values existing in the user
config overwrite those in the generic config; values not
existing there stay at the value in the generic config.

Previously, only boolean #defines were handled properly (and
by code somewhere else). Missing #defines with value were
written as boolean #define, making the file unparseable on
the next read.
This commit is contained in:
Markus Hitter 2016-06-01 18:47:24 +02:00
parent 9d3a064f40
commit d49520c36d
2 changed files with 9 additions and 2 deletions

View File

@ -265,7 +265,11 @@ class BoardPanel(wx.Panel):
prevLines = ""
self.parseDefineName(ln)
self.parseDefineValue(ln)
# 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.
gatheringHelpText = False
prevLines = ""
for ln in self.userBuffer:

View File

@ -230,7 +230,11 @@ class PrinterPanel(wx.Panel):
prevLines = ""
self.parseDefineName(ln)
self.parseDefineValue(ln)
# 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.
gatheringHelpText = False
prevLines = ""
for ln in self.userBuffer:
@ -251,8 +255,7 @@ class PrinterPanel(wx.Panel):
ln = prevLines + ln
prevLines = ""
if self.parseDefineValue(ln):
continue
self.parseDefineValue(ln)
# Parsing done. All parsed stuff is now in these arrays and dicts.
# Uncomment for debugging.