Rename path to configpath

Rename path to configpath to match naming scheme of logpath
This commit is contained in:
Alice Grey 2020-08-30 10:43:54 -05:00
parent 0141b5e130
commit 53cb69e416
1 changed files with 20 additions and 20 deletions

View File

@ -72,8 +72,8 @@ class KlipperPlugin(
)] )]
), ),
configuration = dict( configuration = dict(
path="~/printer.cfg", configpath="~/printer.cfg",
logpath="/tmp/klippy.log", logpath="/tmp/klippy.log",
reload_command="RESTART" reload_command="RESTART"
) )
) )
@ -82,7 +82,7 @@ class KlipperPlugin(
data = octoprint.plugin.SettingsPlugin.on_settings_load(self) data = octoprint.plugin.SettingsPlugin.on_settings_load(self)
filepath = os.path.expanduser( filepath = os.path.expanduser(
self._settings.get(["configuration", "path"]) self._settings.get(["configuration", "configpath"])
) )
try: try:
f = open(filepath, "r") f = open(filepath, "r")
@ -98,7 +98,7 @@ class KlipperPlugin(
if "config" in data: if "config" in data:
try: try:
filepath = os.path.expanduser( filepath = os.path.expanduser(
self._settings.get(["configuration", "path"]) self._settings.get(["configuration", "configpath"])
) )
data["config"] = data["config"].encode('utf-8') data["config"] = data["config"].encode('utf-8')
@ -123,7 +123,7 @@ class KlipperPlugin(
return dict( return dict(
admin=[ admin=[
["connection", "port"], ["connection", "port"],
["configuration", "path"], ["configuration", "configpath"],
["configuration", "replace_connection_panel"] ["configuration", "replace_connection_panel"]
], ],
user=[ user=[
@ -138,7 +138,7 @@ class KlipperPlugin(
def on_settings_migrate(self, target, current): def on_settings_migrate(self, target, current):
if current is None: if current is None:
settings = self._settings settings = self._settings
if settings.has(["serialport"]): if settings.has(["serialport"]):
settings.set(["connection", "port"], settings.get(["serialport"]) ) settings.set(["connection", "port"], settings.get(["serialport"]) )
settings.remove(["serialport"]) settings.remove(["serialport"])
@ -153,19 +153,19 @@ class KlipperPlugin(
if settings.has(["probeHeight"]): if settings.has(["probeHeight"]):
settings.set(["probe", "height"], settings.get(["probeHeight"])) settings.set(["probe", "height"], settings.get(["probeHeight"]))
settings.remove(["probeHeight"]) settings.remove(["probeHeight"])
if settings.has(["probeLift"]): if settings.has(["probeLift"]):
settings.set(["probe", "lift"], settings.get(["probeLift"])) settings.set(["probe", "lift"], settings.get(["probeLift"]))
settings.remove(["probeLift"]) settings.remove(["probeLift"])
if settings.has(["probeSpeedXy"]): if settings.has(["probeSpeedXy"]):
settings.set(["probe", "speed_xy"], settings.get(["probeSpeedXy"])) settings.set(["probe", "speed_xy"], settings.get(["probeSpeedXy"]))
settings.remove(["probeSpeedXy"]) settings.remove(["probeSpeedXy"])
if settings.has(["probeSpeedZ"]): if settings.has(["probeSpeedZ"]):
settings.set(["probe", "speed_z"], settings.get(["probeSpeedZ"])) settings.set(["probe", "speed_z"], settings.get(["probeSpeedZ"]))
settings.remove(["probeSpeedZ"]) settings.remove(["probeSpeedZ"])
if settings.has(["probePoints"]): if settings.has(["probePoints"]):
points = settings.get(["probePoints"]) points = settings.get(["probePoints"])
points_new = [] points_new = []
@ -177,7 +177,7 @@ class KlipperPlugin(
if settings.has(["configPath"]): if settings.has(["configPath"]):
settings.set(["config_path"], settings.get(["configPath"])) settings.set(["config_path"], settings.get(["configPath"]))
settings.remove(["configPath"]) settings.remove(["configPath"])
#-- Template Plugin #-- Template Plugin
def get_template_configs(self): def get_template_configs(self):
@ -227,9 +227,9 @@ class KlipperPlugin(
custom_bindings=True custom_bindings=True
) )
] ]
#-- Asset Plugin #-- Asset Plugin
def get_assets(self): def get_assets(self):
return dict( return dict(
js=["js/klipper.js", js=["js/klipper.js",
@ -243,9 +243,9 @@ class KlipperPlugin(
css=["css/klipper.css"], css=["css/klipper.css"],
less=["css/klipper.less"] less=["css/klipper.less"]
) )
#-- Event Handler Plugin #-- Event Handler Plugin
def on_event(self, event, payload): def on_event(self, event, payload):
if "Connecting" == event: if "Connecting" == event:
self.updateStatus("info", "Connecting ...") self.updateStatus("info", "Connecting ...")
@ -257,9 +257,9 @@ class KlipperPlugin(
elif "Error" == event: elif "Error" == event:
self.updateStatus("error", "Error") self.updateStatus("error", "Error")
self.logError(payload["error"]) self.logError(payload["error"])
#-- GCODE Hook #-- GCODE Hook
def on_parse_gcode(self, comm, line, *args, **kwargs): def on_parse_gcode(self, comm, line, *args, **kwargs):
if "FIRMWARE_VERSION" in line: if "FIRMWARE_VERSION" in line:
printerInfo = parse_firmware_line(line) printerInfo = parse_firmware_line(line)
@ -287,7 +287,7 @@ class KlipperPlugin(
getStats=["logFile"], getStats=["logFile"],
loadConfig=["configFile"] loadConfig=["configFile"]
) )
def on_api_command(self, command, data): def on_api_command(self, command, data):
if command == "listLogFiles": if command == "listLogFiles":
files = [] files = []
@ -332,13 +332,13 @@ class KlipperPlugin(
payload=payload payload=payload
) )
) )
def pollStatus(self): def pollStatus(self):
self._printer.commands("STATUS") self._printer.commands("STATUS")
def updateStatus(self, type, status): def updateStatus(self, type, status):
self.sendMessage("status", type, status) self.sendMessage("status", type, status)
def logInfo(self, message): def logInfo(self, message):
self.sendMessage("log", "info", message) self.sendMessage("log", "info", message)