[refactor]

This commit is contained in:
Martin Muehlhaeuser 2018-08-14 23:34:06 +00:00
parent a03cc70539
commit 91171d40b6
1 changed files with 3 additions and 8 deletions

View File

@ -87,11 +87,11 @@ class KlipperPlugin(
filepath = os.path.expanduser( filepath = os.path.expanduser(
self._settings.get(["configuration", "path"]) self._settings.get(["configuration", "path"])
) )
f = open(filepath) f = open(filepath, "w")
f.write(data["config"]) f.write(data["config"])
f.close() f.close()
self._logger.info( self._logger.info(
"Write Klipper config to {}".format(filepath) "Writing Klipper config to {}".format(filepath)
) )
# Restart klipply to reload config # Restart klipply to reload config
self._printer.commands(self._settings.get(["configuration", "reload_command"])) self._printer.commands(self._settings.get(["configuration", "reload_command"]))
@ -285,12 +285,7 @@ class KlipperPlugin(
kc = Parser() kc = Parser()
sections = kc.load(data["configFile"]) sections = kc.load(data["configFile"])
return flask.jsonify(sections) return flask.jsonify(sections)
def on_api_get(self, request):
log_analyzer = KlipperLogAnalyzer.KlipperLogAnalyzer("/tmp/klippy.log.2018-08-06")
return log_analyzer.analyze()
def get_update_information(self): def get_update_information(self):
return dict( return dict(
klipper=dict( klipper=dict(