Configtool: add --show-all switch.
Show all the loaded (defined) variables. Leave out the commented variables for now.
This commit is contained in:
parent
0c8ae903e9
commit
ba5447b409
|
|
@ -78,6 +78,14 @@ def cmdLoad(arg):
|
|||
print("Expected one of *.ini, board.*.h or printer.*.h.")
|
||||
sys.exit(2)
|
||||
|
||||
def cmdShowAll():
|
||||
names = {"configtool": getSettings(), "board": board, "printer": printer}
|
||||
for namespace in names:
|
||||
if names[namespace]:
|
||||
values = names[namespace].getValues()
|
||||
for k in sorted(values):
|
||||
print("%s.%s: %s" % (namespace, k, str(values[k])))
|
||||
|
||||
def cmdHelp():
|
||||
print("""Usage: %s [options]
|
||||
|
||||
|
|
@ -96,6 +104,8 @@ Following options are available for command line automation:
|
|||
Content of this file is valid before the GUI
|
||||
loads, only. GUI will overwrite them with the
|
||||
files found in config.h.
|
||||
|
||||
-a, --show-all Show all loaded variables and values.
|
||||
""" % sys.argv[0])
|
||||
|
||||
def CommandLine(argv):
|
||||
|
|
@ -106,7 +116,8 @@ def CommandLine(argv):
|
|||
global settings, verbose
|
||||
|
||||
try:
|
||||
opts, args = getopt.getopt(argv, "hvl:", ["help", "verbose", "load="])
|
||||
opts, args = getopt.getopt(argv, "hvl:a", ["help", "verbose", "load=",
|
||||
"show-all"])
|
||||
except getopt.GetoptError as err:
|
||||
print(err)
|
||||
print("Use '%s --help' to get help with command line options." %
|
||||
|
|
@ -128,6 +139,9 @@ def CommandLine(argv):
|
|||
elif opt in ("-l", "--load"):
|
||||
cmdLoad(arg)
|
||||
|
||||
elif opt in ("-a", "--show-all"):
|
||||
cmdShowAll()
|
||||
|
||||
if __name__ == '__main__':
|
||||
CommandLine(sys.argv[1:])
|
||||
StartGui(getSettings())
|
||||
|
|
|
|||
|
|
@ -26,6 +26,12 @@ class Board:
|
|||
self.candHeatPins = []
|
||||
self.candThermPins = []
|
||||
|
||||
def getValues(self):
|
||||
vars = [("sensor." + x[0], x[1:]) for x in self.sensors]
|
||||
vars += [("heater." + x[0], x[1:]) for x in self.heaters]
|
||||
vars += [(x, self.cfgValues[x]) for x in self.cfgValues]
|
||||
return dict(vars)
|
||||
|
||||
def getCPUInfo(self):
|
||||
vF_CPU = None
|
||||
if 'F_CPU' in self.cfgValues.keys():
|
||||
|
|
|
|||
|
|
@ -16,6 +16,10 @@ class Printer:
|
|||
self.settings = settings
|
||||
self.cfgDir = os.path.join(self.settings.folder, "configtool")
|
||||
|
||||
def getValues(self):
|
||||
vars = [(x, self.cfgValues[x]) for x in self.cfgValues]
|
||||
return dict(vars)
|
||||
|
||||
def hasData(self):
|
||||
return (self.configFile != None)
|
||||
|
||||
|
|
|
|||
|
|
@ -100,6 +100,22 @@ class Settings:
|
|||
|
||||
return True
|
||||
|
||||
def getValues(self):
|
||||
return {
|
||||
"arduinodir": str(self.arduinodir),
|
||||
"cflags": str(self.cflags),
|
||||
"ldflags": str(self.ldflags),
|
||||
"objcopyflags": str(self.objcopyflags),
|
||||
"programmer": str(self.programmer),
|
||||
"port": str(self.port),
|
||||
"t0": str(self.t0),
|
||||
"r1": str(self.r1),
|
||||
"numtemps": str(self.numTemps),
|
||||
"maxadc": str(self.maxAdc),
|
||||
"minadc": str(self.minAdc),
|
||||
"uploadspeed": str(self.uploadspeed)
|
||||
}
|
||||
|
||||
def saveSettings(self):
|
||||
self.section = "configtool"
|
||||
try:
|
||||
|
|
|
|||
Loading…
Reference in New Issue