toolbar working
This commit is contained in:
@@ -1,11 +1,17 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
from threading import Event
|
from threading import Event
|
||||||
|
|
||||||
|
import flask
|
||||||
|
|
||||||
CMD_ESP_TEST = "TEST"
|
CMD_ESP_TEST = "TEST"
|
||||||
CMD_ESP_LOAD_STEPS = "eSteps_load"
|
CMD_ESP_LOAD_STEPS = "eSteps_load"
|
||||||
CMD_ESP_START_EXTRUSION = "eSteps_startExtrusion"
|
CMD_ESP_START_EXTRUSION = "eSteps_startExtrusion"
|
||||||
CMD_ESP_SAVE = "eSteps_save"
|
CMD_ESP_SAVE = "eSteps_save"
|
||||||
|
|
||||||
class API(octoprint.plugin.SimpleApiPlugin):
|
class API:
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def apiCommands():
|
def apiCommands():
|
||||||
|
|||||||
@@ -43,10 +43,9 @@ class CalibrationtoolsPlugin(
|
|||||||
# Define your plugin's asset files to automatically include in the
|
# Define your plugin's asset files to automatically include in the
|
||||||
# core UI here.
|
# core UI here.
|
||||||
return {
|
return {
|
||||||
"js": ["js/CalibrationTools.js"],
|
"js": ["js/CalibrationTools.js","js/PIDTuneViewModel.js"],
|
||||||
"css": ["css/style.css"]
|
"css": ["css/style.css"]
|
||||||
}
|
}
|
||||||
# self._settings.valid_boolean_trues:
|
|
||||||
|
|
||||||
def get_settings_defaults(self):
|
def get_settings_defaults(self):
|
||||||
return defaultSettings
|
return defaultSettings
|
||||||
|
|||||||
@@ -7,15 +7,21 @@ from threading import Event
|
|||||||
import flask
|
import flask
|
||||||
import octoprint.plugin
|
import octoprint.plugin
|
||||||
|
|
||||||
|
# from octoprint_CalibrationTools import EStepsApi
|
||||||
|
|
||||||
CMD_TEST = "TEST"
|
CMD_TEST = "TEST"
|
||||||
CMD_LOAD_STEPS = "loadSteps"
|
CMD_LOAD_STEPS = "loadSteps"
|
||||||
CMD_START_EXTRUSION = "startExtrusion"
|
CMD_START_EXTRUSION = "startExtrusion"
|
||||||
CMD_SAVE_E_STEPS = "saveESteps"
|
CMD_SAVE_E_STEPS = "saveESteps"
|
||||||
|
|
||||||
|
|
||||||
class API(octoprint.plugin.SimpleApiPlugin):
|
class API(octoprint.plugin.SimpleApiPlugin):
|
||||||
|
def __init__(self) -> None:
|
||||||
|
super().__init__()
|
||||||
|
# self.espAPI = EStepsApi.API()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_api_commands():
|
def get_api_commands():
|
||||||
|
# x = EStepsApi.apiCommands()
|
||||||
return {
|
return {
|
||||||
CMD_LOAD_STEPS: [],
|
CMD_LOAD_STEPS: [],
|
||||||
CMD_START_EXTRUSION: [],
|
CMD_START_EXTRUSION: [],
|
||||||
@@ -33,6 +39,8 @@ class API(octoprint.plugin.SimpleApiPlugin):
|
|||||||
|
|
||||||
def on_api_command(self, command, data):
|
def on_api_command(self, command, data):
|
||||||
self._logger.debug("api command [%s] received payload [%s]", command, data)
|
self._logger.debug("api command [%s] received payload [%s]", command, data)
|
||||||
|
self.espAPI.apiGateWay()
|
||||||
|
|
||||||
if command == CMD_LOAD_STEPS:
|
if command == CMD_LOAD_STEPS:
|
||||||
self._logger.debug("Load steps from EEPROM")
|
self._logger.debug("Load steps from EEPROM")
|
||||||
if not self._printer.is_ready():
|
if not self._printer.is_ready():
|
||||||
|
|||||||
@@ -41,13 +41,6 @@ $(function () {
|
|||||||
self.is_admin(self.loginStateViewModel.isAdmin());
|
self.is_admin(self.loginStateViewModel.isAdmin());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**open settings*/
|
|
||||||
self.openCalibrationSettings = function () {
|
|
||||||
$('a#navbar_show_settings').click();
|
|
||||||
$('li#settings_plugin_CalibrationTools_link a').click();
|
|
||||||
$("#settings_plugin_CalibrationTools").click();
|
|
||||||
}
|
|
||||||
|
|
||||||
self.from_json = function (response) {
|
self.from_json = function (response) {
|
||||||
self.steps["X"](response.data.X);
|
self.steps["X"](response.data.X);
|
||||||
self.steps["Y"](response.data.Y);
|
self.steps["Y"](response.data.Y);
|
||||||
@@ -83,10 +76,6 @@ $(function () {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
self.tempRestart = function () {
|
|
||||||
OctoPrint.system.executeCommand("core", "restart");
|
|
||||||
}
|
|
||||||
|
|
||||||
self.saveESteps = function () {
|
self.saveESteps = function () {
|
||||||
OctoPrint.simpleApiCommand("CalibrationTools", "saveESteps", {
|
OctoPrint.simpleApiCommand("CalibrationTools", "saveESteps", {
|
||||||
"newESteps": self.results.newSteps()
|
"newESteps": self.results.newSteps()
|
||||||
@@ -105,19 +94,6 @@ $(function () {
|
|||||||
self.from_json(response);
|
self.from_json(response);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
self.test = function () {
|
|
||||||
OctoPrint.simpleApiCommand("CalibrationTools", "TEST").done(function (response) {
|
|
||||||
console.log(response)
|
|
||||||
}).fail(function (response) {
|
|
||||||
new PNotify({
|
|
||||||
title: "Test request",
|
|
||||||
text: response.responseJSON.error.msg,
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is how our plugin registers itself with the application, by adding some configuration
|
// This is how our plugin registers itself with the application, by adding some configuration
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<div class="octo-tab-content">
|
<div class="octo-tab-content">
|
||||||
<div class="row-fluid header">
|
<div class="row-fluid header" id="toolBar">
|
||||||
<div class="span3 title">
|
<div class="span3 title">
|
||||||
<p>Calibration</p>
|
<p>Calibration</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
<div class="span6"></div>
|
<div class="span6"></div>
|
||||||
<div class="span6">
|
<div class="span6">
|
||||||
<button class="btn" data-bind="click: $root.tempRestart, visible: true">
|
<button class="btn" data-bind="click: $root.restart, visible: true">
|
||||||
RESTART
|
RESTART
|
||||||
</button>
|
</button>
|
||||||
<button class="btn btn-primary" data-bind="click: $root.test, visible: true" title="BTN for testing">
|
<button class="btn btn-primary" data-bind="click: $root.test, visible: true" title="BTN for testing">
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="span1 icon">
|
<div class="span1 icon">
|
||||||
<a data-bind="click: $root.openCalibrationSettings">
|
<a data-bind="click: $root.onSettingsClick">
|
||||||
<i class="fas fa-cog fa-lg" data-color="#ddd"></i>
|
<i class="fas fa-cog fa-lg" data-color="#ddd"></i>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@@ -45,3 +45,33 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% block script%}
|
||||||
|
<script type="text/javascript">
|
||||||
|
OCTOPRINT_VIEWMODELS.push({
|
||||||
|
construct: function () {
|
||||||
|
this.restart = function () { OctoPrint.system.executeCommand('core', 'restart') };
|
||||||
|
|
||||||
|
this.test = function () {
|
||||||
|
OctoPrint.simpleApiCommand("CalibrationTools", "TEST").done(function (response) {
|
||||||
|
console.log(response)
|
||||||
|
}).fail(function (response) {
|
||||||
|
new PNotify({
|
||||||
|
title: "Test request",
|
||||||
|
text: response.responseJSON.error.msg,
|
||||||
|
type: "error"
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
this.onSettingsClick = function () {
|
||||||
|
$('a#navbar_show_settings').click();
|
||||||
|
$('li#settings_plugin_CalibrationTools_link a').click();
|
||||||
|
$("#settings_plugin_CalibrationTools").click();
|
||||||
|
};
|
||||||
|
},
|
||||||
|
// dependencies: ["terminalViewModel"],
|
||||||
|
elements: [".toolBar"]
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
||||||
Reference in New Issue
Block a user