Skip to content

Commit

Permalink
Merge pull request #206 from donovan6000/devel
Browse files Browse the repository at this point in the history
Devel
  • Loading branch information
donovan6000 authored Dec 11, 2016
2 parents fd7ebcf + 25d5d77 commit 6d69341
Show file tree
Hide file tree
Showing 14 changed files with 1,098 additions and 1,039 deletions.
12 changes: 9 additions & 3 deletions Changelog
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
Changelog:

V1.14 December 5th, 2016
V1.15 December 11, 2016

* Installers work with OctoPrint >= V1.3.0
* Fixed compatibility with OctoPrint >= V1.3.0
* Fixed backlash calibration instructions

V1.14 December 5, 2016

* Fixed macOS installer

V1.13 December 3rd, 2016
V1.13 December 3, 2016

* Fixed Safari related JavaScript issue

V1.12 December 3rd, 2016
V1.12 December 3, 2016

* Made model editor's raft display more efficient
* Added more tolerance to raft's size in model editor when using Cura to make the boundary checking more accurate
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.14 released on December 5th, 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.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).

### 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.
Binary file modified installers/Linux/uninstall.zip
100755 → 100644
Binary file not shown.
Binary file modified installers/Windows/M3D.cat
Binary file not shown.
Binary file modified installers/Windows/install.zip
Binary file not shown.
Binary file modified installers/Windows/uninstall.zip
100755 → 100644
Binary file not shown.
1 change: 1 addition & 0 deletions installers/macOS/com.octoprint.app.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<key>ProgramArguments</key>
<array>
<string>path to octoprint</string>
<string>serve</string>
</array>
<key>RunAtLoad</key>
<true/>
Expand Down
9 changes: 9 additions & 0 deletions installers/macOS/command line tools installer.bash
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ if [[ "$osx_vers" -ge 9 ]]; then

softwareupdate -i "$cmd_line_tools"
if [ 0 -ne $? ]; then
if [[ -f "$cmd_line_tools_temp_file" ]]; then
rm "$cmd_line_tools_temp_file"
fi
exit 1
fi

Expand Down Expand Up @@ -60,6 +63,12 @@ if [[ "$osx_vers" -eq 7 ]] || [[ "$osx_vers" -eq 8 ]]; then
# command to accomodate for now-expired certificates used
# to sign the downloaded command line tools.
installer -allowUntrusted -pkg "$(find $TMPMOUNT -name '*.mpkg')" -target /
if [ 0 -ne $? ]; then
hdiutil detach "$TMPMOUNT"
rm -rf "$TMPMOUNT"
rm "$TOOLS"
exit 1
fi
hdiutil detach "$TMPMOUNT"
rm -rf "$TMPMOUNT"
rm "$TOOLS"
Expand Down
54 changes: 40 additions & 14 deletions installers/macOS/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,35 @@ else
sudo -u $SUDO_USER launchctl unload /Library/LaunchAgents/com.octoprint.app.plist

# Install Python
while ! curl -f -o index.html https://www.python.org/downloads/mac-osx/
while ! curl -f -o index.html 'https://www.python.org/downloads/mac-osx/'
do
:
done
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
while ! curl -f -o python.pkg 'https://www.python.org/ftp/python/'"${version}"'/python-'"${version}"'-macosx10.6.pkg'
do
:
done
while ! installer -allowUntrusted -pkg python.pkg -target /
do
:
done
installer -allowUntrusted -pkg python.pkg -target /
rm python.pkg

# Install pip
while ! curl -f -O 'https://bootstrap.pypa.io/get-pip.py'
do
:
done
sudo su <<COMMAND
while ! /Library/Frameworks/Python.framework/Versions/2.7/bin/python get-pip.py
do
:
done
COMMAND
rm get-pip.py

# Update pip
while ! sudo -u $SUDO_USER /Library/Frameworks/Python.framework/Versions/2.7/bin/pip install pip --user --upgrade
do
Expand All @@ -56,13 +72,14 @@ else
rm 'command%20line%20tools%20installer.bash'

# Install PyObjC core
while ! curl -f -o index.html https://pypi.python.org/pypi/pyobjc-core
while ! curl -f -o index.html 'https://pypi.python.org/pypi/pyobjc-core'
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)"
rm index.html
while ! curl -f -o pyobjc-core.tar.gz https://pypi.python.org/packages/source/p/pyobjc-core/pyobjc-core-${version}.tar.gz
while ! curl -f -o pyobjc-core.tar.gz ''"${url}"''
do
:
done
Expand All @@ -83,13 +100,14 @@ else
rm -rf pyobjc-core-${version}

# Install PyObjC Cocoa framework
while ! curl -f -o index.html https://pypi.python.org/pypi/pyobjc-framework-Cocoa
while ! curl -f -o index.html 'https://pypi.python.org/pypi/pyobjc-framework-Cocoa'
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)"
rm index.html
while ! curl -f -o pyobjc-framework-Cocoa.tar.gz https://pypi.python.org/packages/source/p/pyobjc-framework-Cocoa/pyobjc-framework-Cocoa-${version}.tar.gz
while ! curl -f -o pyobjc-framework-Cocoa.tar.gz ''"${url}"''
do
:
done
Expand All @@ -100,6 +118,7 @@ else
# Patch installer to fix compiling issues
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

while ! sudo -u $SUDO_USER /Library/Frameworks/Python.framework/Versions/2.7/bin/python setup.py install --user
do
Expand All @@ -109,13 +128,14 @@ else
rm -rf pyobjc-framework-Cocoa-${version}

# Install PyObjC Quartz framework
while ! curl -f -o index.html https://pypi.python.org/pypi/pyobjc-framework-Quartz
while ! curl -f -o index.html 'https://pypi.python.org/pypi/pyobjc-framework-Quartz'
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)"
rm index.html
while ! curl -f -o pyobjc-framework-Quartz.tar.gz https://pypi.python.org/packages/source/p/pyobjc-framework-Quartz/pyobjc-framework-Quartz-${version}.tar.gz
while ! curl -f -o pyobjc-framework-Quartz.tar.gz ''"${url}"''
do
:
done
Expand All @@ -126,6 +146,7 @@ else
# Patch installer to fix compiling issues
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

while ! sudo -u $SUDO_USER /Library/Frameworks/Python.framework/Versions/2.7/bin/python setup.py install --user
do
Expand All @@ -135,13 +156,14 @@ else
rm -rf pyobjc-framework-Quartz-${version}

# Install PyObjC QTKit framework
while ! curl -f -o index.html https://pypi.python.org/pypi/pyobjc-framework-QTKit
while ! curl -f -o index.html 'https://pypi.python.org/pypi/pyobjc-framework-QTKit'
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)"
rm index.html
while ! curl -f -o pyobjc-framework-QTKit.tar.gz https://pypi.python.org/packages/source/p/pyobjc-framework-QTKit/pyobjc-framework-QTKit-${version}.tar.gz
while ! curl -f -o pyobjc-framework-QTKit.tar.gz ''"${url}"''
do
:
done
Expand All @@ -152,6 +174,7 @@ else
# Patch installer to fix compiling issues
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

while ! sudo -u $SUDO_USER /Library/Frameworks/Python.framework/Versions/2.7/bin/python setup.py install --user
do
Expand All @@ -161,7 +184,7 @@ else
rm -rf pyobjc-framework-QTKit-${version}

# Install OctoPrint
while ! curl -f -LOk https://github.com/foosel/OctoPrint/archive/master.zip
while ! curl -f -LOk 'https://github.com/foosel/OctoPrint/archive/master.zip'
do
:
done
Expand All @@ -187,7 +210,7 @@ else
do
:
done
while ! curl -f -LOk https://github.com/donovan6000/M33-Fio/archive/master.zip
while ! curl -f -LOk 'https://github.com/donovan6000/M33-Fio/archive/master.zip'
do
:
done
Expand All @@ -202,7 +225,10 @@ else
do
:
done
installer -allowUntrusted -pkg CH34x_Install.pkg -target /
while ! installer -allowUntrusted -pkg CH34x_Install.pkg -target /
do
:
done
rm CH34x_Install.pkg

# Add OctoPrint to startup programs
Expand Down
50 changes: 30 additions & 20 deletions octoprint_m33fio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1045,7 +1045,7 @@ def startWebcamProcess(self) :

# Clear webcam stream and snapshot
octoprint.settings.settings().set(["webcam", "stream"], "None", True)
octoprint.settings.settings().set(["webcam", "snapshot"], None, True)
octoprint.settings.settings().set(["webcam", "snapshot"], "None", True)

# Save settings
octoprint.settings.settings().save()
Expand Down Expand Up @@ -1987,8 +1987,8 @@ def on_settings_save(self, data) :
else :

# Clear camera URLs
octoprint.settings.settings().set(["webcam", "stream"], None, True)
octoprint.settings.settings().set(["webcam", "snapshot"], None, True)
octoprint.settings.settings().set(["webcam", "stream"], "None", True)
octoprint.settings.settings().set(["webcam", "snapshot"], "None", True)

# Save settings
octoprint.settings.settings().save()
Expand Down Expand Up @@ -3273,8 +3273,25 @@ def on_api_command(self, command, data) :
configFile = self._settings.global_get_basefolder("base").replace("\\", "/") + "/config.yaml" + str(port)
shutil.copyfile(self._settings.global_get_basefolder("base").replace("\\", "/") + "/config.yaml", configFile)

# Create instance
octoprintProcess = subprocess.Popen([sys.executable.replace("\\", "/"), "-c", "import octoprint;octoprint.main()", "--port", str(port), "--config", self._settings.global_get_basefolder("base").replace("\\", "/") + "/config.yaml" + str(port)])
useLegacyCommand = True
try :

# Check if using OctoPrint >= 1.3.x
if tuple(map(int, (octoprint.__version__.split(".", 2)[: 2]))) >= tuple(map(int, ("1.3".split(".")))) :

# Create instance
octoprintProcess = subprocess.Popen([sys.executable.replace("\\", "/"), "-c", "import sys;import os;sys.stdout = open(os.devnull, 'w');import octoprint;octoprint.main();", "serve", "--port", str(port), "--config", self._settings.global_get_basefolder("base").replace("\\", "/") + "/config.yaml" + str(port)])

# Clear use legacy command
useLegacyCommand = False
except :
pass

# Check if creating OctoPrint with legacy command
if useLegacyCommand :

# Create instance
octoprintProcess = subprocess.Popen([sys.executable.replace("\\", "/"), "-c", "import octoprint;octoprint.main();", "--port", str(port), "--config", self._settings.global_get_basefolder("base").replace("\\", "/") + "/config.yaml" + str(port)])

# Wait until new instance is ready
while self.isPortOpen(port) :
Expand Down Expand Up @@ -4002,38 +4019,31 @@ def sendCommands(self, commands) :

# Append all currently queued commands to list
while not self._printer._comm._send_queue.empty() :
command = self._printer._comm._send_queue.get()
commands += [(command[0], command[2])]
command = list(self._printer._comm._send_queue.get())
command.pop(1)
commands += [tuple(command)]

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

# Append all currently queued commands to list
while not self._printer._comm._commandQueue.empty() :
command = self._printer._comm._commandQueue.get()
commands += [(command[0], command[1])]
commands += [self._printer._comm._commandQueue.get()]

# Insert list into queue
for command in commands :
if isinstance(command, tuple) :
self._printer._comm._commandQueue.put(command)
else :
self._printer._comm._commandQueue.put((command, None))
self._printer._comm._commandQueue.put(command)

# Otherwise
else :

# Append all currently queued commands to list
while not self._printer._comm._command_queue.empty() :
command = self._printer._comm._command_queue.get()
commands += [(command[0], command[1])]
commands += [self._printer._comm._command_queue.get()]

# Insert list into queue
for command in commands :
if isinstance(command, tuple) :
self._printer._comm._command_queue.put(command)
else :
self._printer._comm._command_queue.put((command, None))
self._printer._comm._command_queue.put(command)

# Otherwise
else :
Expand Down Expand Up @@ -4155,7 +4165,7 @@ def processWrite(self, data) :
self.numberWrapCounter = 0

# Check if request is invalid
if (not self._printer.is_printing() and (data.startswith("N0 M110 N0") or data.startswith("M110"))) or data == "M21\n" or data == "M84\n" :
if (not self._printer.is_printing() and (data.startswith("N0 M110 N0") or data.startswith("M110"))) or data == "M21\n" or data == "M84\n" or data == "M400\n" :

# Send fake acknowledgment
self._printer.fake_ack()
Expand Down
Loading

0 comments on commit 6d69341

Please sign in to comment.