When a websocket is closed, set "is_closed" to True in the on_closed handler. When closing all websockets, iterate through a list of values.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This allows gcode file metadata to persist through restarts, reducing the time spent parsing. The gcode file path also persists, so it is available even when Klippy is not.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
At times a subprocess created by shell command fails. Attempt to mitigate this by using asyncio's version of subprocess, which should be more stable when running via the event loop.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Instead, look up klippy_apis after all plugins are loaded. This allows the "CORE_PLUGINS" list to determine the exact order in which core plugins are loaded.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This provides an lmdb database which can be used to keep persistent data. This can be used by internal plugins or by clients.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Rather than require developers to add new notification handlers to websockets.py directly, implement a method that may be called to register websocket notifications during init.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
When a closed websocket is detected set a flag to prevent further status updates until the websocket is removed.
Also make sure that the associated subscriptions are removed if a closed websocket is detected during a notification.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This causes the uninstallation script to fail if the user has not applied the patch. It should be removed in a separate script.
Signed-off-by: Eric Callahan <arksine.colde@gmail.com>
This allows clients to define files that will persist through an update, useful if the client has some sort of static configuration.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
When this option is set Mooraker will restart Klipper after the device has been powered on. An additional "restart_delay" option has been added to customize the delay in which the restart is executed.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Move the service restart functionality out of the "service restart" request into its own method. This allows the "service restart" to be called internally by other modules.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Fix issue where apt-get update is called on startup. This should only be done by the "auto updater" or by a specific request to refresh.
Always set an Updater's init event to true when refresh() is called, regardless of the result.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>