Skip to content

Commit

Permalink
🔖 Release 3.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
cp2004 committed Jan 4, 2021
2 parents 991339c + 7f6f039 commit 53c526f
Show file tree
Hide file tree
Showing 14 changed files with 126 additions and 29 deletions.
14 changes: 8 additions & 6 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@
as accurately as possible. If this template is not filled out the pull request may be closed
Thank you for your cooperation!
-->

#### What does this PR do and why is it necessary?

#### How was it tested? How can it be tested by the reviewer?

#### Relevant issues/discussion (if any)

#### Please make sure your PR ticks all the boxes below:
* [ ] If your changes are large or otherwise disruptive: You have discussed these changes by opening an issue first
* [ ] Your PR targets the `devel` branch (No PRs to master please!)
* [ ] If your changes include stylesheets: You have modified the SCSS source (**Not the compiled CSS**)
* [ ] You have run the existing unit tests against your plugin and nothing broke
* [ ] You have read the [Contribution Guidelines](https://github.com/cp2004/OctoPrint-EEPROM-Marlin/blob/master/CONTRIBUTING.md)
* [ ] You have added yourself to the contributors section :) (see `supporters-contributors.py`)

- [ ] If your changes are large or otherwise disruptive: You have discussed these changes by opening an issue first
- [ ] Your PR targets the `devel` branch (No PRs to master please!)
- [ ] If your changes include stylesheets: You have modified the SCSS source (**Not the compiled CSS**)
- [ ] You have run the existing unit tests against your plugin and nothing broke
- [ ] You have read the [Contribution Guidelines](https://github.com/cp2004/OctoPrint-EEPROM-Marlin/blob/master/CONTRIBUTING.md)
- [ ] You have added yourself to the contributors section :) (see `supporters-contributors.py`)
7 changes: 5 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ jobs:
- name: 🔨 Build a source zip
run: |
python setup.py sdist --formats=zip
- name: 🚚 rename to sdist.zip
run: |
mv dist/Marlin\ EEPROM\ editor-*.zip dist/sdist.zip
- name: ⬆ Upload build result
uses: actions/upload-artifact@v1
with:
Expand Down Expand Up @@ -50,7 +53,7 @@ jobs:
python -m pip install octoprint
- name: 🧪 Test install of package
run: |
python -m pip install "dist/Marlin EEPROM editor-*.zip"
python -m pip install dist/sdist.zip
upload-asset:
name: 📦 Upload asset to release
Expand All @@ -66,7 +69,7 @@ jobs:
path: dist
- name: 🚚 Rename to release.zip
run: |
cp "dist/Marlin EEPROM editor-*.zip" release.zip
cp dist/sdist.zip release.zip
- name: 🥅 Catch release ID
id: get_release
uses: bruceadams/get-release@v1.2.2
Expand Down
18 changes: 9 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ Otherwise your changes would be overwritten as soon as I clone the repository by

To compile the CSS (Assuming project root, adjust the path otherwise):

* Install [Sass](https://sass-lang.com/install) using `npm install -g sass`
- Install [Sass](https://sass-lang.com/install) using `npm install -g sass`

* Run `sass octoprint_eeprom_marlin/static/scss/eeprom_marlin.scss octoprint_eeprom_marlin/static/css/eeprom_marlin.css` to compile the CSS.
- Run `sass octoprint_eeprom_marlin/static/scss/eeprom_marlin.scss octoprint_eeprom_marlin/static/css/eeprom_marlin.css` to compile the CSS.

Then you can commit *both* changes to ensure they are not overriden.
Then you can commit _both_ changes to ensure they are not overriden.

#### Pre-commit

There's a pre-commit suite ready in this plugin that keeps an eye on code style, and a couple of performance optimisations.

It is recommended you install it, but it can also be run as a one-off or as a file watcher too. There is PR check that will validate this, and will complain if it does not pass.

* To install: `pre-commit install`
* To run against the entire codebase: `pre-commit run --hook-stage manual --all-files`
* For details of how to set this up with PyCharm Pro, please see the 'File Watcher/Pre-commit' section [OctoPrint documentation](https://docs.octoprint.org/en/master/development/environment.html#pycharm)
- To install: `pre-commit install`
- To run against the entire codebase: `pre-commit run --hook-stage manual --all-files`
- For details of how to set this up with PyCharm Pro, please see the 'File Watcher/Pre-commit' section [OctoPrint documentation](https://docs.octoprint.org/en/master/development/environment.html#pycharm)

#### Adding yourself to the contributors section of the plugin

Expand All @@ -39,6 +39,7 @@ CONTRIBUTORS = [
```

Add your name as another dictionary to this list, like so:

```diff
CONTRIBUTORS = [
{"name": "Anderson Silva (Previous maintainer)", "username": "amsbr"},
Expand All @@ -48,8 +49,7 @@ Add your name as another dictionary to this list, like so:

Your name should then show up under 'Show Contributors' in the plugin's settings pages.


#### Other points

* Please make your contributions against the `devel` branch, to make sure it has the latest codebase. Only exceptions are documentation fixes, such as this one.
* Please fill out the pull request template, to make things easier for me to process. I reply to a lot of things, and may not have the time to do the research myself!
- Please make your contributions against the `devel` branch, to make sure it has the latest codebase. Only exceptions are documentation fixes, such as this one.
- Please fill out the pull request template, to make things easier for me to process. I reply to a lot of things, and may not have the time to do the research myself!
9 changes: 9 additions & 0 deletions octoprint_eeprom_marlin/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
except ImportError:
# we don't need these, just for typed comments
# TODO PY3: Type annotations!
Dict = Optional = None
pass

COMMAND_PARAMS = {
Expand All @@ -28,6 +29,7 @@
"M205": ["S", "T", "B", "X", "Y", "Z", "E", "J"],
"M420": ["S", "Z"],
"M145": ["S", "B", "H", "F"],
"M603": ["L", "U"],
}

COMMAND_NAMES = {
Expand All @@ -46,6 +48,7 @@
"M205": "advanced",
"M420": "autolevel",
"M145": "material",
"M603": "filament_change",
}


Expand Down Expand Up @@ -128,7 +131,11 @@ def __init__(self, plugin):
self.autolevel = IndividualData("autolevel", "M420", ["S", "Z"])
self.material1 = IndividualData("material1", "M145", ["S", "B", "H", "F"])
self.material2 = IndividualData("material2", "M145", ["S", "B", "H", "F"])
self.filament_change = IndividualData(
"filament_change", "M603", COMMAND_PARAMS["M603"]
)

# noinspection PyProtectedMember
self.plugin._logger.info("EEPROM Data initialised")

def from_list(self, data):
Expand All @@ -155,10 +162,12 @@ def from_dict(self, data, ui=True):
data_class = self.material2
else:
# unable to parse again
# noinspection PyProtectedMember
self.plugin._logger.error("Unable to parse M145 command")
return
except KeyError:
# Unable to parse M145
# noinspection PyProtectedMember
self.plugin._logger.error("Unable to parse M145 command")
return
else:
Expand Down
11 changes: 6 additions & 5 deletions octoprint_eeprom_marlin/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def regex_creator(value_type, param_letter):
"floatR": regex_creator("float", "R"),
"floatS": regex_creator("float", "S"),
"floatT": regex_creator("float", "T"),
"floatU": regex_creator("float", "U"),
"floatX": regex_creator("float", "X"),
"floatY": regex_creator("float", "Y"),
"floatZ": regex_creator("float", "Z"),
Expand Down Expand Up @@ -82,8 +83,8 @@ def parse_eeprom_data(self, line):
try:
params = data.COMMAND_PARAMS[command]
except KeyError:
self._logger.error("Unrecognised EEPROM output line, could not parse")
self._logger.error("Line: {}".format(line))
self._logger.warning("Did not recognise EEPROM data, skipping line")
self._logger.warning("Line: {}".format(line))
return

# work out what values we have
Expand All @@ -92,10 +93,10 @@ def parse_eeprom_data(self, line):
try:
param_match = regexes_parameters["float{}".format(param)].search(line)
except KeyError:
self._logger.error(
"Unrecognised EEPROM command parameter, could not parse"
self._logger.warning(
"Did not recognise EEPROM parameter, skipping param"
)
self._logger.error("Parameter: {}".format(param))
self._logger.warning("Parameter: {}".format(param))
continue
if param_match:
parameters[param] = float(param_match.group("value"))
Expand Down
8 changes: 8 additions & 0 deletions octoprint_eeprom_marlin/static/css/eeprom_marlin.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion octoprint_eeprom_marlin/static/css/eeprom_marlin.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 38 additions & 1 deletion octoprint_eeprom_marlin/static/js/eeprom_marlin.js
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,26 @@ $(function () {
return steps;
})();

eeprom.filament_change = (function () {
var filament_change = {};

filament_change.L = ko.observable();
filament_change.U = ko.observable();

filament_change.visible = ko.computed(function () {
for (let param in filament_change) {
if (param === "visible") {
continue;
}
if (filament_change[param]() !== null) {
return true;
}
}
return false;
});
return filament_change;
})();

return eeprom;
})();

Expand Down Expand Up @@ -693,14 +713,31 @@ $(function () {
units: "steps/mm",
},
],
filament_change: [
{
label: "Load length",
value: self.eeprom.filament_change.L,
units: "mm",
},
{
label: "Unload length",
value: self.eeprom.filament_change.U,
units: "mm",
},
],
};

self.eeprom_from_json = function (data) {
// loops through response and assigns values to observables
for (let key in data.eeprom) {
let value = data.eeprom[key];
for (let param in value.params) {
self.eeprom[key][param](value.params[param]);
try {
self.eeprom[key][param](value.params[param]);
} catch {
console.log(key);
console.log(param);
}
}
}
self.unsaved(false);
Expand Down
23 changes: 23 additions & 0 deletions octoprint_eeprom_marlin/static/scss/eeprom_marlin.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
$touchUI_icon: "\f14b";

#touch body {
// TOUCHUI Specific styles
// Yes, it annoys me that TouchUI overrides lots of styles, that make the UI look a little broken
// But we will have to deal with it for as long as touchUI exists & people want to use it

// Touch tab icon
#tabs,
#navbar #all_touchui_settings {
#tab_plugin_eeprom_marlin_link,
Expand All @@ -10,6 +15,24 @@ $touchUI_icon: "\f14b";
}
}
}
// Override some styles to format things a little better **only** within my plugin
// Uses !important to override touch UI styles definitely, we risk chance otherwise.
#tab_plugin_eeprom_marlin {
// override width of the table to stop it going off screen
.table {
width: auto !important;
min-width: 100% !important;
}
// bring back custom icons to buttons
.fas-custom {
font-family: "Font Awesome 5 Free" !important;
font-weight: 900 !important;
}
// apply a *little* bit of margin to separate the button groups, should they be stacked.
.btn-group {
margin-top: 2px;
}
}
}

#tab_plugin_eeprom_marlin {
Expand Down
6 changes: 3 additions & 3 deletions octoprint_eeprom_marlin/templates/backup/content.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
<td data-bind="text: time"></td>
<td>
<button data-bind="click: function(){ $parent.restore_backup(name) }" class="btn btn-small">
<i class="fas-custom fa-custom-cloud-upload-alt"></i>
<i class="fas-custom fa-fw fa-custom-cloud-upload-alt"></i>
</button>
<button data-bind="click: function(){ $parent.delete_backup(name) }" class="btn btn-small btn-danger">
<i class="fa fa-trash-o"></i>
<i class="fa fa-fw fa-trash-o"></i>
</button>
<a data-bind="attr: {href: '/plugin/eeprom_marlin/download/' + name}" class="btn btn-small">
<i class="fa fa-download"></i>
<i class="fa fa-fw fa-download"></i>
</a>
</td>
</tr>
Expand Down
2 changes: 1 addition & 1 deletion octoprint_eeprom_marlin/templates/backup/controls.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<i class="fa fa-fw fa-plus"></i>
{{ _(" New backup") }}
</button>
<button class="btn" data-toggle="modal" data-target="#eepromUploadBackupModal">
<button class="btn" data-bind="enable: enable_buttons" data-toggle="modal" data-target="#eepromUploadBackupModal">
<i class="fa fa-upload" aria-hidden="true"></i>
{{ _(" Upload backup") }}
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
</div>
<div class="modal-body">
<p>Select a file to upload and restore</p>
<div class="alert" data-bind="visible: enable_buttons">
<strong>{{ _("Backup upload is currently disabled while the editor is in read only mode") }}</strong>
</div>
<form class="form-horizontal" onsubmit="return false;">
<div class="control-group">
<label class="control-label">{{ _('Backup file') }}</label>
Expand All @@ -22,6 +25,6 @@
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
<button class="btn btn-primary" data-bind="click: restore_from_upload">{{ _('Upload & restore') }}</button>
<button class="btn btn-primary" data-bind="click: restore_from_upload, enable: enable_buttons">{{ _('Upload & restore') }}</button>
</div>
</div>
8 changes: 8 additions & 0 deletions octoprint_eeprom_marlin/templates/sub/material.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@
{% include "snippets/single_field.jinja2" %}
<!-- /ko -->
</div>
<div data-bind="visible: eeprom.filament_change.visible">
<hr>
<strong>{{ _("Filament Change settings") }}</strong>
<hr>
<!-- ko foreach: UI.filament_change -->
{% include "snippets/single_field.jinja2" %}
<!-- /ko -->
</div>
<div data-bind="visible: eeprom.material1.visible">
<hr>
<strong>{{ _("Material Preset (1)") }}</strong>
Expand Down
3 changes: 3 additions & 0 deletions octoprint_eeprom_marlin/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ def build_backup_name():
def construct_command(data):
command = data["command"]
for param, value in data["params"].items():
# Check that the value exists, avoid M205 [...] JNone
if value is None:
continue
value = str(value) if command != "M145" and param != "S" else str(int(value))
command = command + " " + param + value
return command
Expand Down

0 comments on commit 53c526f

Please sign in to comment.