Skip to content

Commit

Permalink
Merge pull request #207 from donovan6000/devel
Browse files Browse the repository at this point in the history
Devel
  • Loading branch information
donovan6000 authored Dec 27, 2016
2 parents 6d69341 + 89ebc9a commit a311f2b
Show file tree
Hide file tree
Showing 12 changed files with 944 additions and 874 deletions.
5 changes: 5 additions & 0 deletions Changelog
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
Changelog:

V1.16 December 27, 2016

* Disables print cancellation dialog if corresponding setting is enabled in OctoPrint >= V1.3.1
* Fixed macOS installer

V1.15 December 11, 2016

* Installers work with OctoPrint >= V1.3.0
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
### Description
M33 Fio is a general purpose plugin for [OctoPrint](http://octoprint.org/) that extends its capabilities to include many useful feature like the ability to use a Micro 3D printer, modify a model before printing it, host a webcam stream, and much more.

The latest version of M33 Fio is V1.15 released on December 11th, 2016, and an entire changelog for it can be found [here](https://raw.githubusercontent.com/donovan6000/M33-Fio/master/Changelog).
The latest version of M33 Fio is V1.16 released on December 27th, 2016, and an entire changelog for it can be found [here](https://raw.githubusercontent.com/donovan6000/M33-Fio/master/Changelog).

### Features
* Adds a model viewer tab to OctoPrint's interface where any uploaded model can be viewed
Expand Down
Binary file modified installers/Linux/install.zip
Binary file not shown.
34 changes: 17 additions & 17 deletions installers/macOS/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ else
do
:
done
version="$(perl -nle'print $1 if m/Latest Python 2 Release - Python ([0-9\.]*)/' index.html)"
version="$(perl -nle'print $1 if m/Latest Python 2 Release \- Python ([0-9\.]+)/' index.html)"
rm index.html
while ! curl -f -o python.pkg 'https://www.python.org/ftp/python/'"${version}"'/python-'"${version}"'-macosx10.6.pkg'
do
Expand Down Expand Up @@ -76,8 +76,8 @@ COMMAND
do
:
done
version="$(perl -nle'print $1 if m/pyobjc-core-([0-9\.]*)\.tar\.gz/' index.html | head -1)"
url="$(perl -nle'print $1 if m/<a class=\"button green\".*?href=\"(.*)\">Download/' index.html | head -1)"
version="$(perl -nle'print $1 if m/pyobjc\-core\-([0-9\.]+)\.tar\.gz/' index.html | head -1)"
url="$(perl -nle'print $1 if m/\<a href\=\"(.+)\"\>pyobjc\-core\-/' index.html | head -1)"
rm index.html
while ! curl -f -o pyobjc-core.tar.gz ''"${url}"''
do
Expand All @@ -88,9 +88,9 @@ COMMAND
cd pyobjc-core-${version}

# Patch installer to fix compiling issues
sudo -u $SUDO_USER sed -i '' -e 's/def get_sdk_level():/def get_sdk_level():\
sudo -u $SUDO_USER sed -i '' -e 's/def get_sdk_level()\:/def get_sdk_level()\:\
return None/g' setup.py
sudo -u $SUDO_USER sed -i '' -e 's/if os\.path\.exists('\''\/usr\/bin\/xcodebuild'\''):/if False and os\.path\.exists('\''\/usr\/bin\/xcodebuild'\''):/g' setup.py
sudo -u $SUDO_USER sed -i '' -e 's/if os\.path\.exists('\''\/usr\/bin\/xcodebuild'\'')\:/if False and os\.path\.exists('\''\/usr\/bin\/xcodebuild'\'')\:/g' setup.py

while ! sudo -u $SUDO_USER /Library/Frameworks/Python.framework/Versions/2.7/bin/python setup.py install --user
do
Expand All @@ -104,8 +104,8 @@ COMMAND
do
:
done
version="$(perl -nle'print $1 if m/pyobjc-framework-Cocoa-([0-9\.]*)\.tar\.gz/' index.html | head -1)"
url="$(perl -nle'print $1 if m/<a class=\"button green\".*?href=\"(.*)\">Download/' index.html | head -1)"
version="$(perl -nle'print $1 if m/pyobjc\-framework\-Cocoa\-([0-9\.]+)\.tar\.gz/' index.html | head -1)"
url="$(perl -nle'print $1 if m/\<a href\=\"(.+)\"\>pyobjc\-framework\-Cocoa\-/' index.html | head -1)"
rm index.html
while ! curl -f -o pyobjc-framework-Cocoa.tar.gz ''"${url}"''
do
Expand All @@ -116,9 +116,9 @@ COMMAND
cd pyobjc-framework-Cocoa-${version}

# Patch installer to fix compiling issues
sudo -u $SUDO_USER sed -i '' -e 's/def get_sdk_level():/def get_sdk_level():\
sudo -u $SUDO_USER sed -i '' -e 's/def get_sdk_level()\:/def get_sdk_level()\:\
return None/g' pyobjc_setup.py
sudo -u $SUDO_USER sed -i '' -e 's/xcodebuild -version -sdk macosx Path/echo "\/"/g' pyobjc_setup.py
sudo -u $SUDO_USER sed -i '' -e 's/xcodebuild \-version \-sdk macosx Path/echo "\/"/g' pyobjc_setup.py

while ! sudo -u $SUDO_USER /Library/Frameworks/Python.framework/Versions/2.7/bin/python setup.py install --user
do
Expand All @@ -132,8 +132,8 @@ COMMAND
do
:
done
version="$(perl -nle'print $1 if m/pyobjc-framework-Quartz-([0-9\.]*)\.tar\.gz/' index.html | head -1)"
url="$(perl -nle'print $1 if m/<a class=\"button green\".*?href=\"(.*)\">Download/' index.html | head -1)"
version="$(perl -nle'print $1 if m/pyobjc\-framework\-Quartz\-([0-9\.]+)\.tar\.gz/' index.html | head -1)"
url="$(perl -nle'print $1 if m/\<a href\=\"(.+)\"\>pyobjc\-framework\-Quartz\-/' index.html | head -1)"
rm index.html
while ! curl -f -o pyobjc-framework-Quartz.tar.gz ''"${url}"''
do
Expand All @@ -144,9 +144,9 @@ COMMAND
cd pyobjc-framework-Quartz-${version}

# Patch installer to fix compiling issues
sudo -u $SUDO_USER sed -i '' -e 's/def get_sdk_level():/def get_sdk_level():\
sudo -u $SUDO_USER sed -i '' -e 's/def get_sdk_level()\:/def get_sdk_level()\:\
return None/g' pyobjc_setup.py
sudo -u $SUDO_USER sed -i '' -e 's/xcodebuild -version -sdk macosx Path/echo "\/"/g' pyobjc_setup.py
sudo -u $SUDO_USER sed -i '' -e 's/xcodebuild \-version \-sdk macosx Path/echo "\/"/g' pyobjc_setup.py

while ! sudo -u $SUDO_USER /Library/Frameworks/Python.framework/Versions/2.7/bin/python setup.py install --user
do
Expand All @@ -160,8 +160,8 @@ COMMAND
do
:
done
version="$(perl -nle'print $1 if m/pyobjc-framework-QTKit-([0-9\.]*)\.tar\.gz/' index.html | head -1)"
url="$(perl -nle'print $1 if m/<a class=\"button green\".*?href=\"(.*)\">Download/' index.html | head -1)"
version="$(perl -nle'print $1 if m/pyobjc\-framework\-QTKit\-([0-9\.]+)\.tar\.gz/' index.html | head -1)"
url="$(perl -nle'print $1 if m/\<a href\=\"(.+)\"\>pyobjc\-framework\-QTKit\-/' index.html | head -1)"
rm index.html
while ! curl -f -o pyobjc-framework-QTKit.tar.gz ''"${url}"''
do
Expand All @@ -172,9 +172,9 @@ COMMAND
cd pyobjc-framework-QTKit-${version}

# Patch installer to fix compiling issues
sudo -u $SUDO_USER sed -i '' -e 's/def get_sdk_level():/def get_sdk_level():\
sudo -u $SUDO_USER sed -i '' -e 's/def get_sdk_level()\:/def get_sdk_level()\:\
return None/g' pyobjc_setup.py
sudo -u $SUDO_USER sed -i '' -e 's/xcodebuild -version -sdk macosx Path/echo "\/"/g' pyobjc_setup.py
sudo -u $SUDO_USER sed -i '' -e 's/xcodebuild \-version \-sdk macosx Path/echo "\/"/g' pyobjc_setup.py

while ! sudo -u $SUDO_USER /Library/Frameworks/Python.framework/Versions/2.7/bin/python setup.py install --user
do
Expand Down
42 changes: 33 additions & 9 deletions octoprint_m33fio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3404,7 +3404,7 @@ def on_api_command(self, command, data) :
# Otherwise check if parameter is to get print information
elif data["value"] == "Print Information" and hasattr(self, "maxXExtruderLow") and hasattr(self, "maxXExtruderMedium") and hasattr(self, "maxXExtruderHigh") and hasattr(self, "maxYExtruderLow") and hasattr(self, "maxYExtruderMedium") and hasattr(self, "maxYExtruderHigh") and hasattr(self, "maxZExtruder") and hasattr(self, "minXExtruderLow") and hasattr(self, "minXExtruderMedium") and hasattr(self, "minXExtruderHigh") and hasattr(self, "minYExtruderLow") and hasattr(self, "minYExtruderMedium") and hasattr(self, "minYExtruderHigh") and hasattr(self, "minZExtruder") :

# Return print information
# Return print information
return flask.jsonify(dict(value = "OK", maxXLow = self.maxXExtruderLow, maxXMedium = self.maxXExtruderMedium, maxXHigh = self.maxXExtruderHigh, maxYLow = self.maxYExtruderLow, maxYMedium = self.maxYExtruderMedium, maxYHigh = self.maxYExtruderHigh, maxZ = self.maxZExtruder, minXLow = self.minXExtruderLow, minXMedium = self.minXExtruderMedium, minXHigh = self.minXExtruderHigh, minYLow = self.minYExtruderLow, minYMedium = self.minYExtruderMedium, minYHigh = self.minYExtruderHigh, minZ = self.minZExtruder))

# Otherwise check if parameter is starting print
Expand Down Expand Up @@ -4019,7 +4019,10 @@ def sendCommands(self, commands) :

# Append all currently queued commands to list
while not self._printer._comm._send_queue.empty() :
command = list(self._printer._comm._send_queue.get())
try :
command = list(self._printer._comm._send_queue.get(block = False))
except queue.Empty :
break
command.pop(1)
commands += [tuple(command)]

Expand All @@ -4028,22 +4031,34 @@ def sendCommands(self, commands) :

# Append all currently queued commands to list
while not self._printer._comm._commandQueue.empty() :
commands += [self._printer._comm._commandQueue.get()]
try :
commands += [self._printer._comm._commandQueue.get(block = False)]
except queue.Empty :
break

# Insert list into queue
for command in commands :
self._printer._comm._commandQueue.put(command)
try :
self._printer._comm._commandQueue.put(command)
except :
pass

# Otherwise
else :

# Append all currently queued commands to list
while not self._printer._comm._command_queue.empty() :
commands += [self._printer._comm._command_queue.get()]
try :
commands += [self._printer._comm._command_queue.get(block = False)]
except queue.Empty :
break

# Insert list into queue
for command in commands :
self._printer._comm._command_queue.put(command)
try :
self._printer._comm._command_queue.put(command)
except :
pass

# Otherwise
else :
Expand Down Expand Up @@ -4099,21 +4114,30 @@ def emptyCommandQueue(self) :

# Empty command queues
while not self._printer._comm._send_queue.empty() :
self._printer._comm._send_queue.get()
try :
self._printer._comm._send_queue.get(block = False)
except queue.Empty :
break

# Check if deprecated queue name is valid
if hasattr(self._printer._comm, "_commandQueue") :

# Empty command queues
while not self._printer._comm._commandQueue.empty() :
self._printer._comm._commandQueue.get()
try :
self._printer._comm._commandQueue.get(block = False)
except queue.Empty :
break

# Otherwise
else :

# Empty command queues
while not self._printer._comm._command_queue.empty() :
self._printer._comm._command_queue.get()
try :
self._printer._comm._command_queue.get(block = False)
except queue.Empty :
break

# Process write
def processWrite(self, data) :
Expand Down
4 changes: 4 additions & 0 deletions octoprint_m33fio/static/css/m33fio.css
Original file line number Diff line number Diff line change
Expand Up @@ -2116,6 +2116,10 @@ body > div.page-container > div.message .customInput input {

#model .cover.noLoading * {
margin: 0;
width: 60%;
white-space: normal;
text-align: center;
line-height: 24px;
}


Expand Down
Binary file modified octoprint_m33fio/static/img/cube.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified octoprint_m33fio/static/img/grid.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified octoprint_m33fio/static/img/sphere.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
117 changes: 76 additions & 41 deletions octoprint_m33fio/static/js/m33fio.js
Original file line number Diff line number Diff line change
Expand Up @@ -3389,8 +3389,8 @@ $(function() {
// Create model's glow
model.updateMatrix();
modelEditor.models[i].glow = new THREE.Mesh(model.geometry, glowMaterial.clone());
modelEditor.models[i].glow.applyMatrix(model.matrix);
modelEditor.models[i].glow.renderOrder = 1;
modelEditor.models[i].glow.applyMatrix(model.matrix);
modelEditor.models[i].glow.renderOrder = 1;

// Add model's glow to scene
modelEditor.scene[1].add(modelEditor.models[i].glow);
Expand All @@ -3401,7 +3401,7 @@ $(function() {
// Create adhesion's glow
modelEditor.models[i].adhesion.mesh.updateMatrix();
modelEditor.models[i].adhesion.glow = new THREE.Mesh(modelEditor.models[i].adhesion.mesh.geometry, outlineMaterial.clone());
modelEditor.models[i].adhesion.glow.applyMatrix(modelEditor.models[i].adhesion.mesh.matrix);
modelEditor.models[i].adhesion.glow.applyMatrix(modelEditor.models[i].adhesion.mesh.matrix);
modelEditor.models[i].adhesion.glow.renderOrder = 0;

// Add adhesion's glow to scene
Expand Down Expand Up @@ -4557,7 +4557,7 @@ $(function() {

// Set z index order for measurement values
var lowest = order.indexOf(Math.max.apply(null, order));
$("#slicing_configuration_dialog .modal-extra div.measurements > p").eq(lowest).css("z-index", toString(i));
$("#slicing_configuration_dialog .modal-extra div.measurements > p").eq(lowest).css("z-index", i.toString());
order[lowest] = Number.NEGATIVE_INFINITY;

// Position measurement values
Expand Down Expand Up @@ -5773,14 +5773,49 @@ $(function() {
// Stop default behavior
event.stopImmediatePropagation();

// Check if using new dialog system
if(typeof OctoPrint !== "undefined" && typeof OctoPrint.job !== "undefined" && typeof OctoPrint.job.cancel === "function")
// Check if confirming cancellation
if(typeof self.settings.settings.feature.printCancelConfirmation !== "function" || self.settings.settings.feature.printCancelConfirmation()) {

// Show confirmation dialog
showConfirmationDialog({
message: getAlreadyTranslatedText("This will cancel your print."),
onproceed: function() {
// Check if using new dialog system
if(typeof OctoPrint !== "undefined" && typeof OctoPrint.job !== "undefined" && typeof OctoPrint.job.cancel === "function")

// Show confirmation dialog
showConfirmationDialog({
message: getAlreadyTranslatedText("This will cancel your print."),
onproceed: function() {

// Show message
showMessage(gettext("Printing Status"), gettext("Canceling print"));

// Send request
$.ajax({
url: API_BASEURL + "plugin/m33fio",
type: "POST",
dataType: "json",
data: JSON.stringify({
command: "message",
value: "Cancel Print"
}),
contentType: "application/json; charset=UTF-8",
traditional: true,
processData: true
});
}
});

// Otherwise
else {

// Show confirmation dialog
$("#confirmation_dialog .confirmation_dialog_message").html(getAlreadyTranslatedText("This will cancel your print."));
$("#confirmation_dialog .confirmation_dialog_acknowledge").unbind("click").click(function(event) {

// Stop default behavior
event.preventDefault();

// Hide dialog
$("#confirmation_dialog").modal("hide");

// Show message
showMessage(gettext("Printing Status"), gettext("Canceling print"));

Expand All @@ -5797,40 +5832,30 @@ $(function() {
traditional: true,
processData: true
});
}
});
});
$("#confirmation_dialog").modal("show");
}
}

// Otherwise
else {

// Show confirmation dialog
$("#confirmation_dialog .confirmation_dialog_message").html(getAlreadyTranslatedText("This will cancel your print."));
$("#confirmation_dialog .confirmation_dialog_acknowledge").unbind("click").click(function(event) {

// Stop default behavior
event.preventDefault();

// Hide dialog
$("#confirmation_dialog").modal("hide");

// Show message
showMessage(gettext("Printing Status"), gettext("Canceling print"));

// Send request
$.ajax({
url: API_BASEURL + "plugin/m33fio",
type: "POST",
dataType: "json",
data: JSON.stringify({
command: "message",
value: "Cancel Print"
}),
contentType: "application/json; charset=UTF-8",
traditional: true,
processData: true
});
});
$("#confirmation_dialog").modal("show");
// Show message
showMessage(gettext("Printing Status"), gettext("Canceling print"));

// Send request
$.ajax({
url: API_BASEURL + "plugin/m33fio",
type: "POST",
dataType: "json",
data: JSON.stringify({
command: "message",
value: "Cancel Print"
}),
contentType: "application/json; charset=UTF-8",
traditional: true,
processData: true
});
}
}
});
Expand Down Expand Up @@ -7153,7 +7178,7 @@ $(function() {
if(group.hasClass("closed")) {
group.removeClass("closed").children("i").removeClass("icon-caret-down").addClass("icon-caret-up").attr("title", htmlDecode(gettext("Close")));

if(group.hasClass("advanced"))
if(group.hasClass("advanced"))
setTimeout(function() {
$("#slicing_configuration_dialog.profile .modal-extra div.group.advanced > span").css("display", "block");
}, 100);
Expand Down Expand Up @@ -15467,6 +15492,16 @@ $(function() {

// Disable messages
enableMessages = false;

// Reset message system
messages = [];
skippedMessages = 0;

// Check if a message is shown
if($("body > div.page-container > div.message").hasClass("show"))

// Hide message
hideMessage();
}

// On settings shown
Expand Down
Loading

0 comments on commit a311f2b

Please sign in to comment.