Have plotter follow MT mouse - a bit hacky still
17
.project
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Mechanical Turk</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.python.pydev.PyDevBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.python.pydev.pythonNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
8
.pydevproject
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<?eclipse-pydev version="1.0"?><pydev_project>
|
||||
<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
|
||||
<path>/${PROJECT_DIR_NAME}</path>
|
||||
</pydev_pathproperty>
|
||||
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python interpreter</pydev_property>
|
||||
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
|
||||
</pydev_project>
|
16
Pipfile
Normal file
|
@ -0,0 +1,16 @@
|
|||
[[source]]
|
||||
url = "https://pypi.python.org/simple"
|
||||
verify_ssl = true
|
||||
name = "pypi"
|
||||
|
||||
[packages]
|
||||
tornado = "*"
|
||||
coloredlogs = "*"
|
||||
|
||||
[dev-packages]
|
||||
|
||||
[requires]
|
||||
python_version = "3.7"
|
||||
|
||||
[packages.a209065]
|
||||
path = "./../../AxiDraw_API_v253r3"
|
52
Pipfile.lock
generated
Normal file
|
@ -0,0 +1,52 @@
|
|||
{
|
||||
"_meta": {
|
||||
"hash": {
|
||||
"sha256": "58dec9ae9b9fda6e3430fe601c100edb07debda39e6f5530e0c8a5c3286938cf"
|
||||
},
|
||||
"pipfile-spec": 6,
|
||||
"requires": {
|
||||
"python_version": "3.7"
|
||||
},
|
||||
"sources": [
|
||||
{
|
||||
"name": "pypi",
|
||||
"url": "https://pypi.python.org/simple",
|
||||
"verify_ssl": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"default": {
|
||||
"a209065": {
|
||||
"path": "./../../AxiDraw_API_v253r3"
|
||||
},
|
||||
"coloredlogs": {
|
||||
"hashes": [
|
||||
"sha256:34fad2e342d5a559c31b6c889e8d14f97cb62c47d9a2ae7b5ed14ea10a79eff8",
|
||||
"sha256:b869a2dda3fa88154b9dd850e27828d8755bfab5a838a1c97fbc850c6e377c36"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==10.0"
|
||||
},
|
||||
"humanfriendly": {
|
||||
"hashes": [
|
||||
"sha256:23057b10ad6f782e7bc3a20e3cb6768ab919f619bbdc0dd75691121bbde5591d",
|
||||
"sha256:33ee8ceb63f1db61cce8b5c800c531e1a61023ac5488ccde2ba574a85be00a85"
|
||||
],
|
||||
"version": "==4.18"
|
||||
},
|
||||
"tornado": {
|
||||
"hashes": [
|
||||
"sha256:349884248c36801afa19e342a77cc4458caca694b0eda633f5878e458a44cb2c",
|
||||
"sha256:398e0d35e086ba38a0427c3b37f4337327231942e731edaa6e9fd1865bbd6f60",
|
||||
"sha256:4e73ef678b1a859f0cb29e1d895526a20ea64b5ffd510a2307b5998c7df24281",
|
||||
"sha256:559bce3d31484b665259f50cd94c5c28b961b09315ccd838f284687245f416e5",
|
||||
"sha256:abbe53a39734ef4aba061fca54e30c6b4639d3e1f59653f0da37a0003de148c7",
|
||||
"sha256:c845db36ba616912074c5b1ee897f8e0124df269468f25e4fe21fe72f6edd7a9",
|
||||
"sha256:c9399267c926a4e7c418baa5cbe91c7d1cf362d505a1ef898fde44a07c9dd8a5"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==6.0.3"
|
||||
}
|
||||
},
|
||||
"develop": {}
|
||||
}
|
6
disable_motors.py
Normal file
|
@ -0,0 +1,6 @@
|
|||
from pyaxidraw import axidraw
|
||||
ad = axidraw.AxiDraw()
|
||||
ad.plot_setup()
|
||||
ad.options.mode = "manual"
|
||||
ad.options.manual_cmd = "disable_xy"
|
||||
ad.plot_run()
|
2508
mt_server.log
Normal file
3970
mt_server.log.1
Normal file
6175
mt_server.log.2
Normal file
10940
mt_server.log.3
Normal file
0
realones/.gitignore
vendored
Normal file
12
realones/003ad66b60914376912642fe8e6c5d35.svg
Normal file
After Width: | Height: | Size: 20 KiB |
12
realones/044db582c4ec4c299f38663767504afe.svg
Normal file
After Width: | Height: | Size: 6.7 KiB |
12
realones/06abe81efb3041f3b4f83fe567cc86b8.svg
Normal file
After Width: | Height: | Size: 16 KiB |
12
realones/08ddf81ffdad48249149997d97be866d.svg
Normal file
After Width: | Height: | Size: 8.7 KiB |
12
realones/0df90a4213cf4eec81b004632c8274a0.svg
Normal file
After Width: | Height: | Size: 13 KiB |
12
realones/0e619959ec2c487e9278fab6e5129362.svg
Normal file
After Width: | Height: | Size: 6.9 KiB |
12
realones/1.svg
Normal file
After Width: | Height: | Size: 11 KiB |
12
realones/165f80868cd64ecd86025b6bf738f067.svg
Normal file
After Width: | Height: | Size: 8.8 KiB |
12
realones/1ca6b31d47894daea6a5339ad47f380f.svg
Normal file
After Width: | Height: | Size: 13 KiB |
12
realones/1e7455d333324309b30dc20ce892fcb7.svg
Normal file
After Width: | Height: | Size: 10 KiB |
12
realones/2.svg
Normal file
After Width: | Height: | Size: 10 KiB |
12
realones/216bc414b38a4e88bfc45cadd3765848.svg
Normal file
After Width: | Height: | Size: 22 KiB |
12
realones/221d92bf387340cabe9cca3cd3bb56f2.svg
Normal file
After Width: | Height: | Size: 9.1 KiB |
12
realones/29c23d77a807435e950ff743b6a03f6b.svg
Normal file
After Width: | Height: | Size: 14 KiB |
12
realones/2b037f4c00af4dfa92df78cd8aa69dcf.svg
Normal file
After Width: | Height: | Size: 10 KiB |
12
realones/3.svg
Normal file
After Width: | Height: | Size: 10 KiB |
12
realones/4112db881a694b1393311237f05a5381.svg
Normal file
After Width: | Height: | Size: 19 KiB |
12
realones/44e7e12f05eb4f9586828b18ca18a4a5.svg
Normal file
After Width: | Height: | Size: 25 KiB |
12
realones/4fa4502dec254fee9a6ee426c614d10b.svg
Normal file
After Width: | Height: | Size: 7.3 KiB |
12
realones/511c0c525fad4547ab4b6674ad071021.svg
Normal file
After Width: | Height: | Size: 27 KiB |
12
realones/5a31bb94224f45398309d81c294b98a3.svg
Normal file
After Width: | Height: | Size: 11 KiB |
12
realones/5ad4480bce9b45a786a9bed834fac864.svg
Normal file
After Width: | Height: | Size: 30 KiB |
12
realones/5ff455ea3bba47c8a6197bb150c4902e.svg
Normal file
After Width: | Height: | Size: 26 KiB |
12
realones/6aa7c75e7f984eb592836ec754fadf06.svg
Normal file
After Width: | Height: | Size: 27 KiB |
12
realones/6de108b58c4d4cf6aac066d5d1d49029.svg
Normal file
After Width: | Height: | Size: 11 KiB |
12
realones/6e4613d7bb754705ba3414249ea053a7.svg
Normal file
After Width: | Height: | Size: 16 KiB |
12
realones/72d6922e203e4181b05be6a2c8e3217d.svg
Normal file
After Width: | Height: | Size: 8.2 KiB |
12
realones/768753b974404bda940cd37d9a1d3495.svg
Normal file
After Width: | Height: | Size: 6.9 KiB |
12
realones/76bff3ce38214f45ace99a5b5a9ee2e2.svg
Normal file
After Width: | Height: | Size: 5.8 KiB |
12
realones/7d533c8319ce46be8013a63f241c4372.svg
Normal file
After Width: | Height: | Size: 6.6 KiB |
12
realones/7ead6304314b46568580da2564ff25e5.svg
Normal file
After Width: | Height: | Size: 31 KiB |
12
realones/81ba98aab04e4a9bb2dd30f3dc544ea0.svg
Normal file
After Width: | Height: | Size: 5.6 KiB |
12
realones/8307a82c86ee44e089a6d3f73ed10248.svg
Normal file
After Width: | Height: | Size: 9.7 KiB |
12
realones/846770753b1a4186b66a887ff3beb81b.svg
Normal file
After Width: | Height: | Size: 11 KiB |
12
realones/8977291f91c248d38fd3b767e247bedd.svg
Normal file
After Width: | Height: | Size: 29 KiB |
12
realones/8bf674ba823144d196feadfd2ea7a311.svg
Normal file
After Width: | Height: | Size: 5.7 KiB |
12
realones/9059296a1afa4bbb8ba74c3db2a34b4a.svg
Normal file
After Width: | Height: | Size: 6.5 KiB |
12
realones/91fed077d0d3493ca4e7bc859c64bedc.svg
Normal file
After Width: | Height: | Size: 13 KiB |
12
realones/927273c3b0c94db296ec4826d0de94a9.svg
Normal file
After Width: | Height: | Size: 26 KiB |
12
realones/94c44635e13b47f284eedfa89d7517a8.svg
Normal file
After Width: | Height: | Size: 8 KiB |
12
realones/94f627b1bd8242fd8a6e2f35eb216b1c.svg
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg viewBox="0 0 600 600"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
version="1.1"
|
||||
>
|
||||
<path d="M308.0,244.0 l 1.0,0.0 1.0,0.0 1.0,0.0 1.0,0.0 1.0,0.0 1.0,0.0 1.0,0.0 1.0,0.0 1.0,1.0 1.0,0.0 0.0,1.0 1.0,0.0 1.0,1.0 0.0,1.0 1.0,1.0 0.0,1.0 2.0,2.0 1.0,0.0 0.0,1.0 2.0,1.0 1.0,0.0 1.0,1.0 1.0,1.0 0.0,1.0 1.0,1.0 2.0,0.0 1.0,0.0 1.0,0.0 1.0,0.0 1.0,0.0 1.0,0.0 0.0,-1.0 1.0,0.0 1.0,0.0 1.0,-1.0 1.0,0.0 1.0,0.0 2.0,0.0 1.0,0.0 1.0,0.0 1.0,0.0 1.0,0.0 1.0,0.0 1.0,0.0 3.0,0.0 2.0,0.0 1.0,0.0 3.0,0.0 1.0,0.0 1.0,0.0 1.0,0.0 1.0,0.0 1.0,0.0 1.0,0.0 2.0,0.0 2.0,1.0 1.0,1.0 2.0,0.0 1.0,2.0 0.0,0.0 " style="stroke:black;stroke-width:2;fill:none;" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 962 B |
12
realones/a2477e2b08d54c34aeca5fb9e7ab6609.svg
Normal file
After Width: | Height: | Size: 7.9 KiB |
12
realones/a48fa3b9ae894611a0f14fbb243fd2ae.svg
Normal file
After Width: | Height: | Size: 10 KiB |
12
realones/a6cfe1c4c3774bfc976c3069b44de068.svg
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg viewBox="0 0 600 600"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
version="1.1"
|
||||
>
|
||||
<path d="M153.0,226.0 l 10.0,-11.0 18.0,-20.0 21.0,-25.0 9.0,-7.0 3.0,-3.0 1.0,0.0 4.0,6.0 7.0,15.0 6.0,21.0 3.0,21.0 3.0,19.0 0.0,15.0 0.0,7.0 0.0,-4.0 9.0,-14.0 11.0,-11.0 9.0,-4.0 2.0,-1.0 1.0,0.0 2.0,4.0 2.0,18.0 0.0,24.0 -1.0,22.0 -8.0,24.0 -11.0,15.0 -3.0,0.0 -2.0,0.0 -7.0,-6.0 -7.0,-13.0 -6.0,-14.0 -2.0,-15.0 0.0,-15.0 0.0,-18.0 10.0,-19.0 14.0,-14.0 29.0,-13.0 17.0,-1.0 13.0,3.0 14.0,13.0 14.0,18.0 13.0,22.0 5.0,24.0 1.0,26.0 0.0,22.0 -3.0,15.0 -7.0,10.0 -5.0,1.0 -8.0,0.0 -26.0,0.0 -31.0,-5.0 -33.0,-13.0 -18.0,-10.0 -5.0,-9.0 -2.0,-14.0 0.0,-21.0 0.0,-24.0 4.0,-29.0 11.0,-38.0 24.0,-54.0 12.0,-25.0 12.0,-19.0 13.0,-18.0 8.0,-12.0 5.0,-9.0 1.0,-3.0 2.0,-2.0 -5.0,6.0 -11.0,15.0 -13.0,17.0 -9.0,17.0 -6.0,14.0 -4.0,11.0 -2.0,9.0 -2.0,5.0 0.0,2.0 0.0,-2.0 20.0,-40.0 25.0,-43.0 18.0,-31.0 8.0,-12.0 1.0,-1.0 0.0,3.0 0.0,26.0 -1.0,36.0 -7.0,50.0 -7.0,46.0 -4.0,26.0 0.0,2.0 0.0,-6.0 6.0,-19.0 21.0,-47.0 17.0,-41.0 13.0,-25.0 4.0,-12.0 0.0,4.0 0.0,11.0 -4.0,50.0 -5.0,39.0 -3.0,29.0 0.0,12.0 7.0,-8.0 16.0,-42.0 10.0,-21.0 11.0,-24.0 6.0,-16.0 0.0,1.0 0.0,23.0 0.0,36.0 -4.0,42.0 -7.0,37.0 -2.0,17.0 0.0,4.0 5.0,-20.0 13.0,-31.0 15.0,-43.0 9.0,-20.0 2.0,-6.0 1.0,0.0 0.0,3.0 -1.0,11.0 -2.0,24.0 -16.0,59.0 -13.0,40.0 -9.0,32.0 -7.0,22.0 0.0,4.0 -3.0,4.0 -4.0,8.0 -4.0,6.0 -4.0,6.0 -4.0,5.0 -8.0,9.0 -6.0,6.0 -5.0,5.0 -2.0,0.0 -1.0,0.0 -1.0,-14.0 4.0,-19.0 2.0,-10.0 0.0,0.0 m38.0,-68.0 l 0.0,5.0 -2.0,27.0 -4.0,21.0 -5.0,21.0 -8.0,17.0 -4.0,11.0 -5.0,11.0 -1.0,1.0 0.0,-1.0 6.0,-13.0 15.0,-22.0 21.0,-20.0 18.0,-18.0 14.0,-15.0 7.0,-9.0 2.0,-2.0 0.0,4.0 -1.0,17.0 -1.0,9.0 -11.0,31.0 -13.0,21.0 -9.0,15.0 -5.0,9.0 -5.0,8.0 -6.0,7.0 -9.0,9.0 -18.0,11.0 -12.0,5.0 -8.0,0.0 -6.0,2.0 -6.0,0.0 -4.0,0.0 -5.0,0.0 -7.0,0.0 -14.0,-2.0 -20.0,0.0 -22.0,0.0 -17.0,0.0 -14.0,-2.0 -7.0,-2.0 -14.0,-10.0 -12.0,-9.0 -36.0,-28.0 -14.0,-19.0 -11.0,-15.0 -5.0,-14.0 -3.0,-11.0 -2.0,-18.0 0.0,-6.0 3.0,-9.0 4.0,-8.0 5.0,-6.0 6.0,-8.0 8.0,-9.0 10.0,-13.0 11.0,-15.0 8.0,-14.0 4.0,-10.0 5.0,-12.0 4.0,-9.0 7.0,-22.0 2.0,-10.0 0.0,-3.0 0.0,-2.0 -1.0,5.0 -6.0,9.0 -18.0,37.0 -10.0,25.0 -4.0,49.0 0.0,15.0 0.0,16.0 1.0,17.0 3.0,23.0 0.0,9.0 0.0,10.0 0.0,13.0 -3.0,10.0 -1.0,2.0 -1.0,0.0 -1.0,1.0 -3.0,-1.0 -14.0,-12.0 -10.0,-8.0 -17.0,-18.0 -7.0,-10.0 -9.0,-20.0 -4.0,-16.0 -7.0,-25.0 -2.0,-41.0 0.0,-9.0 0.0,-11.0 0.0,-17.0 3.0,-11.0 5.0,-12.0 9.0,-16.0 7.0,-11.0 9.0,-13.0 11.0,-16.0 9.0,-10.0 12.0,-14.0 9.0,-12.0 12.0,-12.0 15.0,-15.0 10.0,-10.0 9.0,-9.0 9.0,-6.0 10.0,-4.0 11.0,0.0 10.0,-1.0 10.0,-2.0 10.0,1.0 5.0,3.0 6.0,4.0 14.0,11.0 9.0,9.0 6.0,9.0 14.0,24.0 9.0,12.0 18.0,16.0 10.0,9.0 8.0,4.0 11.0,6.0 13.0,6.0 13.0,7.0 12.0,5.0 9.0,4.0 8.0,8.0 12.0,15.0 11.0,16.0 15.0,34.0 6.0,25.0 5.0,26.0 2.0,24.0 0.0,20.0 0.0,15.0 0.0,11.0 -2.0,11.0 -2.0,8.0 -5.0,10.0 -8.0,12.0 -17.0,29.0 -11.0,20.0 -11.0,22.0 -11.0,17.0 -6.0,11.0 -4.0,8.0 -3.0,5.0 -5.0,6.0 -4.0,4.0 -9.0,6.0 -20.0,8.0 -20.0,4.0 -16.0,0.0 -23.0,0.0 -13.0,-3.0 -21.0,-13.0 -20.0,-13.0 -4.0,-2.0 -2.0,-1.0 -10.0,-1.0 -17.0,7.0 -12.0,11.0 -4.0,4.0 0.0,1.0 0.0,6.0 7.0,6.0 8.0,2.0 17.0,-3.0 29.0,-13.0 22.0,-4.0 10.0,0.0 14.0,0.0 27.0,8.0 26.0,2.0 24.0,2.0 39.0,0.0 43.0,-5.0 25.0,-10.0 4.0,-2.0 1.0,-1.0 0.0,1.0 -1.0,11.0 -10.0,15.0 -21.0,4.0 -35.0,0.0 -62.0,0.0 -92.0,0.0 -80.0,0.0 -34.0,-4.0 -12.0,-9.0 -11.0,-12.0 -9.0,-25.0 -3.0,-31.0 -5.0,-31.0 -4.0,-28.0 -6.0,-24.0 -6.0,-20.0 -2.0,-11.0 -2.0,-6.0 -7.0,-11.0 -9.0,-12.0 -9.0,-9.0 -12.0,-17.0 -6.0,-14.0 -4.0,-20.0 -3.0,-22.0 -1.0,-25.0 -2.0,-20.0 -3.0,-14.0 -1.0,-11.0 -2.0,-5.0 -2.0,-3.0 -1.0,0.0 -5.0,1.0 -11.0,26.0 -4.0,25.0 0.0,25.0 5.0,33.0 9.0,35.0 6.0,39.0 6.0,34.0 6.0,26.0 2.0,23.0 -1.0,20.0 -7.0,12.0 -2.0,4.0 -1.0,1.0 -2.0,1.0 -2.0,2.0 -3.0,4.0 -2.0,5.0 0.0,1.0 1.0,1.0 12.0,-13.0 25.0,-29.0 40.0,-48.0 30.0,-40.0 57.0,-63.0 62.0,-54.0 20.0,-18.0 1.0,-3.0 0.0,0.0 " style="stroke:black;stroke-width:2;fill:none;" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 4.1 KiB |
12
realones/acc675a569324d3faceed732c6e39edd.svg
Normal file
After Width: | Height: | Size: 12 KiB |
12
realones/aec9bec7f15c414a8424d5959278c4ef.svg
Normal file
After Width: | Height: | Size: 28 KiB |
12
realones/af5cdc57376f4f4eb91f0fc12531278d.svg
Normal file
After Width: | Height: | Size: 8.1 KiB |
12
realones/b138dc8ce1104ce0b4dd591ea28a13db.svg
Normal file
After Width: | Height: | Size: 19 KiB |
12
realones/ba29eaffc7d94a9fabac0d09e1ae00c8.svg
Normal file
After Width: | Height: | Size: 29 KiB |
12
realones/c0dde1c03dc24a59975abc72ca7c8db4.svg
Normal file
After Width: | Height: | Size: 9.9 KiB |
12
realones/c41ceb4575b945b789e48691fc516ada.svg
Normal file
After Width: | Height: | Size: 17 KiB |
12
realones/cca19b90600d4d0d9536ea461e56c53e.svg
Normal file
After Width: | Height: | Size: 13 KiB |
12
realones/cf020e09045f43e7a26104722c5e3f56.svg
Normal file
After Width: | Height: | Size: 21 KiB |
12
realones/d8f48605a49b4563842d07695f1528a2.svg
Normal file
After Width: | Height: | Size: 10 KiB |
12
realones/e17d568b029644d48fb2df2ffbd29eeb.svg
Normal file
After Width: | Height: | Size: 45 KiB |
12
realones/e4f1c0af8da54cb79e0eeda4f171f0af.svg
Normal file
After Width: | Height: | Size: 50 KiB |
12
realones/e5344001f9e241d894586aeb09fb5ed6.svg
Normal file
After Width: | Height: | Size: 11 KiB |
12
realones/e5b63ab1f346435d931dd1e82bd4a0a8.svg
Normal file
After Width: | Height: | Size: 10 KiB |
12
realones/e9db294660c346b4817ca532118b1abf.svg
Normal file
After Width: | Height: | Size: 9.5 KiB |
12
realones/ec7071b582204d18ab1437f51ff2e0db.svg
Normal file
After Width: | Height: | Size: 15 KiB |
12
realones/f59ee563d223447aa58e4aeaffbad292.svg
Normal file
After Width: | Height: | Size: 8.5 KiB |
12
realones/ffa33421c6e441a9bacaa9d61d67baaf.svg
Normal file
After Width: | Height: | Size: 15 KiB |
3641
realones/mt_server.log
Normal file
38
realones/square.svg
Normal file
|
@ -0,0 +1,38 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
id="svg8"
|
||||
version="1.1"
|
||||
viewBox="0 0 210 210"
|
||||
height="210mm"
|
||||
width="210mm">
|
||||
<defs
|
||||
id="defs2" />
|
||||
<metadata
|
||||
id="metadata5">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
transform="translate(0,-87)"
|
||||
id="layer1">
|
||||
<rect
|
||||
y="138.32738"
|
||||
x="51.327381"
|
||||
height="107.34524"
|
||||
width="107.34524"
|
||||
id="rect815"
|
||||
style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.75590557;stroke-opacity:1" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1 KiB |
72
server.py
|
@ -11,6 +11,12 @@ import uuid
|
|||
import coloredlogs
|
||||
import glob
|
||||
|
||||
from pyaxidraw import axidraw # import module
|
||||
from threading import Thread
|
||||
from queue import Queue, Empty
|
||||
import threading
|
||||
|
||||
|
||||
|
||||
logger = logging.getLogger("drawing")
|
||||
|
||||
|
@ -64,6 +70,9 @@ class WebSocketHandler(tornado.websocket.WebSocketHandler):
|
|||
CORS_ORIGINS = ['localhost', '.mturk.com', 'here.rubenvandeven.com']
|
||||
connections = set()
|
||||
|
||||
def initialize(self, draw_q: Queue):
|
||||
self.draw_q = draw_q
|
||||
|
||||
def check_origin(self, origin):
|
||||
parsed_origin = urlparse(origin)
|
||||
# parsed_origin.netloc.lower() gives localhost:3333
|
||||
|
@ -85,8 +94,9 @@ class WebSocketHandler(tornado.websocket.WebSocketHandler):
|
|||
# TODO: sanitize input: min/max, limit strokes
|
||||
if msg['action'] == 'move':
|
||||
# TODO: min/max input
|
||||
point = [float(msg['direction'][0]),float(msg['direction'][1]), 0]
|
||||
point = [float(msg['direction'][0]),float(msg['direction'][1]), bool(msg['mouse'])]
|
||||
self.strokes.append(point)
|
||||
self.draw_q.put(point)
|
||||
|
||||
elif msg['action'] == 'up':
|
||||
logger.info(f'up: {msg}')
|
||||
|
@ -164,12 +174,47 @@ class LatestImageHandler(tornado.web.RequestHandler):
|
|||
with open(latest_file, 'r') as fp:
|
||||
self.write(fp.read())
|
||||
|
||||
def axiDrawCueListener(q: Queue, isRunning: threading.Event):
|
||||
ad = axidraw.AxiDraw()
|
||||
|
||||
try:
|
||||
ad.interactive()
|
||||
|
||||
ad.connect()
|
||||
ad.options.units = 1 # set to use centimeters instead of inches
|
||||
ad.options.accel = 100;
|
||||
ad.options.speed_penup = 100
|
||||
ad.options.speed_pendown = 100
|
||||
ad.options.model = 2 # A3, set to 1 for A4
|
||||
|
||||
ad.moveto(0,0)
|
||||
|
||||
plotterWidth = 22
|
||||
plotterHeight = 18 # 16?
|
||||
|
||||
while isRunning.is_set():
|
||||
# TODO: set timeout on .get() with catch block, so we can escape if no moves come in
|
||||
try:
|
||||
move = draw_q.get(True, 1)
|
||||
except Empty as e:
|
||||
logger.log(5, "Empty queue.")
|
||||
else:
|
||||
ad.moveto(move[0]* plotterWidth, move[1]*plotterHeight)
|
||||
print('handler!',move)
|
||||
except Exception as e:
|
||||
logger.exception(e)
|
||||
finally:
|
||||
logger.warning("Close Axidraw connection")
|
||||
ad.moveto(0,0)
|
||||
ad.disconnect()
|
||||
|
||||
if __name__ == "__main__":
|
||||
args = argParser.parse_args()
|
||||
|
||||
coloredlogs.install(
|
||||
level=logging.DEBUG if args.verbose else logging.INFO,
|
||||
)
|
||||
|
||||
formatter = logging.Formatter(fmt='%(asctime)s %(module)s:%(lineno)d %(levelname)8s | %(message)s',
|
||||
datefmt='%Y/%m/%d %H:%M:%S') # %I:%M:%S %p AM|PM format
|
||||
logFileHandler = logging.handlers.RotatingFileHandler(
|
||||
|
@ -182,12 +227,21 @@ if __name__ == "__main__":
|
|||
logFileHandler
|
||||
)
|
||||
|
||||
draw_q = Queue()
|
||||
isRunning = threading.Event()
|
||||
isRunning.set()
|
||||
|
||||
application = tornado.web.Application([
|
||||
(r"/ws(.*)", WebSocketHandler),
|
||||
(r"/latest.svg", LatestImageHandler), # TODO: have js request the right image, based on a 'start' button. This way we can trace the history of a drawing
|
||||
(r"/(.*)", StaticFileWithHeaderHandler,
|
||||
{"path": 'www', "default_filename": 'index.html'}),
|
||||
], debug=True)
|
||||
application.listen(args.port)
|
||||
tornado.ioloop.IOLoop.current().start()
|
||||
thread = Thread(target = axiDrawCueListener, args = (draw_q, isRunning))
|
||||
thread.start()
|
||||
|
||||
try:
|
||||
application = tornado.web.Application([
|
||||
(r"/ws(.*)", WebSocketHandler, {'draw_q': draw_q}),
|
||||
(r"/latest.svg", LatestImageHandler), # TODO: have js request the right image, based on a 'start' button. This way we can trace the history of a drawing
|
||||
(r"/(.*)", StaticFileWithHeaderHandler,
|
||||
{"path": 'www', "default_filename": 'index.html'}),
|
||||
], debug=True)
|
||||
application.listen(args.port)
|
||||
tornado.ioloop.IOLoop.current().start()
|
||||
finally:
|
||||
isRunning.clear()
|
||||
|
|
|
@ -35,6 +35,10 @@
|
|||
background:#ccc;
|
||||
|
||||
}
|
||||
html, body{
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
@ -65,8 +69,11 @@
|
|||
let resetEl = document.getElementById('reset');
|
||||
let messageEl = document.getElementById('message');
|
||||
|
||||
|
||||
let strokes = [];
|
||||
let isDrawing = false;
|
||||
let currentPoint = null;
|
||||
|
||||
let draw = function(e) {
|
||||
let pos = svgEl.getBoundingClientRect()
|
||||
let x = e.x - pos['left'];
|
||||
|
@ -77,18 +84,29 @@
|
|||
console.log(d);
|
||||
strokeEl.setAttribute('d', d);
|
||||
|
||||
socket.send(JSON.stringify({
|
||||
currentPoint = {
|
||||
'action': 'move',
|
||||
'direction': [x, y]
|
||||
}));
|
||||
'direction': [e.x/window.innerWidth, e.y/window.innerHeight],
|
||||
'mouse': isDrawing,
|
||||
};
|
||||
console.log([x,y], isDrawing);
|
||||
};
|
||||
|
||||
let interval = window.setInterval(function(){
|
||||
if(currentPoint === null) {
|
||||
return
|
||||
}
|
||||
|
||||
socket.send(JSON.stringify(currentPoint));
|
||||
}, 200);
|
||||
|
||||
let penup = function(e) {
|
||||
if(!isDrawing) {
|
||||
return;
|
||||
}
|
||||
isDrawing = false;
|
||||
|
||||
document.body.removeEventListener('mousemove', draw);
|
||||
//document.body.removeEventListener('mousemove', draw);
|
||||
|
||||
let pos = svgEl.getBoundingClientRect()
|
||||
let x = e.x - pos['left'];
|
||||
|
@ -133,7 +151,7 @@
|
|||
let startDrawing = function(e){
|
||||
isDrawing = true;
|
||||
// start drawing
|
||||
document.body.addEventListener('mousemove', draw);
|
||||
//document.body.addEventListener('mousemove', draw);
|
||||
|
||||
};
|
||||
let reset = function() {
|
||||
|
@ -146,6 +164,9 @@
|
|||
|
||||
|
||||
let socket = new WebSocket(url);
|
||||
document.body.addEventListener('mousemove', draw);
|
||||
document.body.addEventListener('mouseup', penup);
|
||||
document.body.addEventListener('mousedown', startDrawing);
|
||||
|
||||
socket.addEventListener('message', function(e){
|
||||
let msg = JSON.parse(e.data);
|
||||
|
@ -157,8 +178,7 @@
|
|||
}
|
||||
});
|
||||
|
||||
document.body.addEventListener('mouseup', penup);
|
||||
svgEl.addEventListener('mousedown', startDrawing);
|
||||
//svgEl.addEventListener('mousedown', startDrawing);
|
||||
resetEl.addEventListener('click', reset);
|
||||
submitEl.addEventListener('click', function(e){
|
||||
if(!strokes.length){
|
||||
|
|
BIN
www/start_image.jpg
Normal file
After Width: | Height: | Size: 144 KiB |