Skip to content

Commit

Permalink
- Reset to zero IJK after rotation in process() (#732)
Browse files Browse the repository at this point in the history
- Pendant show a warning icon in case canvas is not possible to render
(#694)
- Corrected serial import in Utils.py
  • Loading branch information
vlachoudis committed Jan 29, 2018
1 parent fc036bf commit 493dab4
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 23 deletions.
3 changes: 3 additions & 0 deletions CNC.py
Original file line number Diff line number Diff line change
Expand Up @@ -3734,6 +3734,9 @@ def process(self, items, func, tabFunc, *args):
pass
undoinfo.append(self.setLineUndo(bid,lid," ".join(newcmd)))
self.cnc.motionEnd()
# reset arc offsets
for i in "IJK":
if i in old: old[i] = 0.0

# FIXME I should add it later, check all functions using it
self.addUndo(undoinfo)
Expand Down
11 changes: 3 additions & 8 deletions ControlPage.py
Original file line number Diff line number Diff line change
Expand Up @@ -995,7 +995,7 @@ def __init__(self, master, app):
self.addWidget(b)

f.grid_columnconfigure(1, weight=1)

# Coolant control

self.coolant = BooleanVar()
Expand Down Expand Up @@ -1039,12 +1039,8 @@ def __init__(self, master, app):
tkExtra.Balloon.set(mistEnable, _("Start mist (M7)"))
mistEnable.grid(row=row, column=col, pady=0, sticky=NSEW)
self.addWidget(mistEnable)





f.grid_columnconfigure(1, weight=1)

#----------------------------------------------------------------------
def overrideChange(self, event=None):
n = self.overrideCombo.get()
Expand All @@ -1064,7 +1060,6 @@ def overrideComboChange(self):
self.overrideScale.config(to_=100, resolution=25)
else:
self.overrideScale.config(to_=200, resolution=1)

self.override.set(CNC.vars["_Ov"+n])

#----------------------------------------------------------------------
Expand Down Expand Up @@ -1133,7 +1128,7 @@ def coolantMist(self, event=None):
def coolantFlood(self, event=None):
if self._gUpdate: return
# Avoid sending commands before unlocking
if CNC.vars["state"] in (Sender.CONNECTED, Sender.NOT_CONNECTED):
if CNC.vars["state"] in (Sender.CONNECTED, Sender.NOT_CONNECTED):
self.flood.set(FALSE)
return
self.coolant.set(FALSE)
Expand Down
24 changes: 16 additions & 8 deletions Pendant.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,21 +112,29 @@ def do_GET(self):
pass

elif page == "/canvas":
if not Image:
return
if not Image: return
with tempfile.NamedTemporaryFile(suffix='.ps') as tmp:
httpd.app.canvas.postscript(
file=tmp.name,
colormode='color',
)
tmp.flush()
with tempfile.NamedTemporaryFile(suffix='.gif') as out:
Image.open(tmp.name).save(out.name, 'GIF')
out.flush()
out.seek(0)

try:
with tempfile.NamedTemporaryFile(suffix='.gif') as out:
Image.open(tmp.name).save(out.name, 'GIF')
out.flush()
out.seek(0)
self.do_HEAD(200, content="image/gif")
self.wfile.write(out.read())
except:
self.do_HEAD(200, content="image/gif")
self.wfile.write(out.read())
filename = os.path.join(iconpath, "warn.gif")
try:
f = open(filename,"rb")
self.wfile.write(f.read())
f.close()
except:
pass

elif page == "/camera":
if not Camera.hasOpenCV(): return
Expand Down
7 changes: 6 additions & 1 deletion Utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@
import builtins as __builtin__
#__builtin__.unicode = str # dirty hack for python3

try:
import serial
except:
serial = None

__prg__ = "bCNC"
prgpath = os.path.abspath(os.path.dirname(sys.argv[0]))
iniSystem = os.path.join(prgpath,"%s.ini"%(__prg__))
Expand Down Expand Up @@ -368,7 +373,7 @@ def comports():
s = serial.Serial(device)
s.close()
comports.append((device,None,None))
except (OSError, serial.SerialException):
except:
pass
return comports

Expand Down
6 changes: 3 additions & 3 deletions bCNC.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
# Author: vvlachoudis@gmail.com
# Date: 24-Aug-2014

__version__ = "0.9.12"
__date__ = "23 Nov 2017"
__version__ = "0.9.13"
__date__ = "29 Jan 2018"
__author__ = "Vasilis Vlachoudis"
__email__ = "vvlachoudis@gmail.com"

Expand Down Expand Up @@ -2544,7 +2544,7 @@ def usage(rc):
if serial is None:
tkMessageBox.showerror(_("python serial missing"),
_("ERROR: Please install the python pyserial module\n" \
"Windows:\n\tC:\PythonXX\Scripts\easy_install pyserial\n" \
"Windows:\n\tC:\\PythonXX\\Scripts\\easy_install pyserial\n" \
"Mac:\tpip install pyserial\n" \
"Linux:\tsudo apt-get install python-serial\n" \
"\tor yum install python-serial\n" \
Expand Down
Binary file added icons/warn.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions pendant/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,9 @@
display: block;
margin: 0 auto;
object-fit: scale-down;
max-height: 600px;
width: 100%;
height: auto;
//max-height: 600px;
//width: 100%;
//height: auto;
}
</style>
</head>
Expand Down

0 comments on commit 493dab4

Please sign in to comment.