Added settings to specify server commands.
Added commands for system shutdown and restart and for server restart.
This commit is contained in:
parent
1409b79ab5
commit
dab328527a
5 changed files with 57 additions and 3 deletions
|
|
@ -112,6 +112,13 @@ def getSettings():
|
||||||
"afterPrintResumed": None,
|
"afterPrintResumed": None,
|
||||||
"snippets": dict()
|
"snippets": dict()
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"server": {
|
||||||
|
"commands": {
|
||||||
|
"systemShutdownCommand": s.get(["server", "commands", "systemShutdownCommand"]),
|
||||||
|
"systemRestartCommand": s.get(["server", "commands", "systemRestartCommand"]),
|
||||||
|
"serverRestartCommand": s.get(["server", "commands", "serverRestartCommand"])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -250,6 +257,12 @@ def setSettings():
|
||||||
continue
|
continue
|
||||||
s.saveScript("gcode", name, script.replace("\r\n", "\n").replace("\r", "\n"))
|
s.saveScript("gcode", name, script.replace("\r\n", "\n").replace("\r", "\n"))
|
||||||
|
|
||||||
|
if "server" in data:
|
||||||
|
if "commands" in data["server"]:
|
||||||
|
if "systemShutdownCommand" in data["server"]["commands"].keys(): s.set(["server", "commands", "systemShutdownCommand"], data["server"]["commands"]["systemShutdownCommand"])
|
||||||
|
if "systemRestartCommand" in data["server"]["commands"].keys(): s.set(["server", "commands", "systemRestartCommand"], data["server"]["commands"]["systemRestartCommand"])
|
||||||
|
if "serverRestartCommand" in data["server"]["commands"].keys(): s.set(["server", "commands", "serverRestartCommand"], data["server"]["commands"]["serverRestartCommand"])
|
||||||
|
|
||||||
if "plugins" in data:
|
if "plugins" in data:
|
||||||
for plugin in octoprint.plugin.plugin_manager().get_implementations(octoprint.plugin.SettingsPlugin):
|
for plugin in octoprint.plugin.plugin_manager().get_implementations(octoprint.plugin.SettingsPlugin):
|
||||||
plugin_id = plugin._identifier
|
plugin_id = plugin._identifier
|
||||||
|
|
|
||||||
|
|
@ -150,6 +150,7 @@ def index():
|
||||||
folders=(gettext("Folders"), dict(template="dialogs/settings/folders.jinja2", _div="settings_folders", custom_bindings=False)),
|
folders=(gettext("Folders"), dict(template="dialogs/settings/folders.jinja2", _div="settings_folders", custom_bindings=False)),
|
||||||
appearance=(gettext("Appearance"), dict(template="dialogs/settings/appearance.jinja2", _div="settings_appearance", custom_bindings=False)),
|
appearance=(gettext("Appearance"), dict(template="dialogs/settings/appearance.jinja2", _div="settings_appearance", custom_bindings=False)),
|
||||||
logs=(gettext("Logs"), dict(template="dialogs/settings/logs.jinja2", _div="settings_logs")),
|
logs=(gettext("Logs"), dict(template="dialogs/settings/logs.jinja2", _div="settings_logs")),
|
||||||
|
server=(gettext("Server"), dict(template="dialogs/settings/server.jinja2", _div="settings_server", custom_bindings=False)),
|
||||||
)
|
)
|
||||||
if enable_accesscontrol:
|
if enable_accesscontrol:
|
||||||
templates["settings"]["entries"]["accesscontrol"] = (gettext("Access Control"), dict(template="dialogs/settings/accesscontrol.jinja2", _div="settings_users", custom_bindings=False))
|
templates["settings"]["entries"]["accesscontrol"] = (gettext("Access Control"), dict(template="dialogs/settings/accesscontrol.jinja2", _div="settings_users", custom_bindings=False))
|
||||||
|
|
|
||||||
|
|
@ -104,6 +104,11 @@ default_settings = {
|
||||||
"pathSuffix": "path"
|
"pathSuffix": "path"
|
||||||
},
|
},
|
||||||
"maxSize": 100 * 1024, # 100 KB
|
"maxSize": 100 * 1024, # 100 KB
|
||||||
|
"commands": {
|
||||||
|
"systemShutdownCommand": None,
|
||||||
|
"systemRestartCommand": None,
|
||||||
|
"serverRestartCommand": None
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"webcam": {
|
"webcam": {
|
||||||
"stream": None,
|
"stream": None,
|
||||||
|
|
@ -188,7 +193,7 @@ default_settings = {
|
||||||
"settings": [
|
"settings": [
|
||||||
"section_printer", "serial", "printerprofiles", "temperatures", "terminalfilters", "gcodescripts",
|
"section_printer", "serial", "printerprofiles", "temperatures", "terminalfilters", "gcodescripts",
|
||||||
"section_features", "features", "webcam", "accesscontrol", "api",
|
"section_features", "features", "webcam", "accesscontrol", "api",
|
||||||
"section_octoprint", "folders", "appearance", "logs", "plugin_pluginmanager", "plugin_softwareupdate"
|
"section_octoprint", "server", "folders", "appearance", "logs", "plugin_pluginmanager", "plugin_softwareupdate"
|
||||||
],
|
],
|
||||||
"usersettings": ["access", "interface"],
|
"usersettings": ["access", "interface"],
|
||||||
"generic": []
|
"generic": []
|
||||||
|
|
@ -321,14 +326,14 @@ class Settings(object):
|
||||||
|
|
||||||
"/dev/ttyACM0"
|
"/dev/ttyACM0"
|
||||||
|
|
||||||
``["serial", "timeouts"]`` ::
|
``["serial", "timeout"]`` ::
|
||||||
|
|
||||||
communication: 20.0
|
communication: 20.0
|
||||||
temperature: 5.0
|
temperature: 5.0
|
||||||
sdStatus: 1.0
|
sdStatus: 1.0
|
||||||
connection: 10.0
|
connection: 10.0
|
||||||
|
|
||||||
``["serial", "timeouts", "temperature"]`` ::
|
``["serial", "timeout", "temperature"]`` ::
|
||||||
|
|
||||||
5.0
|
5.0
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -149,6 +149,10 @@ $(function() {
|
||||||
|
|
||||||
self.terminalFilters = ko.observableArray([]);
|
self.terminalFilters = ko.observableArray([]);
|
||||||
|
|
||||||
|
self.server_commands_systemShutdownCommand = ko.observable(undefined);
|
||||||
|
self.server_commands_systemRestartCommand = ko.observable(undefined);
|
||||||
|
self.server_commands_serverRestartCommand = ko.observable(undefined);
|
||||||
|
|
||||||
self.settings = undefined;
|
self.settings = undefined;
|
||||||
|
|
||||||
self.addTemperatureProfile = function() {
|
self.addTemperatureProfile = function() {
|
||||||
|
|
@ -415,6 +419,10 @@ $(function() {
|
||||||
self.system_actions(response.system.actions);
|
self.system_actions(response.system.actions);
|
||||||
|
|
||||||
self.terminalFilters(response.terminalFilters);
|
self.terminalFilters(response.terminalFilters);
|
||||||
|
|
||||||
|
self.server_commands_systemShutdownCommand(response.server.commands.systemShutdownCommand);
|
||||||
|
self.server_commands_systemRestartCommand(response.server.commands.systemRestartCommand);
|
||||||
|
self.server_commands_serverRestartCommand(response.server.commands.serverRestartCommand);
|
||||||
};
|
};
|
||||||
|
|
||||||
self.saveData = function (data, successCallback) {
|
self.saveData = function (data, successCallback) {
|
||||||
|
|
@ -499,6 +507,13 @@ $(function() {
|
||||||
"beforePrintResumed": self.scripts_gcode_beforePrintResumed(),
|
"beforePrintResumed": self.scripts_gcode_beforePrintResumed(),
|
||||||
"afterPrinterConnected": self.scripts_gcode_afterPrinterConnected()
|
"afterPrinterConnected": self.scripts_gcode_afterPrinterConnected()
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"server": {
|
||||||
|
"commands": {
|
||||||
|
"systemShutdownCommand": self.server_commands_systemShutdownCommand(),
|
||||||
|
"systemRestartCommand": self.server_commands_systemRestartCommand(),
|
||||||
|
"serverRestartCommand": self.server_commands_serverRestartCommand()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
20
src/octoprint/templates/dialogs/settings/server.jinja2
Normal file
20
src/octoprint/templates/dialogs/settings/server.jinja2
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
<form class="form-horizontal">
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label" for="settings-systemShutdownCommand">{{ _('System Shutdown Command') }}</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input type="text" class="input-block-level" data-bind="value: server_commands_systemShutdownCommand" id="settings-systemShutdownCommand">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label" for="settings-systemRestartCommand">{{ _('System Restart Command') }}</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input type="text" class="input-block-level" data-bind="value: server_commands_systemRestartCommand" id="settings-systemRestartCommand">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label" for="settings-serverRestartCommand">{{ _('Server Restart Command') }}</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input type="text" class="input-block-level" data-bind="value: server_commands_serverRestartCommand" id="settings-serverRestartCommand">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
Loading…
Reference in a new issue