Skip to content

Commit

Permalink
Merge pull request #83 from borisbu/develop
Browse files Browse the repository at this point in the history
🚀 Releasing 2.0.0
  • Loading branch information
RobinTail authored Jul 20, 2023
2 parents 0189809 + 99580fc commit 4e44ebb
Show file tree
Hide file tree
Showing 12 changed files with 149 additions and 30 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Changelog

## Version 2

### 2.0.0

- **Breaking changes**
- Minimal Python version required: `3.7`.
- Minimal JavaScript version support required: `ES6` (aka ES2015).
- Minimal browser versions supporting ES6 are listed [here](https://caniuse.com/?search=es6).
- The distributed PNG icons are replaced with SVG ones.
- In case you've been using them in your configuration (`Icon ON/OFF`), you need to change their filenames:
- `3d-printer.png` –> `3d-printer.svg`,
- `fan-24.png` –> `fan.svg`,
- `webcam.png` –> `webcam.svg`.
- `refresh.png` icon is removed from the distribution.

## Version 1

### 1.4.2
Expand Down
14 changes: 7 additions & 7 deletions octoprint_octorelay/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ def get_settings_defaults(self):
initial_value=False,
cmdON="",
cmdOFF="",
iconOn="""<img src="/plugin/octorelay/static/img/3d-printer.png" height="24" width="24">""",
iconOff="""<img src="/plugin/octorelay/static/img/3d-printer.png" height="24" width="24" style="filter: opacity(20%)">""",
iconOn="""<img width="24" height="24" src="/plugin/octorelay/static/img/3d-printer.svg">""",
iconOff="""<img width="24" height="24" src="/plugin/octorelay/static/img/3d-printer.svg" style="filter: opacity(20%)">""",
labelText="Printer",
confirmOff=True,
autoONforPrint=False,
Expand All @@ -65,8 +65,8 @@ def get_settings_defaults(self):
initial_value=False,
cmdON="",
cmdOFF="",
iconOn="""<img height="24" width="24" src="/plugin/octorelay/static/img/fan-24.png" >""",
iconOff="""<img height="24" width="24" src="/plugin/octorelay/static/img/fan-24.png" style="filter: opacity(20%)">""",
iconOn="""<img width="24" height="24" src="/plugin/octorelay/static/img/fan.svg" >""",
iconOff="""<img width="24" height="24" src="/plugin/octorelay/static/img/fan.svg" style="filter: opacity(20%)">""",
labelText="Fan",
confirmOff=False,
autoONforPrint=True,
Expand All @@ -80,8 +80,8 @@ def get_settings_defaults(self):
initial_value=True,
cmdON="sudo service webcamd start",
cmdOFF="sudo service webcamd stop",
iconOn="""<img height="24" width="24" src="/plugin/octorelay/static/img/webcam.png" >""",
iconOff="""<img height="24" width="24" src="/plugin/octorelay/static/img/webcam.png" style="filter: opacity(20%)">""",
iconOn="""<img width="24" height="24" src="/plugin/octorelay/static/img/webcam.svg" >""",
iconOff="""<img width="24" height="24" src="/plugin/octorelay/static/img/webcam.svg" style="filter: opacity(20%)">""",
labelText="Webcam",
confirmOff=False,
autoONforPrint=True,
Expand Down Expand Up @@ -415,7 +415,7 @@ def input_polling(self):
self.update_ui()
break

__plugin_pythoncompat__ = ">=2.7,<4"
__plugin_pythoncompat__ = ">=3.7,<4"
__plugin_implementation__ = OctoRelayPlugin()

__plugin_hooks__ = {
Expand Down
Binary file removed octoprint_octorelay/static/img/3d-printer.png
Binary file not shown.
33 changes: 33 additions & 0 deletions octoprint_octorelay/static/img/3d-printer.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed octoprint_octorelay/static/img/fan-24.png
Binary file not shown.
42 changes: 42 additions & 0 deletions octoprint_octorelay/static/img/fan.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed octoprint_octorelay/static/img/refresh.png
Binary file not shown.
Binary file removed octoprint_octorelay/static/img/webcam.png
Binary file not shown.
36 changes: 36 additions & 0 deletions octoprint_octorelay/static/img/webcam.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 14 additions & 21 deletions octoprint_octorelay/static/js/octorelay.js
Original file line number Diff line number Diff line change
@@ -1,57 +1,50 @@
"use strict";
$(function () {
var OctoRelayViewModel = function (_a) {
var settingsViewModel = _a[0], loginStateViewModel = _a[1];
var ownCode = "octorelay";
var self = this;
$(() => {
const OctoRelayViewModel = function ([settingsViewModel, loginStateViewModel]) {
const ownCode = "octorelay";
const self = this;
self.settingsViewModel = settingsViewModel;
self.loginState = loginStateViewModel;
self.onDataUpdaterPluginMessage = function (plugin, data) {
self.onDataUpdaterPluginMessage = (plugin, data) => {
if (plugin !== ownCode) {
return;
}
var handleClick = function (key, value) {
var command = function () {
return OctoPrint.simpleApiCommand(ownCode, "update", { pin: key });
};
const handleClick = (key, value) => {
const command = () => OctoPrint.simpleApiCommand(ownCode, "update", { pin: key });
if (!value.confirmOff) {
return command();
}
var dialog = $("#octorelay-confirmation-dialog");
const dialog = $("#octorelay-confirmation-dialog");
dialog.find(".modal-title").text("Turning " + value.labelText + " off");
dialog
.find("#octorelay-confirmation-text")
.text("Are you sure you want to turn the " + value.labelText + " off?");
dialog
.find(".btn-cancel")
.off("click")
.on("click", function () { return dialog.modal("hide"); });
.on("click", () => dialog.modal("hide"));
dialog
.find(".btn-confirm")
.off("click")
.on("click", function () {
.on("click", () => {
command();
dialog.modal("hide");
});
dialog.modal("show");
};
var _loop_1 = function (key, value) {
var btn = $("#relais" + key);
for (const [key, value] of Object.entries(data)) {
const btn = $("#relais" + key);
if (value.active !== undefined) {
btn.toggle(value.active === 1);
}
var icon = $("#ralayIcon" + key);
const icon = $("#ralayIcon" + key);
if (value.iconText !== undefined) {
icon.html(value.iconText);
}
if (value.labelText !== undefined) {
icon.attr("title", value.labelText);
}
icon.off("click").on("click", function () { return handleClick(key, value); });
};
for (var _i = 0, _a = Object.entries(data); _i < _a.length; _i++) {
var _b = _a[_i], key = _b[0], value = _b[1];
_loop_1(key, value);
icon.off("click").on("click", () => handleClick(key, value));
}
};
};
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
plugin_name = "OctoRelay"

# The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module
plugin_version = "1.4.2"
plugin_version = "2.0.0"

# The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin
# module
Expand Down
2 changes: 1 addition & 1 deletion ts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "@tsconfig/node18/tsconfig.json",
"compilerOptions": {
"target": "ES5",
"target": "ES6",
"module": "CommonJS",
"moduleResolution": "Node",
"removeComments": true,
Expand Down

0 comments on commit 4e44ebb

Please sign in to comment.