Added verbose option for settings file
This commit is contained in:
parent
af3abc16ef
commit
05739d7e5f
|
|
@ -25,7 +25,7 @@ class BomPref:
|
|||
self.numberRows = True #add row-numbers to BoM output
|
||||
|
||||
#read KiBOM preferences from file
|
||||
def Read(self, file):
|
||||
def Read(self, file, verbose=False):
|
||||
file = os.path.abspath(file)
|
||||
if not os.path.exists(file) or not os.path.isfile(file):
|
||||
print("{f} is not a valid file!".format(f=file))
|
||||
|
|
@ -47,6 +47,14 @@ class BomPref:
|
|||
if self.SECTION_IGNORE in cf.sections():
|
||||
self.ignore = [i for i in cf.options(self.SECTION_IGNORE)]
|
||||
|
||||
if verbose:
|
||||
print("Preferences:")
|
||||
print(self.OPT_IGNORE_DNF + ' = ' + str(self.ignoreDNF))
|
||||
print(self.OPT_NUMBER_ROWS + ' = ' + str(self.numberRows))
|
||||
|
||||
for i in self.ignore:
|
||||
print("Ignoring column '" + i + "'")
|
||||
|
||||
#write KiBOM preferences to file
|
||||
def Write(self, file):
|
||||
file = os.path.abspath(file)
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ numberRows = True
|
|||
pref_file = os.path.join(os.path.dirname(input_file) , ".bom")
|
||||
pref = BomPref()
|
||||
|
||||
pref.Read(pref_file)
|
||||
pref.Read(pref_file, verbose=True)
|
||||
|
||||
#write preference file back out (first run will generate a file with default preferences)
|
||||
pref.Write(pref_file)
|
||||
|
|
|
|||
Loading…
Reference in New Issue