Skip to content

Commit

Permalink
SW-1995 merge final changes for 0.13.0 release (#1716)
Browse files Browse the repository at this point in the history
  • Loading branch information
Josef-MrBeam authored Mar 15, 2023
2 parents 2de8d0f + 337ef02 commit 5a34844
Show file tree
Hide file tree
Showing 10 changed files with 219 additions and 148 deletions.
13 changes: 4 additions & 9 deletions cypress/e2e/settings/analytics.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,12 @@ describe("Navbar icons", function () {
force: true,
});
});
it("More information about what data we use", function () {
cy.get('[id="settings_plugin_mrbeam_analytics_link"]').click();
cy.get(".mb-0 > .btn-link").click();
cy.get(".card-body").should("to.visible");
cy.wait(3000);
cy.get(".analytics-collapsible").click();
cy.get(".card-body").should("not.visible");
});

it("Privacy policy", function () {
cy.get('[id="settings_plugin_mrbeam_analytics_link"]').click();
cy.get('[style="color: darkgray;font-size: 0.9em"] > a')
cy.get(
'[data-test="mrbeam-ui-settings-better-together-privacy-policy-btn"]'
)
.invoke("attr", "href")
.then((myLink) => {
cy.request(myLink).then((resp) => {
Expand Down
10 changes: 5 additions & 5 deletions octoprint_mrbeam/files/material_settings/materials.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Laserhead,Material,Color,Thickness,Intensity,Speed,Passes,Compressor,Piercing time,Dithering,Comments
You can drag the cell to fill a range with the same name,Color codes take a long time to update -->,"Use ""fill color"" tool",Engrave or (mm),light-dark (%),light-dark 0 to 1500,,level 0 to 3,(ms),yes/no,"interpolated value or #madewithmrbeam? Let us know what makes you tick
You can drag the cell to fill a range with the same name,Color codes take a long time to update -->,"Use ""fill color"" tool",Engrave or (mm),light-dark (%),light-dark 0 to 1500,,level 0 to 3,(ms),yes/no,"interpolated value or #madewithmrbeam? Let us know what makes you tick
"
Mr Beam II,Anodized Aluminum,#000000,Engrave,0-100,30-1000,1,0,0,no,
Mr Beam II,Acrylic,#ffd966,Engrave,0-100,1500-450,1,0,0,no,
Expand Down Expand Up @@ -174,7 +174,7 @@ Mr Beam II (not validated),,#41c500,2,100,600,1,3,0,no,calculated
MrB II Dreamcut,,#41c500,3,100,1300,1,3,0,no,calculated
Mr Beam II (not validated),,#e6e6e6,2,100,140,1,3,0,no,
MrB II Dreamcut,Grey Cardboard,#cccccc,Engrave,0-50,1500-1500,1,3,0,no,
"Dreamcut (not validated)
"Dreamcut (not validated)
",,#cccccc,1,100,100,3,3,0,no,
MrB II Dreamcut,Jersey Fabric,#434343,"0,3",100,1200,2,3,0,no,calculated
MrB II Dreamcut,,#ff0000,"0,3",100,1400,2,3,0,no,tested
Expand Down Expand Up @@ -502,8 +502,8 @@ MrB II Dreamcut x,,#000000,Engrave,0-50,2000-2000,1,3,0,no,
MrB II Dreamcut x,,#000000,"0,8",100,1700,3,3,0,no,
MrB II Dreamcut x,Plywood Poplar,#e7d27f,Engrave,0-40,2000-2000,1,3,0,no,
MrB II Dreamcut x,,#e7d27f,3,100,300,1,3,0,no,tested
MrB II Dreamcut x,,#e7d27f,4,100,350,2,3,0,no,
MrB II Dreamcut x,Plywood Poplar,#e7d27f,Engrave,0-40,2000-2000,1,3,0,no,
MrB II Dreamcut x,,#e7d27f,4,100,200,1,3,0,no,
MrB II Dreamcut x,Plywood Poplar,#e7d27f,5,100,100,1,3,0,no,
MrB II Dreamcut x,Slate,#666666,Engrave,0-60,2000-2000,1,3,0,no,tested
MrB II Dreamcut x,Laser Leather,#c5935f,Engrave,0-25,2000-2000,1,3,0,no,
MrB II Dreamcut x,,#c5935f,"0,6",100,1000,2,3,0,no,
Expand All @@ -516,7 +516,7 @@ MrB II Dreamcut x,,#000000,"0,6",100,1100,1,3,0,no,
MrB II Dreamcut x,Plywood Birch,#e8d4bc,Engrave,0-60,2000-2000,1,3,0,no,
MrB II Dreamcut x,,#e8d4bc,"1,5",100,500,3,3,0,no,
MrB II Dreamcut x,,#e8d4bc,3,100,400,3,3,0,no,
MrB II Dreamcut x,Stamp Rubber,#41c500,Engrave,100,1500-1200,2,3,0,no,
MrB II Dreamcut x,Stamp Rubber,#41c500,Engrave,100,1500-600,1,3,0,no,
MrB II Dreamcut x,Sign Material,#dedede,Engrave,0-60,1500-1400,1,3,0,no,
MrB II Dreamcut x,Sign Material,#dedede,"1,5",100,700,3,3,0,no,
MrB II Dreamcut x,Sign Material,#f3de8d,Engrave,0-50,2000-1400,1,3,0,no,
Expand Down
26 changes: 24 additions & 2 deletions octoprint_mrbeam/static/js/app/snap-plugins/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ Snap.plugin(function (Snap, Element, Paper, global) {
.map((e) => {
const transform = e.transform().totalMatrix.toString();
const clone = e.clone().attr("transform", transform);
const str = clone.outerSVG();
const str = clone.toRenderedElementString();
clone.remove();
return str;
})
Expand All @@ -157,7 +157,7 @@ Snap.plugin(function (Snap, Element, Paper, global) {
<svg version="1.1"
${[...namespaces].join(" ")}
width="${width}" height="${height}"
xxviewBox="${att.viewBox}">
viewBox="${att.viewBox}">
<defs>
${defs}
<style>${fontDecl}</style>
Expand All @@ -170,6 +170,28 @@ Snap.plugin(function (Snap, Element, Paper, global) {
return svg;
};

Element.prototype.toRenderedElementString = function () {
const element = this;

// Create a new parent element to hold the SVG
const parentElement = document.createElement("div");

// Append the parent element to the document body (but don't show it)
parentElement.style.display = "none";
parentElement.appendChild(element.node);

// Append the element to the hidden parent element
document.body.appendChild(parentElement);

// Get innerHTML of the parent element
const elementInnerHTML = parentElement.innerHTML;

// Remove the parent element from the DOM
document.body.removeChild(parentElement);

return elementInnerHTML.toString();
};

Element.prototype.toWorkingAreaDataURL = function (
w,
h,
Expand Down
3 changes: 3 additions & 0 deletions octoprint_mrbeam/static/js/app/view-models/tour.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,9 @@ $(function () {
$(
'.file_list_entry[mrb_name="Schluesselanhaenger.svg"]'
)[0] ||
$(
'.file_list_entry[mrb_name="Schlusselanhanger.svg"]'
)[0] ||
$(
".gcode_files .entry.files_template_model_svg .file_list_entry "
).last()[0],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,10 @@ $(function () {
"#wizard_dialog div.modal-footer button.button-finish"
).show();
$("#wizard_dialog div.modal-footer button.button-finish").text(
"Start guided Tour"
gettext("Start guided Tour")
);
$("#wizard_dialog div.modal-footer button.button-next").text(
"Skip tour"
gettext("Skip tour")
);
document
.querySelector(
Expand All @@ -141,7 +141,7 @@ $(function () {
gettext("Let's go!")
);
$("#wizard_dialog div.modal-footer button.button-next").text(
"Next"
gettext("Next")
);
self.onStartupComplete();
}
Expand Down
31 changes: 22 additions & 9 deletions octoprint_mrbeam/static/js/app/view-models/working-area.js
Original file line number Diff line number Diff line change
Expand Up @@ -1103,8 +1103,10 @@ $(function () {
"flowRoot",
"switch",
"#adobe_illustrator_pgf",
"pattern",
];

let unsupportedElemsDetected = [];
for (var i = 0; i < unsupportedElems.length; i++) {
var myElem = fragment.selectAll(unsupportedElems[i]);
if (myElem.length !== 0) {
Expand All @@ -1116,13 +1118,18 @@ $(function () {
unsupportedElems[i] +
"' element in SVG"
);
self.svg_contains_unsupported_element_warning(
unsupportedElems[i]
);
unsupportedElemsDetected.push(unsupportedElems[i]);
myElem.remove();
}
}

// inform user about unsupported elements
if (unsupportedElemsDetected.length > 0) {
self.svg_contains_unsupported_element_warning(
unsupportedElemsDetected
);
}

// remove other unnecessary or invisible ("display=none") elements
let removeElements = fragment.selectAll(
'title, metadata, script, [display=none], [style*="display:none"], inkscape\\:path-effect, sodipodi\\:namedview'
Expand Down Expand Up @@ -1963,21 +1970,27 @@ $(function () {
};
};

self.svg_contains_unsupported_element_warning = function (elemName) {
elemName = elemName.replace("\\:", ":");
self.svg_contains_unsupported_element_warning = function (
unsupportedElemsDetected
) {
unsupportedElemsDetected = unsupportedElemsDetected
.join(", ")
.replace("\\:", ":");
var error =
"<p>" +
_.sprintf(
gettext(
"The SVG file contains unsupported elements: '%(elemName)s' These elements got removed."
"The SVG file contains unsupported elements: '%(unsupportedElemsDetected)s'. These elements got removed."
),
{ elemName: elemName }
{ unsupportedElemsDetected: unsupportedElemsDetected }
) +
"</p>";
new PNotify({
title: _.sprintf(
gettext("Unsupported elements in SVG: '%(elemName)s'"),
{ elemName: elemName }
gettext(
"Unsupported elements in SVG: '%(unsupportedElemsDetected)s'"
),
{ unsupportedElemsDetected: unsupportedElemsDetected }
),
text: error,
type: "warn",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
</div>
</div>
<div class="span6">
<div class="privacy-policy"><a target="_blank" href="{{ url_for('plugin.mrbeam.static', filename='docs/MrBeamAnalytics-PrivacyPolicy_en.pdf') }}">{{ _('Privacy policy') }}</a></div>
<div class="privacy-policy"><a target="_blank" href="{{ url_for('plugin.mrbeam.static', filename='docs/MrBeamAnalytics-PrivacyPolicy_en.pdf') }}" data-test="mrbeam-ui-settings-better-together-privacy-policy-btn">{{ _('Privacy policy') }}</a></div>
</div>
</div>
</li>
Expand Down
Binary file modified octoprint_mrbeam/translations/de/LC_MESSAGES/messages.mo
Binary file not shown.
Loading

0 comments on commit 5a34844

Please sign in to comment.