Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
f1a9e01642 | |||
14ff4cf24d | |||
04174179c5 | |||
5868dc2485 | |||
c20d234af4 | |||
48a6ca1a40 | |||
25a1b880ad | |||
7c1dca0459 | |||
b684644bbe | |||
13dbf860f0 |
@ -1,3 +1,8 @@
|
|||||||
|
# WARNING
|
||||||
|
|
||||||
|
Plugin actually not in active development!
|
||||||
|
|
||||||
|
|
||||||
### ATTENTION
|
### ATTENTION
|
||||||
Plugin still in development!
|
Plugin still in development!
|
||||||
|
|
||||||
|
@ -12,11 +12,6 @@ import octoprint.plugin
|
|||||||
class CustomControlPlugin(octoprint.plugin.SettingsPlugin,
|
class CustomControlPlugin(octoprint.plugin.SettingsPlugin,
|
||||||
octoprint.plugin.TemplatePlugin,
|
octoprint.plugin.TemplatePlugin,
|
||||||
octoprint.plugin.AssetPlugin):
|
octoprint.plugin.AssetPlugin):
|
||||||
def get_settings_defaults(self):
|
|
||||||
return dict(
|
|
||||||
controls=[]
|
|
||||||
)
|
|
||||||
|
|
||||||
def get_template_configs(self):
|
def get_template_configs(self):
|
||||||
if "editorcollection" in self._plugin_manager.enabled_plugins:
|
if "editorcollection" in self._plugin_manager.enabled_plugins:
|
||||||
return [
|
return [
|
||||||
@ -28,9 +23,13 @@ class CustomControlPlugin(octoprint.plugin.SettingsPlugin,
|
|||||||
dict(type="settings", template="customControl_hookedsettings.jinja2", custom_bindings=True)
|
dict(type="settings", template="customControl_hookedsettings.jinja2", custom_bindings=True)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
def on_settings_load(self):
|
||||||
|
return dict(
|
||||||
|
controls=settings().get(["controls"])
|
||||||
|
)
|
||||||
|
|
||||||
def on_settings_save(self, data):
|
def on_settings_save(self, data):
|
||||||
s = settings()
|
settings().set(["controls"], data["controls"])
|
||||||
s.set(["controls"], data["controls"])
|
|
||||||
|
|
||||||
def get_assets(self):
|
def get_assets(self):
|
||||||
return dict(
|
return dict(
|
||||||
@ -39,7 +38,7 @@ class CustomControlPlugin(octoprint.plugin.SettingsPlugin,
|
|||||||
"js/customControl.js",
|
"js/customControl.js",
|
||||||
"js/customControlDialog.js",
|
"js/customControlDialog.js",
|
||||||
],
|
],
|
||||||
css=["css/customControls.css"],
|
css=["css/customControls.min.css"],
|
||||||
less=["less/customControls.less"]
|
less=["less/customControls.less"]
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -62,6 +61,7 @@ class CustomControlPlugin(octoprint.plugin.SettingsPlugin,
|
|||||||
|
|
||||||
|
|
||||||
__plugin_name__ = "Custom Control Editor"
|
__plugin_name__ = "Custom Control Editor"
|
||||||
|
__plugin_pythoncompat__ = ">=2.7,<4"
|
||||||
|
|
||||||
|
|
||||||
def __plugin_load__():
|
def __plugin_load__():
|
||||||
|
@ -1,40 +1,40 @@
|
|||||||
#customControls .innerSortable {
|
#settings_plugin_customControl .innerSortable {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
min-height: 50px;
|
min-height: 50px;
|
||||||
}
|
}
|
||||||
#customControls .custom_section_horizontal > .custom_control {
|
.customControlEditor .custom_section_horizontal > .custom_control {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
#customControls .custom_section_vertical > .custom_control {
|
.customControlEditor .custom_section_vertical > .custom_control {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
#customControls .custom_section_vertical_section {
|
.customControlEditor .custom_section_vertical_section {
|
||||||
min-width: 15px;
|
min-width: 15px;
|
||||||
min-height: 15px;
|
min-height: 15px;
|
||||||
border: 1px dashed #000000;
|
border: 1px dashed #000000;
|
||||||
}
|
}
|
||||||
#customControls .slider.slider-disabled .slider-track {
|
.customControlEditor .slider.slider-disabled .slider-track {
|
||||||
cursor: default !important;
|
cursor: default !important;
|
||||||
}
|
}
|
||||||
#customControls input[disabled] {
|
.customControlEditor input[disabled] {
|
||||||
background: #fff !important;
|
background: #fff !important;
|
||||||
cursor: text !important;
|
cursor: text !important;
|
||||||
}
|
}
|
||||||
#customControls .btn-group {
|
.customControlEditor .btn-group {
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
#customControls .btn-group.distance > .btn {
|
.customControlEditor .btn-group.distance > .btn {
|
||||||
width: 43px;
|
width: 43px;
|
||||||
padding: 3px 0;
|
padding: 3px 0;
|
||||||
height: 30px;
|
height: 30px;
|
||||||
}
|
}
|
||||||
#customControls .slider-handle {
|
.customControlEditor .slider-handle {
|
||||||
width: 14px;
|
width: 14px;
|
||||||
height: 14px;
|
height: 14px;
|
||||||
margin-left: -7px;
|
margin-left: -7px;
|
||||||
margin-top: -3px;
|
margin-top: -3px;
|
||||||
}
|
}
|
||||||
#customControls .custom_section h1 {
|
.customControlEditor .custom_section h1 {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
display: block;
|
display: block;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@ -47,7 +47,7 @@
|
|||||||
border-bottom: 1px solid #E5E5E5;
|
border-bottom: 1px solid #E5E5E5;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
}
|
}
|
||||||
#customControls .custom_control .slider {
|
.customControlEditor .custom_control .slider {
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
margin-bottom: 2px;
|
margin-bottom: 2px;
|
||||||
|
1
octoprint_customControl/static/css/customControls.min.css
vendored
Normal file
1
octoprint_customControl/static/css/customControls.min.css
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
#settings_plugin_customControl .innerSortable{width:100%;min-height:50px}.customControlEditor .custom_section_horizontal>.custom_control{display:inline-block}.customControlEditor .custom_section_vertical>.custom_control{display:block}.customControlEditor .custom_section_vertical_section{min-width:15px;min-height:15px;border:1px dashed #000}.customControlEditor .slider.slider-disabled .slider-track{cursor:default!important}.customControlEditor input[disabled]{background:#fff!important;cursor:text!important}.customControlEditor .btn-group{margin-bottom:10px}.customControlEditor .btn-group.distance>.btn{width:43px;padding:3px 0;height:30px}.customControlEditor .slider-handle{width:14px;height:14px;margin-left:-7px;margin-top:-3px}.customControlEditor .custom_section h1{cursor:pointer;display:block;width:100%;padding:0;margin-bottom:10px;font-size:21px;line-height:40px;color:#333;border:0;border-bottom:1px solid #E5E5E5;font-weight:400}.customControlEditor .custom_control .slider{margin-left:10px;margin-right:10px;margin-bottom:2px}
|
@ -32,7 +32,9 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
self.onSettingsShown = function () {
|
self.onSettingsShown = function () {
|
||||||
self.requestData();
|
OctoPrint.control.getCustomControls().done(function(response) {
|
||||||
|
self._fromResponse(response);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
self.requestData = function () {
|
self.requestData = function () {
|
||||||
@ -90,10 +92,10 @@
|
|||||||
var target = ko.dataFor(this);
|
var target = ko.dataFor(this);
|
||||||
var item = ko.dataFor(ui.item[0]);
|
var item = ko.dataFor(ui.item[0]);
|
||||||
|
|
||||||
if (target == undefined) {
|
if (target === undefined) {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
if (target == self) {
|
if (target === self) {
|
||||||
if (!item.hasOwnProperty("children")) {
|
if (!item.hasOwnProperty("children")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -105,23 +107,23 @@
|
|||||||
|
|
||||||
var position = ko.utils.arrayIndexOf(ui.item.parent().children(), ui.item[0]);
|
var position = ko.utils.arrayIndexOf(ui.item.parent().children(), ui.item[0]);
|
||||||
if (position >= 0) {
|
if (position >= 0) {
|
||||||
if (item.parent != undefined) {
|
if (item.parent !== undefined) {
|
||||||
item.parent.children.remove(item);
|
item.parent.children.remove(item);
|
||||||
|
|
||||||
if (target == self)
|
if (target === self)
|
||||||
self.controlsFromServer.splice(position, 0, item);
|
self.controlsFromServer.splice(position, 0, item);
|
||||||
else
|
else
|
||||||
target.children.splice(position, 0, item);
|
target.children.splice(position, 0, item);
|
||||||
} else {
|
} else {
|
||||||
self.controlsFromServer = _.without(self.controlsFromServer, item);
|
self.controlsFromServer = _.without(self.controlsFromServer, item);
|
||||||
if (target == self)
|
if (target === self)
|
||||||
self.controlsFromServer.splice(position, 0, item);
|
self.controlsFromServer.splice(position, 0, item);
|
||||||
else
|
else
|
||||||
target.children.splice(position, 0, item);
|
target.children.splice(position, 0, item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
stop: function(event, ui) {
|
stop: function() {
|
||||||
self.rerenderControls();
|
self.rerenderControls();
|
||||||
}
|
}
|
||||||
}).disableSelection();
|
}).disableSelection();
|
||||||
@ -152,19 +154,19 @@
|
|||||||
return def;
|
return def;
|
||||||
};
|
};
|
||||||
|
|
||||||
_.each(list, function (element, index, l) {
|
_.each(list, function (element) {
|
||||||
var input = {
|
var input = {
|
||||||
name: ko.observable(element.name),
|
name: ko.observable(element.name),
|
||||||
parameter: ko.observable(element.parameter),
|
parameter: ko.observable(element.parameter),
|
||||||
default: ko.observable(element.hasOwnProperty("default") ? element.default : undefined)
|
default: ko.observable(element.hasOwnProperty("default") ? element.default : undefined)
|
||||||
}
|
};
|
||||||
|
|
||||||
if (element.hasOwnProperty("slider") && _.isObject(element.slider)) {
|
if (element.hasOwnProperty("slider") && _.isObject(element.slider)) {
|
||||||
input.slider = {
|
input.slider = {
|
||||||
min: ko.observable(element.slider.min),
|
min: ko.observable(element.slider.min),
|
||||||
max: ko.observable(element.slider.max),
|
max: ko.observable(element.slider.max),
|
||||||
step: ko.observable(element.slider.step)
|
step: ko.observable(element.slider.step)
|
||||||
}
|
};
|
||||||
|
|
||||||
var defaultValue = attributeToInt(element, "default", attributeToInt(element.slider, "min", 0));
|
var defaultValue = attributeToInt(element, "default", attributeToInt(element.slider, "min", 0));
|
||||||
|
|
||||||
@ -185,7 +187,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
return inputs;
|
return inputs;
|
||||||
}
|
};
|
||||||
self._processControl = function (parent, control) {
|
self._processControl = function (parent, control) {
|
||||||
if (control.processed) {
|
if (control.processed) {
|
||||||
control.id("settingsCustomControl_id" + self.staticID++);
|
control.id("settingsCustomControl_id" + self.staticID++);
|
||||||
@ -215,7 +217,7 @@
|
|||||||
|
|
||||||
if (control.hasOwnProperty("children")) {
|
if (control.hasOwnProperty("children")) {
|
||||||
control.children = ko.observableArray(self._processControls(control, control.children));
|
control.children = ko.observableArray(self._processControls(control, control.children));
|
||||||
if (!control.hasOwnProperty("layout") || !(control.layout == "vertical" || control.layout == "horizontal" || control.layout == "horizontal_grid"))
|
if (!control.hasOwnProperty("layout") || !(control.layout === "vertical" || control.layout === "horizontal" || control.layout === "horizontal_grid"))
|
||||||
control.layout = ko.observable("vertical");
|
control.layout = ko.observable("vertical");
|
||||||
else
|
else
|
||||||
control.layout = ko.observable(control.layout);
|
control.layout = ko.observable(control.layout);
|
||||||
@ -250,19 +252,19 @@
|
|||||||
|
|
||||||
self.displayMode = function (customControl) {
|
self.displayMode = function (customControl) {
|
||||||
if (customControl.hasOwnProperty("children")) {
|
if (customControl.hasOwnProperty("children")) {
|
||||||
return (customControl.hasOwnProperty("name") && customControl.name() != "") ? "settingsCustomControls_containerTemplate_collapsable" : "settingsCustomControls_containerTemplate_nameless";
|
return (customControl.hasOwnProperty("name") && customControl.name() !== "") ? "settingsCustomControls_containerTemplate_collapsable" : "settingsCustomControls_containerTemplate_nameless";
|
||||||
} else {
|
} else {
|
||||||
return "settingsCustomControls_controlTemplate";
|
return "settingsCustomControls_controlTemplate";
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
self.rowCss = function (customControl) {
|
self.rowCss = function (customControl) {
|
||||||
var span = "span2";
|
var span = "span2";
|
||||||
var offset = "";
|
var offset = "";
|
||||||
if (customControl.hasOwnProperty("width") && customControl.width() != "") {
|
if (customControl.hasOwnProperty("width") && customControl.width() !== "") {
|
||||||
span = "span" + customControl.width();
|
span = "span" + customControl.width();
|
||||||
}
|
}
|
||||||
if (customControl.hasOwnProperty("offset") && customControl.offset() != "") {
|
if (customControl.hasOwnProperty("offset") && customControl.offset() !== "") {
|
||||||
offset = "offset" + customControl.offset();
|
offset = "offset" + customControl.offset();
|
||||||
}
|
}
|
||||||
return "sortable " + span + " " + offset;
|
return "sortable " + span + " " + offset;
|
||||||
@ -271,21 +273,21 @@
|
|||||||
self.searchElement = function (list, id) {
|
self.searchElement = function (list, id) {
|
||||||
for (var i = 0; i < list.length; i++)
|
for (var i = 0; i < list.length; i++)
|
||||||
{
|
{
|
||||||
if (list[i].id() == id)
|
if (list[i].id() === id)
|
||||||
return list[i];
|
return list[i];
|
||||||
|
|
||||||
if (list[i].hasOwnProperty("children")) {
|
if (list[i].hasOwnProperty("children")) {
|
||||||
var element = self.searchElement(list[i].children(), id);
|
var element = self.searchElement(list[i].children(), id);
|
||||||
if (element != undefined)
|
if (element !== undefined)
|
||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
};
|
||||||
|
|
||||||
self.createElement = function (invokedOn, contextParent, selectedMenu) {
|
self.createElement = function (invokedOn, contextParent) {
|
||||||
if (contextParent.attr('id') == "base") {
|
if (contextParent.attr('id') === "base") {
|
||||||
self.customControlDialogViewModel.reset();
|
self.customControlDialogViewModel.reset();
|
||||||
|
|
||||||
self.customControlDialogViewModel.show(function (ret) {
|
self.customControlDialogViewModel.show(function (ret) {
|
||||||
@ -295,7 +297,7 @@
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var parentElement = self.searchElement(self.controlsFromServer, contextParent.attr('id'));
|
var parentElement = self.searchElement(self.controlsFromServer, contextParent.attr('id'));
|
||||||
if (parentElement == undefined) {
|
if (parentElement === undefined) {
|
||||||
self._showPopup({
|
self._showPopup({
|
||||||
title: gettext("Something went wrong while creating the new Element"),
|
title: gettext("Something went wrong while creating the new Element"),
|
||||||
type: "error"
|
type: "error"
|
||||||
@ -309,10 +311,10 @@
|
|||||||
parentElement.children.push(self._processControl(parentElement, ret));
|
parentElement.children.push(self._processControl(parentElement, ret));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
self.deleteElement = function (invokedOn, contextParent, selectedMenu) {
|
self.deleteElement = function (invokedOn, contextParent) {
|
||||||
var element = self.searchElement(self.controlsFromServer, contextParent.attr('id'));
|
var element = self.searchElement(self.controlsFromServer, contextParent.attr('id'));
|
||||||
if (element == undefined) {
|
if (element === undefined) {
|
||||||
self._showPopup({
|
self._showPopup({
|
||||||
title: gettext("Something went wrong while creating the new Element"),
|
title: gettext("Something went wrong while creating the new Element"),
|
||||||
type: "error"
|
type: "error"
|
||||||
@ -321,17 +323,17 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
showConfirmationDialog("", function (e) {
|
showConfirmationDialog("", function (e) {
|
||||||
if (element.parent != undefined)
|
if (element.parent !== undefined)
|
||||||
element.parent.children.remove(element);
|
element.parent.children.remove(element);
|
||||||
else {
|
else {
|
||||||
self.controlsFromServer = _.without(self.controlsFromServer, element);
|
self.controlsFromServer = _.without(self.controlsFromServer, element);
|
||||||
self.rerenderControls();
|
self.rerenderControls();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
self.editElement = function (invokedOn, contextParent, selectedMenu) {
|
self.editElement = function (invokedOn, contextParent) {
|
||||||
var element = self.element = self.searchElement(self.controlsFromServer, contextParent.attr('id'));
|
var element = self.element = self.searchElement(self.controlsFromServer, contextParent.attr('id'));
|
||||||
if (element == undefined) {
|
if (element === undefined) {
|
||||||
self._showPopup({
|
self._showPopup({
|
||||||
title: gettext("Something went wrong while creating the new Element"),
|
title: gettext("Something went wrong while creating the new Element"),
|
||||||
type: "error"
|
type: "error"
|
||||||
@ -342,7 +344,7 @@
|
|||||||
var title = "Edit Container";
|
var title = "Edit Container";
|
||||||
var type = "container";
|
var type = "container";
|
||||||
var data = {
|
var data = {
|
||||||
parent: element.parent,
|
parent: element.parent
|
||||||
};
|
};
|
||||||
|
|
||||||
if (element.hasOwnProperty("name")) {
|
if (element.hasOwnProperty("name")) {
|
||||||
@ -425,21 +427,21 @@
|
|||||||
case "command": {
|
case "command": {
|
||||||
element.name(ret.name);
|
element.name(ret.name);
|
||||||
|
|
||||||
if (ret.command != undefined) {
|
if (ret.command !== undefined) {
|
||||||
element.command = ret.command;
|
element.command = ret.command;
|
||||||
delete element.commands;
|
delete element.commands;
|
||||||
}
|
}
|
||||||
if (ret.commands != undefined) {
|
if (ret.commands !== undefined) {
|
||||||
element.commands = ret.commands;
|
element.commands = ret.commands;
|
||||||
delete element.command;
|
delete element.command;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret.confirm != "") {
|
if (ret.confirm !== "") {
|
||||||
element.confirm = ret.confirm;
|
element.confirm = ret.confirm;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret.input != undefined) {
|
if (ret.input !== undefined) {
|
||||||
_.each(ret.input, function (element, index, list) {
|
_.each(ret.input, function (element, index) {
|
||||||
data.input[index] = ko.mapping.toJS(element);
|
data.input[index] = ko.mapping.toJS(element);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -480,11 +482,11 @@
|
|||||||
element.name(ret.name);
|
element.name(ret.name);
|
||||||
element.script = ret.script;
|
element.script = ret.script;
|
||||||
|
|
||||||
if (ret.confirm != "") {
|
if (ret.confirm !== "") {
|
||||||
element.confirm = ret.confirm;
|
element.confirm = ret.confirm;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret.input != undefined) {
|
if (ret.input !== undefined) {
|
||||||
element.input(self._processInput(ret.input));
|
element.input(self._processInput(ret.input));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -500,15 +502,15 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (element.parent && element.parent.layout() == "horizontal_grid") {
|
if (element.parent && element.parent.layout() === "horizontal_grid") {
|
||||||
if (ret.width != undefined && ret.width != "")
|
if (ret.width !== undefined && ret.width !== "")
|
||||||
element.width(ret.width);
|
element.width(ret.width);
|
||||||
|
|
||||||
if (ret.offset != undefined && ret.offset != "")
|
if (ret.offset !== undefined && ret.offset !== "")
|
||||||
element.offset(ret.offset);
|
element.offset(ret.offset);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
self.controlContextMenu = function (invokedOn, contextParent, selectedMenu)
|
self.controlContextMenu = function (invokedOn, contextParent, selectedMenu)
|
||||||
{
|
{
|
||||||
@ -551,19 +553,19 @@
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
self.editStyle = function (type) {
|
self.editStyle = function (type) {
|
||||||
}
|
};
|
||||||
|
|
||||||
self.recursiveDeleteProperties = function (list) {
|
self.recursiveDeleteProperties = function (list) {
|
||||||
_.each(list, function (element, index, ll) {
|
_.each(list, function (element) {
|
||||||
if (!element.parent || (element.parent.hasOwnProperty("layout") && element.parent.layout() != "horizontal_grid")) {
|
if (!element.parent || (element.parent.hasOwnProperty("layout") && element.parent.layout() !== "horizontal_grid")) {
|
||||||
delete element.width;
|
delete element.width;
|
||||||
delete element.offset;
|
delete element.offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (element.default == "")
|
if (element.default === "")
|
||||||
delete element.default;
|
delete element.default;
|
||||||
|
|
||||||
delete element.id;
|
delete element.id;
|
||||||
@ -576,19 +578,19 @@
|
|||||||
|
|
||||||
if (element.hasOwnProperty("input")) {
|
if (element.hasOwnProperty("input")) {
|
||||||
_.each(element.input(), function (e, i, l) {
|
_.each(element.input(), function (e, i, l) {
|
||||||
if (e.default == "")
|
if (e.default === "")
|
||||||
delete e.default;
|
delete e.default;
|
||||||
|
|
||||||
delete e.value;
|
delete e.value;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (element.hasOwnProperty("width") && element.width() == "")
|
if (element.hasOwnProperty("width") && element.width() === "")
|
||||||
delete element.width;
|
delete element.width;
|
||||||
if (element.hasOwnProperty("offset") && element.offset() == "")
|
if (element.hasOwnProperty("offset") && element.offset() === "")
|
||||||
delete element.offset;
|
delete element.offset;
|
||||||
|
|
||||||
if (!element.hasOwnProperty("name") || element.name() == "") {
|
if (!element.hasOwnProperty("name") || element.name() === "") {
|
||||||
delete element.name;
|
delete element.name;
|
||||||
delete element.collapsed;
|
delete element.collapsed;
|
||||||
}
|
}
|
||||||
@ -601,13 +603,13 @@
|
|||||||
self.recursiveDeleteProperties(element.children());
|
self.recursiveDeleteProperties(element.children());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
self.onSettingsBeforeSave = function () {
|
self.onSettingsBeforeSave = function () {
|
||||||
self.recursiveDeleteProperties(self.controlsFromServer);
|
self.recursiveDeleteProperties(self.controlsFromServer);
|
||||||
self.settingsViewModel.settings.plugins.customControl.controls = self.controlsFromServer;
|
self.settingsViewModel.settings.plugins.customControl.controls = self.controlsFromServer;
|
||||||
}
|
};
|
||||||
|
|
||||||
self.onEventSettingsUpdated = function (payload) {
|
self.onEventSettingsUpdated = function () {
|
||||||
self.requestData();
|
self.requestData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
3860
octoprint_customControl/static/js/jquery.ui.sortable.js
vendored
Normal file
3860
octoprint_customControl/static/js/jquery.ui.sortable.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,9 +1,11 @@
|
|||||||
#customControls {
|
#settings_plugin_customControl {
|
||||||
.innerSortable {
|
.innerSortable {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
min-height: 50px;
|
min-height: 50px;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.customControlEditor {
|
||||||
.custom_section_horizontal > .custom_control {
|
.custom_section_horizontal > .custom_control {
|
||||||
display:inline-block;
|
display:inline-block;
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- "width: 588px" to be the same as teh real Control tab-->
|
<!-- "width: 588px" to be the same as teh real Control tab-->
|
||||||
<div class="innerSortable" style="width: 588px; clear: both; display: none;" id="customControls" data-bind="visible: loginState.isUser, template: { name: $root.displayMode, foreach: controls }"></div>
|
<div class="customControlEditor innerSortable" style="width: 588px; clear: both; display: none;" id="customControls" data-bind="visible: loginState.isUser, template: { name: $root.displayMode, foreach: controls }"></div>
|
||||||
|
|
||||||
<ul id="controlContextMenu" class="dropdown-menu" role="menu" style="display:block;position:fixed !important;margin-bottom:5px;">
|
<ul id="controlContextMenu" class="dropdown-menu" role="menu" style="display:block;position:fixed !important;margin-bottom:5px;">
|
||||||
<li>
|
<li>
|
||||||
|
14
setup.py
14
setup.py
@ -17,7 +17,7 @@ plugin_package = "octoprint_%s" % plugin_identifier
|
|||||||
plugin_name = "OctoPrint-CustomControlPlugin"
|
plugin_name = "OctoPrint-CustomControlPlugin"
|
||||||
|
|
||||||
# The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module
|
# The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module
|
||||||
plugin_version = "0.2"
|
plugin_version = "0.2.2"
|
||||||
|
|
||||||
# The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin
|
# The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin
|
||||||
# module
|
# module
|
||||||
@ -120,13 +120,13 @@ class CleanCommand(Command):
|
|||||||
|
|
||||||
# build folder
|
# build folder
|
||||||
if os.path.exists('build'):
|
if os.path.exists('build'):
|
||||||
print "Deleting build directory"
|
print("Deleting build directory")
|
||||||
shutil.rmtree('build')
|
shutil.rmtree('build')
|
||||||
|
|
||||||
# eggs
|
# eggs
|
||||||
eggs = glob.glob("*.egg-info")
|
eggs = glob.glob("*.egg-info")
|
||||||
for egg in eggs:
|
for egg in eggs:
|
||||||
print "Deleting %s directory" % egg
|
print("Deleting %s directory" % egg)
|
||||||
shutil.rmtree(egg)
|
shutil.rmtree(egg)
|
||||||
|
|
||||||
# pyc files
|
# pyc files
|
||||||
@ -135,11 +135,11 @@ class CleanCommand(Command):
|
|||||||
return
|
return
|
||||||
if len(os.listdir(path)) == 0:
|
if len(os.listdir(path)) == 0:
|
||||||
shutil.rmtree(path)
|
shutil.rmtree(path)
|
||||||
print "Deleted %s since it was empty" % path
|
print("Deleted %s since it was empty" % path)
|
||||||
|
|
||||||
def delete_file(path):
|
def delete_file(path):
|
||||||
os.remove(path)
|
os.remove(path)
|
||||||
print "Deleted %s" % path
|
print("Deleted %s" % path)
|
||||||
|
|
||||||
import fnmatch
|
import fnmatch
|
||||||
_recursively_handle_files(
|
_recursively_handle_files(
|
||||||
@ -155,11 +155,11 @@ class CleanCommand(Command):
|
|||||||
return
|
return
|
||||||
if len(os.listdir(path)) == 0:
|
if len(os.listdir(path)) == 0:
|
||||||
shutil.rmtree(path)
|
shutil.rmtree(path)
|
||||||
print "Deleted %s since it was empty" % path
|
print("Deleted %s since it was empty" % path)
|
||||||
|
|
||||||
def delete_file(path):
|
def delete_file(path):
|
||||||
os.remove(path)
|
os.remove(path)
|
||||||
print "Deleted %s" % path
|
print("Deleted %s" % path)
|
||||||
|
|
||||||
import fnmatch
|
import fnmatch
|
||||||
_recursively_handle_files(
|
_recursively_handle_files(
|
||||||
|
Reference in New Issue
Block a user