initial upload
This commit is contained in:
64
octoprint_extradistance/__init__.py
Normal file
64
octoprint_extradistance/__init__.py
Normal file
@ -0,0 +1,64 @@
|
||||
# coding=utf-8
|
||||
from __future__ import absolute_import
|
||||
|
||||
import octoprint.plugin
|
||||
|
||||
class ExtraDistancePlugin(octoprint.plugin.SettingsPlugin,
|
||||
octoprint.plugin.AssetPlugin,
|
||||
octoprint.plugin.TemplatePlugin):
|
||||
|
||||
##~~ SettingsPlugin mixin
|
||||
|
||||
def get_settings_defaults(self):
|
||||
return dict(
|
||||
# put your plugin's default settings here
|
||||
)
|
||||
|
||||
##~~ AssetPlugin mixin
|
||||
|
||||
def get_assets(self):
|
||||
# Define your plugin's asset files to automatically include in the
|
||||
# core UI here.
|
||||
return dict(
|
||||
js=["js/extradistance.js"],
|
||||
css=["css/extradistance.css"],
|
||||
less=["less/extradistance.less"]
|
||||
)
|
||||
|
||||
##~~ Softwareupdate hook
|
||||
|
||||
def get_update_information(self):
|
||||
# Define the configuration for your plugin to use with the Software Update
|
||||
# Plugin here. See https://github.com/foosel/OctoPrint/wiki/Plugin:-Software-Update
|
||||
# for details.
|
||||
return dict(
|
||||
unknown=dict(
|
||||
displayName="Extra Distance Buttons",
|
||||
displayVersion=self._plugin_version,
|
||||
|
||||
# version check: github repository
|
||||
type="github_release",
|
||||
user="ntoff",
|
||||
repo="OctoPrint-ExtraDistance",
|
||||
current=self._plugin_version,
|
||||
|
||||
# update method: pip
|
||||
pip="https://github.com/ntoff/OctoPrint-ExtraDistance/archive/{target_version}.zip"
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
# If you want your plugin to be registered within OctoPrint under a different name than what you defined in setup.py
|
||||
# ("OctoPrint-PluginSkeleton"), you may define that here. Same goes for the other metadata derived from setup.py that
|
||||
# can be overwritten via __plugin_xyz__ control properties. See the documentation for that.
|
||||
__plugin_name__ = "Extra Distance Buttons"
|
||||
|
||||
def __plugin_load__():
|
||||
global __plugin_implementation__
|
||||
__plugin_implementation__ = ExtraDistancePlugin()
|
||||
|
||||
global __plugin_hooks__
|
||||
__plugin_hooks__ = {
|
||||
"octoprint.plugin.softwareupdate.check_config": __plugin_implementation__.get_update_information
|
||||
}
|
||||
|
17
octoprint_extradistance/static/css/extradistance.css
Normal file
17
octoprint_extradistance/static/css/extradistance.css
Normal file
@ -0,0 +1,17 @@
|
||||
#distance-selector {
|
||||
width: 171px;
|
||||
}
|
||||
#jog_distance {
|
||||
width: 171px;
|
||||
padding-left: 0px;
|
||||
padding-bottom: 0px;
|
||||
margin-left: 0px;
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
#jog_distance2 {
|
||||
width: 171px;
|
||||
padding-top: 0px;
|
||||
padding-left: 0px;
|
||||
margin-top: 0px;
|
||||
margin-left: 0px;
|
||||
}
|
37
octoprint_extradistance/static/js/extradistance.js
Normal file
37
octoprint_extradistance/static/js/extradistance.js
Normal file
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Author: ntoff
|
||||
* License: AGPLv3
|
||||
*/
|
||||
$(function() {
|
||||
function ExtraDistanceViewModel(parameters) {
|
||||
var self = this;
|
||||
|
||||
self.control = parameters[0];
|
||||
|
||||
self.control.distances1 = ko.observableArray([0.01, 0.1, 1, 10]);
|
||||
self.control.distances2 = ko.observableArray([5, 50, 100, 150]);
|
||||
|
||||
if ($("#touch body").length == 0) {
|
||||
$(".distance").remove();
|
||||
$("#control-jog-z").after("\
|
||||
<div class=\"distance\" id=\"distance-selector\">\
|
||||
<div class=\"btn-group\" data-toggle=\"buttons-radio\" id=\"jog_distance1\">\
|
||||
<!-- ko foreach: distances1 -->\
|
||||
<button type=\"button\" class=\"btn distance\" data-bind=\"enable: $root.isOperational() && !$root.isPrinting() && $root.loginState.isUser(), text: $data, click: function() { $root.distance($data) }, css: { active: $root.distance() === $data }, attr: { id: 'control-distance' + $root.stripDistanceDecimal($data) }\"></button>\
|
||||
<!-- /ko -->\
|
||||
</div>\
|
||||
<div class=\"btn-group\" data-toggle=\"buttons-radio\" id=\"jog_distance2\">\
|
||||
<!-- ko foreach: distances2 -->\
|
||||
<button type=\"button\" class=\"btn distance\" data-bind=\"enable: $root.isOperational() && !$root.isPrinting() && $root.loginState.isUser(), text: $data, click: function() { $root.distance($data) }, css: { active: $root.distance() === $data }, attr: { id: 'control-distance' + $root.stripDistanceDecimal($data) }\"></button>\
|
||||
<!-- /ko -->\
|
||||
</div>\
|
||||
</div>\
|
||||
");
|
||||
}
|
||||
}
|
||||
|
||||
OCTOPRINT_VIEWMODELS.push({
|
||||
construct: ExtraDistanceViewModel,
|
||||
dependencies: [ "controlViewModel"]
|
||||
});
|
||||
});
|
18
octoprint_extradistance/static/less/extradistance.less
Normal file
18
octoprint_extradistance/static/less/extradistance.less
Normal file
@ -0,0 +1,18 @@
|
||||
// TODO: Put your plugin's LESS here, have it generated to ../css.
|
||||
#distance-selector {
|
||||
width: 171px;
|
||||
}
|
||||
#jog_distance {
|
||||
width: 171px;
|
||||
padding-left: 0px;
|
||||
padding-bottom: 0px;
|
||||
margin-left: 0px;
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
#jog_distance2 {
|
||||
width: 171px;
|
||||
padding-top: 0px;
|
||||
padding-left: 0px;
|
||||
margin-top: 0px;
|
||||
margin-left: 0px;
|
||||
}
|
1
octoprint_extradistance/templates/README.txt
Normal file
1
octoprint_extradistance/templates/README.txt
Normal file
@ -0,0 +1 @@
|
||||
Put your plugin's Jinja2 templates here.
|
Reference in New Issue
Block a user