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